|
|
# Deployment
|
|
|
|
|
|
## Capistrano
|
|
|
[Capistrano](https://capistranorb.com/documentation/overview/what-is-capistrano/) is a library which manages the deployment of the application. It will execute multiple phases and commands. The exact phases and commands depend on the subpackages. We use the folowing:
|
|
|
|
|
|
* capistrano-rails: For rails support (assets, db migrations)
|
|
|
* capistrano-bundler: For updating dependencies (bundler is package manager)
|
|
|
* capistrano-locally: To execute the deployment on the local server instead of over ssh
|
|
|
|
|
|
### Configuration
|
|
|
The subpackages of capistrano that we use are defined in `Gemfile`. The actual configuration can be found in `/config/deploy.rb`. See https://capistranorb.com/documentation/getting-started/configuration/ for configuration options.
|
|
|
|
|
|
Staging/production specific configuration can be set in `/config/deploy/[staging|production].rb`.
|
|
|
|
|
|
### Structure
|
|
|
The actual structure as it is on the server is explained on https://capistranorb.com/documentation/getting-started/structure/ .
|
|
|
|
|
|
In short:
|
|
|
* `current` contains the currently deployed version
|
|
|
* `shared` contains things that are symlinked into the current folder (configs, keys, etc.)
|
|
|
* `releases` contains the last 5 releases (used for rollbacks)
|
|
|
|
|
|
## Running a rollback
|
|
|
To rollback to the previous release, execute `cap production deploy:rollback`. Please note that database migrations will not be undone.
|
|
|
|
|
|
If the database needs to be restored, run `TODO` to restore from the previously backed up database. The database is backed up right before a deployment starts. |
|
|
\ No newline at end of file |