logux icon indicating copy to clipboard operation
logux copied to clipboard

Docker docs

Open ai opened this issue 5 years ago • 2 comments

How to run Logux server in Docker with Dockerfile example

ai avatar Apr 12 '21 06:04 ai

This is config for traefik. Add index.js, package.json to logux folder, than create docker-compose.yml:

version: "3.7"
networks:
  web:
    external: true

services:
  loguxserver:
    image: node:17-alpine
    command: sh -c "npm install&&node index.js"
    expose: 
      - 31337 
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.loguxhttps.entrypoints=https"
      - "traefik.http.routers.loguxhttps.rule=Host(`mydomain.com`)"
      - "traefik.http.routers.loguxhttps.tls=true"
      - "traefik.http.routers.loguxhttps.tls.certresolver=letsEncrypt"
      - "traefik.docker.network=web"
      - "traefik.port=31337"
    networks:
      - web
    environment:
      LOGUX_BACKEND: http://localhost:3001/
      LOGUX_CONTROL_SECRET: secret
      LOGUX_CONTROL_MASK: 0.0.0.0/0
      TZ: "Europe/Moscow"
    working_dir: /app
    volumes:
      - ./logux/:/app

kapter avatar Apr 02 '22 22:04 kapter

(Just a few thoughts so I don't forget.)

We already have a basic recipe for Dockerfile: https://github.com/logux/docs/blob/main/recipes/deployment.md.

But I think it is not enough for a beginners. We need to add:

  • [ ] Example of using Logux inside Docker Compose
  • [ ] Example of using Logux inside a pnpm workspace with pnpm fetch.
FROM node:20

RUN corepack enable
RUN corepack prepare pnpm@latest --activate

WORKDIR /project

COPY pnpm-lock.yaml ./
RUN pnpm fetch

ADD . ./
RUN pnpm install -r --offline
  • [ ] Example of using a health check
healthcheck:
  test: "curl -f http://localhost:${LOGUX_PORT}/health || exit 1"
  interval: 10s
  timeout: 5s
  retries: 5
  • [ ] Note that environment variables with the LOGUX_ prefix are reserved
  • [ ] How to use LOGUX_CONTROL_MASK environment variable with Docker Compose Network
DOCKER_NETWORK_SUBNET=172.28.0.0/16
DOCKER_NETWORK_GATEWAY=172.28.0.1
LOGUX_CONTROL_MASK=172.28.0.0/16
networks:
  default:
    ipam:
      driver: default
      config:
        - subnet: ${DOCKER_NETWORK_SUBNET}
          gateway: ${DOCKER_NETWORK_GATEWAY}

euaaaio avatar Aug 15 '23 14:08 euaaaio