11# Deployer
22
3- Deploy [ dokku ] ( http://dokku.viewdocs.io/dokku/ ) applications using [ GitHub Deployments API] ( https://developer.github.com/v3/repos/deployments/ ) .
3+ Deploy applications using [ GitHub Deployments API] ( https://developer.github.com/v3/repos/deployments/ ) .
44
551 . Listen/poll new GitHub deployments
662 . Create pending GitHub deployment status and empty Gist
7- 3 . Deploy application to dokku
7+ 3 . Execute command file that deploys application
884 . Create success/failure Github deployment status and update Gist
995 . Sleep 30 seconds
10106 . Go to step #1
1111
12- Make sure to run ` deployer ` as ` dokku ` user.
13-
14- To register github deployments you can use [ deploy] ( https://github.com/remind101/deploy ) ,
12+ To register github deployments you can use curl,
1513[ slashdeploy] ( https://github.com/remind101/slashdeploy ) or something else.
1614
1715If you are using Slack, you can enable 'Deploy Events -> Show deployment statuses'
@@ -24,59 +22,34 @@ deployer -h
2422```
2523
2624```
27- -app string
28- Dokku application name (required)
2925 -env string
30- Github deployment environment (required)
26+ Github deployment environment (required)
27+ -file string
28+ File to execute when new deployment is available (required)
3129 -org string
32- GitHub org (required)
30+ GitHub org (required)
3331 -p string
34- GitHub password (required)
32+ GitHub password (required)
3533 -repo string
36- GitHub repo (required)
34+ GitHub repo (required)
3735 -sleep int
38- Time to sleep between loops (defaults to 30 seconds) (default 30)
36+ Time to sleep between loops (defaults to 30 seconds) (default 30)
3937 -u string
40- GitHub username (required)
41- ```
42-
43- ## Installation
44-
45- Install ` deployer ` on dokku server:
46-
47- ``` bash
48- $ su - dokku
49- $ curl -L -o deployer https://github.com/mak-it/deployer/releases/download/v0.1.2/deployer-linux-amd64
50- $ chmod +x deployer
51- ```
52-
53- Start ` deployer ` on system reboot using ` cron ` and ` screen ` :
54-
55- ``` bash
56- $ su - dokku
57- $ echo " @reboot /usr/bin/screen -d -m /home/dokku/deployer -u ghuser -p ghpass -org mak-it -repo myapp -env demo -app myapp-demo -sleep 30" | crontab -
58- ```
59-
60- Start ` deployer ` in ` screen ` :
61-
62- ``` bash
63- $ su - dokku
64- $ /usr/bin/screen -d -m /home/dokku/deployer -u ghuser -p ghpass -org mak-it -repo myapp -env demo -app myapp-demo -sleep 30
38+ GitHub username (required)
6539```
6640
6741## Example
6842
6943Trigger deployment from developer's machine:
7044
7145``` bash
72- $ cd ~ /src/myapp
7346$ deploy --branch v49.3 --env demo
7447```
7548
76- On the dokku server:
49+ On the application server:
7750
7851``` bash
79- $ deployer -u ghuser -p ghpass -org mak-it -repo myapp -env demo -app myapp-demo -sleep 30
52+ $ deployer -u ghuser -p ghpass -org mak-it -repo myapp -env demo -file bin/deploy-stub -sleep 30
8053```
8154
8255Output:
@@ -85,19 +58,19 @@ Output:
8558Deployer
8659ghuser ghpass mak-it myapp demo myapp-demo
8760Sleep duration: 30s
88- 2017/08/24 13:31:43 Cloning repo
89- 2017/08/24 13:31:51 Adding repo dokku remote .myapp-demo myapp-demo
90612017/08/24 13:32:52 Getting deployment demo
91622017/08/24 13:32:53 Problem in getting deployment Deployment statuses already present
92632017/08/24 13:32:53 Sleeping 30s
93642017/08/24 13:33:23 Getting deployment demo
94652017/08/24 13:33:23 123 v49.3 demo
95- 2017/08/24 13:33:23 Fetchin repo .myapp-demo
96662017/08/24 13:33:24 Gist create ID: 123, Ref: v49.3, Environment: demo
97672017/08/24 13:33:25 Gist https://gist.github.com/...
98682017/08/24 13:33:25 Deployment status create pending
99- 2017/08/24 13:33:26 Deploying repo .myapp-demo
100- Everything up-to-date
69+ 2017/08/24 13:33:26 Executing File bin/deploy-stub
70+ -----> Adding BUILD_ENV to build environment...
71+ -----> Compiling Ruby/Rails
72+ =====> Application deployed:
73+ http://ruby-rails-sample.dokku.me
101742017/08/24 13:33:26 Deployment status create success
102752017/08/24 13:33:26 Gist update
10376```
0 commit comments