Posted 8 months ago. Visible to the public.

Configuration of your application

In most cases your application needs configuration data like database endpoints or API keys to work. This section will help you find the correct location for your configuration data.

Ruby on Rails

There are multiple ways to configure your application.
The database configuration for your application is deliviered via our configuration management (which also confiures your database). You can find it in /var/www/$deployment/shared/config/database.yml. Our capistrano sample recipe symlinks this configuration file during the deployment and your application should use this file by default.
Other configuration data should be stored in the directory shared/config too. It is synced between all your application servers and we will make daily backups of it. If you want us to deliver configuration files (like secrets.yml) for you just contact our operations team. We can deploy these files with our configuration management.

Environment variables

If your rails application expects configuration via environment variables you can place a shared/config/.env file. Environment variables can also be configured by our makandra operations team via our configuration management.

The application processes are invoked via bash so you will have all the variables written to this file available. See down below for more information.

Elixir / Phoenix

We place a database.exs file in the /var/www/$deployment/shared/config/ directory. You can use this file to build your application.
There will also be a DATABASE_URL environment variable if you created a /var/www/$deployment/shared/config/.env file.

If you want to use environment variables to configure your application at runtime you can place them in /var/www/$deployment/shared/config/.env (see down below for further information). Please ensure that your application is started via bash. The environment variables are only read when the application is invoked via a bash shell.

PHP application

There is no default configuration scheme for PHP applications. Ask our operations team for the database credentials. If you want to configure your application via environment variables contact our operations team to configure the variables for you.

Configuring your application via environment variables

Please mind that this is not working at the moment for PHP applications. If you want to pass environment variables to your PHP application contact the makandra operations team to configure them for you.

If your application expects configuration via environment variables you can place a /var/www/$deployment/shared/config/.env file which will be read by the deployusers .bashrc if present. The syntax must be in shell style like this:

# this is a comment and will be ignored FOO_API_KEY=lahj3987yagxg FACEBOOK=fb1UYGF1f7dJ # this comment will be trimmed TWITTER=BLCJKJSLU^T!#@&^LC

Please mind that these environment variables will be loaded if you login with your user and from passenger (rails) processes but are not read by your cronjobs or elixir application by default! You need to prefix your cronjobs with source /var/www/$deployment/shared/config/.env && do_something or you should invoke your cronjob via bash bash -c 'do_something'. Your elixir application must be started via a bash shell.

Owner of this card:

Claus-Theodor Riegg
Last edit:
5 months ago
by Claus-Theodor Riegg
Posted by Claus-Theodor Riegg to opscomplete
This website uses cookies to improve usability and analyze traffic.
Accept or learn more