build: package persistent deployment and maintenance commands
This commit is contained in:
@@ -125,9 +125,14 @@ fi
|
||||
compose() {
|
||||
local directory="$1"
|
||||
shift
|
||||
local runtime_environment=()
|
||||
if [[ -f "$deploy_root/runtime.env" ]]; then
|
||||
runtime_environment=(--env-file "$deploy_root/runtime.env")
|
||||
fi
|
||||
docker compose \
|
||||
--project-name portfolio \
|
||||
--file "$directory/compose.yaml" \
|
||||
"${runtime_environment[@]}" \
|
||||
--env-file "$directory/release.env" \
|
||||
"$@"
|
||||
}
|
||||
@@ -187,12 +192,7 @@ if activate "$release_dir"; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "Deployment failed; attempting rollback." >&2
|
||||
if [[ -n "$previous_release" && -f "$previous_release/compose.yaml" && -f "$previous_release/release.env" ]]; then
|
||||
activate "$previous_release"
|
||||
echo "Rollback succeeded: $(basename "$previous_release")" >&2
|
||||
else
|
||||
echo "No image-based previous release is available for automatic rollback." >&2
|
||||
fi
|
||||
echo "Deployment failed. Automatic image rollback is disabled because startup may have migrated the persistent database." >&2
|
||||
echo "Inspect the failed container. Restore the pre-upgrade backup into a new data directory before activating an older image; see SELF_HOSTING.md." >&2
|
||||
|
||||
exit 1
|
||||
|
||||
Reference in New Issue
Block a user