You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
162 lines
3.1 KiB
162 lines
3.1 KiB
# Deployment Plan: motief.sgeboers.nl
|
|
|
|
**Date:** 2026-03-26
|
|
**Subdomain:** `motief.sgeboers.nl`
|
|
**Stack:** Streamlit · uv · systemd · Nginx · Drone CI
|
|
**Target:** VPS, `webapps` user at `/home/webapps/motief/`
|
|
|
|
---
|
|
|
|
## Already done ✅
|
|
|
|
- VPS directory `/home/webapps/motief/data/` created
|
|
- `motions.db` uploaded to VPS
|
|
- nginx vhost configured for `motief.sgeboers.nl`
|
|
- TLS cert via certbot
|
|
|
|
---
|
|
|
|
## Step A — Install uv on VPS
|
|
|
|
SSH in as `webapps`:
|
|
|
|
```bash
|
|
curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
source $HOME/.cargo/env # or re-login
|
|
uv --version # verify
|
|
```
|
|
|
|
---
|
|
|
|
## Step B — Clone repo and install dependencies
|
|
|
|
```bash
|
|
cd /home/webapps
|
|
git clone <your-gitea-url>/sgeboers/stemwijzer motief
|
|
cd motief
|
|
uv sync
|
|
```
|
|
|
|
The `motions.db` you already uploaded should live at:
|
|
```
|
|
/home/webapps/motief/data/motions.db
|
|
```
|
|
|
|
---
|
|
|
|
## Step C — Create systemd user service
|
|
|
|
Create `~/.config/systemd/user/motief.service`:
|
|
|
|
```ini
|
|
[Unit]
|
|
Description=motief.sgeboers.nl Streamlit app
|
|
After=network.target
|
|
|
|
[Service]
|
|
WorkingDirectory=/home/webapps/motief
|
|
ExecStart=/home/webapps/.local/bin/uv run streamlit run Home.py --server.port=8501 --server.headless=true
|
|
Restart=on-failure
|
|
RestartSec=5
|
|
|
|
[Install]
|
|
WantedBy=default.target
|
|
```
|
|
|
|
Enable and start:
|
|
|
|
```bash
|
|
systemctl --user daemon-reload
|
|
systemctl --user enable motief
|
|
systemctl --user start motief
|
|
systemctl --user status motief # verify it's running
|
|
```
|
|
|
|
Enable linger so the service survives logout:
|
|
|
|
```bash
|
|
# Needs sudo (once only)
|
|
sudo loginctl enable-linger webapps
|
|
```
|
|
|
|
---
|
|
|
|
## Step D — Configure Drone secrets
|
|
|
|
In `drone.sgeboers.nl` → `sgeboers/stemwijzer` → **Settings → Secrets**:
|
|
|
|
| Secret | Value |
|
|
|--------|-------|
|
|
| `DEPLOY_HOST` | VPS hostname or IP |
|
|
| `DEPLOY_SSH_PORT` | `22` (or custom) |
|
|
| `DEPLOY_USER` | `webapps` |
|
|
| `DEPLOY_PASSWORD` | webapps SSH password |
|
|
|
|
---
|
|
|
|
## Step E — First auto-deploy
|
|
|
|
```bash
|
|
git push origin main
|
|
```
|
|
|
|
Drone will SSH in and run:
|
|
```bash
|
|
cd /home/webapps/motief
|
|
git pull origin main
|
|
uv sync
|
|
systemctl --user restart motief
|
|
```
|
|
|
|
---
|
|
|
|
## Step F — Verify
|
|
|
|
```bash
|
|
# On VPS
|
|
systemctl --user status motief
|
|
journalctl --user -u motief -f
|
|
|
|
# From browser
|
|
open https://motief.sgeboers.nl
|
|
```
|
|
|
|
Checklist:
|
|
- [ ] Home.py loads with nav to Stemwijzer and Explorer
|
|
- [ ] Compass tab renders with correct party positions (GL-PvdA top-left, PVV bottom-right)
|
|
- [ ] SVD tab scree plot shows with highlighted top-2 bars
|
|
- [ ] Similarity search returns results
|
|
|
|
---
|
|
|
|
## Ongoing: data updates
|
|
|
|
The `scheduler.py` can be run as a separate user service or a cron job. To set it up as a service:
|
|
|
|
Create `~/.config/systemd/user/motief-scheduler.service`:
|
|
|
|
```ini
|
|
[Unit]
|
|
Description=motief scheduler (weekly pipeline)
|
|
After=network.target
|
|
|
|
[Service]
|
|
WorkingDirectory=/home/webapps/motief
|
|
ExecStart=/home/webapps/.local/bin/uv run python scheduler.py
|
|
Restart=on-failure
|
|
|
|
[Install]
|
|
WantedBy=default.target
|
|
```
|
|
|
|
---
|
|
|
|
## Dependency order
|
|
|
|
```
|
|
A (install uv) ─┐
|
|
B (clone + sync) ─┤─► C (systemd service) ─► E (push to main) ─► F (verify)
|
|
└─► D (Drone secrets) ────┘
|
|
```
|
|
|
|
Total estimated time: **20 minutes**.
|
|
|