Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker docs #86

Open
ai opened this issue Apr 12, 2021 · 2 comments
Open

Docker docs #86

ai opened this issue Apr 12, 2021 · 2 comments

Comments

@ai
Copy link
Member

ai commented Apr 12, 2021

How to run Logux server in Docker with Dockerfile example

@ai ai added the part: docs label Apr 12, 2021
@ai ai added this to the 2: bēt milestone Apr 12, 2021
@ai ai modified the milestones: 2: bēt, 3: gīml Oct 3, 2021
@kapter
Copy link

kapter commented Apr 2, 2022

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

@euaaaio
Copy link
Member

euaaaio commented Aug 15, 2023

(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}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants