Deployment

The easiest way to deploy Gauguin is by using Docker. More specifically, we'll need three different services, so we're going to use docker-compose.

Let's log into your server and create a file called docker-compose.yaml

version: '3.7'

services:

  alpine_chrome:
    image: zenika/alpine-chrome:latest
    container_name: gauguin-chrome-apline
    command: [chromium-browser, "--headless", "--disable-gpu", "--no-sandbox", "--disable-dev-shm-usage", "--remote-debugging-address=0.0.0.0", "--remote-debugging-port=9222"]
    ports:
      - 9222:9222
    restart: unless-stopped
    networks:
      - caddynet

  gin_gonic:
    image: docker.pkg.github.com/micheleriva/gauguin/server:v0.0.1
    links:
      - alpine_chrome
      - caddy
    depends_on:
      - alpine_chrome
    env_file:
      - .env
    ports:
      - 5491:5491
    expose:
      - '5491'
    volumes:
      - ./:/app
    restart: unless-stopped
    networks:
      - caddynet

  caddy:
    image: abiosoft/caddy
    container_name: gauguin-caddy
    cap_add:
      - CAP_NET_BIND_SERVICE
    ports:
      - 80:80
      - 443:443
    expose:
      - '443'
      - '80'
    volumes:
      - ./Caddyfile:/etc/Caddyfile
    command: -conf /etc/Caddyfile
    restart: always
    networks:
      - caddynet

networks:
  caddynet:
    driver: bridge

As you can see, we're using Caddy as a reverse proxy. Let's create a new file called Caddyfile:

example.com:80, example.com:443 {
  gzip
  tls example@example.com
  tls self_signed

  proxy / gauguin-gin-gonic:5491 {
    transparent
  }
}

Last updated