-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
125 lines (120 loc) · 3.57 KB
/
docker-compose.yml
File metadata and controls
125 lines (120 loc) · 3.57 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
services:
youtube-frontend:
build: .
ports:
- "3030:3000"
volumes:
- ./cache_data:/app/.cache
- ./.env:/app/.env:rw
restart: unless-stopped
container_name: youtube-channel-frontend
networks:
- medusa-network
depends_on:
medusa:
condition: service_healthy
medusa:
image: node:20-alpine
working_dir: /app
volumes:
- medusa-data:/app
- ./scripts:/scripts
command: >
sh -c "
apk add --no-cache git postgresql-client bash &&
if [ ! -d /app/medusa-store ]; then
echo 'Cloning Medusa starter...' &&
cd /app &&
git clone --depth 1 https://github.com/medusajs/medusa-starter-default.git medusa-store
fi &&
cd /app/medusa-store &&
if [ ! -f .env ]; then
cp .env.template .env
fi &&
sed -i 's|LOCALHOST|postgres|g' .env &&
sed -i 's|5432|5432|g' .env &&
sed -i 's|medusa_test|medusa|g' .env &&
sed -i 's|MEDUSA_SECRET_PASSWORD|medusa_pass|g' .env &&
if ! grep -q 'sslmode=disable' .env; then
sed -i 's|DATABASE_URL=.*|DATABASE_URL=postgresql://medusa:medusa_pass@postgres:5432/medusa?sslmode=disable|g' .env
fi &&
if [ ! -d node_modules ]; then
npm install --ignore-scripts 2>/dev/null || npm install
fi &&
echo 'Running database migrations...' &&
npx medusa db:migrate &&
echo 'Creating admin user...' &&
chmod +x /scripts/init-medusa.sh && /scripts/init-medusa.sh &&
if [ "$SEED_DATABASE" = "true" ]; then
echo 'Seeding database...' &&
npx medusa exec ./src/scripts/seed.ts 2>/dev/null || true
fi &&
echo 'Starting Medusa server...' &&
npm run start
"
ports:
- "9000:9000"
- "7001:7001"
environment:
NODE_ENV: development
DATABASE_URL: postgresql://medusa:medusa_pass@postgres:5432/medusa?sslmode=disable
REDIS_URL: redis://redis:6379
JWT_SECRET: ${JWT_SECRET:-supersecret_jwt_key_change_in_production}
COOKIE_SECRET: ${COOKIE_SECRET:-supersecret_cookie_change_in_production}
STRIPE_SECRET_KEY: ${STRIPE_SECRET_KEY:-}
STRIPE_WEBHOOK_SECRET: ${STRIPE_WEBHOOK_SECRET:-}
MEDUSA_ADMIN_EMAIL: ${MEDUSA_ADMIN_EMAIL:-admin@influenced.local}
MEDUSA_ADMIN_PASSWORD: ${MEDUSA_ADMIN_PASSWORD:-medusa_admin123}
SEED_DATABASE: ${SEED_DATABASE:-false}
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_started
networks:
- medusa-network
restart: unless-stopped
container_name: medusa-server
healthcheck:
test: ["CMD-SHELL", "wget -qO- http://localhost:9000/health || exit 1"]
interval: 30s
timeout: 10s
retries: 3
start_period: 60s
postgres:
image: postgres:16-alpine
environment:
POSTGRES_USER: medusa
POSTGRES_PASSWORD: medusa_pass
POSTGRES_DB: medusa
volumes:
- postgres-data:/var/lib/postgresql/data
ports:
- "5433:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U medusa"]
interval: 5s
timeout: 5s
retries: 10
networks:
- medusa-network
restart: unless-stopped
container_name: medusa-postgres
redis:
image: redis:7-alpine
ports:
- "6380:6379"
volumes:
- redis-data:/data
networks:
- medusa-network
restart: unless-stopped
container_name: medusa-redis
volumes:
cache_data:
medusa-data:
postgres-data:
redis-data:
networks:
medusa-network:
driver: bridge