From d24031ab4958b506d8ff25039953c82be0ddf379 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sun, 3 Jul 2016 17:11:23 -0400 Subject: [PATCH] Add language to each codeblock [ci skip] --- docs/application-deployment.md | 20 ++++--- docs/backup-recovery.md | 10 ++-- docs/deployment/buildpacks.md | 2 +- docs/deployment/deployment-tasks.md | 2 +- docs/deployment/dockerfiles.md | 8 +-- docs/deployment/domain-configuration.md | 4 +- docs/deployment/one-off-processes.md | 4 +- docs/deployment/ssl-configuration.md | 2 +- docs/deployment/user-management.md | 4 +- docs/docker-options.md | 2 +- docs/dokku-storage.md | 9 ++-- docs/getting-started/install/linode.md | 8 +-- docs/getting-started/install/vagrant.md | 7 +-- docs/nginx.md | 12 +++-- docs/process-management.md | 5 +- docs/remote-commands.md | 6 +-- docs/troubleshooting.md | 72 +++++++++++++------------ 17 files changed, 99 insertions(+), 78 deletions(-) diff --git a/docs/application-deployment.md b/docs/application-deployment.md index 1e2d0a2e5..b69466ce1 100644 --- a/docs/application-deployment.md +++ b/docs/application-deployment.md @@ -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 ... diff --git a/docs/backup-recovery.md b/docs/backup-recovery.md index 593068fc1..f9400384f 100644 --- a/docs/backup-recovery.md +++ b/docs/backup-recovery.md @@ -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 , 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 diff --git a/docs/deployment/buildpacks.md b/docs/deployment/buildpacks.md index 50821523e..180938e58 100644 --- a/docs/deployment/buildpacks.md +++ b/docs/deployment/buildpacks.md @@ -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 ``` diff --git a/docs/deployment/deployment-tasks.md b/docs/deployment/deployment-tasks.md index 4ae65fa0f..87e3a7abd 100644 --- a/docs/deployment/deployment-tasks.md +++ b/docs/deployment/deployment-tasks.md @@ -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.", diff --git a/docs/deployment/dockerfiles.md b/docs/deployment/dockerfiles.md index 165b3931f..cec7a5134 100644 --- a/docs/deployment/dockerfiles.md +++ b/docs/deployment/dockerfiles.md @@ -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 . ./ diff --git a/docs/deployment/domain-configuration.md b/docs/deployment/domain-configuration.md index 8669475bb..95eece474 100644 --- a/docs/deployment/domain-configuration.md +++ b/docs/deployment/domain-configuration.md @@ -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/*; diff --git a/docs/deployment/one-off-processes.md b/docs/deployment/one-off-processes.md index 1e622be63..dac0cedc0 100644 --- a/docs/deployment/one-off-processes.md +++ b/docs/deployment/one-off-processes.md @@ -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 diff --git a/docs/deployment/ssl-configuration.md b/docs/deployment/ssl-configuration.md index adcd5b83d..b145fe33c 100644 --- a/docs/deployment/ssl-configuration.md +++ b/docs/deployment/ssl-configuration.md @@ -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 }}; diff --git a/docs/deployment/user-management.md b/docs/deployment/user-management.md index c6c7f3b1e..0c6cd4eb1 100644 --- a/docs/deployment/user-management.md +++ b/docs/deployment/user-management.md @@ -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 ``` diff --git a/docs/docker-options.md b/docs/docker-options.md index 523e3eab3..e9666efb2 100644 --- a/docs/docker-options.md +++ b/docs/docker-options.md @@ -12,7 +12,7 @@ docker-options:remove 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" > ``` diff --git a/docs/dokku-storage.md b/docs/dokku-storage.md index a2cfd61d5..1dd40733f 100644 --- a/docs/dokku-storage.md +++ b/docs/dokku-storage.md @@ -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 "-v /tmp/python-test:/opt/test" + +```shell +dokku docker-options:add "-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. diff --git a/docs/getting-started/install/linode.md b/docs/getting-started/install/linode.md index 38d1d8933..773f0f822 100644 --- a/docs/getting-started/install/linode.md +++ b/docs/getting-started/install/linode.md @@ -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. diff --git a/docs/getting-started/install/vagrant.md b/docs/getting-started/install/vagrant.md index 3fb497105..d6116be84 100644 --- a/docs/getting-started/install/vagrant.md +++ b/docs/getting-started/install/vagrant.md @@ -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 ``` diff --git a/docs/nginx.md b/docs/nginx.md index 09d03c29c..9fadd65ca 100644 --- a/docs/nginx.md +++ b/docs/nginx.md @@ -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; ``` diff --git a/docs/process-management.md b/docs/process-management.md index 120a7269f..e10754162 100644 --- a/docs/process-management.md +++ b/docs/process-management.md @@ -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 ``` diff --git a/docs/remote-commands.md b/docs/remote-commands.md index f13c94535..18a63f81c 100644 --- a/docs/remote-commands.md +++ b/docs/remote-commands.md @@ -4,9 +4,9 @@ Dokku commands can be run over ssh. Anywhere you would run `dokku `, 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 -- ` 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 diff --git a/docs/troubleshooting.md b/docs/troubleshooting.md index 5a6da26c6..767ff2cb6 100644 --- a/docs/troubleshooting.md +++ b/docs/troubleshooting.md @@ -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