/ opencodehub / docker-compose.yml
JustAPI Bot fix: comprehensive UI, docs, security, and deployment improvements · 7/14/2026
381467d
148 lines · 4.1 KB
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
services:
  # Main OpenCodeHub application
  app:
    build:
      context: .
      dockerfile: Dockerfile
    container_name: opencodehub
    restart: unless-stopped
    ports:
      - "4321:4321" # Web interface
    environment:
      - NODE_ENV=production
      - DATABASE_URL=postgresql://opencodehub:opencodehub@postgres:5432/opencodehub
      - DATABASE_TYPE=postgres
      - REDIS_URL=redis://redis:6379
      - JWT_SECRET=${JWT_SECRET:-supersecretjwtkey}
      - WORKFLOW_SECRET_ENCRYPTION_KEY=${WORKFLOW_SECRET_ENCRYPTION_KEY:-0123456789abcdef0123456789abcdef}
      - INTERNAL_HOOK_SECRET=${INTERNAL_HOOK_SECRET:-supersecrethookkey}
      - CRON_SECRET=${CRON_SECRET:-supersecretcronkey}
      - RUNNER_SECRET=${RUNNER_SECRET:-supersecretrunnerkey}
      - AI_CONFIG_ENCRYPTION_KEY=${AI_CONFIG_ENCRYPTION_KEY:-0123456789abcdef0123456789abcdef}
      - SERVER_URL=http://localhost:4321
      - DATA_DIR=/data
      - STORAGE_TYPE=local
      - GIT_REPOS_PATH=/data/repositories
      - GIT_SSH_PORT=2222
    volumes:
      - ./data/opencodehub:/data
    depends_on:
      postgres:
        condition: service_healthy
      redis:
        condition: service_healthy
    networks:
      - opencodehub-network
    healthcheck:
      test:
        [
          "CMD",
          "wget",
          "--no-verbose",
          "--tries=1",
          "--spider",
          "http://localhost:4321/api/health",
        ]
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 10s

  # SSH Git server
  ssh-git:
    build:
      context: .
      dockerfile: Dockerfile
    container_name: opencodehub-ssh
    restart: unless-stopped
    command: ["bun", "scripts/ssh-server.ts"]
    ports:
      - "2222:2222" # SSH Git
    environment:
      - NODE_ENV=production
      - DATABASE_URL=postgresql://opencodehub:opencodehub@postgres:5432/opencodehub
      - DATABASE_TYPE=postgres
      - REDIS_URL=redis://redis:6379
      - JWT_SECRET=${JWT_SECRET:-supersecretjwtkey}
      - WORKFLOW_SECRET_ENCRYPTION_KEY=${WORKFLOW_SECRET_ENCRYPTION_KEY:-0123456789abcdef0123456789abcdef}
      - AI_CONFIG_ENCRYPTION_KEY=${AI_CONFIG_ENCRYPTION_KEY:-0123456789abcdef0123456789abcdef}
      - SERVER_URL=http://app:4321
      - DATA_DIR=/data
      - STORAGE_TYPE=local
      - GIT_REPOS_PATH=/data/repositories
      - GIT_SSH_PORT=2222
      - GIT_SSH_HOST_KEY=/data/ssh/host_key
    volumes:
      - ./data/opencodehub:/data
    depends_on:
      postgres:
        condition: service_healthy
      redis:
        condition: service_healthy
    networks:
      - opencodehub-network

  # PostgreSQL database
  postgres:
    image: docker.io/library/postgres:16-alpine
    container_name: opencodehub-postgres
    restart: unless-stopped
    environment:
      POSTGRES_USER: opencodehub
      POSTGRES_PASSWORD: opencodehub
      POSTGRES_DB: opencodehub
    volumes:
      - ./data/postgres:/var/lib/postgresql/data
    ports:
      - "5432:5432"
    networks:
      - opencodehub-network
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U opencodehub -d opencodehub"]
      interval: 10s
      timeout: 5s
      retries: 5

  # Redis for caching and sessions
  redis:
    image: docker.io/library/redis:7-alpine
    container_name: opencodehub-redis
    restart: unless-stopped
    command: redis-server --appendonly yes
    volumes:
      - ./data/redis:/data
    ports:
      - "6379:6379"
    networks:
      - opencodehub-network
    healthcheck:
      test: ["CMD", "redis-cli", "ping"]
      interval: 10s
      timeout: 5s
      retries: 5

  # Pipeline runner (for CI/CD jobs)
  runner:
    build:
      context: .
      dockerfile: Dockerfile.runner
    container_name: opencodehub-runner
    restart: unless-stopped
    privileged: true # Required for Docker-in-Docker
    environment:
      - RUNNER_TOKEN=${RUNNER_TOKEN:-}
      - SERVER_URL=http://app:4321
      - DOCKER_HOST=unix:///var/run/docker.sock
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - ./data/runner/work:/work
      - ./data/runner/cache:/cache
    depends_on:
      - app
    networks:
      - opencodehub-network

networks:
  opencodehub-network:
    driver: bridge