Last active
August 29, 2015 14:13
-
-
Save Epigene/cfe87807356f395a2dd5 to your computer and use it in GitHub Desktop.
A workflow for configuring and deploying PHP apps via dokku
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Make PHP app Dokku-friendly | |
# Add staging and production clauses to database.yml | |
# Tell docker how to start app, Add to Procfile (web server dependant) | |
# Simple puma setup | |
Make Procfile, add line: | |
web: bundle exec puma -t ${PUMA_MIN_THREADS:-1}:${PUMA_MAX_THREADS:-1} -w ${PUMA_WORKERS:-2} -p $PORT -e ${RACK_ENV:-production} | |
# Simple unicorn setup: | |
Make Procfile, add line: | |
web: bundle exec unicorn -p $PORT -c ./config/unicorn.rb | |
Make config/unicorn.rb, populate with default pre and post-fork blocks | |
# In a git repo folder, add a dokku remote following `git remote add <remote_name> <role>@<ip_or_domain>:<codename>`, for example: | |
git remote add dokku dokku@apps.creative.gs:wordpress | |
# deploy to dokku remote | |
git push dokku master | |
# Dokku only deploys master, so in case of other branch deploy do `git push <remote> <other_branch>:master`: | |
git push dokku staging:master | |
# Link database container to app container | |
# ENV config | |
# use command `dokku config:set <app-name> <key>=<value>` | |
dokku config:set <app-name> RAILS_ENV=staging | |
dokku config:set <app-name> SECRET_KEY_BASE=as6dka987da... | |
# To redeploy without changes | |
dokku release <appname> | |
dokku deploy <appname> | |
# To add additional SSH keys, run on the computer that wants to add: | |
cat ~/.ssh/id_rsa.pub | ssh deployer@<IP> "sudo sshcommand acl-add dokku progrium" | |
# To remove a container | |
# SSH onto the server, then execute: | |
dokku delete myapp |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment