Skip to content

Commit

Permalink
Merge pull request #165 from PlexTrac/mm/podman_bugfix
Browse files Browse the repository at this point in the history
remove duplicate podman pulls
  • Loading branch information
StevenPaugh authored Nov 26, 2024
2 parents 91d741f + 29713d1 commit 2a6c16b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.7.11
current_version = 0.7.12

commit = True
tag = True
Expand Down
6 changes: 3 additions & 3 deletions src/_podman.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
}

Expand Down
10 changes: 5 additions & 5 deletions src/_update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/plextrac
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash
set -Eeuo pipefail

VERSION=0.7.11
VERSION=0.7.12

## Podman Global Declaration Variable
declare -A svcValues
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit 2a6c16b

Please sign in to comment.