diff --git a/.bumpversion.cfg b/.bumpversion.cfg index d2352e4..2f83378 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 0.7.11 +current_version = 0.7.12 commit = True tag = True diff --git a/src/_podman.sh b/src/_podman.sh index c4be5df..05f796d 100644 --- a/src/_podman.sh +++ b/src/_podman.sh @@ -139,7 +139,7 @@ function plextrac_install_podman() { mod_start # this doesn't re-run migrations run_cb_migrations fi - + mod_info info "Post installation note:" log "If you wish to have access to historical logs, you can configure docker to send logs to journald." @@ -173,7 +173,7 @@ function plextrac_start_podman() { fi serviceValues[migrations-env_vars]="-e COUCHBASE_URL=${COUCHBASE_URL:-http://plextracdb} -e CB_API_PASS=${CB_API_PASS} -e CB_API_USER=${CB_API_USER} -e REDIS_CONNECTION_STRING=${REDIS_CONNECTION_STRING:-redis} -e REDIS_PASSWORD=${REDIS_PASSWORD:?err} -e PG_HOST=${PG_HOST:-postgres} -e PG_MIGRATE_PATH=/usr/src/plextrac-api -e PG_SUPER_USER=${POSTGRES_USER:?err} -e PG_SUPER_PASSWORD=${POSTGRES_PASSWORD:?err} -e PG_CORE_ADMIN_PASSWORD=${PG_CORE_ADMIN_PASSWORD:?err} -e PG_CORE_ADMIN_USER=${PG_CORE_ADMIN_USER:?err} -e PG_CORE_DB=${PG_CORE_DB:?err} -e PG_RUNBOOKS_ADMIN_PASSWORD=${PG_RUNBOOKS_ADMIN_PASSWORD:?err} -e PG_RUNBOOKS_ADMIN_USER=${PG_RUNBOOKS_ADMIN_USER:?err} -e PG_RUNBOOKS_RW_PASSWORD=${PG_RUNBOOKS_RW_PASSWORD:?err} -e PG_RUNBOOKS_RW_USER=${PG_RUNBOOKS_RW_USER:?err} -e PG_RUNBOOKS_DB=${PG_RUNBOOKS_DB:?err} -e PG_CKEDITOR_ADMIN_PASSWORD=${PG_CKEDITOR_ADMIN_PASSWORD:?err} -e PG_CKEDITOR_ADMIN_USER=${PG_CKEDITOR_ADMIN_USER:?err} -e PG_CKEDITOR_DB=${PG_CKEDITOR_DB:?err} -e PG_CKEDITOR_RO_PASSWORD=${PG_CKEDITOR_RO_PASSWORD:?err} -e PG_CKEDITOR_RO_USER=${PG_CKEDITOR_RO_USER:?err} -e PG_CKEDITOR_RW_PASSWORD=${PG_CKEDITOR_RW_PASSWORD:?err} -e PG_CKEDITOR_RW_USER=${PG_CKEDITOR_RW_USER:?err} -e PG_TENANTS_WRITE_MODE=${PG_TENANTS_WRITE_MODE:-couchbase_only} -e PG_TENANTS_READ_MODE=${PG_TENANTS_READ_MODE:-couchbase_only} -e PG_CORE_RO_PASSWORD=${PG_CORE_RO_PASSWORD:?err} -e PG_CORE_RO_USER=${PG_CORE_RO_USER:?err} -e PG_CORE_RW_PASSWORD=${PG_CORE_RW_PASSWORD:?err} -e PG_CORE_RW_USER=${PG_CORE_RW_USER:?err} -e CKEDITOR_MIGRATE=${CKEDITOR_MIGRATE:-} -e CKEDITOR_SERVER_CONFIG=${CKEDITOR_SERVER_CONFIG:-}" serviceValues[ckeditor-backend-env_vars]="-e DATABASE_DATABASE=${PG_CKEDITOR_DB:?err} -e DATABASE_DRIVER=postgres -e DATABASE_HOST=postgres -e DATABASE_PASSWORD=${PG_CKEDITOR_ADMIN_PASSWORD:?err} -e DATABASE_POOL_CONNECTION_LIMIT=10 -e DATABASE_PORT=5432 -e DATABASE_SCHEMA=public -e DATABASE_USER=${PG_CKEDITOR_ADMIN_USER:?err} -e ENABLE_METRIC_LOGS=${CKEDITOR_ENABLE_METRIC_LOGS:-false} -e ENVIRONMENTS_MANAGEMENT_SECRET_KEY=${CKEDITOR_ENVIRONMENT_SECRET_KEY:-} -e LICENSE_KEY=${CKEDITOR_SERVER_LICENSE_KEY:-} -e LOG_LEVEL=${CKEDITOR_LOG_LEVEL:-} -e REDIS_CONNECTION_STRING=redis://redis:6379 -e REDIS_HOST=redis -e REDIS_PASSWORD=${REDIS_PASSWORD:?err}" - + if [ "${CKEDITOR_MIGRATE:-false}" == "true" ]; then serviceNames=("plextracdb" "postgres" "redis" "ckeditor-backend" "plextracapi" "notification-engine" "notification-sender" "contextual-scoring-service" "migrations" "plextracnginx") fi @@ -274,7 +274,7 @@ function podman_run_cb_migrations() { local image="${serviceValues[api-image]}" debug "Running migrations" - podman run ${serviceValues[env-file]} $env_vars --entrypoint='["/bin/sh","-c","npm run maintenance:enable && npm run pg:migrate && npm run db:migrate && npm run pg:etl up all && npm run maintenance:disable"]' --restart=no \ + podman run ${serviceValues[env-file]} $env_vars --entrypoint='["/bin/sh","-c","npm run maintenance:enable && npm run pg:superuser:bootstrap --if-present && npm run pg:migrate && npm run db:migrate && npm run pg:etl up all && npm run maintenance:disable"]' --restart=no \ $volumes:z --replace --name="migrations" ${serviceValues[network]} -d $image 1>/dev/null } diff --git a/src/_update.sh b/src/_update.sh index 1c36126..6047792 100644 --- a/src/_update.sh +++ b/src/_update.sh @@ -112,13 +112,13 @@ function mod_update() { fi else info "AIRGAPPED mode enabled, skipping image pull" + # podman needs to remove containers before attempting to start with updated containers + if [ "$CONTAINER_RUNTIME" == "podman" ]; then + title "Removing old podman containers" + podman_remove + fi fi - if [ "$CONTAINER_RUNTIME" == "podman" ]; then - title "Pulling latest container images" - podman_remove - podman_pull_images - fi mod_start || sleep 20 run_cb_migrations if [ "$CONTAINER_RUNTIME" == "podman" ]; then diff --git a/src/plextrac b/src/plextrac index c3e8546..c165096 100755 --- a/src/plextrac +++ b/src/plextrac @@ -1,7 +1,7 @@ #!/bin/bash set -Eeuo pipefail -VERSION=0.7.11 +VERSION=0.7.12 ## Podman Global Declaration Variable declare -A svcValues @@ -452,7 +452,7 @@ function run_cb_migrations() { fi for s in / - \\ \|; do local log="" - local container="" + local container="" container="$(container_client ps -a | grep migrations 2>/dev/null | awk '{print $1}')" log="$(container_client logs $container 2> /dev/null | tail -n 1 -q || true)" printf "\r\033[K%s %s -- %s" "$s" "$container" "$log"