Skip to content

How to Deploy Kails with docker

Embbnux Ji edited this page Oct 5, 2016 · 1 revision

Deploy with docker

pull images

docker pull redis
docker pull postgres
docker pull embbnux/kails

start containers

# redis
docker run --name kails-redis -d redis
# postgres
docker run --name kails-postgres -e POSTGRES_PASSWORD=kails_db_password -e POSTGRES_USER=kails_db_user -e POSTGRES_DB=kails_db -d postgres

set ENV variable

file: .env.docker

NODE_ENV=production
HOST_NAME_PRO=https://kails.org
PORT=5000
SERVE_STATIC_PRO=true
DATABASE_HOST_PRO=kails-postgres
DATABASE_NAME_PRO=kails_db
DATABASE_USERNAME_PRO=kails_db_user
DATABASE_PASSWORD_PRO=kails_db_password
REDIS_URL_PRO=redis://kails-redis:6379/1
ASSET_HOST_PRO=https://kails.org
SECRET_KEY_BASE=975a31d802cf09ef688b05eb6337efc3422b4e25fe42a311bc4e5ffb268c335590be89f464d3adabfbcfae4b431a5029ad6486bce777caa962d75a18322ea12

start kails

docker run --env-file ./.env.docker --name kails -p 127.0.0.1:5000:5000 --link kails-redis:redis --link kails-postgres:postgres --dns=8.8.8.8 -d embbnux/kails

nginx

sudo apt-get install nginx

cat /etc/nginx/sites-enabled/kails.conf :

upstream kails {
  server 127.0.0.1:5000;
}
server {
  listen 80;
  server_name kails.org;
  root /opt/www/kails/public;
  location / {
    index  index.html index.htm;
    proxy_pass http://kails;
    proxy_set_header Host $http_host;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  }
}

restart nginx

sudo service nginx restart
Clone this wiki locally