Our developer experience is oriented around git. We want any
authorized developer to be able to push to the development
,
staging
, or production
branches and have the code be deployed
to the respective infrastructure with a minimum of fuss.
To achieve this Parabol's environments are deployed using CircleCI and dokku.
Install dokku onto a server of your choice. On your dokku host, you'll need to install plugins for backend services required by the Parabol application, or provide environment variables that allow the Parabol application to connect to these services if you have them hosted elsewhere.
- dokku-redis
- dokku-rethinkdb
- optional: dokku-letsencrypt
Create your application using dokku apps:create
, link services, and
optionally configure letsencrypt.
$ dokku apps:create parabol-action
$ dokku redis:link <redis-service> parabol-action
$ dokku rethinkdb:link <rethinkdb-service> parabol-action
$ dokku letsencrypt parabol-action
For each environment variable defined in .env.example,
define the variable with the appropriate value for the environment by
using dokku config:set <app>
. For example:
$ dokku config:set parabol-action --no-restart FOO="bar"
$ git remote add dokku dokku@host:parabol-action
To deploy the application, all you need to do is push your branch to the remote:
$ git push dokku master
This bit of setup is going to be fussy. If you attempt setting up CircleCI with with our circle.yml, please help us by enhancing this section of the documentation.
Our CircleCI configuration looks for certain branch names. Namely,
development
, staging
, or production
and deploys to the
appropriate infrastructure. If the current branch does not match
one of these names (e.g. master
), then only tests will be
performed.
At a high level, this is what our CircleCI configuration does:
- An ssh key is added by its fingerprint id from the CircleCI web configuration
- A Slack message is posted using a webhook
- Automated tests are run
- If this is a deployment, a special devops deployment repository is checked-out and the appropriate server environment variables are used
- If this is a deployment, the dokku deployment is automated using a custom github user