mirror of
https://github.com/azaion/admin.git
synced 2026-06-21 18:01:10 +00:00
c7b297de83
- Deleted the deploy.cmd script as it was no longer needed. - Updated Dockerfile to include curl for health checks and added a non-root user for improved security. - Modified health check command to use curl for better reliability. - Adjusted docker-compose.test.yml to reflect changes in health check configuration. - Cleaned up appsettings.json and removed unused configuration properties. - Removed Resource entity and related requests from the codebase as part of the architectural shift. - Updated documentation to reflect the removal of hardware binding and related endpoints. Co-authored-by: Cursor <cursoragent@cursor.com>
60 lines
2.1 KiB
Bash
Executable File
60 lines
2.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# scripts/start-services.sh — `docker run` the API with the env overlay
|
|
# materialized into a temp file. Bind mounts come from DEPLOY_HOST_*.
|
|
|
|
set -euo pipefail
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
. "$SCRIPT_DIR/_lib.sh"
|
|
|
|
usage() {
|
|
cat <<'EOF'
|
|
Usage: ./scripts/start-services.sh [--help]
|
|
|
|
Reads from the environment (deploy.sh sets these):
|
|
REGISTRY_HOST, REGISTRY_IMAGE, REGISTRY_TAG
|
|
DEPLOY_CONTAINER_NAME, DEPLOY_HOST_PORT
|
|
DEPLOY_HOST_CONTENT_DIR, DEPLOY_HOST_LOGS_DIR
|
|
ASPNETCORE_ENVIRONMENT, ASPNETCORE_URLS
|
|
ASPNETCORE_ConnectionStrings__AzaionDb / __AzaionDbAdmin
|
|
ASPNETCORE_JwtConfig__Secret
|
|
ASPNETCORE_ResourcesConfig__* (defaults from appsettings.json if unset)
|
|
EOF
|
|
}
|
|
|
|
[[ "${1:-}" == "--help" || "${1:-}" == "-h" ]] && { usage; exit 0; }
|
|
|
|
require_env \
|
|
REGISTRY_HOST REGISTRY_IMAGE REGISTRY_TAG \
|
|
DEPLOY_CONTAINER_NAME DEPLOY_HOST_PORT \
|
|
DEPLOY_HOST_CONTENT_DIR DEPLOY_HOST_LOGS_DIR \
|
|
ASPNETCORE_ConnectionStrings__AzaionDb \
|
|
ASPNETCORE_ConnectionStrings__AzaionDbAdmin \
|
|
ASPNETCORE_JwtConfig__Secret
|
|
require_cmd docker
|
|
|
|
IMAGE="$REGISTRY_HOST/$REGISTRY_IMAGE:$REGISTRY_TAG"
|
|
|
|
# Materialize an env file for `docker run --env-file`. We pass only the
|
|
# ASPNETCORE_* + AZAION_* variables — registry / deploy host vars stay on the
|
|
# host, never in the container.
|
|
ENV_FILE="$(mktemp -t azaion-runtime-env.XXXXXX)"
|
|
chmod 600 "$ENV_FILE"
|
|
trap 'rm -f "$ENV_FILE"' EXIT INT TERM
|
|
|
|
env | grep -E '^(ASPNETCORE_|AZAION_)' > "$ENV_FILE" || true
|
|
|
|
mkdir -p "$DEPLOY_HOST_CONTENT_DIR" "$DEPLOY_HOST_LOGS_DIR"
|
|
|
|
log_info "Starting $DEPLOY_CONTAINER_NAME from $IMAGE on host port $DEPLOY_HOST_PORT"
|
|
docker run --detach \
|
|
--name "$DEPLOY_CONTAINER_NAME" \
|
|
--restart unless-stopped \
|
|
--env-file "$ENV_FILE" \
|
|
--publish "$DEPLOY_HOST_PORT:8080" \
|
|
--volume "$DEPLOY_HOST_CONTENT_DIR:/app/Content" \
|
|
--volume "$DEPLOY_HOST_LOGS_DIR:/app/logs" \
|
|
"$IMAGE" >/dev/null
|
|
|
|
log_info "Container ID: $(docker container inspect -f '{{.Id}}' "$DEPLOY_CONTAINER_NAME" | cut -c1-12)"
|
|
log_info "Running revision label: $(current_image_revision "$DEPLOY_CONTAINER_NAME")"
|