Skip to content
This repository was archived by the owner on Oct 15, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 17 additions & 41 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,52 +39,28 @@ The Database Playground is a platform designed to enhance your SQL skills throug

### Zeabur

1. Deploy Redis, PostgreSQL, Meilisearch, and Umami (for statistics) on Zeabur.
2. Deploy [SQL runner](https://github.com/database-playground/sqlrunner-v2) on Zeabur, and rename the service host to
`sqlrunner`.
3. Deploy the application in Git mode on Zeabur. You can use our prebuilt image at
the GitHub Registry.
4. Deploy the worker in Git mode on Zeabur. You can use our prebuilt image at
the GitHub Registry. Also, it is recommended to create more than 1 worker.
5. Add the following environment variables to the application:
```env
DATABASE_URL=postgresql://${POSTGRES_USERNAME}:${POSTGRES_PASSWORD}@postgresql.zeabur.internal:5432/${POSTGRES_DATABASE}?serverVersion=16&charset=utf8
REDIS_URI=${REDIS_CONNECTION_STRING}
SERVER_NAME=:${PORT}
APP_SECRET=${PASSWORD}
MEILISEARCH_URL=http://meilisearch.zeabur.internal:7700
MEILISEARCH_API_KEY=${MEILI_MASTER_KEY}
UMAMI_DOMAIN=your-umami-domain.tld
UMAMI_WEBSITE_ID=your-website-id
OPENAI_API_KEY=your-openai-api-key
LINE_NOTIFY_DSN=linenotify://line-notify-token@default
SQLRUNNER_URL=http://sqlrunner.zeabur.internal:8080
MAILER_DSN=ses://ACCESS_KEY:SECRET_KEY@default?region=eu-west-1
MESSENGER_TRANSPORT_DSN=${REDIS_URI}/messages
```
6. Add the following environment variables to the worker:
```env
DATABASE_URL=postgresql://${POSTGRES_USERNAME}:${POSTGRES_PASSWORD}@postgresql.zeabur.internal:5432/${POSTGRES_DATABASE}?serverVersion=16&charset=utf8
REDIS_URI=${REDIS_CONNECTION_STRING}
MEILISEARCH_URL=http://meilisearch.zeabur.internal:7700
MEILISEARCH_API_KEY=${MEILI_MASTER_KEY}
APP_SECRET=${PASSWORD}
LINE_NOTIFY_DSN=linenotify://line-notify-token@default
MAILER_DSN=ses://ACCESS_KEY:SECRET_KEY@default?region=eu-west-1
MESSENGER_TRANSPORT_DSN=${REDIS_URI}/messages
MESSENGER_CONSUMER_NAME=app-sf-worker-1 # Change the number for each worker
```
7. Bind your domain, and the application will be ready for use. The Meilisearch index will be automatically created on start up.
We have 2 Zeabur template file:

- `zeabur/app.yaml`: The main application.
- `zeabur/monitor.yaml`: The uptime monitor (containing the worker monitors).

To deploy the application on Zeabur, follow these steps:

1. Update the `<VARIABLES>` in the template file. You would need to fill some tokens and secrets there.
2. Create 2 projects (can be on different regions) on Zeabur.
3. Run `npx zeabur template deploy -f zeabur/app.yaml --project-id PROJECT-ID` to deploy the application.
4. Run `npx zeabur template deploy -f zeabur/monitor.yaml --project-id PROJECT-ID` to deploy the uptime monitor.
5. Restore the backup of PostgreSQL or import the schema and questions using the `app:import` command.
6. Create an account if you haven't done so: `php ./bin/console app:create-user -p "yourpassword" -r "ROLE_ADMIN" "admin" "[email protected]"`
7. Set up your Uptime Kuma in the monitor project.

### Docker

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).
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).

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:
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:

```bash
export IMAGES_PREFIX=ghcr.io/database-playground/
docker compose -f compose.yaml -f compose.prod.yaml up -d
```
8 changes: 4 additions & 4 deletions compose.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
services:
###> doctrine/doctrine-bundle ###
database:
image: postgres:${POSTGRES_VERSION:-16}-alpine
image: pgautoupgrade/pgautoupgrade:${POSTGRES_VERSION:-17-alpine}
environment:
POSTGRES_DB: ${POSTGRES_DB:-app}
# You should definitely change the password in production
Expand Down Expand Up @@ -34,7 +34,7 @@ services:
volumes:
- redis_data:/data:rw
meilisearch:
image: getmeili/meilisearch:${MEILISEARCH_VERSION:-v1.10}
image: getmeili/meilisearch:${MEILISEARCH_VERSION:-nightly}
environment:
MEILI_MASTER_KEY: ${MEILI_MASTER_KEY:-!MasterChangeMe!}
volumes:
Expand All @@ -50,7 +50,7 @@ services:
restart: unless-stopped
environment:
SERVER_NAME: ${SERVER_NAME:-localhost}, php:80
DATABASE_URL: "postgresql://${POSTGRES_USER:-app}:${POSTGRES_PASSWORD:-!ChangeMe!}@database:5432/${POSTGRES_DB:-app}?serverVersion=${POSTGRES_VERSION:-16}&charset=${POSTGRES_CHARSET:-utf8}"
DATABASE_URL: "postgresql://${POSTGRES_USER:-app}:${POSTGRES_PASSWORD:-!ChangeMe!}@database:5432/${POSTGRES_DB:-app}?serverVersion=${POSTGRES_VERSION:-17}&charset=${POSTGRES_CHARSET:-utf8}"
REDIS_URI: "redis://redis:6379"
MEILISEARCH_URL: "http://meilisearch:7700"
MEILISEARCH_API_KEY: ${MEILI_MASTER_KEY:-!MasterChangeMe!}
Expand Down Expand Up @@ -79,7 +79,7 @@ services:
dockerfile: worker.Dockerfile
context: .
environment:
DATABASE_URL: "postgresql://${POSTGRES_USER:-app}:${POSTGRES_PASSWORD:-!ChangeMe!}@database:5432/${POSTGRES_DB:-app}?serverVersion=${POSTGRES_VERSION:-16}&charset=${POSTGRES_CHARSET:-utf8}"
DATABASE_URL: "postgresql://${POSTGRES_USER:-app}:${POSTGRES_PASSWORD:-!ChangeMe!}@database:5432/${POSTGRES_DB:-app}?serverVersion=${POSTGRES_VERSION:-17}&charset=${POSTGRES_CHARSET:-utf8}"
REDIS_URI: "redis://redis:6379"
MEILISEARCH_URL: "http://meilisearch:7700"
MEILISEARCH_API_KEY: ${MEILI_MASTER_KEY:-!MasterChangeMe!}
Expand Down
Loading
Loading