From b5d3a060f777f87299f993adc6f39e9c7685486f Mon Sep 17 00:00:00 2001 From: Frank Date: Sun, 26 Apr 2026 20:04:12 +0200 Subject: [PATCH] Deploy full import artifacts tree --- docs/vserver_docker_deploy.md | 17 +++++++++-------- scripts/deploy-vserver.sh | 10 ++++++++++ 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/docs/vserver_docker_deploy.md b/docs/vserver_docker_deploy.md index c2a11a2..7ad2d46 100644 --- a/docs/vserver_docker_deploy.md +++ b/docs/vserver_docker_deploy.md @@ -133,13 +133,14 @@ Or point at a different config file: 1. Publishes `src/RolemasterDb.App/RolemasterDb.App.csproj` in `Release`. 2. Precreates `publish/wwwroot/components/layout` and `publish/wwwroot/components/shared` before publish. This is required because the current project otherwise fails to publish two JavaScript static assets. -3. Bundles the publish output, `src/RolemasterDb.App/rolemaster.db`, and the runtime Dockerfile into `artifacts/deploy//`. - The publish output already includes `src/RolemasterDb.App/import-artifacts`, so those files are shipped as part of every release bundle. -4. Uploads the bundle to the vserver. -5. Extracts the bundle on the vserver. -6. Seeds `REMOTE_DATA_DIR/rolemaster.db` on first deploy only. -7. Builds the Docker image on the vserver. -8. Recreates the container with: +3. Replaces `publish/import-artifacts` with a full copy of `src/RolemasterDb.App/import-artifacts`. + This is required because the current publish output does not reliably include deep artifact folders such as `cells/` and `pages/`. +4. Bundles the publish output, `src/RolemasterDb.App/rolemaster.db`, and the runtime Dockerfile into `artifacts/deploy//`. +5. Uploads the bundle to the vserver. +6. Extracts the bundle on the vserver. +7. Seeds `REMOTE_DATA_DIR/rolemaster.db` on first deploy only. +8. Builds the Docker image on the vserver. +9. Recreates the container with: ```text --restart unless-stopped @@ -155,7 +156,7 @@ Running the same deploy command again will: - publish a fresh release bundle - upload a new timestamped release - keep the existing database in `REMOTE_DATA_DIR` -- keep the imported artifact files inside the image for that release +- keep the complete imported artifact tree inside the image for that release - rebuild the image and restart the container - leave the nginx config and TLS setup untouched diff --git a/scripts/deploy-vserver.sh b/scripts/deploy-vserver.sh index 0ba0aec..4f43f11 100755 --- a/scripts/deploy-vserver.sh +++ b/scripts/deploy-vserver.sh @@ -51,6 +51,7 @@ stage_dir="$artifact_root/stage" tarball_path="$artifact_root/${RELEASE_PREFIX}-${release_id}.tar.gz" publish_dir="$repo_root/src/RolemasterDb.App/bin/Release/net10.0/publish" seed_db_path="$repo_root/src/RolemasterDb.App/rolemaster.db" +import_artifacts_source_dir="$repo_root/src/RolemasterDb.App/import-artifacts" dockerfile_path="$repo_root/deploy/vserver.Dockerfile" project_path="$repo_root/src/RolemasterDb.App/RolemasterDb.App.csproj" remote_release_dir="$REMOTE_APP_DIR/releases/$release_id" @@ -67,6 +68,11 @@ if [[ ! -f "$dockerfile_path" ]]; then exit 1 fi +if [[ ! -d "$import_artifacts_source_dir" ]]; then + echo "Import artifacts directory not found: $import_artifacts_source_dir" >&2 + exit 1 +fi + mkdir -p "$artifact_root" echo "Opening shared SSH connection to $REMOTE_HOST..." @@ -85,6 +91,10 @@ mkdir -p \ env DOTNET_CLI_HOME="${DOTNET_CLI_HOME:-/tmp}" \ dotnet publish "$project_path" -c Release +echo "Copying full import-artifacts tree into publish output..." +rm -rf "$publish_dir/import-artifacts" +cp -a "$import_artifacts_source_dir" "$publish_dir/import-artifacts" + echo "Preparing deploy bundle..." rm -rf "$stage_dir" mkdir -p "$stage_dir/publish" "$stage_dir/seed"