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
Show all changes
21 commits
Select commit Hold shift + click to select a range
20ff1d6
chore: Upgrade dependencies
pan93412 Nov 25, 2024
03fe286
feat(admin): Use Pretty URL for EasyAdmin
pan93412 Nov 25, 2024
623213a
fix(docker): Refresh the broken cache of Symfony when building
pan93412 Nov 25, 2024
0a78b48
fix(admin): Replace deprecated icon names
pan93412 Nov 25, 2024
c4a150c
refactor(admin): Remove batch actions
pan93412 Nov 27, 2024
74d0c0c
chore: Update dependencies
pan93412 Nov 27, 2024
6693700
refactor: Lazy loading the unneeded components
pan93412 Nov 27, 2024
e405de1
refactor(events): Use pretty URL to the feedback URL
pan93412 Nov 27, 2024
e47d230
feat(events): Reindex the questions when the question is updated
pan93412 Nov 27, 2024
6b8c0c3
fix(admin): Replace deprecated icon names in Action
pan93412 Nov 27, 2024
dceb066
feat: Implement SQL Runner SDK
pan93412 Nov 27, 2024
79b17dd
refactor!: Migrate to new SQL Runner
pan93412 Nov 27, 2024
c209037
chore: Install cURL extension to improve HTTP performance
pan93412 Nov 27, 2024
ed671e6
docs: Note about "sqlrunner" deployment
pan93412 Nov 27, 2024
7c5757b
refactor!: Remove old dbrunner completely
pan93412 Nov 27, 2024
b215994
style: Replace space with tab in Dockerfile
pan93412 Nov 27, 2024
f5d1557
refactor: Remove redundant import and await
pan93412 Nov 27, 2024
a845c90
chore: Correct sqlrunner reference in .env
pan93412 Nov 27, 2024
f5eb910
refactor(sqlrunner): Drop out LockFactory
pan93412 Nov 27, 2024
48cabb1
fix(challenge/answer): Handle SchemaExecuteException and QueryExecute…
pan93412 Nov 27, 2024
31d48e5
chore: Update dependencies
pan93412 Nov 27, 2024
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
3 changes: 3 additions & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ OPENAI_API_KEY=!ChangeMe!
MESSENGER_TRANSPORT_DSN=doctrine://default?auto_setup=0
###< symfony/messenger ###

# SQL Runner
SQLRUNNER_URL=http://sqlrunner.app-sf.orb.local:8080

###> symfony/line-notify-notifier ###
# LINE_NOTIFY_DSN=linenotify://TOKEN@default
###< symfony/line-notify-notifier ###
5 changes: 4 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ RUN set -eux; \
install-php-extensions \
@composer \
apcu \
curl \
intl \
opcache \
zip \
Expand Down Expand Up @@ -89,9 +90,11 @@ RUN set -eux; \
composer run-script --no-dev post-install-cmd; \
chmod +x bin/console; sync;

# build sass and asset maps
# build route cache, sass and asset maps
RUN set -eux; \
chmod +x bin/console; sync; \
./bin/console cache:clear; \
./bin/console cache:warmup; \
./bin/console sass:build; \
./bin/console typescript:build; \
./bin/console asset-map:compile;
13 changes: 6 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,10 @@ 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 the application in Git mode on Zeabur.
3. Add the following environment variables to the application:
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.
4. 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}
Expand All @@ -53,12 +55,9 @@ The Database Playground is a platform designed to enhance your SQL skills throug
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
```
4. Create an index in Meilisearch by running:
```bash
php bin/console meili:create --update-settings
```
5. Bind your domain, and the application will be ready for use.
5. Bind your domain, and the application will be ready for use. The Meilisearch index will be automatically created on start up.

### Docker

Expand Down
2 changes: 1 addition & 1 deletion assets/app/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as bootstrap from "bootstrap";
import "./bootstrap.ts";
import "./stimulus.ts";

/**
* Initialize tooltips of Bootstrap
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion assets/controllers.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"@symfony/ux-chartjs": {
"chart": {
"enabled": true,
"fetch": "eager"
"fetch": "lazy"
}
},
"@symfony/ux-live-component": {
Expand Down
5 changes: 3 additions & 2 deletions assets/controllers/challenge_comment_controller.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Controller } from "@hotwired/stimulus";
import { Component, getComponent } from "@symfony/ux-live-component";
import * as bootstrap from "bootstrap";
import type * as bootstrap from "bootstrap";

export default class extends Controller<HTMLElement> {
#component: Component | undefined;
Expand All @@ -24,7 +24,8 @@ export default class extends Controller<HTMLElement> {

const $confirmModal = this.element.querySelector<HTMLElement>(".app-challenge-comment__deletion_confirm");
if ($confirmModal) {
this.#modal = new bootstrap.Modal($confirmModal);
const bs = await import("bootstrap");
this.#modal = new bs.Modal($confirmModal);
}
}

Expand Down
4 changes: 3 additions & 1 deletion assets/controllers/challenge_executor_controller.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { sql } from "@codemirror/lang-sql";
import { Controller } from "@hotwired/stimulus";
import { getComponent } from "@symfony/ux-live-component";
import { basicSetup, EditorView } from "codemirror";
import type { EditorView } from "codemirror";

export default class extends Controller<HTMLElement> {
static values = {
Expand All @@ -15,6 +15,8 @@ export default class extends Controller<HTMLElement> {
#editorView: EditorView | undefined;

async connect() {
const { basicSetup, EditorView } = await import("codemirror");

const component = await getComponent(this.element);
let lastQuery = this.element.dataset["lastQuery"];

Expand Down
9 changes: 5 additions & 4 deletions assets/controllers/challenge_instruction_modal_controller.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
import { Controller } from "@hotwired/stimulus";
import { Component, getComponent } from "@symfony/ux-live-component";
import * as bootstrap from "bootstrap";
import type * as bootstrap from "bootstrap";

export default class extends Controller<HTMLElement> {
#component: Component | undefined;
#modal: bootstrap.Modal | undefined;

async initialize(): Promise<void> {
async initialize() {
this.#component = await getComponent(this.element);
}

connect(): void {
this.#modal = new bootstrap.Modal(this.element);
async connect() {
const bs = await import("bootstrap");
this.#modal = new bs.Modal(this.element);
}

async open() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { Controller } from "@hotwired/stimulus";
import * as bootstrap from "bootstrap";
import type * as bootstrap from "bootstrap";

export default class extends Controller<HTMLElement> {
#modal: bootstrap.Modal | undefined;
#videoUrl: string | undefined;

connect(): void {
this.#modal = new bootstrap.Modal(this.element);
async connect() {
const bs = await import("bootstrap");
this.#modal = new bs.Modal(this.element);
this.#videoUrl = this.element.dataset.videoUrl;
}

Expand Down
26 changes: 1 addition & 25 deletions assets/styles/app.scss
Original file line number Diff line number Diff line change
@@ -1,29 +1,5 @@
@use "sass:list";
@use "sass:map";
@import "../../vendor/twbs/bootstrap/scss/functions";

// Variables
$prefix: bs-;
$spacer: 0.8rem;
$primary: #4154f1;
$navbar-padding-x: 2rem;
$navbar-padding-y: $spacer * 0.85;
$input-btn-border-width: var(--#{$prefix}border-width);
$input-border-width: $input-btn-border-width;
$input-height-border: calc(#{$input-border-width} * 2);
$form-floating-height: add(3.5rem * 0.8, $input-height-border);
$form-floating-padding-y: 0.65rem;

$timeline-color: #808080;
$timeline-width: 2px;

@import "../../vendor/twbs/bootstrap/scss/bootstrap-reboot";
$font-family-sans-serif: list.join(
("LXGW WenKai TC", cursive),
$font-family-sans-serif
);

@import "../../vendor/twbs/bootstrap/scss/bootstrap";
@import "./bootstrap";

// global
html {
Expand Down
61 changes: 61 additions & 0 deletions assets/styles/bootstrap.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
@use "sass:list";
@import "../../vendor/twbs/bootstrap/scss/functions";

// Variables
$prefix: bs-;
$spacer: 0.8rem;
$primary: #4154f1;
$navbar-padding-x: 2rem;
$navbar-padding-y: $spacer * 0.85;
$input-btn-border-width: var(--#{$prefix}border-width);
$input-border-width: $input-btn-border-width;
$input-height-border: calc(#{$input-border-width} * 2);
$form-floating-height: add(3.5rem * 0.8, $input-height-border);
$form-floating-padding-y: 0.65rem;

$timeline-color: #808080;
$timeline-width: 2px;

@import "../../vendor/twbs/bootstrap/scss/variables";

$font-family-sans-serif: list.join(
("LXGW WenKai TC", cursive),
$font-family-sans-serif
);

// required parts
@import "../../vendor/twbs/bootstrap/scss/maps";
@import "../../vendor/twbs/bootstrap/scss/mixins";
@import "../../vendor/twbs/bootstrap/scss/root";
@import "../../vendor/twbs/bootstrap/scss/utilities";

// other components
@import "../../vendor/twbs/bootstrap/scss/reboot";
@import "../../vendor/twbs/bootstrap/scss/type";
@import "../../vendor/twbs/bootstrap/scss/images";
@import "../../vendor/twbs/bootstrap/scss/containers";
@import "../../vendor/twbs/bootstrap/scss/grid";
@import "../../vendor/twbs/bootstrap/scss/tables";
@import "../../vendor/twbs/bootstrap/scss/forms";
@import "../../vendor/twbs/bootstrap/scss/buttons";
@import "../../vendor/twbs/bootstrap/scss/transitions";
@import "../../vendor/twbs/bootstrap/scss/dropdown";
@import "../../vendor/twbs/bootstrap/scss/button-group";
@import "../../vendor/twbs/bootstrap/scss/nav";
@import "../../vendor/twbs/bootstrap/scss/navbar";
@import "../../vendor/twbs/bootstrap/scss/card";
@import "../../vendor/twbs/bootstrap/scss/breadcrumb";
@import "../../vendor/twbs/bootstrap/scss/pagination";
@import "../../vendor/twbs/bootstrap/scss/badge";
@import "../../vendor/twbs/bootstrap/scss/alert";
@import "../../vendor/twbs/bootstrap/scss/list-group";
@import "../../vendor/twbs/bootstrap/scss/close";
@import "../../vendor/twbs/bootstrap/scss/modal";
@import "../../vendor/twbs/bootstrap/scss/tooltip";
@import "../../vendor/twbs/bootstrap/scss/spinners";

// Helpers
@import "../../vendor/twbs/bootstrap/scss/helpers";

// Utilities
@import "../../vendor/twbs/bootstrap/scss/utilities/api";
3 changes: 3 additions & 0 deletions compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ services:
test: set -o pipefail;curl -fsS http://localhost:7700/health | grep -q '{"status":"available"}'
retries: 3
timeout: 5s
sqlrunner:
image: ghcr.io/database-playground/sqlrunner-v2:main
php:
image: ${IMAGES_PREFIX:-}app-php
restart: unless-stopped
Expand All @@ -52,6 +54,7 @@ services:
REDIS_URI: "redis://redis:6379"
MEILISEARCH_URL: "http://meilisearch:7700"
MEILISEARCH_API_KEY: ${MEILI_MASTER_KEY:-!MasterChangeMe!}
SQLRUNNER_URL: "http://sqlrunner:8080"
volumes:
- caddy_data:/data
- caddy_config:/config
Expand Down
Loading