Scalingo JSON Manifest
The manifest is an optional file named scalingo.json you can add at the
root of your repository to configure review apps and one-click deploy button. Its intent is to
configure how an application should be created.
For Review Apps, configuration in scalingo.json takes precedence over
configuration inherited from the parent application. The manifest is evaluated
only when the review app is created. Changes to scalingo.json do not reconfigure
existing review apps on subsequent deployments.
Configuration of the Environment
The scalingo.json manifest can be used to customize the environment of the
application.
Review Apps
Variables described in the manifest are created when the review app is created, if one of those variables is present in the parent app environment, it will be replaced following the manifest rule.
One-Click Deployment
The manifest describes the default values of the environment variables, the user can still customize them before triggering the deployment.
Example
{
"env": {
"ENVIRONMENT": {
"value": "staging"
},
"ADMIN_URL": {
"generator": "url",
"template": "%URL%/admin"
},
"SECRET_KEY": {
"generator": "secret"
}
}
}
Monorepos
If your application code is in a subdirectory (configured using the PROJECT_DIR environment variable), Scalingo
detects the JSON manifest under this subdirectory.
If there is no JSON manifest in the PROJECT_DIR folder, Scalingo
tries to get the scalingo.json in every folder up to the root of your repository.
See our dedicated page on monorepos for more information about this type of setup.
Configuration of the Application Firewall
Review apps inherit the Application Firewall rules from their parent app by default. You can override the inherited rules in scalingo.json.
An explicit firewall_rules list replaces the parent’s rules; it is not merged
with them. Omitting firewall_rules keeps the inherited rules.
If firewall_rules contains more rules than the application’s quota allows
(20 by default), Review App creation fails.
Example
{
"firewall_rules": [
{
"cidr": "203.0.113.42/32",
"label": "office"
},
{
"cidr": "192.0.2.0/24"
}
]
}
Disabling the Application Firewall
To disable the firewall on a review app where the parent app have some firewall rules, pass an empty array.
In that case the child app will be created without any firewall rules and thus the firewall will be disabled for the child app.
{
"firewall_rules": []
}
Configuration of Addons
Addons can also be declared in the JSON manifest and they’ll be provisioned before deploying a review app or starting a one-click deploy.
Review Apps
By default, addons are copied from the parent app. If you want to change the plan the review app will be using, or to avoid using some of them which only make sense in production, you can specify the list of addons in the manifest.
One-Click Deployments
Addons declared in the manifest will be provisioned before starting the deployment of the application.
Example
The options attribute is optional, currently only the version parameter is allowed in it.
{
"addons": [
{
"plan": "postgresql:postgresql-starter-512",
"options": {
"version": "11"
}
}, {
"plan": "redis:redis-starter-128"
}
]
}
Deployment Hooks
The JSON manifest also lets you declare scripts which will be executed as postdeploy hook.
-
first-deploy: Executed after the first deployment of a review app or one-click app. It will be executed as many times as necessary until a first deployment is considered a “success” by the platform. -
postdeploy[Deprecated]: Executed after each deployment of a review app except the first one iffirst-deployis defined. This feature has been deprecated in favor of postdeploy script in theProcfilefile.
Example
{
"scripts": {
"first-deploy": "bundle exec rake db:migrate db:seed",
"postdeploy": "bundle exec rake db:migrate"
}
}
Container Formation
The scalingo.json manifest can be used to setup a container formation. A container formation defines the shape of the containers that will be launched.
Review Apps
You can specify the shape and the number of containers to be launched when a Review App is created. This is useful for making an exact copy of a production environment in Review Apps without having to perform any manual actions.
One-Click Deployment
The manifest describes how applications deployed with our one-click button are deployed. This can be useful, for example, if you want to deploy a worker at the same time to handle asynchronous tasks.
Example
{
"formation": {
"web": {
"amount": 2,
"size": "L"
},
"worker": {
"amount": 1,
"size": "XL"
}
}
}
Reference Documentation
You can find the comprehensive documentation about the structure of the Scalingo JSON Manifest in our developers documentation