Deploy full import artifacts tree

This commit is contained in:
2026-04-26 20:04:12 +02:00
parent 995316c8ca
commit b5d3a060f7
2 changed files with 19 additions and 8 deletions

View File

@@ -133,13 +133,14 @@ Or point at a different config file:
1. Publishes `src/RolemasterDb.App/RolemasterDb.App.csproj` in `Release`. 1. Publishes `src/RolemasterDb.App/RolemasterDb.App.csproj` in `Release`.
2. Precreates `publish/wwwroot/components/layout` and `publish/wwwroot/components/shared` before publish. 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. 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/<release-id>/`. 3. Replaces `publish/import-artifacts` with a full copy of `src/RolemasterDb.App/import-artifacts`.
The publish output already includes `src/RolemasterDb.App/import-artifacts`, so those files are shipped as part of every release bundle. This is required because the current publish output does not reliably include deep artifact folders such as `cells/` and `pages/`.
4. Uploads the bundle to the vserver. 4. Bundles the publish output, `src/RolemasterDb.App/rolemaster.db`, and the runtime Dockerfile into `artifacts/deploy/<release-id>/`.
5. Extracts the bundle on the vserver. 5. Uploads the bundle to the vserver.
6. Seeds `REMOTE_DATA_DIR/rolemaster.db` on first deploy only. 6. Extracts the bundle on the vserver.
7. Builds the Docker image on the vserver. 7. Seeds `REMOTE_DATA_DIR/rolemaster.db` on first deploy only.
8. Recreates the container with: 8. Builds the Docker image on the vserver.
9. Recreates the container with:
```text ```text
--restart unless-stopped --restart unless-stopped
@@ -155,7 +156,7 @@ Running the same deploy command again will:
- publish a fresh release bundle - publish a fresh release bundle
- upload a new timestamped release - upload a new timestamped release
- keep the existing database in `REMOTE_DATA_DIR` - 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 - rebuild the image and restart the container
- leave the nginx config and TLS setup untouched - leave the nginx config and TLS setup untouched

View File

@@ -51,6 +51,7 @@ stage_dir="$artifact_root/stage"
tarball_path="$artifact_root/${RELEASE_PREFIX}-${release_id}.tar.gz" tarball_path="$artifact_root/${RELEASE_PREFIX}-${release_id}.tar.gz"
publish_dir="$repo_root/src/RolemasterDb.App/bin/Release/net10.0/publish" publish_dir="$repo_root/src/RolemasterDb.App/bin/Release/net10.0/publish"
seed_db_path="$repo_root/src/RolemasterDb.App/rolemaster.db" 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" dockerfile_path="$repo_root/deploy/vserver.Dockerfile"
project_path="$repo_root/src/RolemasterDb.App/RolemasterDb.App.csproj" project_path="$repo_root/src/RolemasterDb.App/RolemasterDb.App.csproj"
remote_release_dir="$REMOTE_APP_DIR/releases/$release_id" remote_release_dir="$REMOTE_APP_DIR/releases/$release_id"
@@ -67,6 +68,11 @@ if [[ ! -f "$dockerfile_path" ]]; then
exit 1 exit 1
fi 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" mkdir -p "$artifact_root"
echo "Opening shared SSH connection to $REMOTE_HOST..." echo "Opening shared SSH connection to $REMOTE_HOST..."
@@ -85,6 +91,10 @@ mkdir -p \
env DOTNET_CLI_HOME="${DOTNET_CLI_HOME:-/tmp}" \ env DOTNET_CLI_HOME="${DOTNET_CLI_HOME:-/tmp}" \
dotnet publish "$project_path" -c Release 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..." echo "Preparing deploy bundle..."
rm -rf "$stage_dir" rm -rf "$stage_dir"
mkdir -p "$stage_dir/publish" "$stage_dir/seed" mkdir -p "$stage_dir/publish" "$stage_dir/seed"