fix prod
Build & Deploy / Build & Push Docker Image (push) Successful in 2m51s
Test / Type Check (all packages) (push) Successful in 51s
Build & Deploy / Deploy to VPS (push) Successful in 4s
Test / API Unit Tests (push) Successful in 49s
Test / Homepage Unit Tests (push) Successful in 42s
Test / Storefront Unit Tests (push) Successful in 40s
Test / Admin Unit Tests (push) Successful in 41s
Test / Dashboard Unit Tests (push) Successful in 41s
Test / API Integration Tests (push) Successful in 59s

This commit is contained in:
root
2026-07-01 09:18:14 -04:00
parent 184a4bac8b
commit e2b564aea5
4 changed files with 88 additions and 9 deletions
+58 -2
View File
@@ -10,7 +10,7 @@ source "${ROOT_DIR}/scripts/docker-prod-common.sh"
usage() {
cat <<'EOF'
Usage:
./deploy-production.sh [--with-pgmanage] [--skip-prune]
./deploy-production.sh [--with-pgmanage] [--skip-prune] [--image-tag <tag>] [--fetch-through-vpn] [--pull-registry]
What it does:
1. Validates .env.docker.production
@@ -23,11 +23,19 @@ What it does:
VPN/shared-folder image flow:
Put an archive matching IMAGE_TAG in ./image-archives before running this script.
Example: ./image-archives/carmanagement-latest.tar
Options:
--image-tag <tag> Override IMAGE_TAG from .env.docker.production for this run
--fetch-through-vpn
Fetch IMAGE_TAG into IMAGE_ARCHIVE_DIR before deployment.
Requires VPN_CONTAINER and prompts for REGISTRY_TOKEN when unset.
--pull-registry Ignore IMAGE_ARCHIVE_DIR and pull directly from the registry
EOF
}
include_pgmanage=0
skip_prune=0
fetch_through_vpn=0
while [[ $# -gt 0 ]]; do
case "$1" in
@@ -39,6 +47,27 @@ while [[ $# -gt 0 ]]; do
skip_prune=1
shift
;;
--image-tag)
if [[ -z "${2:-}" ]]; then
echo "--image-tag requires a tag value." >&2
usage >&2
exit 1
fi
IMAGE_TAG="$2"
export IMAGE_TAG
shift 2
;;
--fetch-through-vpn)
fetch_through_vpn=1
shift
;;
--pull-registry)
IMAGE_ARCHIVE_DIR=""
IMAGE_ARCHIVE_REQUIRED=false
IMAGE_ARCHIVE_DISABLED=true
export IMAGE_ARCHIVE_DIR IMAGE_ARCHIVE_REQUIRED IMAGE_ARCHIVE_DISABLED
shift
;;
-h|--help)
usage
exit 0
@@ -51,6 +80,12 @@ while [[ $# -gt 0 ]]; do
esac
done
if [[ "${fetch_through_vpn}" -eq 1 && ("${IMAGE_ARCHIVE_DISABLED:-false}" == "true" || "${IMAGE_ARCHIVE_DISABLED:-0}" == "1") ]]; then
echo "--fetch-through-vpn and --pull-registry cannot be used together." >&2
usage >&2
exit 1
fi
require_command() {
local command_name="$1"
@@ -60,6 +95,18 @@ require_command() {
fi
}
fetch_release_archive_through_vpn() {
if [[ "${fetch_through_vpn}" -ne 1 ]]; then
return 0
fi
echo "Fetching image archive through VPN container"
IMAGE_TAG="${IMAGE_TAG}" \
APP_IMAGE="${APP_IMAGE:-10.0.0.4/melabidi/carmanagement}" \
TRANSFER_DIR="${IMAGE_ARCHIVE_DIR:-/opt/docker-image-transfer}" \
"${ROOT_DIR}/fetch-image-through-vpn.sh" "${IMAGE_TAG}"
}
normalize_archive_dir() {
if [[ -z "${IMAGE_ARCHIVE_DIR:-}" ]]; then
return 0
@@ -81,8 +128,16 @@ print_release_summary() {
echo " Env: ${ENV_FILE}"
echo " Compose project: ${PROJECT_NAME}"
if [[ -n "${IMAGE_ARCHIVE_DIR:-}" ]]; then
if [[ "${IMAGE_ARCHIVE_DISABLED:-false}" == "true" || "${IMAGE_ARCHIVE_DISABLED:-0}" == "1" ]]; then
echo " Image source: registry pull (archive loading disabled)"
elif [[ -n "${IMAGE_ARCHIVE_DIR:-}" ]]; then
echo " Image archive dir: ${IMAGE_ARCHIVE_DIR}"
else
echo " Image source: registry pull"
fi
if [[ "${IMAGE_ARCHIVE_REQUIRED:-false}" == "true" || "${IMAGE_ARCHIVE_REQUIRED:-0}" == "1" ]]; then
echo " Registry pull: disabled (IMAGE_ARCHIVE_REQUIRED=${IMAGE_ARCHIVE_REQUIRED})"
fi
}
@@ -288,6 +343,7 @@ print_release_summary
ensure_traefik_network
ensure_api_uploads_volume
fetch_release_archive_through_vpn
login_registry_if_configured
echo "Preparing release image"