Problem: JSON snapshots (~180KB each × 4 cities × daily) live in git — bloating repo history. Reports are deployed to 3 places redundantly.
Principle: Git stores code only. Web server stores data + output. Clean separation of concerns.
Simplest. Everything runs where the output lives. No network transfers.
| Step | What happens |
|---|---|
| 1 | Clone repo once: git clone <repo> /var/www/weather/repo |
| 2 | Set up Python venv + install deps on the server |
| 3 | Cron at 07:00: cd repo && git pull && python3 run-and-publish.py |
| 4 | Scripts write JSON to /var/www/weather/data/ |
| 5 | Scripts write HTML to /var/www/weather/public/ |
| 6 | Nginx serves /var/www/weather/public/ as web root |
Pros: No scp, no CI, no git push for data. Instant. Simple.
Cons: Need SSH + Python 3.12 on the server.
Keep cron on seroiuts00655. Sync output to web server.
| Step | What happens |
|---|---|
| 1 | Cron at 07:00 on build server runs scripts (same as today) |
| 2 | Scripts write to local /tmp/weather-output/ |
| 3 | rsync -az /tmp/weather-output/ user@webserver:/var/www/weather/ |
| 4 | Data + HTML synced in one shot |
Pros: No Python needed on web server. Familiar scp/rsync pattern.
Cons: Extra network hop. Need SSH key to web server from build server.
# 1. Add to .gitignore:
data/
public_html/
# 2. Environment-based paths (run-and-publish.py):
DATA_DIR = os.environ.get("WEATHER_DATA_DIR", "./data")
OUTPUT_DIR = os.environ.get("WEATHER_OUTPUT_DIR", "./public_html")
# 3. Remove from scripts:
- scp deploy logic (or make it optional)
- git add/commit/push of data + HTML
- GitLab CI pages job
# 4. Nginx config:
server {
server_name weather.yourdomain.com;
root /var/www/weather/public;
index index.html;
}
| # | Question | Why |
|---|---|---|
| 1 | SSH access details (host, user, key) | To set up deployment |
| 2 | Server OS and available tools | To know if Python 3.12 is available |
| 3 | Web server software (nginx, Apache, Caddy?) | To configure serving |
| 4 | Domain name | To update links and references |
| 5 | Where should cron run? | Option A vs B |
| 6 | Keep GitLab Pages as fallback? | Dual deploy or remove? |
Once you have the answers above, the migration takes ~30 minutes:
run-and-publish.py to use new paths.gitignore — stop tracking data/HTML