File size: 2,325 Bytes
eee16fe
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# Product deploy: run on a CLOUD VM (Oracle free, Hetzner, AWS, etc.)
# Source of truth: Hugging Face repo manus4oHER/metin2-private-server
# Your laptop is NOT the host.
name: metin2-private-server

services:
  database:
    image: mysql:8.0
    restart: unless-stopped
    environment:
      MYSQL_ROOT_PASSWORD: ${DB_ROOT_PASSWORD:-changeme}
    volumes:
      - db_data:/var/lib/mysql
      - ./schema.sql:/docker-entrypoint-initdb.d/01-schema.sql:ro
    healthcheck:
      test: ["CMD", "mysqladmin", "ping", "-h", "127.0.0.1", "-uroot", "-p${DB_ROOT_PASSWORD:-changeme}"]
      interval: 10s
      timeout: 5s
      retries: 30
      start_period: 40s
    networks: [m2net]

  cache:
    image: redis:7-alpine
    restart: unless-stopped
    networks: [m2net]

  auth:
    build:
      context: ./open-mt2
      dockerfile: Dockerfile
    restart: unless-stopped
    environment:
      DB_HOST: database
      CACHE_HOST: cache
      AUTH_SERVER_ADDRESS: "0.0.0.0"
      AUTH_SERVER_PORT: "11002"
      DB_PORT: "3306"
      DB_USER: root
      DB_ROOT_PASSWORD: ${DB_ROOT_PASSWORD:-changeme}
      AUTH_DB_DATABASE_NAME: auth
      GAME_DB_DATABASE_NAME: game
      CACHE_PORT: "6379"
      LOG_LEVEL: info
      NODE_ENV: production
    ports:
      - "11002:11002"
    depends_on:
      database:
        condition: service_healthy
      cache:
        condition: service_started
    command: ["node", "src/auth/main.js"]
    networks: [m2net]

  game:
    build:
      context: ./open-mt2
      dockerfile: Dockerfile
    restart: unless-stopped
    environment:
      DB_HOST: database
      CACHE_HOST: cache
      GAME_SERVER_ADDRESS: "0.0.0.0"
      REAL_SERVER_ADDRESS: ${PUBLIC_IP:-0.0.0.0}
      GAME_SERVER_PORT: "13001"
      DB_PORT: "3306"
      DB_USER: root
      DB_ROOT_PASSWORD: ${DB_ROOT_PASSWORD:-changeme}
      AUTH_DB_DATABASE_NAME: auth
      GAME_DB_DATABASE_NAME: game
      CACHE_PORT: "6379"
      LOG_LEVEL: info
      NODE_ENV: production
    ports:
      - "13001:13001"
    depends_on:
      database:
        condition: service_healthy
      cache:
        condition: service_started
      auth:
        condition: service_started
    command: ["node", "--max-old-space-size=2048", "src/game/main.js"]
    networks: [m2net]

volumes:
  db_data:

networks:
  m2net:
    driver: bridge