aboutsummaryrefslogtreecommitdiffhomepage
path: root/docker/docker-compose.yml
blob: 95edb8ec67b441e89ee44ffc7f3b98d9611264a4 (plain)
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
94
95
96
version: "3.8"

services:
  monkeytype-frontend:
    container_name: monkeytype-frontend
    image: monkeytype/monkeytype-frontend:latest
    ports:
      - "${HTTP_PORT:-8080}:80"
    restart: on-failure
    depends_on:
      monkeytype-backend:
        condition: service_healthy
    env_file:
      - path: ./.env
        required: true
    environment:
      - FIREBASE_APIKEY=${FIREBASE_APIKEY:-}
      - FIREBASE_AUTHDOMAIN=${FIREBASE_AUTHDOMAIN:-}
      - FIREBASE_PROJECTID=${FIREBASE_PROJECTID:-}
      - FIREBASE_STORAGEBUCKET=${FIREBASE_STORAGEBUCKET:-}
      - FIREBASE_MESSAGINGSENDERID=${FIREBASE_MESSAGINGSENDERID:-}
      - FIREBASE_APPID=${FIREBASE_APPID:-}
      - MONKEYTYPE_BACKENDURL=${MONKEYTYPE_BACKENDURL}
      - RECAPTCHA_SITE_KEY=${RECAPTCHA_SITE_KEY:-}

  monkeytype-backend:
    container_name: monkeytype-backend
    image: monkeytype/monkeytype-backend:latest
    ports:
      - "${BACKEND_PORT:-5005}:5005"
    restart: on-failure
    environment:
      - DB_NAME=monkeytype
      - DB_URI=mongodb://monkeytype-mongodb:27017
      - REDIS_URI=redis://monkeytype-redis:6379
      - FRONTEND_URL=${MONKEYTYPE_FRONTENDURL}
      - RECAPTCHA_SECRET=${RECAPTCHA_SECRET:-}
    volumes:
      #uncomment to enable the account system, check the SELF_HOSTING.md file
      #- type: bind
      #  source: ./serviceAccountKey.json
      #  target: /app/backend/src/credentials/serviceAccountKey.json
      #  read_only: true
      - type: bind
        source: ./backend-configuration.json
        target: /app/backend/dist/backend-configuration.json
        read_only: true
    depends_on:
      monkeytype-redis:
        condition: service_healthy
      monkeytype-mongodb:
        condition: service_healthy
    healthcheck:
      test: ["CMD", "nc", "-z", "-v", "localhost", "5005"]
      interval: 5s
      timeout: 10s
      retries: 15
      start_period: 5s

  monkeytype-redis:
    container_name: monkeytype-redis
    image: redis:6.2.6
    #uncomment if you want to expose the redis server
    #ports:
    #  - "${REDIS_PORT:-6379}:6379"
    restart: on-failure
    volumes:
      - redis-data:/data
    healthcheck:
      test: [ "CMD", "redis-cli", "--raw", "incr", "ping" ]
      interval: 5s
      timeout: 10s
      retries: 15
      start_period: 10s

  monkeytype-mongodb:
    container_name: monkeytype-mongodb
    image: mongo:5.0.8
    restart: on-failure
    volumes:
      - mongo-data:/data/db
    #uncomment if you want to expose the mongodb server
    #ports:
    #  - "${MONGO_PORT:-27017}:27017"
    healthcheck:
      test: echo 'db.stats().ok' | mongo localhost:27017/test --quiet
      interval: 5s
      timeout: 10s
      retries: 15
      start_period: 10s

volumes:
  mongo-data:
    name: monkeytype_mongo_data
  redis-data:
    name: monkeytype_redis_data