Configure app
App Configuration is managed using environment variables. It involves 2 kinds of environment variables:
Build variables
These are available only in the environment where the application is built out of the source code. Application building typically constitutes installing dependencies. So, any configuration which you want to take effect when building the application needs to be specified here.
Examples could be the language versions you want to install.
Some other examples would be NODE_ENV=production
, MAVEN_OPTS=-Xms256m -Xmx512m
etc.
Build variables can be added at the “build variables” tab of the app page.
Runtime variables
These variables are available only when running the app. Your database connection is a good example of a runtime variable.
Other examples are JAVA_TOOL_OPTIONS=-Dserver.port=8082
, DJANGO_SETTINGS_MODULE=config.settings.production
etc.
Runtime variables can be added at the “Environment variables” tab of the app page.
Secrets
Secrets are also modelled as runtime variables, except they can’t be viewed or edited once they’re added. Unlike other runtime variables, they are encrypted at rest. You app key in Laravel is a good example(
APP_KEY=base64:supersecretkey`).
Secrets can be added at the “Secrets” tab of the app page.
Volumes
ShapeBlock builds and packages your application into a container, and containers are ephermeral. Any information you store in the container gets wiped out when the container restarts. In your application, you might want to save images, files or other data in the container and make sure that it persists even after containers restart. For doing this, you create mount volumes, where you specify a mount name, a path and the size of the volume. You can do so in the “Volumes” tab of the app page.
All apps are built in the /workspace
directory of the container. When you give a path, you should give the absolute path. For instance, if you want to mount a persistent volume for the “data/images” directory in your app, then the path value will be /workspace/data/images
.
Check out examples for typical app configuration values for your stack.
Rolling out changes
As long as your app is in “Created” state, adding any of the above configurations will not yet deploy the app.
Once your app is in “Ready” state, changing any of these configurations will trigger a new deployment.
Possible next steps
Attach a service
Optional required only if your app talks to a database