DB setup and key generate