|
|
|
# Example deployment
|
|
|
|
|
|
|
|
## Preliminary setup of a Dokku application
|
|
|
|
|
|
|
|
`dokku help` is self explanatory.
|
|
|
|
|
|
|
|
Proceed as follows to create a new frab instance.
|
|
|
|
|
|
|
|
```
|
|
|
|
dokku create dbp2016_live
|
|
|
|
dokku domains:set dbp2016_live scriptum.degrowth.org,dbp2016_live.apps.ecobytes.net
|
|
|
|
dokku ssh:selfsigned
|
|
|
|
dokku logs dbp2016_live
|
|
|
|
```
|
|
|
|
|
|
|
|
Granting a git client access to the application is exemplified for three different roles below.
|
|
|
|
|
|
|
|
```
|
|
|
|
cat ~/.ssh/id_rsa.pub | dokku deploy:allow frab
|
|
|
|
cat ~/.ssh/id_rsa.pub | dokku developer:allow frab
|
|
|
|
cat ~/.ssh/id_rsa.pub | dokku access:add
|
|
|
|
```
|
|
|
|
|
|
|
|
### Operational Maintenance Lifecycling
|
|
|
|
|
|
|
|
Take care of your container in times of need.
|
|
|
|
|
|
|
|
```
|
|
|
|
dokku start dbp2016_live
|
|
|
|
dokku status dbp2016_live
|
|
|
|
dokku stop dbp2016_live
|
|
|
|
dokku restart dbp2016_live
|
|
|
|
dokku rebuild dbp2016_live
|
|
|
|
```
|
|
|
|
|
|
|
|
### Mutable Cleanup Sequence
|
|
|
|
|
|
|
|
Get rid of it all.
|
|
|
|
|
|
|
|
```
|
|
|
|
dokku stop dbp2016_live
|
|
|
|
dokku postgresql:unlink dbp2016_live db_dbp2016
|
|
|
|
dokku delete dbp2016_live
|
|
|
|
dokku postgresql:delete db_dbp2016
|
|
|
|
```
|
|
|
|
|
|
|
|
### PostgreSQL
|
|
|
|
|
|
|
|
Initialize the application database, link it to the application created above and inform yourself about its environment.
|
|
|
|
|
|
|
|
```
|
|
|
|
dokku postgresql:delete db_dbp2016
|
|
|
|
dokku postgresql:create db_dbp2016
|
|
|
|
dokku postgresql:link dbp2016_live db_dbp2016
|
|
|
|
dokku postgresql:info dbp2016_live db_dbp2016
|
|
|
|
```
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
Create the neccessary environment. Use this template as inspiration
|
|
|
|
|
|
|
|
```
|
|
|
|
# Paste an output of 'pwgen 64' here
|
|
|
|
SECRET_KEY_BASE=Quei3ohseGuDac3aiquooPheeghahwahw4ahjei4keinuiphaidouraeNgeip1Ai
|
|
|
|
CUSTOM_RUBY_VERSION=2.2.3
|
|
|
|
BUNDLE_WITHOUT=development:test:mysql:sqlite3
|
|
|
|
RACK_ENV=production
|
|
|
|
RAILS_ENV=production
|
|
|
|
RAILS_SERVE_STATIC_FILES=true
|
|
|
|
# Adapt the host to expect
|
|
|
|
FRAB_HOST=dbp2016_live.apps.ecobytes.net
|
|
|
|
FRAB_PROTOCOL=https
|
|
|
|
# Get your Database URL
|
|
|
|
DATABASE_URL=postgres://<from Dokku output>
|
|
|
|
# Use a valid transmission service, including accepted certificate.
|
|
|
|
FROM_EMAIL=text@allmende.io
|
|
|
|
SMTP_ADDRESS=mx.allmende.io
|
|
|
|
SMTP_PASSWORD=mappingalternatives
|
|
|
|
SMTP_PORT=587
|
|
|
|
SMTP_USER_NAME=text@allmende.io
|
|
|
|
```
|
|
|
|
|
|
|
|
Do so in a more meaningful and correct manner
|
|
|
|
|
|
|
|
```
|
|
|
|
cp .env.example .env
|
|
|
|
vi .env
|
|
|
|
dokku config:set dbp2016_live `paste -d " " -s .env`
|
|
|
|
dokku run dbp2016_live bundle exec rake db:setup
|
|
|
|
```
|
|
|
|
|
|
|
|
For debugging purposes with your application
|
|
|
|
|
|
|
|
```
|
|
|
|
dokku run dbp2016_live bundle exec rake db:migrate
|
|
|
|
dokku run dbp2016_live bundle exec rake db:seed
|
|
|
|
```
|
|
|
|
|
|
|
|
Review your setup.
|
|
|
|
|
|
|
|
```
|
|
|
|
dokku config dbp2016_live
|
|
|
|
```
|
|
|
|
|
|
|
|
## Initialize a development and deployment environment
|
|
|
|
|
|
|
|
```
|
|
|
|
git clone https://lab.allmende.io/ecobytes/dbp2016.git
|
|
|
|
git remote add dokku dokku:apps.ecobytes.net:dbp2016_live
|
|
|
|
```
|
|
|
|
|
|
|
|
## Go live!
|
|
|
|
|
|
|
|
git push dokku deployment:master
|
|
|
|
|
|
|
|
# TODO
|
|
|
|
|
|
|
|
* Extended lifecycle management
|
|
|
|
* Revert
|
|
|
|
* `dokku rebuild <app> [ref]`
|
|
|
|
* `dokku rebuild:force <app> [ref]`
|
|
|
|
* Tagging
|
|
|
|
* `dokku top dbp2016_live`
|
|
|
|
* `dokku url dbp2016_live`
|
|
|
|
` `enable, disable, enter, exec
|
|
|
|
* Backup
|
|
|
|
* PostgreSQL Database
|
|
|
|
* Static Assetts, *look below*
|
|
|
|
* Proper SSL lifecycle instructions
|
|
|
|
* Let's Encrypt only from [December 3rd](https://letsencrypt.org/2015/11/12/public-beta-timing.html)
|
|
|
|
* Until then [StartSSL](http://www.westphahl.net/blog/2012/01/03/setting-up-https-with-nginx-and-startssl/)
|
|
|
|
* `nginx:import-ssl` tar pipe with `server.crt` and `server.key`
|
|
|
|
* Permanence for static assetts
|
|
|
|
* `volume:create <name> <paths...>`
|
|
|
|
* `volume:link dbp2016_live <name>` |
|
|
|
\ No newline at end of file |