Overview
This article talks about moving database password from customer_settings.py to an environment variable
Considerations
This article assumes that the CloudBolt database lives in an external server and the database connection was overridden at customer_settings.py at /var/opt/cloudbolt/proserv directory.
Procedure
Step 1 Define an env variable
Follow the steps mentioned at https://ultimatedjango.com/learn-django/lessons/handling-sensitive-keys/
Step 2 Modify JobEngine config file to respect the env variable
SSH to the CB box
Go to /etc/supervisord.d
Run vi jobengine.conf and add the DB password at the end of the env variable like this
[program:jobengine]
environment=PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:,CB_DBA_MYSQL_PASSWORD="CBDBPASSWORD"
Restart the JE and supervisord daemon by running service supervisord restart
In this example, CB_DBA_MYSQL_PASSWORD
is the env variable defined at Step 1.
Step 3 Test the configuration
Run a job and make sure the job is picked up by the jobengine.
0 Comments