How To Move Database password to an environment variable in CB Appliance?

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

  1. 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

  1. SSH to the CB box

  2. Go to /etc/supervisord.d 

  3. Run  vi jobengine.conf and add the DB password at the end of the env variable like this

    1. [program:jobengine]
      environment=PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:,CB_DBA_MYSQL_PASSWORD="CBDBPASSWORD"

    2. 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

  1. Run a job and make sure the job is picked up by the jobengine.

Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.