Spaces:
Running
Running
chore: update startup script configuration for environment initialization
Browse files
start.sh
CHANGED
|
@@ -135,6 +135,14 @@ if [ -n "${HF_TOKEN:-}" ]; then
|
|
| 135 |
echo "Restoring persisted data from HF Dataset..."
|
| 136 |
python3 /app/paperclip-sync.py restore 2>&1 || true
|
| 137 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 138 |
# Check if last sync failed
|
| 139 |
if [ -f "${SYNC_STATUS_FILE}" ]; then
|
| 140 |
LAST_ERROR=$(python3 -c "import json; f=open('${SYNC_STATUS_FILE}'); d=json.load(f); print(d.get('last_error') or '')" 2>/dev/null || true)
|
|
|
|
| 135 |
echo "Restoring persisted data from HF Dataset..."
|
| 136 |
python3 /app/paperclip-sync.py restore 2>&1 || true
|
| 137 |
|
| 138 |
+
# Re-stamp .db-password with current session's password so restore can't
|
| 139 |
+
# overwrite it with an old base64 value that breaks DATABASE_URL next restart
|
| 140 |
+
echo "${DB_PASSWORD}" > "${DB_PASSWORD_FILE}"
|
| 141 |
+
chmod 600 "${DB_PASSWORD_FILE}"
|
| 142 |
+
|
| 143 |
+
# Update PostgreSQL password to match (restore may have re-created the DB)
|
| 144 |
+
su - postgres -c "psql -c \"ALTER USER postgres WITH PASSWORD '${DB_PASSWORD}';\"" >/dev/null 2>&1 || true
|
| 145 |
+
|
| 146 |
# Check if last sync failed
|
| 147 |
if [ -f "${SYNC_STATUS_FILE}" ]; then
|
| 148 |
LAST_ERROR=$(python3 -c "import json; f=open('${SYNC_STATUS_FILE}'); d=json.load(f); print(d.get('last_error') or '')" 2>/dev/null || true)
|