Skip to content

Advanced Beiwe‐Backend Settings

Eli Jones edited this page Mar 19, 2024 · 8 revisions

The Beiwe-Backend contains some advanced settings that can be set by changing the values of various environment variables. There are two places to make these changes, one will apply to your data-processing servers, the other to your web-facing Elastic Beanstalk servers.

Elastic Beanstalk

  1. Log in to the AWS Console, navigate to the Elastic Beanstalk console in the appropriate region. It will look similar to this:
  1. Click on the appropriate Elastic Beanstalk Environment to bring you to its main console page. On the left-hand side click on configuration.
  1. Scroll to the Environment Properties section. You will see various variables that should be familiar from your deployment environment setup. Configuring advanced settings means making additions or changes to these values.

Data Processing Servers

Setting environment variables for your data processing server(s) is accomplished by editing a somewhat weirdly-named file remote_db_env.py.

On the computer from which you ran the deployment operation there will be a file inside the beiwe-backend repository clone that you made. It will be here, where "staging5" is the name you gave your cluster: cluster_management/environment_configuration/staging5_remote_db_env.py

This file is generated as part of deployment logic, it will look like this, but in an apparently random order:

import os
os.environ['BEIWE_SERVER_AWS_ACCESS_KEY_ID'] = 'never_share'
os.environ['BEIWE_SERVER_AWS_SECRET_ACCESS_KEY'] = 'absolutely_do_not_share_this_one_anywhere'
os.environ['DOMAIN_NAME'] = 'your.beiwe.domain.name.biz'
os.environ['FLASK_SECRET_KEY'] = 'totally_secure_random_string'
os.environ['S3_BUCKET'] = 'probably_your_environment_name_plus_36_digits_of_junk'
os.environ['SENTRY_DATA_PROCESSING_DSN'] = 'https =//[email protected]/a_number'
os.environ['SENTRY_ELASTIC_BEANSTALK_DSN'] = 'https =//[email protected]/a_number'
os.environ['SENTRY_JAVASCRIPT_DSN'] = 'https =//[email protected]/a_number'
os.environ['SYSADMIN_EMAILS'] = '[email protected]'
os.environ['RDS_DB_NAME'] = 'this_is_your_database_server_name'
os.environ['RDS_HOSTNAME'] = 'the_url_to_your_database'
os.environ['RDS_PASSWORD'] = 'dont_share_ever'
os.environ['RDS_USERNAME'] = 'nor_this_one'

This is a Python file that injects environment variables into the environment, it is run very early during the beiwe-backend loading process. To add a value simply copy that os.environ['key_name'] = 'key_value' syntax.

You can either edit this file on your computer and deploy a new data processing server, or you can ssh onto your existing data processing server and edit the same file located at /home/ubuntu/beiwe-backend/config/remote_db_env.py. If you do this you will need to run the processing-restart command to restart the beiwe-backend code running on that server.


Advanced Settings Documentation

The advanced settings are thoroughly documented in the settings.py file in the config folder of the beiwe-backend repository, here is a direct link to the most up-to-date version of that file.

If you believe that there is a lack of clarity or this page needs to be updated please create an issue referencing this page.

Clone this wiki locally