The deploy file is here
Published
π
.fortrabbit/deploy.yml
Deployment settings on the new platform can now live in the Git repository. A file at .fortrabbit/deploy.yml holds an environment's build commands, post-deploy commands and distribution rules. Every deployment reads it from the commit it deploys.
What's new
The deploy file is live on the new platform. Deployment settings can now live in the Git repository, in a file at .fortrabbit/deploy.yml.
Until now, build commands, post-deploy commands, cached directories, the Git source directory and the deployment strategy all lived in the dashboard or came through the API.
Changing how an app is built used to happen outside the repository. Nobody could review it in a pull request. git log did not know about it. A colleague who cloned the project had to open the dashboard to see how it deploys. And when a deploy broke, the answer to "what changed?" was split across two places.
The deploy file moves those settings into the repo. Now they're reviewed, versioned and copied with the code.
Infrastructure as code, for deployment
Infrastructure as code (IaC) is the practice of describing infrastructure in versioned files instead of configuring it by hand. Terraform, Ansible, Kubernetes manifests and GitHub Actions workflows all use the same idea. The deploy file applies it to the deployment settings of a fortrabbit environment.
A deploy file for a Laravel app:
apiVersion: 1.0
build:
buildCommands:
- composer install --no-dev --prefer-dist --no-interaction
- npm ci && npm run build
postDeployCommands:
- php artisan migrate --force
cachedDirectories:
- node_modules
distribution:
strategy: replace
excludePatterns:
- storage
JSON works too, as .fortrabbit/deploy.json. Every key, every default and every validation rule is in the docs:
What changes
- Reviewed with the code: A new build step goes through the same pull request as the code that needs it.
- Read from the deployed commit: Every deployment reads the file from the commit it deploys. A branch that needs a different build command carries its own file.
- Copied with the repository: A new app created from a repo with a deploy file skips the deployment steps in the dashboard.
- Editable by agents: A coding agent changes a YAML file in the repo. No dashboard access, no API token.
Once a deploy file is found, the dashboard shows its values as read-only and links to the file. It keeps the values saved in the dashboard, but does not use them. Delete the file and push to use and edit them there again.
Outlook
This is the first release. It covers how code is built and how it reaches the environment. We plan to extend infrastructure as code from here. Maybe that means moving more, possibly all, of an environment's configuration into YAML files in .fortrabbit. No promises on what comes next or when.
References
- Deploy file
- Tell us what you think!