From 939a876348e4c8fd5bb956681a533f659598109e Mon Sep 17 00:00:00 2001 From: Sam Dodrill Date: Sat, 16 Aug 2014 19:05:20 -0700 Subject: [PATCH 01/23] contrib: add dokku client shell script This is adapted from the one I use in my shell profile scripts. This kinda-sorta-maybe acts like the `heroku` or `deis` commands and does some clever reorganization of data before sending it to the server. To use the app name generator, install the `elfs` rock from Moonrocks. --- contrib/dokku_client.sh | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100755 contrib/dokku_client.sh diff --git a/contrib/dokku_client.sh b/contrib/dokku_client.sh new file mode 100755 index 000000000..0c7e2cf0a --- /dev/null +++ b/contrib/dokku_client.sh @@ -0,0 +1,32 @@ +if [ -z "$DOKKU_CONTROLLER" ] +then + function dokku { + appname=$(git remote -v 2>/dev/null | grep dokku | head -n 1 | cut -f1 -d' ' | cut -f2 -d':' 2>/dev/null) + if [ "$?" != "0" ] + then + donotshift="YES" + fi + if [ "$1" = "create" ] + then + appname=$(echo "print(elfs.GenName())" | lua -l elfs) + if git remote add dokku dokku@$DOKKU_CONTROLLER:$appname + then + echo "-----> Dokku remote added at $DOKKU_CONTROLLER" + echo "-----> Application name is $appname" + else + echo "! Dokku remote not added! Do you already have a dokku remote?" + return + fi + git push dokku master + else + if [ -z "$donotshift" ] + then + ssh dokku@$DOKKU_CONTROLLER $* + exit + fi + verb=$1 + shift + ssh dokku@$DOKKU_CONTROLLER "$verb" "$appname" $@ + fi + } +fi From 5caf2ab6e360346ab6c89298c6de17496c676b57 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Mon, 17 Nov 2014 17:03:22 -0500 Subject: [PATCH 02/23] Reorganized list of available datastore plugins --- docs/plugins.md | 37 +++++++++++++++++++++++++++---------- 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/docs/plugins.md b/docs/plugins.md index c9207f96b..2018dc7ef 100644 --- a/docs/plugins.md +++ b/docs/plugins.md @@ -75,30 +75,47 @@ Note: The following plugins have been supplied by our community and may not have ### Datastores +#### Relational + | Plugin | Author | Compatibility | | --- | --- | --- | -| [CouchDB](https://github.com/racehub/dokku-couchdb-plugin) | [RaceHub](https://github.com/racehub) | Compatible with 0.2.0 | | [MariaDB](https://github.com/Kloadut/dokku-md-plugin) | [Kloadut][] | Compatible with 0.2.0 | | [MariaDB (single container)](https://github.com/ohardy/dokku-mariadb) | [ohardy][] | Compatible with 0.2.0 | -| [MongoDB (single container)](https://github.com/jeffutter/dokku-mongodb-plugin) | [jeffutter][] | | +| [MySQL](https://github.com/hughfletcher/dokku-mysql-plugin) | [hughfletcher][] | | | [PostgreSQL](https://github.com/Kloadut/dokku-pg-plugin) | [Kloadut][] | Compatible with 0.2.0 | | [PostgreSQL (single container)](https://github.com/jeffutter/dokku-postgresql-plugin) | [jeffutter][] | This plugin creates a single postgresql container that all your apps can use. Thus only one instance of postgresql running (good for servers without a ton of memory). | | [PostgreSQL](https://github.com/jezdez/dokku-postgres-plugin) | [jezdez][] | Compatible with 0.2.0 | | [PostgreSQL (single container)](https://github.com/ohardy/dokku-psql) | [ohardy][] | Compatible with 0.2.0 | +| [Postgresql](https://github.com/jlachowski/dokku-pg-plugin) | [jlachowski][] | IP & PORT available directly in linked app container env variables (requires link plugin)| | [PostGIS](https://github.com/fermuch/dokku-pg-plugin) | [fermuch][] | | + +#### Caching + +| Plugin | Author | Compatibility | +| --- | --- | --- | +| [Memcached](https://github.com/jezdez/dokku-memcached-plugin) | [jezdez][] | Compatible with 0.2.0 | +| [Memcached](https://github.com/jlachowski/dokku-memcached-plugin) | [jlachowski][] | IP & PORT available directly in linked app container env variables (requires link plugin)| | [Redis](https://github.com/jezdez/dokku-redis-plugin) | [jezdez][] | Requires https://github.com/rlaneve/dokku-link; compatible with 0.2.0 | | [Redis](https://github.com/luxifer/dokku-redis-plugin) | [luxifer][] | | | [Redis (single container)](https://github.com/ohardy/dokku-redis) | [ohardy][] | Compatible with 0.2.0 | -| [RethinkDB](https://github.com/stuartpb/dokku-rethinkdb-plugin) | [stuartpb][] | 2014-02-22: targeting dokku @ [latest][217d00a]; will fail with Dokku earlier than [28de3ec][]. | -| [RiakCS (single container)](https://github.com/jeffutter/dokku-riakcs-plugin) | [jeffutter][] | Incompatible with 0.2.0 (checked at [dccee02][]) | -| [MySQL](https://github.com/hughfletcher/dokku-mysql-plugin) | [hughfletcher][] | | -| [Memcached](https://github.com/jezdez/dokku-memcached-plugin) | [jezdez][] | Compatible with 0.2.0 | -| [Neo4j](https://github.com/Aomitayo/dokku-neo4j-plugin) | [Aomitayo][] | | +| [Varnish](https://github.com/Zenedith/dokku-varnish-plugin) | [Zenedith][] | Varnish cache between nginx and application with base configuration| + +#### Queuing + +| Plugin | Author | Compatibility | +| --- | --- | --- | | [RabbitMQ](https://github.com/jlachowski/dokku-rabbitmq-plugin) | [jlachowski][] | IP & PORT available directly in linked app container env variables (requires link plugin)| | [RabbitMQ (single container)](https://github.com/jlachowski/dokku-rabbitmq-single-plugin) | [jlachowski][] | IP & PORT available directly in linked app container env variables (requires link plugin)| -| [Postgresql](https://github.com/jlachowski/dokku-pg-plugin) | [jlachowski][] | IP & PORT available directly in linked app container env variables (requires link plugin)| -| [Memcached](https://github.com/jlachowski/dokku-memcached-plugin) | [jlachowski][] | IP & PORT available directly in linked app container env variables (requires link plugin)| -| [Varnish](https://github.com/Zenedith/dokku-varnish-plugin) | [Zenedith][] | Varnish cache between nginx and application with base configuration| + +#### Other + +| Plugin | Author | Compatibility | +| --- | --- | --- | +| [CouchDB](https://github.com/racehub/dokku-couchdb-plugin) | [RaceHub](https://github.com/racehub) | Compatible with 0.2.0 | +| [MongoDB (single container)](https://github.com/jeffutter/dokku-mongodb-plugin) | [jeffutter][] | | +| [RethinkDB](https://github.com/stuartpb/dokku-rethinkdb-plugin) | [stuartpb][] | 2014-02-22: targeting dokku @ [latest][217d00a]; will fail with Dokku earlier than [28de3ec][]. | +| [RiakCS (single container)](https://github.com/jeffutter/dokku-riakcs-plugin) | [jeffutter][] | Incompatible with 0.2.0 (checked at [dccee02][]) | +| [Neo4j](https://github.com/Aomitayo/dokku-neo4j-plugin) | [Aomitayo][] | | [dccee02]: https://github.com/jeffutter/dokku-riakcs-plugin/commit/dccee02702e7001851917b7814e78a99148fb709 From ac84ef68cc9cc1ac9dd0458bd578728845111ca4 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Mon, 17 Nov 2014 17:11:00 -0500 Subject: [PATCH 03/23] Change tables to be left aligned --- docs/template.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/template.html b/docs/template.html index a66d9b40b..03404017c 100644 --- a/docs/template.html +++ b/docs/template.html @@ -55,7 +55,7 @@ padding-left: 20px; } tr, td { - text-align: center; + text-align: left; } #gistbody h1:first-child { border-bottom: 1px solid #dadada; From ab012063517e0ad4167d5ef661c185dcd25807ae Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sat, 22 Nov 2014 15:37:29 -0500 Subject: [PATCH 04/23] Better formatting of plugin tables --- docs/plugins.md | 238 +++++++++++++++++++++++++----------------------- 1 file changed, 122 insertions(+), 116 deletions(-) diff --git a/docs/plugins.md b/docs/plugins.md index 2018dc7ef..52605a2ef 100644 --- a/docs/plugins.md +++ b/docs/plugins.md @@ -32,138 +32,144 @@ If you create your own plugin: Note: The following plugins have been supplied by our community and may not have been tested by dokku maintainers. -[Kloadut]: https://github.com/Kloadut -[jeffutter]: https://github.com/jeffutter -[jezdez]: https://github.com/jezdez -[blag]: https://github.com/blag -[luxifer]: https://github.com/luxifer -[stuartpb]: https://github.com/stuartpb -[hughfletcher]: https://github.com/hughfletcher -[Aomitayo]: https://github.com/Aomitayo -[jlachowski]: https://github.com/jlachowski -[apmorton]: https://github.com/apmorton -[statianzo]: https://github.com/statianzo -[sehrope]: https://github.com/sehrope -[wmluke]: https://github.com/wmluke -[krisrang]: https://github.com/krisrang -[scottatron]: https://github.com/scottatron -[pauldub]: https://github.com/pauldub -[dyson]: https://github.com/dyson -[musicglue]: https://github.com/musicglue -[motin]: https://github.com/motin -[neam]: https://github.com/neam -[cedricziel]: https://github.com/cedricziel -[pnegahdar]: https://github.com/pnegahdar -[fgrehm]: https://github.com/fgrehm -[alexanderbeletsky]: https://github.com/alexanderbeletsky -[thrashr888]: https://github.com/thrashr888 -[robv]: https://github.com/robv -[rlaneve]: https://github.com/rlaneve -[cef]: https://github.com/cef +[agco-adm]: https://github.com/agco-adm +[ademuk]: https://github.com/ademuk [alex-sherwin]: https://github.com/alex-sherwin +[alexanderbeletsky]: https://github.com/alexanderbeletsky +[Aomitayo]: https://github.com/Aomitayo +[apmorton]: https://github.com/apmorton +[blag]: https://github.com/blag +[cameron-martin]: https://github.com/cameron-martin +[cedricziel]: https://github.com/cedricziel +[cef]: https://github.com/cef +[darkpixel]: https://github.com/darkpixel +[dyson]: https://github.com/dyson [F4-Group]: https://github.com/F4-Group [fermuch]: https://github.com/fermuch -[Zenedith]: https://github.com/Zenedith +[fgrehm]: https://github.com/fgrehm +[gdi2290]: https://github.com/gdi2290 [heichblatt]: https://github.com/heichblatt -[michaelshobbs]: https://github.com/michaelshobbs +[hughfletcher]: https://github.com/hughfletcher [iskandar]: https://github.com/iskandar -[mikexstudios]: https://github.com/mikexstudios -[cameron-martin]: https://github.com/cameron-martin +[jeffutter]: https://github.com/jeffutter +[jezdez]: https://github.com/jezdez +[jlachowski]: https://github.com/jlachowski +[krisrang]: https://github.com/krisrang +[Kloadut]: https://github.com/Kloadut +[luxifer]: https://github.com/luxifer +[mlebkowski]: https://github.com/mlebkowski [matto1990]: https://github.com/matto1990 +[michaelshobbs]: https://github.com/michaelshobbs +[mikecsh]: https://github.com/mikecsh +[mikexstudios]: https://github.com/mikexstudios +[motin]: https://github.com/motin +[musicglue]: https://github.com/musicglue +[neam]: https://github.com/neam +[nornagon]: https://github.com/nornagon [ohardy]: https://github.com/ohardy -[agco-adm]: https://github.com/agco-adm +[pauldub]: https://github.com/pauldub +[pnegahdar]: https://github.com/pnegahdar +[RaceHub]: https://github.com/racehub +[rlaneve]: https://github.com/rlaneve +[robv]: https://github.com/robv +[scottatron]: https://github.com/scottatron +[sehrope]: https://github.com/sehrope +[statianzo]: https://github.com/statianzo +[stuartpb]: https://github.com/stuartpb +[thrashr888]: https://github.com/thrashr888 +[wmluke]: https://github.com/wmluke +[Zenedith]: https://github.com/Zenedith ### Datastores #### Relational -| Plugin | Author | Compatibility | -| --- | --- | --- | -| [MariaDB](https://github.com/Kloadut/dokku-md-plugin) | [Kloadut][] | Compatible with 0.2.0 | -| [MariaDB (single container)](https://github.com/ohardy/dokku-mariadb) | [ohardy][] | Compatible with 0.2.0 | -| [MySQL](https://github.com/hughfletcher/dokku-mysql-plugin) | [hughfletcher][] | | -| [PostgreSQL](https://github.com/Kloadut/dokku-pg-plugin) | [Kloadut][] | Compatible with 0.2.0 | -| [PostgreSQL (single container)](https://github.com/jeffutter/dokku-postgresql-plugin) | [jeffutter][] | This plugin creates a single postgresql container that all your apps can use. Thus only one instance of postgresql running (good for servers without a ton of memory). | -| [PostgreSQL](https://github.com/jezdez/dokku-postgres-plugin) | [jezdez][] | Compatible with 0.2.0 | -| [PostgreSQL (single container)](https://github.com/ohardy/dokku-psql) | [ohardy][] | Compatible with 0.2.0 | -| [Postgresql](https://github.com/jlachowski/dokku-pg-plugin) | [jlachowski][] | IP & PORT available directly in linked app container env variables (requires link plugin)| -| [PostGIS](https://github.com/fermuch/dokku-pg-plugin) | [fermuch][] | | +| Plugin | Author | Compatibility | +| ------------------------------------------------------------------------------------------------- | --------------------- | --------------------- | +| [MariaDB](https://github.com/Kloadut/dokku-md-plugin) | [Kloadut][] | Compatible with 0.2.0 | +| [MariaDB (single container)](https://github.com/ohardy/dokku-mariadb) | [ohardy][] | Compatible with 0.2.0 | +| [MySQL](https://github.com/hughfletcher/dokku-mysql-plugin) | [hughfletcher][] | | +| [PostgreSQL](https://github.com/Kloadut/dokku-pg-plugin) | [Kloadut][] | Compatible with 0.2.0 | +| [PostgreSQL](https://github.com/jezdez/dokku-postgres-plugin) | [jezdez][] | Compatible with 0.2.0 | +| [PostgreSQL](https://github.com/jlachowski/dokku-pg-plugin) | [jlachowski][] | IP & PORT available directly in linked app container env variables (requires link plugin)| +| [PostgreSQL (single container)](https://github.com/jeffutter/dokku-postgresql-plugin) | [jeffutter][] | This plugin creates a single postgresql container that all your apps can use. Thus only one instance of postgresql running (good for servers without a ton of memory). | +| [PostgreSQL (single container)](https://github.com/ohardy/dokku-psql) | [ohardy][] | Compatible with 0.2.0 | +| [PostGIS](https://github.com/fermuch/dokku-pg-plugin) | [fermuch][] | | #### Caching -| Plugin | Author | Compatibility | -| --- | --- | --- | -| [Memcached](https://github.com/jezdez/dokku-memcached-plugin) | [jezdez][] | Compatible with 0.2.0 | -| [Memcached](https://github.com/jlachowski/dokku-memcached-plugin) | [jlachowski][] | IP & PORT available directly in linked app container env variables (requires link plugin)| -| [Redis](https://github.com/jezdez/dokku-redis-plugin) | [jezdez][] | Requires https://github.com/rlaneve/dokku-link; compatible with 0.2.0 | -| [Redis](https://github.com/luxifer/dokku-redis-plugin) | [luxifer][] | | -| [Redis (single container)](https://github.com/ohardy/dokku-redis) | [ohardy][] | Compatible with 0.2.0 | -| [Varnish](https://github.com/Zenedith/dokku-varnish-plugin) | [Zenedith][] | Varnish cache between nginx and application with base configuration| +| Plugin | Author | Compatibility | +| ------------------------------------------------------------------------------------------------- | --------------------- | --------------------- | +| [Memcached](https://github.com/jezdez/dokku-memcached-plugin) | [jezdez][] | Compatible with 0.2.0 | +| [Memcached](https://github.com/jlachowski/dokku-memcached-plugin) | [jlachowski][] | IP & PORT available directly in linked app container env variables (requires link plugin)| +| [Redis](https://github.com/jezdez/dokku-redis-plugin) | [jezdez][] | Requires https://github.com/rlaneve/dokku-link; compatible with 0.2.0 | +| [Redis](https://github.com/luxifer/dokku-redis-plugin) | [luxifer][] | | +| [Redis (single container)](https://github.com/ohardy/dokku-redis) | [ohardy][] | Compatible with 0.2.0 | +| [Varnish](https://github.com/Zenedith/dokku-varnish-plugin) | [Zenedith][] | Varnish cache between nginx and application with base configuration| #### Queuing -| Plugin | Author | Compatibility | -| --- | --- | --- | -| [RabbitMQ](https://github.com/jlachowski/dokku-rabbitmq-plugin) | [jlachowski][] | IP & PORT available directly in linked app container env variables (requires link plugin)| -| [RabbitMQ (single container)](https://github.com/jlachowski/dokku-rabbitmq-single-plugin) | [jlachowski][] | IP & PORT available directly in linked app container env variables (requires link plugin)| +| Plugin | Author | Compatibility | +| ------------------------------------------------------------------------------------------------- | --------------------- | --------------------- | +| [RabbitMQ](https://github.com/jlachowski/dokku-rabbitmq-plugin) | [jlachowski][] | IP & PORT available directly in linked app container env variables (requires link plugin)| +| [RabbitMQ (single container)](https://github.com/jlachowski/dokku-rabbitmq-single-plugin) | [jlachowski][] | IP & PORT available directly in linked app container env variables (requires link plugin)| #### Other -| Plugin | Author | Compatibility | -| --- | --- | --- | -| [CouchDB](https://github.com/racehub/dokku-couchdb-plugin) | [RaceHub](https://github.com/racehub) | Compatible with 0.2.0 | -| [MongoDB (single container)](https://github.com/jeffutter/dokku-mongodb-plugin) | [jeffutter][] | | -| [RethinkDB](https://github.com/stuartpb/dokku-rethinkdb-plugin) | [stuartpb][] | 2014-02-22: targeting dokku @ [latest][217d00a]; will fail with Dokku earlier than [28de3ec][]. | -| [RiakCS (single container)](https://github.com/jeffutter/dokku-riakcs-plugin) | [jeffutter][] | Incompatible with 0.2.0 (checked at [dccee02][]) | -| [Neo4j](https://github.com/Aomitayo/dokku-neo4j-plugin) | [Aomitayo][] | | +| Plugin | Author | Compatibility | +| ------------------------------------------------------------------------------------------------- | --------------------- | --------------------- | +| [CouchDB](https://github.com/racehub/dokku-couchdb-plugin) | [RaceHub][] | Compatible with 0.2.0 | +| [MongoDB (single container)](https://github.com/jeffutter/dokku-mongodb-plugin) | [jeffutter][] | | +| [RethinkDB](https://github.com/stuartpb/dokku-rethinkdb-plugin) | [stuartpb][] | 2014-02-22: targeting dokku @ [latest][217d00a]; will fail with Dokku earlier than [28de3ec][]. | +| [RiakCS (single container)](https://github.com/jeffutter/dokku-riakcs-plugin) | [jeffutter][] | Incompatible with 0.2.0 (checked at [dccee02][]) | +| [Neo4j](https://github.com/Aomitayo/dokku-neo4j-plugin) | [Aomitayo][] | | [dccee02]: https://github.com/jeffutter/dokku-riakcs-plugin/commit/dccee02702e7001851917b7814e78a99148fb709 ### Process Managers -| Plugin | Author | Compatibility | -| --- | --- | --- | -| [Circus](https://github.com/apmorton/dokku-circus) | [apmorton][] | | -| [Shoreman ](https://github.com/statianzo/dokku-shoreman) | [statianzo][] | Compatible with 0.2.0 | -| [Supervisord](https://github.com/statianzo/dokku-supervisord) | [statianzo][] | Compatible with 0.2.0 | -| [Logging Supervisord](https://github.com/sehrope/dokku-logging-supervisord) | [sehrope][] | Works with dokku @ [c77cbf1][] - no 0.2.0 compatibility | -| [Forego](https://github.com/iskandar/dokku-forego) | [iskandar][] | Compatible with 0.2.x | +| Plugin | Author | Compatibility | +| ------------------------------------------------------------------------------------------------- | --------------------- | --------------------- | +| [Circus](https://github.com/apmorton/dokku-circus) | [apmorton][] | | +| [Shoreman ](https://github.com/statianzo/dokku-shoreman) | [statianzo][] | Compatible with 0.2.0 | +| [Supervisord](https://github.com/statianzo/dokku-supervisord) | [statianzo][] | Compatible with 0.2.0 | +| [Logging Supervisord](https://github.com/sehrope/dokku-logging-supervisord) | [sehrope][] | Works with dokku @ [c77cbf1][] - no 0.2.0 compatibility | +| [Forego](https://github.com/iskandar/dokku-forego) | [iskandar][] | Compatible with 0.2.x | [c77cbf1]: https://github.com/progrium/dokku/commit/c77cbf1d3ae07f0eafb85082ed7edcae9e836147 [28de3ec]: https://github.com/progrium/dokku/commit/28de3ecaa3231a223f83fd8d03f373308673bc40 ### Dokku Features -| Plugin | Author | Compatibility | -| --- | --- | --- | -| [Custom Domains](https://github.com/neam/dokku-custom-domains) | [motin][] | Compatible with 0.2.* and master | -| [Multiple Domains](https://github.com/wmluke/dokku-domains-plugin)4 | [wmluke][] | Compatible with 0.2.0 . | -| [git rev-parse HEAD in env](https://github.com/nornagon/dokku-git-rev) | [nornagon](https://github.com/nornagon) | Compatible with 0.2.0 | -| [Rebuild application](https://github.com/scottatron/dokku-rebuild) | [scottatron][] | Compatible with 0.2.x | -| [Multi-Buildpack](https://github.com/pauldub/dokku-multi-buildpack) | [pauldub][] | | -| [Docker Options](https://github.com/dyson/dokku-docker-options) | [dyson][] | Requires dokku >= [c77cbf1][] | -| [Persistent Storage](https://github.com/dyson/dokku-persistent-storage) | [dyson][] | Requires dokku >= [c77cbf1][] | -| [Volume (persistent storage)](https://github.com/ohardy/dokku-volume) | [ohardy][] | Compatible with 0.2.0 | -| [user-env-compile](https://github.com/musicglue/dokku-user-env-compile)1 | [musicglue][] | Compatible with dokku master branch | -| [user-env-compile](https://github.com/motin/dokku-user-env-compile)1 | [motin][] | Compatible with 0.2.1 | -| [registry](https://github.com/agco-adm/dokku-registry)5 | [agco-adm](https://github.com/agco-adm) | | -| [SSH Deployment Keys](https://github.com/cedricziel/dokku-deployment-keys)2 | [cedricziel][] | 2014-01-17: compatible with upstream/master | -| [SSH Hostkeys](https://github.com/cedricziel/dokku-hostkeys-plugin)3 | [cedricziel][] | 2014-01-17: compatible with upstream/master | -| [Link Containers](https://github.com/rlaneve/dokku-link) | [rlaneve][] | Requires dokku >= [c77cbf1][] | -| [Host Port binding](https://github.com/stuartpb/dokku-bind-port) | [stuartpb][] | Requires dokku >= [c77cbf1][]. 2014-02-17: [a043e98][] targeting dokku @ [latest][217d00a] | -| [Docker name](https://github.com/alex-sherwin/dokku-name) | [alex-sherwin][] | Requires dokku >= [c77cbf1][] | -| [No VHOST](https://github.com/alex-sherwin/dokku-novhost) | [alex-sherwin][] | Requires dokku >= [c77cbf1][] | -| [Docker Direct](https://github.com/heichblatt/dokku-docker-direct) | [heichblatt][] | | -| [Ports](https://github.com/heichblatt/dokku-ports) | [heichblatt][] | | -| [Debug](https://github.com/heichblatt/dokku-debug) | [heichblatt][] | | -| [Pre-Deploy Tasks](https://github.com/michaelshobbs/dokku-app-predeploy-tasks) | [michaelshobbs][] | | -| [Hostname](https://github.com/michaelshobbs/dokku-hostname) | [michaelshobbs][] | | -| [VHOSTS Custom Configuration](https://github.com/neam/dokku-nginx-vhosts-custom-configuration) | [motin][] | Compatible with 0.3.1+ | -| [Multiple domains and per-app custom nginx.conf](https://github.com/mikexstudios/dokku-nginx-alt) | [mikexstudios][] | Works with v0.2.3 | -| [Supply env vars to buildpacks](https://github.com/cameron-martin/dokku-build-env)| [cameron-martin][] | Works with v0.2.3 | -| [HTTP Auth Secure Apps](https://github.com/matto1990/dokku-secure-apps) | [matto1990][] | Works with v0.2.3 | -| [app-url](https://github.com/mikecsh/dokku-app-url) | [mikecsh](https://github.com/mikecsh) | Works with 0.2.0 | -| [dokku-registry](https://github.com/agco-adm/dokku-registry) | [agco-adm][] | | +| Plugin | Author | Compatibility | +| ------------------------------------------------------------------------------------------------- | --------------------- | --------------------- | +| [app-url](https://github.com/mikecsh/dokku-app-url) | [mikecsh][] | Works with 0.2.0 | +| [Custom Domains](https://github.com/neam/dokku-custom-domains) | [motin][] | Compatible with 0.2.* | +| [Debug](https://github.com/heichblatt/dokku-debug) | [heichblatt][] | | +| [Docker Direct](https://github.com/heichblatt/dokku-docker-direct) | [heichblatt][] | | +| [Docker Options](https://github.com/dyson/dokku-docker-options) | [dyson][] | dokku >= [c77cbf1][] | +| [Dokku Name](https://github.com/alex-sherwin/dokku-name) | [alex-sherwin][] | dokku >= [c77cbf1][] | +| [Dokku Registry](https://github.com/agco-adm/dokku-registry) | [agco-adm][] | | +| [git rev-parse HEAD in env](https://github.com/nornagon/dokku-git-rev) | [nornagon][] | Compatible with 0.2.0 | +| [HTTP Auth Secure Apps](https://github.com/matto1990/dokku-secure-apps) | [matto1990][] | Works with v0.2.3 | +| [Host Port binding](https://github.com/stuartpb/dokku-bind-port) | [stuartpb][] | dokku >= [c77cbf1][]. 2014-02-17: [a043e98][] targeting dokku @ [latest][217d00a] | +| [Hostname](https://github.com/michaelshobbs/dokku-hostname) | [michaelshobbs][] | | +| [Link Containers](https://github.com/rlaneve/dokku-link) | [rlaneve][] | dokku >= [c77cbf1][] | +| [Multi-Buildpack](https://github.com/pauldub/dokku-multi-buildpack) | [pauldub][] | | +| [Multiple Domains](https://github.com/wmluke/dokku-domains-plugin)4 | [wmluke][] | Compatible with 0.2.0 | +| [Nginx-Alt](https://github.com/mikexstudios/dokku-nginx-alt) | [mikexstudios][] | Works with v0.2.3 | +| [No VHOST](https://github.com/alex-sherwin/dokku-novhost) | [alex-sherwin][] | Requires dokku >= [c77cbf1][] | +| [Persistent Storage](https://github.com/dyson/dokku-persistent-storage) | [dyson][] | Requires dokku >= [c77cbf1][] | +| [Ports](https://github.com/heichblatt/dokku-ports) | [heichblatt][] | | +| [Pre-Deploy Tasks](https://github.com/michaelshobbs/dokku-app-predeploy-tasks) | [michaelshobbs][] | | +| [Rebuild application](https://github.com/scottatron/dokku-rebuild) | [scottatron][] | Compatible with 0.2.x | +| [SSH Deployment Keys](https://github.com/cedricziel/dokku-deployment-keys)2 | [cedricziel][] | 2014-01-17: compatible with upstream/master | +| [SSH Hostkeys](https://github.com/cedricziel/dokku-hostkeys-plugin)3 | [cedricziel][] | 2014-01-17: compatible with upstream/master | +| [Supply env vars to buildpacks](https://github.com/cameron-martin/dokku-build-env) | [cameron-martin][] | Works with v0.2.3 | +| [user-env-compile](https://github.com/musicglue/dokku-user-env-compile)1 | [musicglue][] | Compatible with dokku master branch | +| [user-env-compile](https://github.com/motin/dokku-user-env-compile)1 | [motin][] | Compatible with 0.2.1 | +| [VHOSTS Custom Configuration](https://github.com/neam/dokku-nginx-vhosts-custom-configuration) | [motin][] | Compatible with 0.3.1 | +| [Volume (persistent storage)](https://github.com/ohardy/dokku-volume) | [ohardy][] | Compatible with 0.2.0 | [8fca220]: https://github.com/progrium/dokku/commit/8fca2204edb0017796d6915ca9157c05b1238e28 [217d00a]: https://github.com/progrium/dokku/commit/217d00a1bc47a7e24d8847617bb08a1633025fc7 @@ -182,21 +188,21 @@ Note: The following plugins have been supplied by our community and may not have ### Other Add-ons -| Plugin | Author | Compatibility | -| --- | --- | --- | -| [Node](https://github.com/pnegahdar/dokku-node) | [pnegahdar](https://github.com/pnegahdar) | | -| [Node](https://github.com/ademuk/dokku-nodejs) | [ademuk](https://github.com/ademuk) | | -| [Chef cookbooks](https://github.com/fgrehm/chef-dokku) | [fgrehm][] | | -| [Bower install](https://github.com/alexanderbeletsky/dokku-bower-install) | [alexanderbeletsky][] | | -| [Bower/Grunt](https://github.com/thrashr888/dokku-bower-grunt-build-plugin) | [thrashr888][] | | -| [Bower/Gulp](https://github.com/gdi2290/dokku-bower-gulp-build-plugin) | [gdi2290](https://github.com/gdi2290) | | -| [Elasticsearch](https://github.com/robv/dokku-elasticsearch) | [robv][] | | -| [Elasticsearch](https://github.com/jezdez/dokku-elasticsearch-plugin) | [jezdez][] | Compatible with 0.2.0 | -| [Elasticsearch](https://github.com/blag/dokku-elasticsearch-plugin)1 | [blag][] | Compatible with 0.2.0 | -| [HipChat Notifications](https://github.com/cef/dokku-hipchat) | [cef][] | | -| [Graphite/statsd] (https://github.com/jlachowski/dokku-graphite-plugin) | [jlachowski][] | | -| [APT](https://github.com/F4-Group/dokku-apt) | [F4-Group][] | | -| [User ACL](https://github.com/mlebkowski/dokku-acl) | [Maciej Łebkowski](https://github.com/mlebkowski) | | -| [PrimeCache](https://github.com/darkpixel/dokku-prime-cache) | [darkpixel](https://github.com/darkpixel/) | | +| Plugin | Author | Compatibility | +| ------------------------------------------------------------------------------------------------- | --------------------- | --------------------- | +| [Node](https://github.com/pnegahdar/dokku-node) | [pnegahdar][] | | +| [Node](https://github.com/ademuk/dokku-nodejs) | [ademuk][] | | +| [Chef cookbooks](https://github.com/fgrehm/chef-dokku) | [fgrehm][] | | +| [Bower install](https://github.com/alexanderbeletsky/dokku-bower-install) | [alexanderbeletsky][] | | +| [Bower/Grunt](https://github.com/thrashr888/dokku-bower-grunt-build-plugin) | [thrashr888][] | | +| [Bower/Gulp](https://github.com/gdi2290/dokku-bower-gulp-build-plugin) | [gdi2290][] | | +| [Elasticsearch](https://github.com/robv/dokku-elasticsearch) | [robv][] | | +| [Elasticsearch](https://github.com/jezdez/dokku-elasticsearch-plugin) | [jezdez][] | Compatible with 0.2.0 | +| [Elasticsearch](https://github.com/blag/dokku-elasticsearch-plugin)1 | [blag][] | Compatible with 0.2.0 | +| [HipChat Notifications](https://github.com/cef/dokku-hipchat) | [cef][] | | +| [Graphite/statsd](https://github.com/jlachowski/dokku-graphite-plugin) | [jlachowski][] | | +| [APT](https://github.com/F4-Group/dokku-apt) | [F4-Group][] | | +| [User ACL](https://github.com/mlebkowski/dokku-acl) | [Maciej Łebkowski][] | | +| [PrimeCache](https://github.com/darkpixel/dokku-prime-cache) | [darkpixel][] | | 1 Forked from [jezdez/dokku-elasticsearch-plugin](https://github.com/jezdez/dokku-elasticsearch-plugin): uses Elasticsearch 1.2 (instead of 0.90), doesn't depend on dokku-link, runs as elasticsearch user instead of root, and turns off multicast autodiscovery for use in a VPS environment. From 47811f60f489ea5dc6a8e508ac1421919ffb8b61 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sat, 22 Nov 2014 15:37:42 -0500 Subject: [PATCH 05/23] Ensure tables have proper width --- docs/template.html | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/template.html b/docs/template.html index 03404017c..e0540238a 100644 --- a/docs/template.html +++ b/docs/template.html @@ -54,7 +54,14 @@ list-style-position: outside; padding-left: 20px; } + th:nth-of-type(1) { + width: 230px; + } + th:nth-of-type(2) { + width: 140px; + } tr, td { + line-height: 24px; text-align: left; } #gistbody h1:first-child { From 19609f70784faa605c9ad1d6413d9aae632c2f86 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sat, 22 Nov 2014 16:04:05 -0500 Subject: [PATCH 06/23] Import ssl certificates Also ensures output is stored in proper tls directory Closes #518 --- docs/tls-spdy-support.md | 10 ++++++++ plugins/nginx-vhosts/commands | 43 +++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100755 plugins/nginx-vhosts/commands diff --git a/docs/tls-spdy-support.md b/docs/tls-spdy-support.md index 80f472421..430af9ce0 100644 --- a/docs/tls-spdy-support.md +++ b/docs/tls-spdy-support.md @@ -28,3 +28,13 @@ The nginx configuration will need to be reloaded in order for the updated TLS co The [HSTS header](https://en.wikipedia.org/wiki/HTTP_Strict_Transport_Security) is an HTTP header that can inform browsers that all requests to a given site should be made via HTTPS. dokku does not, by default, enable this header. It is thus left up to you, the user, to enable it for your site. Beware that if you enable the header and a subsequent deploy of your application results in an HTTP deploy (for whatever reason), the way the header works means that a browser will not attempt to request the HTTP version of your site if the HTTPS version fails. + +## Importing ssl certificates + +You can import ssl certificates via tarball using the following command: + +``` bash +dokku nginx:import-ssl myapp < archive-of-certs.tar +``` + +This archive should is expanded via `tar xvf`. It should contain `server.crt` and `server.key`. diff --git a/plugins/nginx-vhosts/commands b/plugins/nginx-vhosts/commands new file mode 100755 index 000000000..59943655c --- /dev/null +++ b/plugins/nginx-vhosts/commands @@ -0,0 +1,43 @@ +#!/usr/bin/env bash +set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x + +case "$1" in + nginx:import-ssl) + if [[ -z $2 ]]; then + echo "Please specify an app to create" + exit 1 + fi + APP="$2" + if [[ ! -d "$DOKKU_ROOT/$APP" ]]; then + echo "App $APP does not exist" + exit 1 + fi + if [[ -t 0 ]]; then + echo "Tar archive containing server.crt and server.key expected on stdin" + exit 1 + fi + + TEMP_DIR=`mktemp -d` + cd $TEMP_DIR + tar xvf - <&0 + if [[ -f "$TEMP_DIR/server.crt" ]]; then + echo "Tar archive missing server.crt" + exit 1 + fi + if [[ -f "$TEMP_DIR/server.key" ]]; then + echo "Tar archive missing server.key" + exit 1 + fi + + mkdir -p "$DOKKU_ROOT/$APP/tls" + mv "$TEMP_DIR/server.crt" "$DOKKU_ROOT/$APP/tls/server.crt" + mv "$TEMP_DIR/server.key" "$DOKKU_ROOT/$APP/tls/server.key" + rm -rf $TEMP_DIR + ;; + help) + cat && cat< Imports a tarball from stdin; should contain server.crt and server.key +EOF + ;; + +esac From 69f360864fa0f683b054d603026c75173c01d649 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sat, 22 Nov 2014 16:42:55 -0500 Subject: [PATCH 07/23] Disable nginx vhosts via `dokku config:set myapp NO_VHOST=1`. Closes #485 --- docs/tls-spdy-support.md | 10 +++++++++ plugins/nginx-vhosts/post-deploy | 36 +++++++++++++++++++++++++------- 2 files changed, 38 insertions(+), 8 deletions(-) diff --git a/docs/tls-spdy-support.md b/docs/tls-spdy-support.md index 430af9ce0..2beef1b5c 100644 --- a/docs/tls-spdy-support.md +++ b/docs/tls-spdy-support.md @@ -38,3 +38,13 @@ dokku nginx:import-ssl myapp < archive-of-certs.tar ``` This archive should is expanded via `tar xvf`. It should contain `server.crt` and `server.key`. + +## Disabling VHOSTS + +If desired, it is possible to disable vhosts by setting the `NO_VHOST` environment variable: + +```bash +dokku config:set myapp NO_VHOST=1 +``` + +On subsequent deploys, the nginx virtualhost will be discarded. This is useful when deploying internal-facing services that should not be publicly routeable. diff --git a/plugins/nginx-vhosts/post-deploy b/plugins/nginx-vhosts/post-deploy index 19d5f04fc..125bbfdc3 100755 --- a/plugins/nginx-vhosts/post-deploy +++ b/plugins/nginx-vhosts/post-deploy @@ -5,7 +5,15 @@ APP="$1"; PORT="$2" WILDCARD_SSL="$DOKKU_ROOT/tls" SSL="$DOKKU_ROOT/$APP/tls" -if [[ -f "$DOKKU_ROOT/VHOST" ]]; then +set +e +NO_VHOST=$(dokku config:get $APP NO_VHOST) +set -e + +if [[ -z "$NO_VHOST" ]]; then + echo "-----> NO_VHOST config detected" +fi + +if [[ -f "$DOKKU_ROOT/VHOST" && ! -z "$NO_VHOST" ]]; then VHOST=$(< "$DOKKU_ROOT/VHOST") SUBDOMAIN=${APP/%\.${VHOST}/} if [[ "$APP" == *.* ]] && [[ "$SUBDOMAIN" == "$APP" ]]; then @@ -26,9 +34,9 @@ EOF SSL_DIRECTIVES="" fi - # ssl based nginx.conf if [[ -n "$SSL_INUSE" ]]; then - cat< $DOKKU_ROOT/$APP/nginx.conf + echo "-----> creating ssl nginx.conf" + cat< $DOKKU_ROOT/$APP/nginx.conf upstream $APP { server 127.0.0.1:$PORT; } server { listen [::]:80; @@ -61,10 +69,10 @@ $SSL_DIRECTIVES } EOF - echo "https://$hostname" > "$DOKKU_ROOT/$APP/URL" -else -# default nginx.conf - cat< $DOKKU_ROOT/$APP/nginx.conf + echo "https://$hostname" > "$DOKKU_ROOT/$APP/URL" + else + echo "-----> creating non-ssl nginx.conf" + cat< $DOKKU_ROOT/$APP/nginx.conf upstream $APP { server 127.0.0.1:$PORT; } server { listen [::]:80; @@ -85,10 +93,22 @@ server { } EOF - echo "http://$hostname" > "$DOKKU_ROOT/$APP/URL" + echo "http://$hostname" > "$DOKKU_ROOT/$APP/URL" fi + echo "-----> Running nginx-pre-reload" pluginhook nginx-pre-reload $APP $PORT echo " Reloading nginx" sudo /etc/init.d/nginx reload > /dev/null +else + if [[ -f "$DOKKU_ROOT/$APP/URL" ]]; then + echo "------> NO_VHOST set, deleting $APP/URL" + rm "$DOKKU_ROOT/$APP/URL" + fi + if [[ -f "$DOKKU_ROOT/$APP/nginx.conf" ]]; then + echo "------> NO_VHOST set, deleting $APP/nginx.conf" + rm "$DOKKU_ROOT/$APP/nginx.conf" + echo "------> NO_VHOST set, reloading nginx after nginx.conf deletion" + sudo /etc/init.d/nginx reload > /dev/null + fi fi From fd1678b576c21ec874c5996a876b4b3f556c9d6a Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sat, 22 Nov 2014 16:45:38 -0500 Subject: [PATCH 08/23] Remove reference to no-vhost plugin that is now in core --- docs/plugins.md | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/plugins.md b/docs/plugins.md index 52605a2ef..4798c9ef8 100644 --- a/docs/plugins.md +++ b/docs/plugins.md @@ -158,7 +158,6 @@ Note: The following plugins have been supplied by our community and may not have | [Multi-Buildpack](https://github.com/pauldub/dokku-multi-buildpack) | [pauldub][] | | | [Multiple Domains](https://github.com/wmluke/dokku-domains-plugin)4 | [wmluke][] | Compatible with 0.2.0 | | [Nginx-Alt](https://github.com/mikexstudios/dokku-nginx-alt) | [mikexstudios][] | Works with v0.2.3 | -| [No VHOST](https://github.com/alex-sherwin/dokku-novhost) | [alex-sherwin][] | Requires dokku >= [c77cbf1][] | | [Persistent Storage](https://github.com/dyson/dokku-persistent-storage) | [dyson][] | Requires dokku >= [c77cbf1][] | | [Ports](https://github.com/heichblatt/dokku-ports) | [heichblatt][] | | | [Pre-Deploy Tasks](https://github.com/michaelshobbs/dokku-app-predeploy-tasks) | [michaelshobbs][] | | From 4754f241f25347c7211afcfbe2ba470bf4473451 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sat, 22 Nov 2014 17:18:33 -0500 Subject: [PATCH 09/23] Add the ability to customize an app's hostname using the nginx-hostname pluginhook Closes #254 --- docs/index.md | 2 +- docs/{tls-spdy-support.md => nginx.md} | 38 ++++++++++++++++++++++---- plugins/nginx-vhosts/post-deploy | 15 ++++++---- 3 files changed, 43 insertions(+), 12 deletions(-) rename docs/{tls-spdy-support.md => nginx.md} (74%) diff --git a/docs/index.md b/docs/index.md index 73fe4e06e..96d368336 100644 --- a/docs/index.md +++ b/docs/index.md @@ -12,7 +12,7 @@ Docker powered mini-Heroku. The smallest PaaS implementation you've ever seen. - [Remote commands](http://progrium.viewdocs.io/dokku/remote-commands) - [Plugins](http://progrium.viewdocs.io/dokku/plugins) - [Configuration management](http://progrium.viewdocs.io/dokku/configuration-management) -- [TLS/SPDY support](http://progrium.viewdocs.io/dokku/tls-spdy-support) +- [Nginx Configuration](http://progrium.viewdocs.io/dokku/nginx) - [DNS](http://progrium.viewdocs.io/dokku/dns) ## Things this project won't do diff --git a/docs/tls-spdy-support.md b/docs/nginx.md similarity index 74% rename from docs/tls-spdy-support.md rename to docs/nginx.md index 2beef1b5c..e3bb8dadf 100644 --- a/docs/tls-spdy-support.md +++ b/docs/nginx.md @@ -1,14 +1,18 @@ -# TLS/SPDY support +# Nginx + +Dokku uses nginx as it's server for routing requests to specific applications. + +## TLS/SPDY support Dokku provides easy TLS/SPDY support out of the box. This can be done app-by-app or for all subdomains at once. Note that whenever TLS support is enabled SPDY is also enabled. -## Per App +### Per App To enable TLS connection to to one of your applications, copy or symlink the `.crt`/`.pem` and `.key` files into the application's `/home/dokku/:app/tls` folder (create this folder if it doesn't exist) as `server.crt` and `server.key` respectively. Redeployment of the application will be needed to apply TLS configuration. Once it is redeployed, the application will be accessible by `https://` (redirection from `http://` is applied as well). -## All Subdomains +### All Subdomains To enable TLS connections for all your applications at once you will need a wildcard TLS certificate. @@ -23,13 +27,13 @@ The nginx configuration will need to be reloaded in order for the updated TLS co **Note**: TLS will not be enabled unless the application's VHOST matches the certificate's name. (i.e. if you have a cert for *.example.com TLS won't be enabled for something.example.org or example.net) -## HSTS Header +### HSTS Header The [HSTS header](https://en.wikipedia.org/wiki/HTTP_Strict_Transport_Security) is an HTTP header that can inform browsers that all requests to a given site should be made via HTTPS. dokku does not, by default, enable this header. It is thus left up to you, the user, to enable it for your site. Beware that if you enable the header and a subsequent deploy of your application results in an HTTP deploy (for whatever reason), the way the header works means that a browser will not attempt to request the HTTP version of your site if the HTTPS version fails. -## Importing ssl certificates +### Importing ssl certificates You can import ssl certificates via tarball using the following command: @@ -48,3 +52,27 @@ dokku config:set myapp NO_VHOST=1 ``` On subsequent deploys, the nginx virtualhost will be discarded. This is useful when deploying internal-facing services that should not be publicly routeable. + +## Customizing hostnames + +Applications typically have the following structure for their hostname: + +``` +scheme://subdomain.domain.tld +``` + +The `subdomain` is inferred from the pushed application name, while the `domain` is set during initial configuration in the `$DOKKU_ROOT/VHOST` file. + +You can optionally override this in a plugin by implementing the `nginx-hostname` pluginhook. For example, you can reverse the subdomain with the following sample `nginx-hostname` pluginhook: + +```bash +#!/usr/bin/env bash +set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x + +APP="$1"; SUBDOMAIN="$2"; VHOST="$3" + +NEW_SUBDOMAIN=`echo $SUBDOMAIN | rev` +echo "$NEW_SUBDOMAIN.$VHOST" +``` + +If the `nginx-hostname` has no output, the normal hostname algorithm will be executed. diff --git a/plugins/nginx-vhosts/post-deploy b/plugins/nginx-vhosts/post-deploy index 125bbfdc3..e37145e35 100755 --- a/plugins/nginx-vhosts/post-deploy +++ b/plugins/nginx-vhosts/post-deploy @@ -16,10 +16,13 @@ fi if [[ -f "$DOKKU_ROOT/VHOST" && ! -z "$NO_VHOST" ]]; then VHOST=$(< "$DOKKU_ROOT/VHOST") SUBDOMAIN=${APP/%\.${VHOST}/} - if [[ "$APP" == *.* ]] && [[ "$SUBDOMAIN" == "$APP" ]]; then - hostname="${APP/\//-}" - else - hostname="${APP/\//-}.$VHOST" + hostname=$(: | pluginhook nginx-hostname $APP $SUBDOMAIN $VHOST) + if [[ ! -n $hostname ]]; then + if [[ "$APP" == *.* ]] && [[ "$SUBDOMAIN" == "$APP" ]]; then + hostname="${APP/\//-}" + else + hostname="${APP/\//-}.$VHOST" + fi fi if [[ -e "$SSL/server.crt" ]] && [[ -e "$SSL/server.key" ]]; then @@ -35,7 +38,7 @@ EOF fi if [[ -n "$SSL_INUSE" ]]; then - echo "-----> creating ssl nginx.conf" + echo "-----> Creating ssl nginx.conf" cat< $DOKKU_ROOT/$APP/nginx.conf upstream $APP { server 127.0.0.1:$PORT; } server { @@ -71,7 +74,7 @@ EOF echo "https://$hostname" > "$DOKKU_ROOT/$APP/URL" else - echo "-----> creating non-ssl nginx.conf" + echo "-----> Creating non-ssl nginx.conf" cat< $DOKKU_ROOT/$APP/nginx.conf upstream $APP { server 127.0.0.1:$PORT; } server { From cfc7c41e47a2cc1aa1e2ed668e9f4412b38a0696 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sat, 22 Nov 2014 17:52:46 -0500 Subject: [PATCH 10/23] Add PLUGIN:help command to each plugin --- plugins/apps/commands | 2 +- plugins/backup/commands | 2 +- plugins/config/commands | 2 +- plugins/git/commands | 2 +- plugins/nginx-vhosts/commands | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/plugins/apps/commands b/plugins/apps/commands index 673238045..3b5fbf9ec 100755 --- a/plugins/apps/commands +++ b/plugins/apps/commands @@ -64,7 +64,7 @@ case "$1" in pluginhook post-delete $APP ;; - help) + help | apps:help) cat && cat< Create a new app diff --git a/plugins/backup/commands b/plugins/backup/commands index 4c41037fc..ace6d1783 100755 --- a/plugins/backup/commands +++ b/plugins/backup/commands @@ -85,7 +85,7 @@ case "$1" in echo "Import complete." ;; - help) + help | backup:help) cat && cat< Display the config vars for an app config:get KEY Display a config value for an app diff --git a/plugins/git/commands b/plugins/git/commands index 0b90005e5..5c9d0ad97 100755 --- a/plugins/git/commands +++ b/plugins/git/commands @@ -54,7 +54,7 @@ EOF git-shell -c "$args" ;; - help) + help | git:help) cat ;; diff --git a/plugins/nginx-vhosts/commands b/plugins/nginx-vhosts/commands index 59943655c..786bcd6a6 100755 --- a/plugins/nginx-vhosts/commands +++ b/plugins/nginx-vhosts/commands @@ -34,7 +34,7 @@ case "$1" in mv "$TEMP_DIR/server.key" "$DOKKU_ROOT/$APP/tls/server.key" rm -rf $TEMP_DIR ;; - help) + help | nginx:help) cat && cat< Imports a tarball from stdin; should contain server.crt and server.key EOF From e7219c0346cc9eb9df12a74d2dee385ef38ec837 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sat, 22 Nov 2014 18:02:06 -0500 Subject: [PATCH 11/23] Release 0.3.2 --- HISTORY.md | 10 ++++++++++ README.md | 2 +- contrib/dokku-installer.rb | 2 +- docs/installation.md | 2 +- 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index bacb60464..733127eca 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,5 +1,15 @@ # History +## 0.3.2 + +- #675: @michaelhobbs port wait-to-retire from broadly/dokku +- #765: @josegonzalez Ignore tls directory when listing apps +- #766: @josegonzalez Sort output of apps command +- #771: @josegonzalez Doc updates +- #518 #772: @nickl- Import ssl certificates +- #773: @alex-sherwin Support a way to not create nginx vhost +- #774: @josegonzalez Add the ability to customize an app's hostname using nginx-hostname pluginhook + ## 0.3.1 - 647b2157: @josegonzalez Update HISTORY.md for 0.3.0 diff --git a/README.md b/README.md index ce422d53d..3a2134e98 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ Docker powered mini-Heroku. The smallest PaaS implementation you've ever seen. S To install the latest stable version of dokku, you can run the following bootstrapper command: - $ wget -qO- https://raw.github.com/progrium/dokku/v0.3.1/bootstrap.sh | sudo DOKKU_TAG=v0.3.1 bash + $ wget -qO- https://raw.github.com/progrium/dokku/v0.3.2/bootstrap.sh | sudo DOKKU_TAG=v0.3.2 bash ## Documentation diff --git a/contrib/dokku-installer.rb b/contrib/dokku-installer.rb index 6506fc176..9c32b8b87 100755 --- a/contrib/dokku-installer.rb +++ b/contrib/dokku-installer.rb @@ -21,7 +21,7 @@ if ARGV[0] == "onboot" exit end -version = "v0.3.1" +version = "v0.3.2" dokku_root = ENV["DOKKU_ROOT"] || "/home/dokku" admin_key = `cat /root/.ssh/authorized_keys`.split("\n").first hostname = `bash -c '[[ $(dig +short $HOSTNAME) ]] && echo $HOSTNAME || curl icanhazip.com'`.strip diff --git a/docs/installation.md b/docs/installation.md index 92f20125e..301c9d760 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -11,7 +11,7 @@ Ubuntu 14.04 x64 x64. Ideally have a domain ready to point to your host. It's de To install the latest stable version of dokku, you can run the following bootstrapper command: ```bash -wget -qO- https://raw.github.com/progrium/dokku/v0.3.1/bootstrap.sh | sudo DOKKU_TAG=v0.3.1 bash +wget -qO- https://raw.github.com/progrium/dokku/v0.3.2/bootstrap.sh | sudo DOKKU_TAG=v0.3.2 bash ``` ## Configuring From c4f5b3e219e80b50bed6bb1b76dc2963bcab74a9 Mon Sep 17 00:00:00 2001 From: joliv Date: Sat, 22 Nov 2014 22:09:11 -0500 Subject: [PATCH 12/23] Update man page for new commands --- dokku.1 | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/dokku.1 b/dokku.1 index efce792f2..87a41819b 100644 --- a/dokku.1 +++ b/dokku.1 @@ -1,4 +1,4 @@ -.TH DOKKU 1 2014-05-10 +.TH DOKKU 1 2014-11-22 .\"Make sure to change that date when you commit a change! .\" .SH NAME @@ -15,6 +15,15 @@ work with plugins and inspect the current state of your server. .\" .SH OPTIONS .TP +.BI apps:create " " +Create a new app. +.TP +.BI apps:destroy " " +Permanantly destroy an app. +.TP +.B apps +List your apps. +.TP .BI backup:import " file" Import dokku config files. .TP @@ -33,15 +42,16 @@ Set one or more config vars for an app. .BI config:unset " KEY1" \fR\ (KEY2\ \.\.\.) Remove one or more config vars from an app. .TP -.BI delete " " -Delete an application. -.TP .B help Print the list of commands. .TP .B logs \ \fI \fR[\fI-t\fR] Show the last logs for an application (-t follows) .TP +.BI nginx:import-ssl " " +Imports a tarball from stdin which should contain +server\.crt and server\.key +.TP .B plugins-install Install active plugins. .TP From 2d776292c3e5156a2e853fd618a1bb712acc02ce Mon Sep 17 00:00:00 2001 From: Thomas Boerger Date: Thu, 13 Nov 2014 17:04:39 +0100 Subject: [PATCH 13/23] Added environment variable for base container In order to be able to use a different base image i have added another environment variable where everybody can switch the used base container for the applications directly through the environment variable DOKKU_IMAGE or with the help of the dokkurc configuration. --- dokku | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dokku b/dokku index 2f0ec3b93..934b9649b 100755 --- a/dokku +++ b/dokku @@ -1,6 +1,9 @@ #!/usr/bin/env bash set -eo pipefail + +export DOKKU_IMAGE=${DOKKU_IMAGE:="progrium/buildstep"} export DOKKU_ROOT=${DOKKU_ROOT:="/home/dokku"} + export PLUGIN_PATH=${PLUGIN_PATH:="/var/lib/dokku/plugins"} [[ -f $DOKKU_ROOT/dokkurc ]] && source $DOKKU_ROOT/dokkurc @@ -36,7 +39,7 @@ case "$1" in build) APP="$2"; IMAGE="dokku/$APP"; CACHE_DIR="$DOKKU_ROOT/$APP/cache" - id=$(cat | docker run -i -a stdin progrium/buildstep /bin/bash -c "mkdir -p /app && tar -xC /app") + id=$(cat | docker run -i -a stdin $DOKKU_DISTRO /bin/bash -c "mkdir -p /app && tar -xC /app") test $(docker wait $id) -eq 0 docker commit $id $IMAGE > /dev/null [[ -d $CACHE_DIR ]] || mkdir $CACHE_DIR From 14b1743c2aef9c9f2c6ba5cd2317654757266a36 Mon Sep 17 00:00:00 2001 From: Thomas Boerger Date: Thu, 13 Nov 2014 17:37:26 +0100 Subject: [PATCH 14/23] Added openSUSE support I have done the first steps to get dokku running for other distros like openSUSE. I have simply replaced the important places within the core plugins with a check for DOKKU_DISTRO that gets exported by dokku itself. It just replaces the apt-get and service start/restart/reload functionality with the openSUSE counterparts. --- dokku | 1 + plugins/00_dokku-standard/install | 22 +++++++++++++++++++++- plugins/nginx-vhosts/dependencies | 17 ++++++++++++----- plugins/nginx-vhosts/install | 31 +++++++++++++++++++++++-------- plugins/nginx-vhosts/post-delete | 10 +++++++++- plugins/nginx-vhosts/post-deploy | 20 +++++++++++++++++++- 6 files changed, 85 insertions(+), 16 deletions(-) diff --git a/dokku b/dokku index 934b9649b..22bb1a280 100755 --- a/dokku +++ b/dokku @@ -1,6 +1,7 @@ #!/usr/bin/env bash set -eo pipefail +export DOKKU_DISTRO=${DOKKU_DISTRO:="ubuntu"} export DOKKU_IMAGE=${DOKKU_IMAGE:="progrium/buildstep"} export DOKKU_ROOT=${DOKKU_ROOT:="/home/dokku"} diff --git a/plugins/00_dokku-standard/install b/plugins/00_dokku-standard/install index 9625e8fdc..99e3bf41e 100755 --- a/plugins/00_dokku-standard/install +++ b/plugins/00_dokku-standard/install @@ -7,7 +7,9 @@ fi # temporary hack for https://github.com/progrium/dokku/issues/82 # redeploys all apps after a reboot -cat< /etc/init/dokku-redeploy.conf +case "$DOKKU_DISTRO" in + ubuntu) + cat< /etc/init/dokku-redeploy.conf description "Dokku app redeploy service" start on (started docker) @@ -17,3 +19,21 @@ script sudo -i -u dokku /usr/local/bin/dokku deploy:all end script EOF + ;; + + opensuse) + cat< /etc/systemd/system/dokku-redeploy.service +[Unit] +Description=Dokku app redeploy service +After=docker.target + +[Service] +Type=simple +User=dokku +ExecStart=/usr/local/bin/dokku deploy:all + +[Install] +WantedBy=multi-user.target +EOF + ;; +esac diff --git a/plugins/nginx-vhosts/dependencies b/plugins/nginx-vhosts/dependencies index 04914f084..dbb5a7325 100755 --- a/plugins/nginx-vhosts/dependencies +++ b/plugins/nginx-vhosts/dependencies @@ -1,8 +1,15 @@ #!/bin/bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -# latest stable NGINX 1.4.x with websocket support -apt-get install -qq -y software-properties-common python-software-properties -add-apt-repository -y ppa:nginx/stable -apt-get update -apt-get install -qq -y nginx dnsutils +case "$DOKKU_DISTRO" in + ubuntu) + apt-get install -qq -y software-properties-common python-software-properties + add-apt-repository -y ppa:nginx/stable + apt-get update + apt-get install -qq -y nginx dnsutils + ;; + + opensuse) + zypper -q in -y nginx bind-utils + ;; +esac diff --git a/plugins/nginx-vhosts/install b/plugins/nginx-vhosts/install index ae5fa5079..afe9e20b0 100755 --- a/plugins/nginx-vhosts/install +++ b/plugins/nginx-vhosts/install @@ -1,12 +1,18 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -if ! grep -q dokku-nginx-reload "/etc/sudoers"; then - touch /etc/sudoers.tmp - cp /etc/sudoers /tmp/sudoers.new - echo "%dokku ALL=(ALL)NOPASSWD:/etc/init.d/nginx reload # dokku-nginx-reload" >> /tmp/sudoers.new - EDITOR="cp /tmp/sudoers.new" visudo - rm /tmp/sudoers.new +if [[ ! -f /etc/sudoers.d/dokku-nginx ]]; then + case "$DOKKU_DISTRO" in + ubuntu) + echo "%dokku ALL=(ALL) NOPASSWD:/etc/init.d/nginx reload" >> /etc/sudoers.d/dokku-nginx + ;; + + opensuse) + echo "%dokku ALL=(ALL) NOPASSWD:/sbin/service nginx reload" >> /etc/sudoers.d/dokku-nginx + ;; + esac + + chmod 0440 /etc/sudoers.d/dokku-nginx fi # if dokku.conf has not been created, create it @@ -25,10 +31,19 @@ ssl_prefer_server_ciphers on; #ssl_certificate_key $DOKKU_ROOT/tls/server.key; EOF fi -sed -i 's/# server_names_hash_bucket_size/server_names_hash_bucket_size/' /etc/nginx/nginx.conf + +echo 'server_names_hash_bucket_size 64' >| /etc/nginx/conf.d/server_names_hash_bucket_size.conf if [[ ! -f "$DOKKU_ROOT/VHOST" ]]; then [[ $(dig +short $(< "$DOKKU_ROOT/HOSTNAME")) ]] && cp "$DOKKU_ROOT/HOSTNAME" "$DOKKU_ROOT/VHOST" fi -/etc/init.d/nginx start +case "$DOKKU_DISTRO" in + ubuntu) + /etc/init.d/nginx start + ;; + + opensuse) + /sbin/service nginx start + ;; +esac diff --git a/plugins/nginx-vhosts/post-delete b/plugins/nginx-vhosts/post-delete index 3c0ea3ce5..ab0578794 100755 --- a/plugins/nginx-vhosts/post-delete +++ b/plugins/nginx-vhosts/post-delete @@ -1,4 +1,12 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -sudo /etc/init.d/nginx reload > /dev/null +case "$DOKKU_DISTRO" in + ubuntu) + sudo /etc/init.d/nginx reload > /dev/null + ;; + + opensuse) + sudo /sbin/service nginx reload > /dev/null + ;; +esac diff --git a/plugins/nginx-vhosts/post-deploy b/plugins/nginx-vhosts/post-deploy index e37145e35..d1f07ae96 100755 --- a/plugins/nginx-vhosts/post-deploy +++ b/plugins/nginx-vhosts/post-deploy @@ -101,8 +101,17 @@ EOF echo "-----> Running nginx-pre-reload" pluginhook nginx-pre-reload $APP $PORT + echo " Reloading nginx" - sudo /etc/init.d/nginx reload > /dev/null + case "$DOKKU_DISTRO" in + ubuntu) + sudo /etc/init.d/nginx reload > /dev/null + ;; + + opensuse) + sudo /sbin/service nginx reload > /dev/null + ;; + esac else if [[ -f "$DOKKU_ROOT/$APP/URL" ]]; then echo "------> NO_VHOST set, deleting $APP/URL" @@ -112,6 +121,15 @@ else echo "------> NO_VHOST set, deleting $APP/nginx.conf" rm "$DOKKU_ROOT/$APP/nginx.conf" echo "------> NO_VHOST set, reloading nginx after nginx.conf deletion" + case "$DOKKU_DISTRO" in + ubuntu) + sudo /etc/init.d/nginx reload > /dev/null + ;; + + opensuse) + sudo /sbin/service nginx reload > /dev/null + ;; + esac sudo /etc/init.d/nginx reload > /dev/null fi fi From 8bc3d372ec04d7de29007ca0fae8bed5ac4243f0 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sun, 23 Nov 2014 16:42:21 -0500 Subject: [PATCH 15/23] Minor bash formatting changes --- plugins/00_dokku-standard/commands | 10 +++++----- plugins/config/commands | 10 +++++----- plugins/nginx-vhosts/commands | 3 ++- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/plugins/00_dokku-standard/commands b/plugins/00_dokku-standard/commands index 8e4c36cb9..962f6f3fa 100755 --- a/plugins/00_dokku-standard/commands +++ b/plugins/00_dokku-standard/commands @@ -8,13 +8,13 @@ case "$1" in logs) if [[ -z $2 ]]; then - echo "Please specify an app to run the command on" - exit 1 + echo "Please specify an app to run the command on" + exit 1 fi APP="$2"; if [[ ! -d "$DOKKU_ROOT/$APP" ]]; then - echo "App $APP does not exist" - exit 1 + echo "App $APP does not exist" + exit 1 fi if [[ -f "$DOKKU_ROOT/$APP/CONTAINER" ]]; then @@ -55,7 +55,7 @@ case "$1" in if [[ -f "$DOKKU_ROOT/$APP/URL" ]]; then echo $(< "$DOKKU_ROOT/$APP/URL") fi - ;; + ;; version) cat "$DOKKU_ROOT/VERSION" || { diff --git a/plugins/config/commands b/plugins/config/commands index 5fccdc83e..1247b9cce 100755 --- a/plugins/config/commands +++ b/plugins/config/commands @@ -94,7 +94,7 @@ case "$1" in echo "=== $APP config vars ===" config_styled_hash "$VARS" - ;; + ;; config:get) if [[ -z $3 ]]; then @@ -110,7 +110,7 @@ case "$1" in KEY="$3" cat $ENV_FILE | grep -Eo "export ([a-zA-Z_][a-zA-Z0-9_]*=.*)" | grep "^export $KEY=" | cut -d"=" -f2- | sed -e "s/^'//" -e "s/'$//" - ;; + ;; config:set) if [[ -z "${*:3}" ]]; then @@ -154,7 +154,7 @@ ${var}" config_write "$ENV_TEMP" fi - ;; + ;; config:unset) if [[ -z $3 ]]; then @@ -173,7 +173,7 @@ ${var}" config_write "$ENV_TEMP" done - ;; + ;; help | config:help) cat && cat< KEY1=VALUE1 [KEY2=VALUE2 ...] Set one or more config vars config:unset KEY1 [KEY2 ...] Unset one or more config vars EOF - ;; + ;; esac diff --git a/plugins/nginx-vhosts/commands b/plugins/nginx-vhosts/commands index 786bcd6a6..b705ca39d 100755 --- a/plugins/nginx-vhosts/commands +++ b/plugins/nginx-vhosts/commands @@ -34,8 +34,9 @@ case "$1" in mv "$TEMP_DIR/server.key" "$DOKKU_ROOT/$APP/tls/server.key" rm -rf $TEMP_DIR ;; + help | nginx:help) - cat && cat< Imports a tarball from stdin; should contain server.crt and server.key EOF ;; From d307a5b8ecb98857b89a5031b9ddfd2c3435085b Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sun, 23 Nov 2014 18:09:11 -0500 Subject: [PATCH 16/23] Output error message when a command is not found. Closes #778 Plugins with commands will need to implement a catch-all command that exits with the `DOKKU_NOT_IMPLEMENTED_EXIT`` code (10). This signals to dokku that a given plugin has indeed not executed anything for a plugin (which may not always be the case). Using plugins that do not implement this pattern will result in those plugins silencing the error message. --- docs/plugins.md | 43 ++++++++++++++++++++++++++++++ dokku | 22 ++++++++++++++- plugins/00_dokku-standard/commands | 4 +++ plugins/apps/commands | 4 +++ plugins/backup/commands | 4 +++ plugins/config/commands | 4 +++ plugins/git/commands | 4 +++ plugins/nginx-vhosts/commands | 4 +++ 8 files changed, 88 insertions(+), 1 deletion(-) diff --git a/docs/plugins.md b/docs/plugins.md index 4798c9ef8..c67a780cc 100644 --- a/docs/plugins.md +++ b/docs/plugins.md @@ -28,6 +28,49 @@ If you create your own plugin: 3. edit this page and add a link to it below! 4. subscribe to the [dokku development blog](http://progrium.com) to be notified about API changes and releases +### Sample plugin + +The below plugin is a dummy `dokku hello` plugin. If your plugin exposes commands, this is a good template for your `commands` file: + +```bash +#!/usr/bin/env bash +set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x + +case "$1" in + hello) + [[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1 + [[ ! -d "$DOKKU_ROOT/$APP" ]] && echo "App $APP does not exist" && exit 1 + APP="$2"; + + echo "Hello $APP" + ;; + + hello:world) + echo "Hello world" + ;; + + help) + cat && cat< Says "Hello " + hello:world Says "Hello world" +EOF + ;; + + *) + exit $DOKKU_NOT_IMPLEMENTED_EXIT + ;; + +esac +``` + +A few notes: + +- You should always support `DOKKU_TRACE` as specified on the 2nd line of the plugin. +- If your command requires that an application exists, ensure you check for it's existence in the manner prescribed above. +- A `help` command is required, though it is allowed to be empty. +- Commands *should* be namespaced. +- As of 0.3.3, a catch-all should be implemented which exits with a `DOKKU_NOT_IMPLEMENTED_EXIT` code. This allows dokku to output a `command not found` message. + ## Community plugins Note: The following plugins have been supplied by our community and may not have been tested by dokku maintainers. diff --git a/dokku b/dokku index 22bb1a280..548b5217d 100755 --- a/dokku +++ b/dokku @@ -6,6 +6,8 @@ export DOKKU_IMAGE=${DOKKU_IMAGE:="progrium/buildstep"} export DOKKU_ROOT=${DOKKU_ROOT:="/home/dokku"} export PLUGIN_PATH=${PLUGIN_PATH:="/var/lib/dokku/plugins"} +export DOKKU_NOT_IMPLEMENTED_EXIT=10 +export DOKKU_VALID_EXIT=0 [[ -f $DOKKU_ROOT/dokkurc ]] && source $DOKKU_ROOT/dokkurc @@ -143,6 +145,9 @@ case "$1" in ;; help|'') + echo "Usage: dokku COMMAND [command-specific-options]" + echo "" + cat< Date: Sun, 23 Nov 2014 19:54:10 -0500 Subject: [PATCH 17/23] Rename DOKKU_CONTROLLER to DOKKU_HOST --- contrib/dokku_client.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/contrib/dokku_client.sh b/contrib/dokku_client.sh index 0c7e2cf0a..b7fdaafd1 100755 --- a/contrib/dokku_client.sh +++ b/contrib/dokku_client.sh @@ -1,4 +1,4 @@ -if [ -z "$DOKKU_CONTROLLER" ] +if [ -z "$DOKKU_HOST" ] then function dokku { appname=$(git remote -v 2>/dev/null | grep dokku | head -n 1 | cut -f1 -d' ' | cut -f2 -d':' 2>/dev/null) @@ -9,9 +9,9 @@ then if [ "$1" = "create" ] then appname=$(echo "print(elfs.GenName())" | lua -l elfs) - if git remote add dokku dokku@$DOKKU_CONTROLLER:$appname + if git remote add dokku dokku@$DOKKU_HOST:$appname then - echo "-----> Dokku remote added at $DOKKU_CONTROLLER" + echo "-----> Dokku remote added at $DOKKU_HOST" echo "-----> Application name is $appname" else echo "! Dokku remote not added! Do you already have a dokku remote?" @@ -21,12 +21,12 @@ then else if [ -z "$donotshift" ] then - ssh dokku@$DOKKU_CONTROLLER $* + ssh dokku@$DOKKU_HOST $* exit fi verb=$1 shift - ssh dokku@$DOKKU_CONTROLLER "$verb" "$appname" $@ + ssh dokku@$DOKKU_HOST "$verb" "$appname" $@ fi } fi From 303bc18265ce45b5565b610fcc733d4e69c4e47c Mon Sep 17 00:00:00 2001 From: Olivier Hardy Date: Tue, 26 Aug 2014 16:42:10 +0200 Subject: [PATCH 18/23] Handle dokku plugins-update command --- dokku | 7 ++++++- dokku.1 | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/dokku b/dokku index 22bb1a280..bacb6080f 100755 --- a/dokku +++ b/dokku @@ -11,7 +11,7 @@ export PLUGIN_PATH=${PLUGIN_PATH:="/var/lib/dokku/plugins"} [[ $DOKKU_TRACE ]] && set -x -if [[ $(id -un) != "dokku" && $1 != plugins-install* ]]; then +if [[ $(id -un) != "dokku" && $1 != plugins-install* && $1 != "plugins-update" ]]; then sudo -u dokku -H $0 "$@" exit fi @@ -134,6 +134,10 @@ case "$1" in pluginhook dependencies ;; + plugins-update) + pluginhook update + ;; + # temporary hack for https://github.com/progrium/dokku/issues/82 deploy:all) for app in $(ls -d $DOKKU_ROOT/*/CONTAINER); do @@ -147,6 +151,7 @@ case "$1" in help Print the list of commands plugins Print active plugins plugins-install Install active plugins + plugins-update Update active plugins EOF ;; diff --git a/dokku.1 b/dokku.1 index 87a41819b..35bfcfcef 100644 --- a/dokku.1 +++ b/dokku.1 @@ -55,6 +55,9 @@ server\.crt and server\.key .B plugins-install Install active plugins. .TP +.B plugins-update +Update active plugins. +.TP .B plugins Print active plugins. .TP From 3faa37b2e108ae27d6889563fa700407a54ed2ee Mon Sep 17 00:00:00 2001 From: Thomas Boerger Date: Thu, 13 Nov 2014 16:50:44 +0100 Subject: [PATCH 19/23] Keep environment for sudo To be able to set some other environment variables even if dokku gets called from a different user we have to keep the environment with sudo intact, so i added the -E option. --- dokku | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dokku b/dokku index bacb6080f..50d2cb62d 100755 --- a/dokku +++ b/dokku @@ -12,7 +12,7 @@ export PLUGIN_PATH=${PLUGIN_PATH:="/var/lib/dokku/plugins"} [[ $DOKKU_TRACE ]] && set -x if [[ $(id -un) != "dokku" && $1 != plugins-install* && $1 != "plugins-update" ]]; then - sudo -u dokku -H $0 "$@" + sudo -u dokku -E -H $0 "$@" exit fi From 9eab9ed1e1ca706b93ef826fa741b8758fef3939 Mon Sep 17 00:00:00 2001 From: Thomas Boerger Date: Thu, 13 Nov 2014 16:52:39 +0100 Subject: [PATCH 20/23] Replaced hard coded plugins path To be able to switch the plugin path i have removed the hard coded plugin path from the catch all section of the switch within the main dokku executable. --- Makefile | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index fc3eaf439..defbac45c 100644 --- a/Makefile +++ b/Makefile @@ -5,6 +5,7 @@ PLUGINHOOK_URL ?= https://s3.amazonaws.com/progrium-pluginhook/pluginhook_0.1.0_ STACK_URL ?= https://github.com/progrium/buildstep.git PREBUILT_STACK_URL ?= https://github.com/progrium/buildstep/releases/download/2014-03-08/2014-03-08_429d4a9deb.tar.gz DOKKU_ROOT ?= /home/dokku +PLUGINS_PATH ?= /var/lib/dokku/plugins # If the first argument is "vagrant-dokku"... ifeq (vagrant-dokku,$(firstword $(MAKECMDGOALS))) @@ -23,12 +24,12 @@ install: dependencies stack copyfiles plugin-dependencies plugins version copyfiles: addman cp dokku /usr/local/bin/dokku - mkdir -p /var/lib/dokku/plugins - find /var/lib/dokku/plugins -mindepth 2 -maxdepth 2 -name '.core' -printf '%h\0' | xargs -0 rm -Rf + mkdir -p ${PLUGINS_PATH} + find ${PLUGINS_PATH} -mindepth 2 -maxdepth 2 -name '.core' -printf '%h\0' | xargs -0 rm -Rf find plugins/ -mindepth 1 -maxdepth 1 -type d -printf '%f\n' | while read plugin; do \ - rm -Rf /var/lib/dokku/plugins/$$plugin && \ - cp -R plugins/$$plugin /var/lib/dokku/plugins && \ - touch /var/lib/dokku/plugins/$$plugin/.core; \ + rm -Rf ${PLUGINS_PATH}/$$plugin && \ + cp -R plugins/$$plugin ${PLUGINS_PATH} && \ + touch ${PLUGINS_PATH}/$$plugin/.core; \ done addman: From ad497191dfcad3ca439a55e9bf08130c16225ba0 Mon Sep 17 00:00:00 2001 From: Will Boyce Date: Sat, 18 Oct 2014 02:25:23 +0100 Subject: [PATCH 21/23] Add `git pull` support --- dokku | 7 +++++++ plugins/git/commands | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/dokku b/dokku index 50d2cb62d..a217b5d70 100755 --- a/dokku +++ b/dokku @@ -38,6 +38,13 @@ case "$1" in echo ;; + git-upload-pack) + APP=${2//"'"/} # strip single quotes from the app name: 'app_name' -> app_name + pluginhook pre-pull $APP + cat | git-upload-pack "$DOKKU_ROOT/$APP" + pluginhook post-pull $APP + ;; + build) APP="$2"; IMAGE="dokku/$APP"; CACHE_DIR="$DOKKU_ROOT/$APP/cache" id=$(cat | docker run -i -a stdin $DOKKU_DISTRO /bin/bash -c "mkdir -p /app && tar -xC /app") diff --git a/plugins/git/commands b/plugins/git/commands index 5c9d0ad97..c00f21539 100755 --- a/plugins/git/commands +++ b/plugins/git/commands @@ -6,7 +6,7 @@ git_archive_all() { TMP_WORK_DIR=$(mktemp -d) chmod 755 $TMP_WORK_DIR unset GIT_DIR GIT_WORK_TREE - git clone $DOKKU_ROOT/$APP $TMP_WORK_DIR &> /dev/null + git clone -q $DOKKU_ROOT/$APP $TMP_WORK_DIR &> /dev/null pushd $TMP_WORK_DIR > /dev/null git config advice.detachedHead false git checkout $REV &> /dev/null From aa1c7f6fa45855b657514fd0ef4c9f9640166747 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sun, 23 Nov 2014 20:47:15 -0500 Subject: [PATCH 22/23] Move git-upload-pack command to git plugin Also use the same APP escaping as used for other git commands. --- dokku | 7 ------- plugins/git/commands | 7 +++++++ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/dokku b/dokku index a217b5d70..50d2cb62d 100755 --- a/dokku +++ b/dokku @@ -38,13 +38,6 @@ case "$1" in echo ;; - git-upload-pack) - APP=${2//"'"/} # strip single quotes from the app name: 'app_name' -> app_name - pluginhook pre-pull $APP - cat | git-upload-pack "$DOKKU_ROOT/$APP" - pluginhook post-pull $APP - ;; - build) APP="$2"; IMAGE="dokku/$APP"; CACHE_DIR="$DOKKU_ROOT/$APP/cache" id=$(cat | docker run -i -a stdin $DOKKU_DISTRO /bin/bash -c "mkdir -p /app && tar -xC /app") diff --git a/plugins/git/commands b/plugins/git/commands index c00f21539..918925b0c 100755 --- a/plugins/git/commands +++ b/plugins/git/commands @@ -34,6 +34,13 @@ case "$1" in done ;; + git-upload-pack) + APP="$(echo $2 | perl -pe 's/(? Date: Sun, 23 Nov 2014 21:02:40 -0500 Subject: [PATCH 23/23] Use git-* as a pluginhook prefix --- plugins/git/commands | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/git/commands b/plugins/git/commands index 918925b0c..b10c72e0d 100755 --- a/plugins/git/commands +++ b/plugins/git/commands @@ -36,9 +36,9 @@ case "$1" in git-upload-pack) APP="$(echo $2 | perl -pe 's/(?