Changeset f434294 in Klonkt
- Timestamp:
- 07/31/2026 02:02:34 PM (6 weeks ago)
- Branches:
- main
- Children:
- 0ca7e9a4
- Parents:
- 5462bab
- Files:
-
- 3 edited
-
deploy/MULTI-INSTANCE.md (modified) (1 diff)
-
scripts/klonkt-migrate-data.sh (modified) (1 diff)
-
scripts/klonkt-refresh-updater.sh (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
deploy/MULTI-INSTANCE.md
r5462bab rf434294 84 84 because the port comes from the same `.env`. 85 85 86 **Rolling back.** The old `klonkt.service` is disabled but not deleted. To go 87 back, move the data into `/opt/klonkt/storage`, restore the relative paths in 88 `.env`, and run `systemctl enable --now klonkt`. 86 **Rolling back.** The old `klonkt.service` is disabled and masked, not deleted. 87 Masked because `disable` alone does not stop `systemctl restart klonkt` from 88 starting it again, and a resurrected unit no longer finds its `.env` (that moved 89 with the data): it would fall back to the defaults and write a fresh empty 90 database into the checkout. To go back, move the data into `/opt/klonkt/storage`, 91 restore the relative paths in `.env`, then `systemctl unmask klonkt` and 92 `systemctl enable --now klonkt`. 89 93 90 94 ## Adding an instance -
scripts/klonkt-migrate-data.sh
r5462bab rf434294 129 129 130 130 step "Switching to klonkt@$SLUG" 131 if systemctl is-enabled --quiet "$OLD_UNIT" 2>/dev/null; then131 if systemctl list-unit-files "$OLD_UNIT" >/dev/null 2>&1; then 132 132 run "systemctl disable --now $OLD_UNIT" 133 say "disabled $OLD_UNIT (file kept, so you can roll back)" 133 # Disable only removes the autostart link: `systemctl restart klonkt` would 134 # still START it. That is not theoretical — an updater generated before the 135 # split does exactly that, and the resurrected unit finds no .env (it moved 136 # with the data), falls back to the built-in defaults and creates a FRESH 137 # EMPTY database in the checkout. Masking makes any such call fail loudly. 138 # Reversible: systemctl unmask klonkt. 139 run "systemctl mask $OLD_UNIT" 140 say "disabled and masked $OLD_UNIT (unmask to roll back)" 134 141 fi 135 142 run "systemctl enable --now 'klonkt@$SLUG'" -
scripts/klonkt-refresh-updater.sh
r5462bab rf434294 58 58 chmod +x /usr/local/bin/klonkt-update 59 59 echo "klonkt-update rewritten: branch ${BRANCH}, code ${KLONKT_DIR}, instances under ${DATA_ROOT}" 60 61 # On a split install the old single unit must not be startable. `disable` alone 62 # does not stop `systemctl restart klonkt` from starting it, and a resurrected 63 # klonkt.service has no .env (it moved with the data): it falls back to the 64 # defaults and writes a fresh empty database into the checkout. 65 SPLIT=0 66 for d in "${DATA_ROOT}"/*/; do [ -f "$d/.env" ] && SPLIT=1 && break; done 67 if [ "$SPLIT" = 1 ] && systemctl list-unit-files klonkt.service >/dev/null 2>&1; then 68 if ! systemctl is-enabled klonkt.service 2>/dev/null | grep -q masked; then 69 systemctl stop klonkt.service 2>/dev/null || true 70 systemctl disable klonkt.service 2>/dev/null || true 71 systemctl mask klonkt.service 72 echo "retired klonkt.service: stopped, disabled and masked (unmask to roll back)" 73 fi 74 fi 75 76 # A leftover storage/ in the checkout means something ran without the instance 77 # config. Report it; never delete it unattended — only its owner can tell 78 # whether it holds anything. 79 if [ "$SPLIT" = 1 ] && [ -e "${KLONKT_DIR}/storage" ]; then 80 echo 81 echo "WARNING: ${KLONKT_DIR}/storage exists while instance data lives in ${DATA_ROOT}." 82 echo " Something ran without the instance .env and wrote here. Check with:" 83 echo " sqlite3 ${KLONKT_DIR}/storage/database.sqlite 'select count(*) from posts;'" 84 echo " If it is empty, it is a stray from a resurrected klonkt.service and" 85 echo " can be removed. If it is NOT empty, do not delete it: ask first." 86 fi
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)