refactor: rename materia → beanflows throughout codebase
- Rename src/materia/ → src/beanflows/ (Python package)
- Rename transform/sqlmesh_materia/ → transform/sqlmesh_beanflows/
- Rename infra/supervisor/materia-supervisor.service → beanflows-supervisor.service
- Rename infra/backup/materia-backup.{service,timer} → beanflows-backup.{service,timer}
- Update all path strings: /opt/materia → /opt/beanflows, /data/materia → /data/beanflows
- Update pyproject.toml: project name, CLI entrypoint, workspace source key
- Update all internal imports from materia.* → beanflows.*
- Update infra scripts: REPO_DIR, service names, systemctl references
- Fix docker-compose.prod.yml: /data/materia → /data/beanflows (bind mount path)
Intentionally left unchanged: Pulumi stack name (materia-infrastructure) and
Hetzner resource names ("materia-key", "managed_by: materia") — these reference
live cloud infrastructure and require separate cloud-side renames.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
9
infra/backup/beanflows-backup.service
Normal file
9
infra/backup/beanflows-backup.service
Normal file
@@ -0,0 +1,9 @@
|
||||
[Unit]
|
||||
Description=Beanflows Landing Data Backup to R2
|
||||
After=network-online.target
|
||||
Wants=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/usr/bin/rclone sync /data/beanflows/landing/ r2:backup/beanflows/landing/ --log-level INFO
|
||||
TimeoutStartSec=1800
|
||||
@@ -1,5 +1,5 @@
|
||||
[Unit]
|
||||
Description=Materia Landing Data Backup Timer
|
||||
Description=Beanflows Landing Data Backup Timer
|
||||
|
||||
[Timer]
|
||||
OnCalendar=*-*-* 00/6:00:00
|
||||
@@ -1,9 +0,0 @@
|
||||
[Unit]
|
||||
Description=Materia Landing Data Backup to R2
|
||||
After=network-online.target
|
||||
Wants=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/usr/bin/rclone sync /data/materia/landing/ r2:backup/materia/landing/ --log-level INFO
|
||||
TimeoutStartSec=1800
|
||||
@@ -14,7 +14,7 @@
|
||||
set -euo pipefail
|
||||
|
||||
SERVICE_USER="beanflows_service"
|
||||
REPO_DIR="/opt/materia"
|
||||
REPO_DIR="/opt/beanflows"
|
||||
GITEA_REPO="ssh://git@git.padelnomics.io:2222/deemanone/beanflows.git"
|
||||
UV="/home/${SERVICE_USER}/.local/bin/uv"
|
||||
|
||||
@@ -57,9 +57,9 @@ sudo -u "${SERVICE_USER}" bash -c "cd ${REPO_DIR} && ${UV} sync --all-packages"
|
||||
|
||||
# ── Systemd supervisor service ────────────────────────────────────────────────
|
||||
|
||||
cp "${REPO_DIR}/infra/supervisor/materia-supervisor.service" /etc/systemd/system/
|
||||
cp "${REPO_DIR}/infra/supervisor/beanflows-supervisor.service" /etc/systemd/system/
|
||||
systemctl daemon-reload
|
||||
systemctl enable --now materia-supervisor
|
||||
systemctl enable --now beanflows-supervisor
|
||||
|
||||
# ── R2 backup timer (optional) ────────────────────────────────────────────────
|
||||
# Enabled only when R2_ACCESS_KEY_ID, R2_SECRET_ACCESS_KEY, and R2_ENDPOINT
|
||||
@@ -96,7 +96,7 @@ EOF
|
||||
chmod 600 "${RCLONE_CONF}"
|
||||
|
||||
UNITS_CHANGED=0
|
||||
for unit in materia-backup.service materia-backup.timer; do
|
||||
for unit in beanflows-backup.service beanflows-backup.timer; do
|
||||
if ! diff -q "${REPO_DIR}/infra/backup/${unit}" "/etc/systemd/system/${unit}" >/dev/null 2>&1; then
|
||||
cp "${REPO_DIR}/infra/backup/${unit}" /etc/systemd/system/
|
||||
UNITS_CHANGED=1
|
||||
@@ -104,7 +104,7 @@ EOF
|
||||
done
|
||||
[ "${UNITS_CHANGED}" = "1" ] && systemctl daemon-reload
|
||||
|
||||
systemctl enable --now materia-backup.timer
|
||||
systemctl enable --now beanflows-backup.timer
|
||||
echo "$(date '+%H:%M:%S') ==> R2 backup timer enabled."
|
||||
else
|
||||
echo "$(date '+%H:%M:%S') ==> R2_ACCESS_KEY_ID / R2_SECRET_ACCESS_KEY / R2_ENDPOINT not set — skipping backup timer."
|
||||
@@ -113,8 +113,8 @@ fi
|
||||
echo ""
|
||||
echo "=== Bootstrap complete! ==="
|
||||
echo ""
|
||||
echo "Check status: systemctl status materia-supervisor"
|
||||
echo "View logs: journalctl -u materia-supervisor -f"
|
||||
echo "Workflow status: sudo -u ${SERVICE_USER} ${UV} run -p ${REPO_DIR} python src/materia/supervisor.py status"
|
||||
echo "Backup timer: systemctl list-timers materia-backup.timer"
|
||||
echo "Check status: systemctl status beanflows-supervisor"
|
||||
echo "View logs: journalctl -u beanflows-supervisor -f"
|
||||
echo "Workflow status: sudo -u ${SERVICE_USER} ${UV} run -p ${REPO_DIR} python src/beanflows/supervisor.py status"
|
||||
echo "Backup timer: systemctl list-timers beanflows-backup.timer"
|
||||
echo "Tag: $(sudo -u "${SERVICE_USER}" git -C "${REPO_DIR}" describe --tags --always)"
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#
|
||||
# What it does:
|
||||
# 1. Creates beanflows_service user (nologin) + adds to docker group
|
||||
# 2. Creates /opt/materia + /data/materia/landing with correct ownership
|
||||
# 2. Creates /opt/beanflows + /data/beanflows/landing with correct ownership
|
||||
# 3. Installs git, curl, age, sops, rclone, uv
|
||||
# 4. Generates ed25519 SSH deploy key for GitLab read access
|
||||
# 5. Generates age keypair at ~/.config/sops/age/keys.txt (as service user)
|
||||
@@ -17,10 +17,10 @@
|
||||
set -euo pipefail
|
||||
|
||||
SERVICE_USER="beanflows_service"
|
||||
APP_DIR="/opt/materia"
|
||||
DATA_DIR="/data/materia"
|
||||
APP_DIR="/opt/beanflows"
|
||||
DATA_DIR="/data/beanflows"
|
||||
SSH_DIR="/home/${SERVICE_USER}/.ssh"
|
||||
DEPLOY_KEY="${SSH_DIR}/materia_deploy"
|
||||
DEPLOY_KEY="${SSH_DIR}/beanflows_deploy"
|
||||
SOPS_AGE_DIR="/home/${SERVICE_USER}/.config/sops/age"
|
||||
|
||||
ROTATE_KEYS="${ROTATE_KEYS:-}"
|
||||
@@ -63,7 +63,7 @@ fi
|
||||
|
||||
if [ ! -f "${DEPLOY_KEY}" ]; then
|
||||
sudo -u "${SERVICE_USER}" ssh-keygen -t ed25519 \
|
||||
-f "${DEPLOY_KEY}" -N "" -C "materia-deploy"
|
||||
-f "${DEPLOY_KEY}" -N "" -C "beanflows-deploy"
|
||||
fi
|
||||
|
||||
if [ ! -f "${SSH_DIR}/config" ]; then
|
||||
|
||||
29
infra/supervisor/beanflows-supervisor.service
Normal file
29
infra/supervisor/beanflows-supervisor.service
Normal file
@@ -0,0 +1,29 @@
|
||||
[Unit]
|
||||
Description=Beanflows Supervisor - Pipeline Orchestration
|
||||
After=network-online.target
|
||||
Wants=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=beanflows_service
|
||||
WorkingDirectory=/opt/beanflows
|
||||
ExecStart=/bin/sh -c 'exec uv run python src/beanflows/supervisor.py'
|
||||
Restart=always
|
||||
RestartSec=10
|
||||
EnvironmentFile=/opt/beanflows/.env
|
||||
Environment=PATH=/home/beanflows_service/.local/bin:/usr/local/bin:/usr/bin:/bin
|
||||
Environment=LANDING_DIR=/data/beanflows/landing
|
||||
Environment=DUCKDB_PATH=/data/beanflows/lakehouse.duckdb
|
||||
Environment=SERVING_DUCKDB_PATH=/data/beanflows/analytics.duckdb
|
||||
Environment=SUPERVISOR_GIT_PULL=1
|
||||
|
||||
# Resource limits
|
||||
LimitNOFILE=65536
|
||||
|
||||
# Logging
|
||||
StandardOutput=journal
|
||||
StandardError=journal
|
||||
SyslogIdentifier=beanflows-supervisor
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -1,29 +0,0 @@
|
||||
[Unit]
|
||||
Description=Materia Supervisor - Pipeline Orchestration
|
||||
After=network-online.target
|
||||
Wants=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=beanflows_service
|
||||
WorkingDirectory=/opt/materia
|
||||
ExecStart=/bin/sh -c 'exec uv run python src/materia/supervisor.py'
|
||||
Restart=always
|
||||
RestartSec=10
|
||||
EnvironmentFile=/opt/materia/.env
|
||||
Environment=PATH=/home/beanflows_service/.local/bin:/usr/local/bin:/usr/bin:/bin
|
||||
Environment=LANDING_DIR=/data/materia/landing
|
||||
Environment=DUCKDB_PATH=/data/materia/lakehouse.duckdb
|
||||
Environment=SERVING_DUCKDB_PATH=/data/materia/analytics.duckdb
|
||||
Environment=SUPERVISOR_GIT_PULL=1
|
||||
|
||||
# Resource limits
|
||||
LimitNOFILE=65536
|
||||
|
||||
# Logging
|
||||
StandardOutput=journal
|
||||
StandardError=journal
|
||||
SyslogIdentifier=materia-supervisor
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
Reference in New Issue
Block a user