Dockerizing Things Talk

May 18th 16

I gave a talk about working with Docker given at GlasgowJS 11/2015

Demo

The demo is available here

docker-compose.yml

nginx:
  build: ./nginx
  links:
    - app1:app1
    - app2:app2
    - app3:app3
  ports:
    - "80:80"
app1:
  build: .
  volumes:
    - "./app:/src/app"
  links:
    - "db:redis"
app2:
  build: .
  volumes:
    - "./app:/src/app"
  links:
    - "db:redis"
app3:
  build: .
  volumes:
    - "./app:/src/app"
  links:
    - "db:redis"
db:
  image: redis

NGINX

Dockerfile

FROM nginx

COPY nginx.conf /etc/nginx/nginx.conf<Paste>

nginx.conf

worker_processes 4;

events { worker_connections 1024; }

http {

  upstream web-app {
    least_conn;
    server app1:3000 weight=10 max_fails=3 fail_timeout=30s;
    server app2:3000 weight=10 max_fails=3 fail_timeout=30s;
    server app3:3000 weight=10 max_fails=3 fail_timeout=30s;
  }

  server {
    listen 80;

    location / {
      proxy_pass //web-app;
      proxy_http_version 1.1;
      proxy_set_header Upgrade $http_upgrade;
      proxy_set_header Connection 'upgrade';
      proxy_set_header Host $host;
      proxy_cache_bypass $http_upgrade;
    }
  }
}

CSS Starter

Next