feat(roadmap): integrate validated cleanup localisation and backup fixes
This commit is contained in:
@@ -3,3 +3,7 @@
|
||||
The deployment script and Gitea workflow live in this directory and `.gitea/workflows/`. The current deployment, health/readiness, rollback, and secret-handling guidance is in the repository [infrastructure guide](../docs/infrastructure/README.md), especially [deployment](../docs/infrastructure/deployment.md) and [disaster recovery](../docs/infrastructure/disaster-recovery.md).
|
||||
|
||||
Keep the server `.env` outside the repository. Do not run production deployment, restore, migration, or credential rotation as part of local documentation work.
|
||||
|
||||
MariaDB backup connection parsing uses `scripts/parse-backup-connection.py` (Python 3, already required by deployment preflight). Keys are case-insensitive and support the documented host/user/password/database aliases. Single/double-quoted values may contain semicolons and doubled quote characters. The dump contract requires one TCP host, a database and user, with port 1-65535 (default 3306); an empty password is retained. Duplicate aliases, control characters, host lists/socket paths and database path separators are rejected before dumping. This deliberately bounded parser is not the full MySqlConnector configuration engine. Additional connection options do not change existing dump-client TLS behavior; that qualification remains separate.
|
||||
|
||||
Run `python scripts/test-deploy-backup.py` for the offline synthetic dump-boundary regression. It extracts only the backup function and never executes the deployment entry point, contacts a database or reads the production environment.
|
||||
|
||||
+11
-11
@@ -326,19 +326,19 @@ backup_database() {
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Parse the ADO.NET connection string. Keys are case-insensitive in .NET, so match that.
|
||||
local db_host db_port db_name db_user db_pass
|
||||
db_host="$(sed -n 's/.*[Ss]erver=\([^;]*\).*/\1/p' <<<"$cs")"
|
||||
db_port="$(sed -n 's/.*[Pp]ort=\([^;]*\).*/\1/p' <<<"$cs")"
|
||||
db_name="$(sed -n 's/.*[Dd]atabase=\([^;]*\).*/\1/p' <<<"$cs")"
|
||||
db_user="$(sed -n 's/.*[Uu]ser[ ]*[Ii]*[Dd]*=\([^;]*\).*/\1/p' <<<"$cs")"
|
||||
db_pass="$(sed -n 's/.*[Pp]assword=\([^;]*\).*/\1/p' <<<"$cs")"
|
||||
db_port="${db_port:-3306}"
|
||||
|
||||
if [ -z "$db_host" ] || [ -z "$db_name" ] || [ -z "$db_user" ]; then
|
||||
echo "Could not parse host/database/user from JOBTRACKER_CONNECTION_STRING. Aborting deploy."
|
||||
# Keep secrets off argv; parse aliases/quoted separators without evaluating shell text.
|
||||
local db_host db_port db_name db_user db_pass parsed_connection
|
||||
local -a connection_fields=()
|
||||
if ! parsed_connection="$(printf '%s' "$cs" | python3 scripts/parse-backup-connection.py)"; then
|
||||
echo "Could not parse JOBTRACKER_CONNECTION_STRING for backup. Aborting deploy."
|
||||
return 1
|
||||
fi
|
||||
mapfile -t connection_fields <<< "$parsed_connection"
|
||||
db_host="${connection_fields[0]}"
|
||||
db_port="${connection_fields[1]}"
|
||||
db_name="${connection_fields[2]}"
|
||||
db_user="${connection_fields[3]}"
|
||||
db_pass="${connection_fields[4]}"
|
||||
|
||||
local target="$BACKUP_DIR/jobtracker-${db_name}-${BACKUP_STAMP}.sql.gz"
|
||||
echo "Backing up MariaDB database '${db_name}' on ${db_host}:${db_port} to ${target}"
|
||||
|
||||
Reference in New Issue
Block a user