Install QuizDock
This page installs a new instance. Pick the setup first in Choose a deployment. The script is the shortest path, and the only one that also backs up, restores and upgrades for you.
Prerequisites
Section titled “Prerequisites”- Docker Engine with the Compose plugin (
docker compose), or Docker Desktop on a Mac or a PC. - curl, for the script to download its files.
- A user allowed to talk to the Docker daemon (in the
dockergroup, or root). - One free TCP port on the server for the application (
18080by default), and a second one for Keycloak in the full setup (18081by default).
Memory and CPU: see Sizing.
With the quizdock script
Section titled “With the quizdock script”-
On the server, create an empty folder for the instance and go into it. Everything the instance needs lives there:
.env, the Compose files, the backups.Terminal window mkdir -p /srv/quizdock && cd /srv/quizdock -
Download the script and make it executable:
Terminal window curl -fsSLO https://raw.githubusercontent.com/quizdock/quizdock/main/quizdockchmod +x quizdockThe script is also available as a raw file to read before running it.
-
Run one of these, for the setup you chose:
Terminal window ./quizdock init --standalone # one container./quizdock init # Compose: answer "none" (local mode) or "oidc" (your provider)./quizdock init --full # Compose with the bundled Keycloakinitwith no option is the same asinit --compose. It asks for the application name, the language and the HTTP port; then the sign-in mode, except with--full, which signs in with its Keycloak; withoidc, your provider’s issuer and client id; with--full, the host name browsers will use and the Keycloak port; and whether administrators may change settings from the browser (ADMIN_WEB_SCOPE, see Allow changes from the web): answered yes in local mode, it also generates the administration token (ADMIN_TOKEN) and says where it is. It then:- writes
.envwith permissions600; for Compose and the full setup, with a random PostgreSQL password (and, in the full setup, random passwords for Keycloak’s administrator and the two sample accounts); - remembers the setup in
.envasQUIZDOCK_MODE; - downloads
docker-compose.prod.ymlfor Compose, plusdocker-compose.full.ymlandkeycloak/realm-export.jsonfor the full setup, when they are not already in the folder.
An existing
.envis only replaced after you confirm. - writes
-
Start the instance:
Terminal window ./quizdock upupstarts the containers, then waits up to 120 seconds for the application’s/healthto answer (and up to 180 seconds more for Keycloak in the full setup). It prints the address when the instance is ready. -
Open
http://<server>:18080in a browser and finish the setup. See Finish the setup in the browser.
With docker run (standalone)
Section titled “With docker run (standalone)”The all-in-one image needs nothing else. On the machine that runs Docker:
docker run -d --name quizdock --restart unless-stopped \ -p 18080:3000 -v quizdock:/data fchaussin/quizdock:standalone-v quizdock:/datakeeps the database, the media and the templates in a named volume. Without it, everything is lost with the container.- To set variables, add
--env-file .env. A commented starting point isenv/standalone.env.examplein the QuizDock repository, also downloadable ashttps://raw.githubusercontent.com/quizdock/quizdock/main/env/standalone.env.example. - The first start creates the database and runs the migrations: allow a minute before
/healthanswers.
The ./quizdock script manages a container started this way if it is named quizdock and the folder has a .env with QUIZDOCK_MODE=standalone.
With Docker Compose by hand
Section titled “With Docker Compose by hand”-
On the server, in the instance’s folder, download the Compose file and a commented
.envto start from:Terminal window curl -fsSLO https://raw.githubusercontent.com/quizdock/quizdock/main/docker-compose.prod.ymlcurl -fsSL -o .env https://raw.githubusercontent.com/quizdock/quizdock/main/env/local.env.examplechmod 600 .envFor your own provider, take
env/oidc.env.exampleinstead ofenv/local.env.example. -
Edit
.env: at least replacePOSTGRES_PASSWORD. Without a.env, the Compose file falls back to the user and passwordlive. -
Start it:
Terminal window docker compose -f docker-compose.prod.yml up -dThe
migrateservice applies the database migrations and exits; the application starts once it has succeeded.
For the full setup, also download docker-compose.full.yml and keycloak/realm-export.json (into a keycloak/ folder), start from env/full.env.example, replace its four passwords, and start with:
docker compose -f docker-compose.prod.yml -f docker-compose.full.yml --profile keycloak up -dThe script works on a folder set up by hand: without QUIZDOCK_MODE in .env, it assumes Compose.
Finish the setup in the browser
Section titled “Finish the setup in the browser”A fresh instance offers a setup wizard: usage, health, identity, address, access, limits, content, then a summary. It asks for a setup token first, so that whoever reaches a fresh instance cannot take it over. The token is written in the application’s log at start:
./quizdock logs quizdock # Compose; for standalone: ./quizdock logsLook for the line This instance is not set up yet. Open it in a browser and give the setup token …, then stop following the log with Ctrl+C. The token works once and expires 24 hours after it was created. Each start, while the setup is open, writes a new one and the previous one stops working. A new one, on the server, in the instance’s folder:
./quizdock qd setup.tokenAn automated deployment configured entirely in .env skips the wizard with ./quizdock qd setup.complete. What the wizard sets, and what it never touches: see the administration overview.
The full setup: first sign-in
Section titled “The full setup: first sign-in”- The host name you gave
init --full(PUBLIC_HOST) is used by every browser, for QuizDock and for Keycloak, on their two ports.localhostonly works on the server itself: on a network, use the server’s LAN address or a name every device resolves. - Two sample accounts exist:
host(Alex Host, roleshostandadmin) andplayer(Sam Player, roleplayer). Their temporary passwords are in.envasKEYCLOAK_HOST_PASSWORDandKEYCLOAK_PLAYER_PASSWORD; each must choose a new one at first sign-in. - The Keycloak administration console is on the Keycloak port, with
KEYCLOAK_ADMINandKEYCLOAK_ADMIN_PASSWORD. Create the other accounts there. - Keycloak imports the realm only into an empty database: changing these passwords in
.envlater changes nothing.
HTTPS in the full setup: see Reverse proxy.
After a reboot
Section titled “After a reboot”The application, PostgreSQL and Redis come back by themselves after the server or Docker restarts (the Compose file gives them restart: unless-stopped). An instance stopped with ./quizdock down stays stopped until ./quizdock up. A standalone container created by the script (or with --restart unless-stopped, as above) comes back by itself too.
- Networking: make sure phones reach the invitation address.
- Configuration: every variable.
- Back up an instance, before the first real event.