Skip to content
This repository was archived by the owner on Oct 15, 2025. It is now read-only.

Commit 7c3b2ad

Browse files
committed
docs(zeabur): Update Zeabur deploy instruction [skip ci]
1 parent 75eb7a1 commit 7c3b2ad

File tree

3 files changed

+376
-41
lines changed

3 files changed

+376
-41
lines changed

README.md

Lines changed: 17 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -39,52 +39,28 @@ The Database Playground is a platform designed to enhance your SQL skills throug
3939

4040
### Zeabur
4141

42-
1. Deploy Redis, PostgreSQL, Meilisearch, and Umami (for statistics) on Zeabur.
43-
2. Deploy [SQL runner](https://github.com/database-playground/sqlrunner-v2) on Zeabur, and rename the service host to
44-
`sqlrunner`.
45-
3. Deploy the application in Git mode on Zeabur. You can use our prebuilt image at
46-
the GitHub Registry.
47-
4. Deploy the worker in Git mode on Zeabur. You can use our prebuilt image at
48-
the GitHub Registry. Also, it is recommended to create more than 1 worker.
49-
5. Add the following environment variables to the application:
50-
```env
51-
DATABASE_URL=postgresql://${POSTGRES_USERNAME}:${POSTGRES_PASSWORD}@postgresql.zeabur.internal:5432/${POSTGRES_DATABASE}?serverVersion=16&charset=utf8
52-
REDIS_URI=${REDIS_CONNECTION_STRING}
53-
SERVER_NAME=:${PORT}
54-
APP_SECRET=${PASSWORD}
55-
MEILISEARCH_URL=http://meilisearch.zeabur.internal:7700
56-
MEILISEARCH_API_KEY=${MEILI_MASTER_KEY}
57-
UMAMI_DOMAIN=your-umami-domain.tld
58-
UMAMI_WEBSITE_ID=your-website-id
59-
OPENAI_API_KEY=your-openai-api-key
60-
LINE_NOTIFY_DSN=linenotify://line-notify-token@default
61-
SQLRUNNER_URL=http://sqlrunner.zeabur.internal:8080
62-
MAILER_DSN=ses://ACCESS_KEY:SECRET_KEY@default?region=eu-west-1
63-
MESSENGER_TRANSPORT_DSN=${REDIS_URI}/messages
64-
```
65-
6. Add the following environment variables to the worker:
66-
```env
67-
DATABASE_URL=postgresql://${POSTGRES_USERNAME}:${POSTGRES_PASSWORD}@postgresql.zeabur.internal:5432/${POSTGRES_DATABASE}?serverVersion=16&charset=utf8
68-
REDIS_URI=${REDIS_CONNECTION_STRING}
69-
MEILISEARCH_URL=http://meilisearch.zeabur.internal:7700
70-
MEILISEARCH_API_KEY=${MEILI_MASTER_KEY}
71-
APP_SECRET=${PASSWORD}
72-
LINE_NOTIFY_DSN=linenotify://line-notify-token@default
73-
MAILER_DSN=ses://ACCESS_KEY:SECRET_KEY@default?region=eu-west-1
74-
MESSENGER_TRANSPORT_DSN=${REDIS_URI}/messages
75-
MESSENGER_CONSUMER_NAME=app-sf-worker-1 # Change the number for each worker
76-
```
77-
7. Bind your domain, and the application will be ready for use. The Meilisearch index will be automatically created on start up.
42+
We have 2 Zeabur template file:
43+
44+
- `zeabur/app.yaml`: The main application.
45+
- `zeabur/monitor.yaml`: The uptime monitor (containing the worker monitors).
46+
47+
To deploy the application on Zeabur, follow these steps:
48+
49+
1. Update the `<VARIABLES>` in the template file. You would need to fill some tokens and secrets there.
50+
2. Create 2 projects (can be on different regions) on Zeabur.
51+
3. Run `npx zeabur template deploy -f zeabur/app.yaml --project-id PROJECT-ID` to deploy the application.
52+
4. Run `npx zeabur template deploy -f zeabur/monitor.yaml --project-id PROJECT-ID` to deploy the uptime monitor.
53+
5. Restore the backup of PostgreSQL or import the schema and questions using the `app:import` command.
54+
6. Create an account if you haven't done so: `php ./bin/console app:create-user -p "yourpassword" -r "ROLE_ADMIN" "admin" "admin@youremail.tld"`
55+
7. Set up your Uptime Kuma in the monitor project.
7856

7957
### Docker
8058

81-
We provide a Docker Compose configuration based on [Symfony Docker](https://github.com/dunglas/symfony-docker) for
82-
deployment. The prebuilt image is available at
83-
the [GitHub Registry](https://github.com/orgs/database-playground/packages).
59+
We provide a Docker Compose configuration based on [Symfony Docker](https://github.com/dunglas/symfony-docker) for deployment. The prebuilt image is available at the [GitHub Registry](https://github.com/orgs/database-playground/packages).
8460

85-
To deploy the application, you may need to update the secret or environment variables in the `compose.yaml` and
86-
`compose.prod.yaml` files, and then run the following command:
61+
To deploy the application, you may need to update the secret or environment variables in the `compose.yaml` and `compose.prod.yaml` files, and then run the following command:
8762

8863
```bash
64+
export IMAGES_PREFIX=ghcr.io/database-playground/
8965
docker compose -f compose.yaml -f compose.prod.yaml up -d
9066
```

zeabur/app.yaml

Lines changed: 279 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,279 @@
1+
# yaml-language-server: $schema=https://schema.zeabur.app/template.json
2+
apiVersion: zeabur.com/v1
3+
kind: Template
4+
metadata:
5+
name: database-playground-main
6+
spec:
7+
description: The main applications of Database Playground
8+
icon: https://s3.dbplay.pan93.com/icon.svg
9+
services:
10+
- name: postgresql
11+
icon: https://raw.githubusercontent.com/zeabur/service-icons/main/marketplace/postgresql.svg
12+
template: PREBUILT_V2
13+
spec:
14+
source:
15+
image: docker.io/pgautoupgrade/pgautoupgrade:17-alpine
16+
command:
17+
- docker-entrypoint.sh
18+
- -c
19+
- config_file=/etc/postgresql/postgresql.conf
20+
ports:
21+
- id: database
22+
port: 5432
23+
type: TCP
24+
volumes:
25+
- id: data
26+
dir: /var/lib/postgresql/data
27+
instructions:
28+
- type: TEXT
29+
title: Connection String
30+
content: postgresql://${POSTGRES_USERNAME}:${POSTGRES_PASSWORD}@${PORT_FORWARDED_HOSTNAME}:${DATABASE_PORT_FORWARDED_PORT}/${POSTGRES_DATABASE}
31+
- type: TEXT
32+
title: PostgreSQL Connect Command
33+
content: psql "postgresql://${POSTGRES_USERNAME}:${POSTGRES_PASSWORD}@${PORT_FORWARDED_HOSTNAME}:${DATABASE_PORT_FORWARDED_PORT}/${POSTGRES_DATABASE}"
34+
- type: TEXT
35+
title: PostgreSQL username
36+
content: ${POSTGRES_USERNAME}
37+
category: Credentials
38+
- type: PASSWORD
39+
title: PostgresSQL password
40+
content: ${POSTGRES_PASSWORD}
41+
category: Credentials
42+
- type: TEXT
43+
title: PostgresSQL database
44+
content: ${POSTGRES_DATABASE}
45+
category: Credentials
46+
- type: TEXT
47+
title: PostgreSQL host
48+
content: ${PORT_FORWARDED_HOSTNAME}
49+
category: Hostname & Port
50+
- type: TEXT
51+
title: PostgreSQL port
52+
content: ${DATABASE_PORT_FORWARDED_PORT}
53+
category: Hostname & Port
54+
env:
55+
PGDATA:
56+
default: /var/lib/postgresql/data/pgdata
57+
expose: false
58+
POSTGRES_CONNECTION_STRING:
59+
default: postgresql://${POSTGRES_USERNAME}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DATABASE}
60+
expose: true
61+
POSTGRES_DATABASE:
62+
default: ${POSTGRES_DB}
63+
expose: true
64+
POSTGRES_DB:
65+
default: zeabur
66+
expose: false
67+
POSTGRES_HOST:
68+
default: ${CONTAINER_HOSTNAME}
69+
expose: true
70+
POSTGRES_PASSWORD:
71+
default: ${PASSWORD}
72+
expose: true
73+
POSTGRES_PORT:
74+
default: ${DATABASE_PORT}
75+
expose: true
76+
POSTGRES_URI:
77+
default: ${POSTGRES_CONNECTION_STRING}
78+
expose: true
79+
POSTGRES_USER:
80+
default: root
81+
expose: false
82+
POSTGRES_USERNAME:
83+
default: ${POSTGRES_USER}
84+
expose: true
85+
configs:
86+
- path: /etc/postgresql/postgresql.conf
87+
template: |
88+
# https://github.com/postgres/postgres/blob/master/src/backend/utils/misc/postgresql.conf.sample
89+
listen_addresses = '*'
90+
max_connections = 100
91+
shared_buffers = 128MB
92+
dynamic_shared_memory_type = posix
93+
max_wal_size = 1GB
94+
min_wal_size = 80MB
95+
log_timezone = 'Etc/UTC'
96+
datestyle = 'iso, mdy'
97+
timezone = 'Etc/UTC'
98+
lc_messages = 'en_US.utf8'
99+
lc_monetary = 'en_US.utf8'
100+
lc_numeric = 'en_US.utf8'
101+
lc_time = 'en_US.utf8'
102+
default_text_search_config = 'pg_catalog.english'
103+
permission: null
104+
envsubst: null
105+
- name: redis
106+
icon: https://raw.githubusercontent.com/zeabur/service-icons/main/marketplace/redis.svg
107+
template: PREBUILT_V2
108+
spec:
109+
source:
110+
image: redis/redis-stack-server:latest
111+
ports:
112+
- id: database
113+
port: 6379
114+
type: TCP
115+
volumes:
116+
- id: data
117+
dir: /data
118+
instructions:
119+
- type: TEXT
120+
title: Command to connect to your Redis
121+
content: redis-cli -h ${PORT_FORWARDED_HOSTNAME} -p ${DATABASE_PORT_FORWARDED_PORT} -a ${REDIS_PASSWORD}
122+
- type: TEXT
123+
title: Redis Connection String
124+
content: redis://:${REDIS_PASSWORD}@${PORT_FORWARDED_HOSTNAME}:${DATABASE_PORT_FORWARDED_PORT}
125+
- type: PASSWORD
126+
title: Redis password
127+
content: ${REDIS_PASSWORD}
128+
category: Credentials
129+
- type: TEXT
130+
title: Redis host
131+
content: ${PORT_FORWARDED_HOSTNAME}
132+
category: Hostname & Port
133+
- type: TEXT
134+
title: Redis port
135+
content: ${DATABASE_PORT_FORWARDED_PORT}
136+
category: Hostname & Port
137+
env:
138+
CONFFILE:
139+
default: /etc/redis-stack.conf
140+
expose: false
141+
REDIS_ARGS:
142+
default: --requirepass ${REDIS_PASSWORD}
143+
expose: false
144+
REDIS_CONNECTION_STRING:
145+
default: redis://:${REDIS_PASSWORD}@${REDIS_HOST}:${REDIS_PORT}
146+
expose: true
147+
REDIS_HOST:
148+
default: ${CONTAINER_HOSTNAME}
149+
expose: true
150+
REDIS_PASSWORD:
151+
default: ${PASSWORD}
152+
expose: true
153+
REDIS_PORT:
154+
default: ${DATABASE_PORT}
155+
expose: true
156+
REDIS_URI:
157+
default: ${REDIS_CONNECTION_STRING}
158+
expose: true
159+
configs:
160+
- path: /etc/redis-stack.conf
161+
template: |
162+
port 6379
163+
daemonize no
164+
permission: null
165+
envsubst: null
166+
- name: meilisearch
167+
icon: https://www.meilisearch.com/favicon.svg
168+
template: PREBUILT_V2
169+
spec:
170+
source:
171+
image: getmeili/meilisearch
172+
ports:
173+
- id: web
174+
port: 7700
175+
type: HTTP
176+
volumes:
177+
- id: data
178+
dir: /meili_data
179+
instructions:
180+
- type: PASSWORD
181+
title: Meilisearch Master Key
182+
content: ${MEILI_MASTER_KEY}
183+
category: Credentials
184+
env:
185+
MEILI_MASTER_KEY:
186+
default: ${PASSWORD}
187+
expose: true
188+
configs: []
189+
- name: sqlrunner
190+
icon: https://upload.wikimedia.org/wikipedia/commons/9/97/Sqlite-square-icon.svg
191+
template: PREBUILT_V2
192+
spec:
193+
source:
194+
image: ghcr.io/database-playground/sqlrunner-v2:main
195+
ports:
196+
- id: web
197+
port: 8080
198+
type: HTTP
199+
configs: []
200+
- name: app
201+
icon: https://s3.dbplay.pan93.com/icon.svg
202+
template: PREBUILT_V2
203+
spec:
204+
source:
205+
image: ghcr.io/database-playground/app-sf:master
206+
ports:
207+
- id: web
208+
port: 3000
209+
type: HTTP
210+
env:
211+
APP_SECRET:
212+
default: ${PASSWORD}
213+
DATABASE_URL:
214+
default: postgresql://${POSTGRES_USERNAME}:${POSTGRES_PASSWORD}@postgresql.zeabur.internal:5432/${POSTGRES_DATABASE}?serverVersion=17&charset=utf8
215+
expose: true
216+
LINE_NOTIFY_DSN:
217+
default: linenotify://<TOKEN>@default
218+
expose: true
219+
MEILISEARCH_API_KEY:
220+
default: ${MEILI_MASTER_KEY}
221+
expose: true
222+
MEILISEARCH_URL:
223+
default: http://meilisearch.zeabur.internal:7700
224+
expose: true
225+
OPENAI_API_KEY:
226+
default: <YOUR_OPENAI_KEY>
227+
expose: true
228+
REDIS_URI:
229+
default: ${REDIS_CONNECTION_STRING}
230+
expose: true
231+
SERVER_NAME:
232+
default: :3000
233+
expose: false
234+
SQLRUNNER_URL:
235+
default: http://sqlrunner.zeabur.internal:8080
236+
expose: true
237+
UMAMI_DOMAIN:
238+
default: <YOUR_UMAMI_DOMAIN>
239+
expose: false
240+
UMAMI_WEBSITE_ID:
241+
default: <YOUR_UMAMI_WEBSITE_ID>
242+
expose: false
243+
MESSENGER_TRANSPORT_DSN:
244+
default: ${REDIS_URI}/messages
245+
expose: true
246+
configs: []
247+
- name: worker-1
248+
icon: https://s3.dbplay.pan93.com/icon.svg
249+
template: PREBUILT_V2
250+
spec:
251+
source:
252+
image: ghcr.io/database-playground/app-sf-worker:master
253+
env:
254+
MESSENGER_CONSUMER_NAME:
255+
default: app-sf-worker-1
256+
expose: false
257+
configs: []
258+
- name: worker-2
259+
icon: https://s3.dbplay.pan93.com/icon.svg
260+
template: PREBUILT_V2
261+
spec:
262+
source:
263+
image: ghcr.io/database-playground/app-sf-worker:master
264+
env:
265+
MESSENGER_CONSUMER_NAME:
266+
default: app-sf-worker-2
267+
expose: false
268+
configs: []
269+
- name: worker-3
270+
icon: https://s3.dbplay.pan93.com/icon.svg
271+
template: PREBUILT_V2
272+
spec:
273+
source:
274+
image: ghcr.io/database-playground/app-sf-worker:master
275+
env:
276+
MESSENGER_CONSUMER_NAME:
277+
default: app-sf-worker-3
278+
expose: false
279+
configs: []

0 commit comments

Comments
 (0)