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.
There are multiple ways to configure your application.
The database configuration for your application is deliviered via our configuration management (which also configures 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.
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.
We place a
database.exs file in the
/var/www/$deployment/shared/config/ directory. You can use this file to build your application.
If you create a
/var/www/$deployment/shared/config/.env file there will be some default environment variables with configuration for our hosting infrastructure:
DATABASE_URL: a database connection string like
APPDIR: path to your application directory
PORT: the port your app must listen on
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.
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.
When you deploy a new version of your PHP application, the fpm-php workers will not restart and clear your opcache and apc. As you usually want to start using your newly deployed code immediately, we allow clearing the caches using the FPM socket.
We suggest installing and using cachetool for this. After installation you may use it from your capistrano/compose tasks or on the cli like this:
$ php cachetool.phar opcache:reset --fcgi=/var/run/php/$deployment-fpm.sock
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 it 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 deploy users
.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 ignored 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.