# Psalmbord Online

## Run with Docker Compose

This project includes a `Dockerfile` + `docker-compose.yml` to run the Flask app behind gunicorn.

### Configure environment (optional)

Copy the example env file:

```bash
cp .env.example .env
```

### Start

```bash
docker compose up -d --build
```

Open:

- http://localhost:5000 (or `WEB_PORT`)

### Persisted data

Docker compose bind-mounts the following so data survives container rebuilds/recreates:

- `./instance/` -> SQLite database file (stored at `instance/liturgie.db`)
- `./static/uploads/` -> uploaded backgrounds/logos

### Default admin user

On startup, `init_db.py` ensures DB/tables exist and creates an admin user **only if it does not already exist**.

Defaults:

- Username: `admin`
- Password: `admin`

Override via `.env`:

```env
ADMIN_USERNAME=admin
ADMIN_PASSWORD=change-me
```

## SMTP + wachtwoord reset

De applicatie kan wachtwoord-reset emails sturen via SMTP.

1. Log in als admin en ga naar **Admin Dashboard**.
2. Vul bij **SMTP instellingen (wachtwoord reset)** de SMTP host/port/credentials en `Van email` in.
3. Gebruik **Test email sturen** om te verifiëren.
4. Gebruikers kunnen vervolgens op de login-pagina klikken op **Wachtwoord vergeten?**.

Let op: SMTP instellingen worden opgeslagen in de SQLite database (single-row tabel `smtp_settings`).

### Handmatige test

1. Start de app.
2. Log in als admin → **Admin Dashboard** → configureer SMTP.
3. Klik **Test email sturen**.
4. Ga naar `/login` → **Wachtwoord vergeten?** → vul een bestaand gebruikers-emailadres in.
5. Open de reset-link uit de email en stel een nieuw wachtwoord in.
6. Log in met het nieuwe wachtwoord.

## Release / publish (git + docker push)

This repo includes a helper script that:

1. Prompt for a version (e.g. `1.2.3`)
2. Create a git commit with message `Version <version>`
3. Push to: `https://git.alphen.cloud/bramval/PsalmbordOnlineCE`
4. Build + push Docker image to:
   - `git.alphen.cloud/bramval/psalmbordonlinece:<version>`
   - `git.alphen.cloud/bramval/psalmbordonlinece:latest`

### Recommended (cross-platform Python)

```bash
python release.py
```

Non-interactive:

```bash
python release.py --version 1.2.3 --yes
```

Dry run:

```bash
python release.py --version 1.2.3 --dry-run
```

If Docker push fails due to authentication, run:

```bash
docker login git.alphen.cloud
```
