Add language to each codeblock
[ci skip]
This commit is contained in:
@@ -82,7 +82,7 @@ Total 231 (delta 93), reused 147 (delta 53)
|
||||
|
||||
When the deploy finishes, the application's URL will be shown.
|
||||
|
||||
```shell
|
||||
```
|
||||
=====> Application deployed:
|
||||
http://ruby-rails-sample.dokku.me
|
||||
```
|
||||
@@ -152,8 +152,10 @@ Note that if the buildpack or dockerfile build process require ssh key access fo
|
||||
|
||||
The name of remote repository is used as the name of application to be deployed, as for example above:
|
||||
|
||||
$ git remote add dokku dokku@dokku.me:ruby-rails-sample
|
||||
$ git push dokku master
|
||||
```shell
|
||||
git remote add dokku dokku@dokku.me:ruby-rails-sample
|
||||
git push dokku master
|
||||
```
|
||||
|
||||
Is deployed to,
|
||||
|
||||
@@ -162,8 +164,10 @@ Is deployed to,
|
||||
|
||||
You can also specify fully qualified names, say `app.dokku.me`, as
|
||||
|
||||
$ git remote add dokku dokku@dokku.me:app.dokku.me
|
||||
$ git push dokku master
|
||||
```shell
|
||||
git remote add dokku dokku@dokku.me:app.dokku.me
|
||||
git push dokku master
|
||||
```
|
||||
|
||||
So, after deployment the application will be available at,
|
||||
|
||||
@@ -172,8 +176,10 @@ So, after deployment the application will be available at,
|
||||
|
||||
This is in particular useful, then you want to deploy to root domain, as
|
||||
|
||||
$ git remote add dokku dokku@dokku.me:dokku.me
|
||||
$ git push dokku master
|
||||
```shell
|
||||
git remote add dokku dokku@dokku.me:dokku.me
|
||||
git push dokku master
|
||||
```
|
||||
|
||||
... deployment ...
|
||||
|
||||
|
||||
@@ -6,10 +6,10 @@
|
||||
|
||||
Because Dokku is git based, rebuilding a deployed app is as easy as pushing from git. You can push to a new server by updating the dokku remote in you local app's repo.
|
||||
|
||||
```
|
||||
$ git remote rm dokku
|
||||
$ git remote add dokku dokku@[dokku.me:dokku.me]
|
||||
$ git push dokku [master]
|
||||
```shell
|
||||
git remote rm dokku
|
||||
git remote add dokku dokku@[dokku.me:dokku.me]
|
||||
git push dokku [master]
|
||||
```
|
||||
## Databases
|
||||
|
||||
@@ -35,7 +35,7 @@ storage:unmount <app> <host-dir:container-dir>, Remove an existing bind mount
|
||||
|
||||
The best plan for disaster recovery is to always keep multiple (remote) copies of your local repo, static assets and periodic database dumps. In case of an emergency when your git repo and backups are completely lost, you can recover the last pushed copy from your remote dokku server (assuming you still have the ssh key).
|
||||
|
||||
```
|
||||
```shell
|
||||
mkdir [app-name] ; cd !$
|
||||
git init && git remote add dokku dokku@[dokku.me:app-name]
|
||||
git pull dokku/master && git checkout dokku/master
|
||||
|
||||
@@ -75,7 +75,7 @@ The syntax for declaring a `Procfile` is as follows. Note that the format is one
|
||||
|
||||
If, for example, you have multiple queue workers and wish to scale them separately, the following would be a valid way to work around the requirement of not duplicating process types:
|
||||
|
||||
```
|
||||
```Procfile
|
||||
worker: env QUEUE=* bundle exec rake resque:work
|
||||
importantworker: env QUEUE=important bundle exec rake resque:work
|
||||
```
|
||||
|
||||
@@ -18,7 +18,7 @@ Simply place an `app.json` file in the root of your repository or for dockerfile
|
||||
|
||||
### Example app.json
|
||||
|
||||
```
|
||||
```json
|
||||
{
|
||||
"name": "barebones nodejs",
|
||||
"description": "A barebones Node.js app using Express 4.",
|
||||
|
||||
@@ -27,13 +27,13 @@ When ports are exposed through the default nginx proxy, they are proxied externa
|
||||
|
||||
By default no arguments are passed to `docker run` when deploying the container and the `CMD` or `ENTRYPOINT` defined in the `Dockerfile` are executed. You can take advantage of docker ability of overriding the `CMD` or passing parameters to your `ENTRYPOINT` setting `$DOKKU_DOCKERFILE_START_CMD`. Let's say for example you are deploying a base nodejs image, with the following `ENTRYPOINT`:
|
||||
|
||||
```
|
||||
```Dockerfile
|
||||
ENTRYPOINT ["node"]
|
||||
```
|
||||
|
||||
You can do:
|
||||
|
||||
```
|
||||
```shell
|
||||
dokku config:set APP DOKKU_DOCKERFILE_START_CMD="--harmony server.js"
|
||||
```
|
||||
|
||||
@@ -52,14 +52,14 @@ When you deploy your app a Docker image will be built, the `Procfile` will be ex
|
||||
(it must be in the folder defined in your `Dockerfile` as `WORKDIR` or `/app`) and the commands
|
||||
in it will be passed to `docker run` to start your process(es). Here's an example `Procfile`:
|
||||
|
||||
```
|
||||
```Procfile
|
||||
web: bin/run-prod.sh
|
||||
worker: bin/run-worker.sh
|
||||
```
|
||||
|
||||
And `Dockerfile`:
|
||||
|
||||
```
|
||||
```Dockerfile
|
||||
FROM debian:jessie
|
||||
WORKDIR /app
|
||||
COPY . ./
|
||||
|
||||
@@ -71,7 +71,7 @@ dokku domains:remove myapp example.com
|
||||
|
||||
By default, dokku will route any received request with an unknown HOST header value to the lexicographically first site in the nginx config stack. If this is not the desired behavior, you may want to add the following configuration to the global nginx configuration. This will catch all unknown HOST header values and return a `410 Gone` response. You can replace the `return 410;` with `return 444;` which will cause nginx to not respond to requests that do not match known domains (connection refused).
|
||||
|
||||
```
|
||||
```nginx
|
||||
server {
|
||||
listen 80 default_server;
|
||||
listen [::]:80 default_server;
|
||||
@@ -84,7 +84,7 @@ server {
|
||||
|
||||
You may also wish to use a separate vhost in your `/etc/nginx/sites-enabled` directory. To do so, create the vhost in that directory as `/etc/nginx/sites-enabled/00-default.conf`. You will also need to change two lines in the main `nginx.conf`:
|
||||
|
||||
```
|
||||
```nginx
|
||||
# Swap both conf.d include line and the sites-enabled include line. From:
|
||||
include /etc/nginx/conf.d/*.conf;
|
||||
include /etc/nginx/sites-enabled/*;
|
||||
|
||||
@@ -95,7 +95,7 @@ dokku enter node-js-app web python script/background-worker.py
|
||||
|
||||
Your procfile can have the following entry:
|
||||
|
||||
```
|
||||
```Procfile
|
||||
cron: sleep infinity
|
||||
```
|
||||
|
||||
@@ -138,7 +138,7 @@ Regularly scheduled tasks can be a bit of a pain with dokku. The following are g
|
||||
|
||||
The following is a sample cronfile that you can use for your applications:
|
||||
|
||||
```
|
||||
```cron
|
||||
# server cron jobs
|
||||
MAILTO="mail@example.com"
|
||||
PATH=/usr/local/bin:/usr/bin:/bin
|
||||
|
||||
@@ -83,7 +83,7 @@ Your application has access to the HTTP headers `X-Forwarded-Proto`, `X-Forwarde
|
||||
|
||||
If your server runs behind an HTTP/S load balancer, then Nginx will see all requests as coming from the load balancer. If your load balancer sets the `X-Forwarded-` headers, you can tell Nginx to pass these headers from load balancer to your application by using the following [nginx custom template](/dokku/nginx/#customizing-the-nginx-configuration)
|
||||
|
||||
```shell
|
||||
```go
|
||||
server {
|
||||
listen [::]:{{ .NGINX_PORT }};
|
||||
listen {{ .NGINX_PORT }};
|
||||
|
||||
@@ -33,13 +33,13 @@ At it's base, the `sshcommand` *must* be run under a user with sudo access, as i
|
||||
|
||||
For instance, if you stored your public key at `~/.ssh/id_rsa.pub-open` and are deploying to EC2 where the default root-enabled user is `ubuntu`, you can run the following command to add your key under the `superuser` username:
|
||||
|
||||
```
|
||||
```shell
|
||||
cat ~/.ssh/id_rsa.pub-open | ssh ubuntu@dokku.me "sudo sshcommand acl-add dokku superuser"
|
||||
```
|
||||
|
||||
If you are using the vagrant installation, you can also use the `make vagrant-acl-add` target to add your public key to dokku (it will use your host username as the `USER`):
|
||||
|
||||
```
|
||||
```shell
|
||||
cat ~/.ssh/id_rsa.pub | make vagrant-acl-add
|
||||
```
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ docker-options:remove <app> <phase(s)> OPTION Remove Docker option from app f
|
||||
|
||||
> When specifying multiple phases, they **must** be comma-separated _without_ spaces in between each phase, like so:
|
||||
>
|
||||
> ```
|
||||
> ```shell
|
||||
> dokku docker-options:add myapp deploy,run "-v /home/dokku/logs/myapp:/app/logs"
|
||||
> ```
|
||||
|
||||
|
||||
@@ -19,8 +19,8 @@ The storage plugin requires explicit paths on the host side. This is intentional
|
||||
|
||||
This example demonstrates how to mount the recommended directory to `/storage` inside the container:
|
||||
|
||||
```
|
||||
$ dokku storage:mount app-name /var/lib/dokku/data/storage:/storage
|
||||
```shell
|
||||
dokku storage:mount app-name /var/lib/dokku/data/storage:/storage
|
||||
```
|
||||
|
||||
Dokku will then mount the shared contents of`/var/lib/dokku/data/storage` to `/storage` inside the container.
|
||||
@@ -61,8 +61,9 @@ Your app may have services that are running in memory and need to be backed up l
|
||||
### Build phase
|
||||
|
||||
By default, dokku will only bind storage mounts during the deploy and run phases. Under certain conditions, one might want to bind a storage mount during the build phase. This can be accomplished by using the `docker-options` plugin directly.
|
||||
```
|
||||
$ dokku docker-options:add <app> "-v /tmp/python-test:/opt/test"
|
||||
|
||||
```shell
|
||||
dokku docker-options:add <app> "-v /tmp/python-test:/opt/test"
|
||||
```
|
||||
|
||||
NOTE: **This can cause data loss** if you bind a mount under `/app` in buildpack apps as herokuish will attempt to remove the original app path during the build phase.
|
||||
|
||||
@@ -24,9 +24,11 @@ __Warning__: These steps will delete *everything* on your Linode.
|
||||
|
||||
5. SSH into your Linode as root and run the following commands:
|
||||
|
||||
apt-get update
|
||||
apt-get -qq upgrade
|
||||
apt-get -qq install linux-image-virtual linux-image-extra-virtual
|
||||
```shell
|
||||
apt-get update
|
||||
apt-get -qq upgrade
|
||||
apt-get -qq install linux-image-virtual linux-image-extra-virtual
|
||||
```
|
||||
|
||||
6. When prompted, install Grub onto the first hard drive.
|
||||
|
||||
|
||||
@@ -4,12 +4,13 @@
|
||||
- Download and install [Vagrant](http://www.vagrantup.com/downloads.html)
|
||||
- Clone Dokku
|
||||
|
||||
```
|
||||
```shell
|
||||
git clone https://github.com/dokku/dokku.git
|
||||
```
|
||||
|
||||
- Create VM
|
||||
```
|
||||
|
||||
```shell
|
||||
# Optional ENV arguments:
|
||||
# - `BOX_NAME`
|
||||
# - `BOX_URI`
|
||||
@@ -22,7 +23,7 @@
|
||||
```
|
||||
- Setup SSH Config in `~/.ssh/config`. The port listed here is usually correct, though you may want to verify that it is the same as the one listed in the output of `vagrant ssh-config dokku`
|
||||
|
||||
```
|
||||
```ini
|
||||
Host dokku.me
|
||||
Port 22
|
||||
```
|
||||
|
||||
@@ -24,7 +24,8 @@ Dokku uses a templating library by the name of [sigil](https://github.com/glider
|
||||
### Example Custom Template
|
||||
|
||||
Use case: add an `X-Served-By` header to requests
|
||||
```
|
||||
|
||||
```go
|
||||
server {
|
||||
listen [::]:{{ .NGINX_PORT }};
|
||||
listen {{ .NGINX_PORT }};
|
||||
@@ -64,6 +65,7 @@ upstream {{ .APP }} {
|
||||
```
|
||||
|
||||
### Available template variables
|
||||
|
||||
```
|
||||
{{ .APP }} Application name
|
||||
{{ .APP_SSL_PATH }} Path to SSL certificate and key
|
||||
@@ -84,7 +86,8 @@ upstream {{ .APP }} {
|
||||
|
||||
### Example HTTP to HTTPS Custom Template
|
||||
Use case: a simple dockerfile app that includes `EXPOSE 80`
|
||||
```
|
||||
|
||||
```go
|
||||
server {
|
||||
listen [::]:80;
|
||||
listen 80;
|
||||
@@ -130,7 +133,8 @@ upstream {{ .APP }} {
|
||||
```
|
||||
|
||||
### Example using new proxy port mapping
|
||||
```
|
||||
|
||||
```go
|
||||
{{ range $port_map := .PROXY_PORT_MAP | split " " }}
|
||||
{{ $port_map_list := $port_map | split ":" }}
|
||||
{{ $scheme := index $port_map_list 0 }}
|
||||
@@ -181,7 +185,7 @@ upstream {{ $.APP }}-{{ $upstream_port }} {
|
||||
|
||||
The default nginx.conf template will include everything from your apps `nginx.conf.d/` subdirectory in the main `server {}` block (see above):
|
||||
|
||||
```
|
||||
```go
|
||||
include {{ .DOKKU_ROOT }}/{{ .APP }}/nginx.conf.d/*.conf;
|
||||
```
|
||||
|
||||
|
||||
@@ -24,7 +24,8 @@ Dokku allows you to run multiple process types at different container counts. Fo
|
||||
You can optionally create a `DOKKU_SCALE` file in the root of your repository. Dokku expects this file to contain one line for every process defined in your Procfile.
|
||||
|
||||
Example:
|
||||
```
|
||||
|
||||
```Procfile
|
||||
web=1
|
||||
worker=2
|
||||
```
|
||||
@@ -33,7 +34,7 @@ worker=2
|
||||
|
||||
Dokku can also manage scaling itself via the `ps:scale` command. This command can be used to scale multiple process types at the same time.
|
||||
|
||||
```
|
||||
```shell
|
||||
dokku ps:scale app_name web=1 worker=2
|
||||
```
|
||||
|
||||
|
||||
@@ -4,9 +4,9 @@ Dokku commands can be run over ssh. Anywhere you would run `dokku <command>`, ju
|
||||
The `-t` is used to request a pty. It is highly recommended to do so.
|
||||
To avoid the need to type the `-t` option each time, simply create/modify a section in the `.ssh/config` on the client side, as follows:
|
||||
|
||||
```
|
||||
```ini
|
||||
Host dokku.me
|
||||
RequestTTY yes
|
||||
RequestTTY yes
|
||||
```
|
||||
|
||||
## Behavioral modifiers
|
||||
@@ -14,7 +14,7 @@ RequestTTY yes
|
||||
Dokku also supports certain command-line arguments that augment it's behavior. If using these over ssh, you must use the form `ssh -t dokku@dokku.me -- <command>`
|
||||
in order to avoid ssh interpretting dokku arguments for itself.
|
||||
|
||||
```shell
|
||||
```
|
||||
--quiet suppress output headers
|
||||
--trace enable DOKKU_TRACE for current execution only
|
||||
--rm|--rm-container remove docker container after successful dokku run <app> <command>
|
||||
|
||||
@@ -6,14 +6,14 @@ __Solution:__
|
||||
|
||||
Most of the time it's caused by some defaults newer versions of nginx set. To make sure that's the issue you're having run the following:
|
||||
|
||||
```
|
||||
$ nginx -t
|
||||
nginx: [emerg] could not build the server_names_hash, you should increase server_names_hash_bucket_size: 32
|
||||
```shell
|
||||
nginx -t
|
||||
## nginx: [emerg] could not build the server_names_hash, you should increase server_names_hash_bucket_size: 32
|
||||
```
|
||||
|
||||
If you get a similar error just edit __/etc/nginx/nginx.conf__ and add the following line to your http section:
|
||||
|
||||
```
|
||||
```nginx
|
||||
http {
|
||||
(... existing content ...)
|
||||
server_names_hash_bucket_size 64;
|
||||
@@ -26,11 +26,11 @@ A value of 64 would allow domains with up to 64 characters. Set it to 128 if you
|
||||
|
||||
Save the file and try stopping nginx and starting it again:
|
||||
|
||||
```
|
||||
$ /etc/init.d/nginx stop
|
||||
* Stopping nginx nginx [ OK ]
|
||||
$ /etc/init.d/nginx start
|
||||
* Starting nginx nginx [ OK ]
|
||||
```shell
|
||||
/etc/init.d/nginx stop
|
||||
## * Stopping nginx nginx [ OK ]
|
||||
/etc/init.d/nginx start
|
||||
## * Starting nginx nginx [ OK ]
|
||||
```
|
||||
|
||||
***
|
||||
@@ -45,12 +45,16 @@ The `remote rejected` error does not give enough information. Anything could hav
|
||||
|
||||
To enable dokku tracing, simply run the following command:
|
||||
|
||||
# Since 0.3.9
|
||||
dokku trace on
|
||||
```shell
|
||||
# since 0.3.9
|
||||
dokku trace on
|
||||
```
|
||||
|
||||
In versions older than 0.3.9, you can create a `/home/dokku/dokkurc` file containing the following :
|
||||
|
||||
export DOKKU_TRACE=1
|
||||
```shell
|
||||
export DOKKU_TRACE=1
|
||||
```
|
||||
|
||||
This will trace all of dokku's activity. If this does not help you, create a [gist](https://gist.github.com) containing the full log, and create an issue.
|
||||
|
||||
@@ -64,28 +68,28 @@ __Solution (Less solution, more helpful troubleshooting steps):__
|
||||
|
||||
Find the failed phase's container image (*077581956a92* in this example)
|
||||
|
||||
```
|
||||
$ docker ps -a | grep build
|
||||
94d9515e6d93 077581956a92 "/build" 29 minutes ago Exited (0) 25 minutes ago cocky_bell
|
||||
```
|
||||
```shell
|
||||
docker ps -a | grep build
|
||||
## 94d9515e6d93 077581956a92 "/build" 29 minutes ago Exited (0) 25 minutes ago cocky_bell
|
||||
```
|
||||
|
||||
Start a new container with the failed image and poke around (i.e. ensure you can access the internet from within the container or attempt the failed command, if known)
|
||||
|
||||
```
|
||||
$ docker run -ti 077581956a92 /bin/bash
|
||||
root@9763ab86e1b4:/# curl -s -S icanhazip.com
|
||||
192.168.0.1
|
||||
curl http://s3pository.heroku.com/node/v0.10.30/node-v0.10.30-linux-x64.tar.gz -o node-v0.10.30-linux-x64.tar.gz
|
||||
tar tzf node-v0.10.30-linux-x64.tar.gz
|
||||
...
|
||||
```
|
||||
```shell
|
||||
docker run -ti 077581956a92 /bin/bash
|
||||
curl -s -S icanhazip.com
|
||||
## 192.168.0.1
|
||||
curl http://s3pository.heroku.com/node/v0.10.30/node-v0.10.30-linux-x64.tar.gz -o node-v0.10.30-linux-x64.tar.gz
|
||||
tar tzf node-v0.10.30-linux-x64.tar.gz
|
||||
## ...
|
||||
```
|
||||
|
||||
Sometimes (especially on DO) deploying again seems to get past these seemingly transient issues
|
||||
Additionally we've seen issues if changing networks that have different DNS resolvers. In this case, you can run the following to update your resolv.conf
|
||||
|
||||
```
|
||||
$ resolvconf -u
|
||||
```
|
||||
```shell
|
||||
resolvconf -u
|
||||
```
|
||||
|
||||
Please see https://github.com/dokku/dokku/issues/841 and https://github.com/dokku/dokku/issues/649
|
||||
|
||||
@@ -102,8 +106,10 @@ You get asked for a password because your ssh secret key can't be found. This ma
|
||||
|
||||
You have to point ssh to the correct secret key for your domain name. Add the following to your `~/.ssh/config`:
|
||||
|
||||
Host DOKKU_HOSTNAME
|
||||
IdentityFile "~/.ssh/KEYNAME"
|
||||
```ini
|
||||
Host DOKKU_HOSTNAME
|
||||
IdentityFile "~/.ssh/KEYNAME"
|
||||
```
|
||||
|
||||
Also see [issue #116](https://github.com/dokku/dokku/issues/116)
|
||||
|
||||
@@ -117,7 +123,9 @@ In many cases the application will require the a `process.env.PORT` port opposed
|
||||
|
||||
When specifying your port you may want to use something similar to:
|
||||
|
||||
var port = process.env.PORT || 3000
|
||||
```javascript
|
||||
var port = process.env.PORT || 3000
|
||||
```
|
||||
|
||||
Please see https://github.com/dokku/dokku/issues/282
|
||||
|
||||
@@ -145,6 +153,4 @@ dokku config:set --global CURL_TIMEOUT=600
|
||||
dokku config:set --global CURL_CONNECT_TIMEOUT=30
|
||||
```
|
||||
|
||||
References
|
||||
* https://github.com/dokku/dokku/issues/509
|
||||
* https://github.com/dokku-alt/dokku-alt/issues/169
|
||||
Please see https://github.com/dokku/dokku/issues/509
|
||||
|
||||
Reference in New Issue
Block a user