fix production
Build & Deploy / Build & Push Docker Image (push) Successful in 3m26s
Test / Type Check (all packages) (push) Successful in 59s
Build & Deploy / Deploy to VPS (push) Successful in 4s
Test / API Unit Tests (push) Successful in 52s
Test / Homepage Unit Tests (push) Successful in 45s
Test / Storefront Unit Tests (push) Has been cancelled
Test / Admin Unit Tests (push) Has been cancelled
Test / Dashboard Unit Tests (push) Has been cancelled
Test / API Integration Tests (push) Has been cancelled
Build & Deploy / Build & Push Docker Image (push) Successful in 3m26s
Test / Type Check (all packages) (push) Successful in 59s
Build & Deploy / Deploy to VPS (push) Successful in 4s
Test / API Unit Tests (push) Successful in 52s
Test / Homepage Unit Tests (push) Successful in 45s
Test / Storefront Unit Tests (push) Has been cancelled
Test / Admin Unit Tests (push) Has been cancelled
Test / Dashboard Unit Tests (push) Has been cancelled
Test / API Integration Tests (push) Has been cancelled
This commit is contained in:
@@ -73,6 +73,13 @@ Or fetch the archive and deploy in one command:
|
|||||||
VPN_CONTAINER="6c5dca44e1c2" ./deploy-production.sh --fetch-through-vpn
|
VPN_CONTAINER="6c5dca44e1c2" ./deploy-production.sh --fetch-through-vpn
|
||||||
```
|
```
|
||||||
|
|
||||||
|
When `IMAGE_ARCHIVE_REQUIRED=true`, `./deploy-production.sh` will also fetch a
|
||||||
|
missing archive automatically if `VPN_CONTAINER` is set:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
VPN_CONTAINER="6c5dca44e1c2" ./deploy-production.sh
|
||||||
|
```
|
||||||
|
|
||||||
Equivalent manual command:
|
Equivalent manual command:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|||||||
@@ -21,8 +21,10 @@ What it does:
|
|||||||
6. Waits for health checks and prints container status
|
6. Waits for health checks and prints container status
|
||||||
|
|
||||||
VPN/shared-folder image flow:
|
VPN/shared-folder image flow:
|
||||||
Put an archive matching IMAGE_TAG in ./image-archives before running this script.
|
Put an archive matching IMAGE_TAG in IMAGE_ARCHIVE_DIR before running this script.
|
||||||
Example: ./image-archives/carmanagement-latest.tar
|
Example: /opt/docker-image-transfer/carmanagement-latest.tar
|
||||||
|
When IMAGE_ARCHIVE_REQUIRED=true and VPN_CONTAINER is set, a missing archive is
|
||||||
|
fetched through the VPN container before loading the release image.
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
--image-tag <tag> Override IMAGE_TAG from .env.docker.production for this run
|
--image-tag <tag> Override IMAGE_TAG from .env.docker.production for this run
|
||||||
@@ -96,10 +98,16 @@ require_command() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fetch_release_archive_through_vpn() {
|
fetch_release_archive_through_vpn() {
|
||||||
if [[ "${fetch_through_vpn}" -ne 1 ]]; then
|
if ! should_fetch_release_archive_through_vpn; then
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ -z "${VPN_CONTAINER:-}" ]]; then
|
||||||
|
echo "VPN_CONTAINER is required to fetch the image archive through VPN." >&2
|
||||||
|
usage >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
echo "Fetching image archive through VPN container"
|
echo "Fetching image archive through VPN container"
|
||||||
IMAGE_TAG="${IMAGE_TAG}" \
|
IMAGE_TAG="${IMAGE_TAG}" \
|
||||||
APP_IMAGE="${APP_IMAGE:-10.0.0.4/melabidi/carmanagement}" \
|
APP_IMAGE="${APP_IMAGE:-10.0.0.4/melabidi/carmanagement}" \
|
||||||
@@ -107,6 +115,44 @@ fetch_release_archive_through_vpn() {
|
|||||||
"${ROOT_DIR}/fetch-image-through-vpn.sh" "${IMAGE_TAG}"
|
"${ROOT_DIR}/fetch-image-through-vpn.sh" "${IMAGE_TAG}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
release_archive_exists() {
|
||||||
|
local archive_dir="${IMAGE_ARCHIVE_DIR:-}"
|
||||||
|
|
||||||
|
if [[ -z "${archive_dir}" || ! -d "${archive_dir}" ]]; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
shopt -s nullglob
|
||||||
|
local archives=(
|
||||||
|
"${archive_dir}"/*"${IMAGE_TAG}"*.tar
|
||||||
|
"${archive_dir}"/*"${IMAGE_TAG}"*.tar.gz
|
||||||
|
"${archive_dir}"/*"${IMAGE_TAG}"*.tgz
|
||||||
|
)
|
||||||
|
shopt -u nullglob
|
||||||
|
|
||||||
|
[[ ${#archives[@]} -gt 0 ]]
|
||||||
|
}
|
||||||
|
|
||||||
|
should_fetch_release_archive_through_vpn() {
|
||||||
|
if [[ "${IMAGE_ARCHIVE_DISABLED:-false}" == "true" || "${IMAGE_ARCHIVE_DISABLED:-0}" == "1" ]]; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "${fetch_through_vpn}" -eq 1 ]]; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "${IMAGE_ARCHIVE_REQUIRED:-false}" != "true" && "${IMAGE_ARCHIVE_REQUIRED:-0}" != "1" ]]; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -z "${VPN_CONTAINER:-}" ]]; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
! release_archive_exists
|
||||||
|
}
|
||||||
|
|
||||||
normalize_archive_dir() {
|
normalize_archive_dir() {
|
||||||
if [[ -z "${IMAGE_ARCHIVE_DIR:-}" ]]; then
|
if [[ -z "${IMAGE_ARCHIVE_DIR:-}" ]]; then
|
||||||
return 0
|
return 0
|
||||||
|
|||||||
Reference in New Issue
Block a user