The Database Playground is a platform designed to enhance your SQL skills through an engaging gamification system.
- Use PhpStorm for PHP and Twig development, and VS Code for TypeScript development.
- Devenv provides a comprehensive development environment, including pre-commit hooks and runtimes for PHP and Node.js. Learn more at Devenv.
- Docker Compose is utilized to set up the development runtime environment. For more details, visit the Docker Compose documentation.
- Clone the repository.
- Run
devenv up
to start the development environment. - Execute
composer install
to install PHP dependencies. - Run
pnpm install
to install Node.js dependencies, which is useful for type checking. - Start the database, Redis, and PHP runtime for development:
docker compose up -d
- Create an administrator user by running:
php ./bin/console app:create-user -p "yourpassword" -r "ROLE_ADMIN" "admin" "[email protected]"
ROLE_USER
is the default role suitable for regular users, such as students.ROLE_ADMIN
is the administrator role that grants access to the admin panel, enables management of questions, and allows viewing of all submissions and feedback.ROLE_ALLOWED_TO_SWITCH
is the role that permits switching (impersonating) to another user, which is useful for debugging.
- (Optional) Import the schema and questions using:
php ./bin/console app:import schema.json
- Access the application at
https://localhost
, and usehttps://localhost/admin
to access the admin panel.
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:
- Update the
<VARIABLES>
in the template file. You would need to fill some tokens and secrets there. - Create 2 projects (can be on different regions) on Zeabur.
- Run
npx zeabur template deploy -f zeabur/app.yaml --project-id PROJECT-ID
to deploy the application. - Run
npx zeabur template deploy -f zeabur/monitor.yaml --project-id PROJECT-ID
to deploy the uptime monitor. - Restore the backup of PostgreSQL or import the schema and questions using the
app:import
command. - Create an account if you haven't done so:
php ./bin/console app:create-user -p "yourpassword" -r "ROLE_ADMIN" "admin" "[email protected]"
- Set up your Uptime Kuma in the monitor project.
We provide a Docker Compose configuration based on Symfony Docker for deployment. The prebuilt image is available at the GitHub Registry.
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:
export IMAGES_PREFIX=ghcr.io/database-playground/
docker compose -f compose.yaml -f compose.prod.yaml up -d