data-refresh.service: use /tmp instead of /tmp/data_analyst_staging in ReadWritePaths — the subdirectory may not exist at service start, causing mount namespace setup to fail before any Exec* directive runs. deploy.sh: fix typo services/corporate-memory -> services/corporate_memory so the mkdir conditional actually matches the repo directory name. deploy.sh: add ReadWritePaths validation loop that auto-creates any missing directories listed in installed .service files before daemon-reload. This acts as a safety net against future NAMESPACE failures from new services.
33 lines
959 B
Desktop File
33 lines
959 B
Desktop File
[Unit]
|
|
Description=Data Refresh - scheduled sync from BigQuery to local Parquet
|
|
After=network-online.target
|
|
Wants=network-online.target
|
|
|
|
[Service]
|
|
Type=oneshot
|
|
User=root
|
|
Group=data-ops
|
|
WorkingDirectory=/opt/data-analyst/repo
|
|
ExecStart=/opt/data-analyst/.venv/bin/python3 -m src.data_sync --scheduled
|
|
|
|
# Environment
|
|
EnvironmentFile=/opt/data-analyst/.env
|
|
Environment=PYTHONPATH=/opt/data-analyst/repo
|
|
Environment=CONFIG_DIR=/opt/data-analyst/instance/config
|
|
|
|
# Write access to data directory, logs, and /tmp (for staging + lock file)
|
|
ProtectSystem=strict
|
|
ReadWritePaths=/data /opt/data-analyst/logs /tmp
|
|
PrivateTmp=false
|
|
|
|
# Sync can take a while for large tables
|
|
TimeoutStartSec=3600
|
|
|
|
# Prevent overlapping runs
|
|
ExecCondition=/usr/bin/test ! -f /tmp/data-refresh.lock
|
|
ExecStartPre=/usr/bin/touch /tmp/data-refresh.lock
|
|
ExecStartPost=/usr/bin/rm -f /tmp/data-refresh.lock
|
|
ExecStopPost=/usr/bin/rm -f /tmp/data-refresh.lock
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|