Skip to content

Docker docs #86

Open
Open

Description

@ai

How to run Logux server in Docker with Dockerfile example

Activity

  1. added this to the 2: bēt milestone on Apr 12, 2021
  2. modified the milestones: 2: bēt, 3: gīml on Oct 3, 2021
  3. kapter commented on Apr 2, 2022

    @kapter

    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
    
  4. euaaaio commented on Aug 15, 2023

    @euaaaio
    Member

    (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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions