diff --git a/components/applications-service/habitat/hooks/run b/components/applications-service/habitat/hooks/run index bf17cf8bf2e..b7ea831891d 100644 --- a/components/applications-service/habitat/hooks/run +++ b/components/applications-service/habitat/hooks/run @@ -11,12 +11,9 @@ exec 2>&1 # We do this here because init hooks block the hab supervisor DBNAME="{{cfg.storage.database}}" if [ ! -f /hab/.skip_migration ]; then - echo "/hab/.skip_migration does not exist, running pg-helper command $(pwd)/$0 at $LINENO" pg-helper ensure-service-database "$DBNAME" pg-helper create-extension "$DBNAME" "pgcrypto" pg-helper fix-permissions "$DBNAME" -else - echo "/hab/.skip_migration does exist, skipping pg-helper" fi # cleanup old migration files diff --git a/components/authn-service/habitat/hooks/run b/components/authn-service/habitat/hooks/run index 38a38b3671e..9c9e66c196f 100644 --- a/components/authn-service/habitat/hooks/run +++ b/components/authn-service/habitat/hooks/run @@ -7,12 +7,9 @@ exec 2>&1 {{pkgPathFor "chef/mlsa"}}/bin/accept {{cfg.mlsa.accept}} if [ ! -f /hab/.skip_migration ]; then - echo "/hab/.skip_migration does not exist, running pg-helper command $(pwd)/$0 at $LINENO" pg-helper ensure-service-database "{{cfg.storage.database}}" pg-helper create-extension "{{cfg.storage.database}}" "pgcrypto" -else - echo "/hab/.skip_migration does exist, skipping pg-helper" fi diff --git a/components/authz-service/habitat/hooks/run b/components/authz-service/habitat/hooks/run index b7035296913..7a1120cf7f0 100644 --- a/components/authz-service/habitat/hooks/run +++ b/components/authz-service/habitat/hooks/run @@ -7,13 +7,10 @@ exec 2>&1 {{pkgPathFor "chef/mlsa"}}/bin/accept {{cfg.mlsa.accept}} if [ ! -f /hab/.skip_migration ]; then - echo "/hab/.skip_migration does not exist, running pg-helper command $(pwd)/$0 at $LINENO" pg-helper ensure-service-database "{{cfg.storage.database}}" pg-helper create-extension "{{cfg.storage.database}}" "pgcrypto" pg-helper create-extension "{{cfg.storage.database}}" "uuid-ossp" -else - echo "/hab/.skip_migration does exist, skipping pg-helper" fi # cleanup old migration files rm -rf {{pkg.svc_static_path}}/{migrations,data-migrations} diff --git a/components/automate-builder-api/habitat/hooks/run b/components/automate-builder-api/habitat/hooks/run index 3f226310d65..066c14186ef 100644 --- a/components/automate-builder-api/habitat/hooks/run +++ b/components/automate-builder-api/habitat/hooks/run @@ -19,12 +19,9 @@ render-template config.toml "{{pkg.svc_var_path}}/etc/config.toml" \ export DBNAME="{{cfg.datastore.database}}" export USERNAME="{{cfg.datastore.user}}" if [ ! -f /hab/.skip_migration ]; then - echo "/hab/.skip_migration does not exist, running pg-helper command $(pwd)/$0 at $LINENO" pg-helper ensure-service-database "$DBNAME" pg-helper fix-permissions "$USERNAME" pg-helper alter-role --superuser=true "$USERNAME" -else - echo "/hab/.skip_migration does exist, skipping pg-helper" fi if ! ls {{pkg.svc_data_path}}/keys/bldr-*; then diff --git a/components/automate-cs-bookshelf/habitat/hooks/run b/components/automate-cs-bookshelf/habitat/hooks/run index d43cb9ca8b7..6fb13ed3883 100644 --- a/components/automate-cs-bookshelf/habitat/hooks/run +++ b/components/automate-cs-bookshelf/habitat/hooks/run @@ -19,14 +19,11 @@ mkdir -p "{{pkg.svc_var_path}}/etc" render-template sqerl.config "{{pkg.svc_var_path}}/etc/sqerl.config" if [ ! -f /hab/.skip_migration ]; then - echo "/hab/.skip_migration does not exist, running pg-helper command $(pwd)/$0 at $LINENO" pg-helper rename-if-exists bookshelf "$DBNAME" pg-helper ensure-service-database "$DBNAME" pg-helper create-extension "$DBNAME" "uuid-ossp" pg-helper sqitch-deploy "$DBNAME" "{{pkgPathFor "chef/bookshelf"}}/schema" pg-helper fix-permissions "$DBNAME" -else - echo "/hab/.skip_migration does exist, skipping pg-helper" fi diff --git a/components/automate-cs-oc-bifrost/habitat/hooks/run b/components/automate-cs-oc-bifrost/habitat/hooks/run index 5f292e6dd80..b1acae46e44 100644 --- a/components/automate-cs-oc-bifrost/habitat/hooks/run +++ b/components/automate-cs-oc-bifrost/habitat/hooks/run @@ -19,14 +19,11 @@ mkdir -p "{{pkg.svc_var_path}}/etc" render-template sqerl.config "{{pkg.svc_var_path}}/etc/sqerl.config" if [ ! -f /hab/.skip_migration ]; then - echo "/hab/.skip_migration does not exist, running pg-helper command $(pwd)/$0 at $LINENO" pg-helper rename-if-exists bifrost "$DBNAME" pg-helper ensure-service-database "$DBNAME" pg-helper create-extension "$DBNAME" "uuid-ossp" pg-helper sqitch-deploy "$DBNAME" "{{pkgPathFor "chef/oc_bifrost"}}/schema/" pg-helper fix-permissions "$DBNAME" -else - echo "/hab/.skip_migration does exist, skipping pg-helper" fi diff --git a/components/automate-cs-oc-erchef/habitat/hooks/run b/components/automate-cs-oc-erchef/habitat/hooks/run index f862b992baf..742bdd53463 100644 --- a/components/automate-cs-oc-erchef/habitat/hooks/run +++ b/components/automate-cs-oc-erchef/habitat/hooks/run @@ -22,15 +22,12 @@ render-template sqerl.config "{{pkg.svc_var_path}}/etc/sqerl.config" render-template pg.env "{{pkg.svc_var_path}}/etc/pg.env" if [ ! -f /hab/.skip_migration ]; then - echo "/hab/.skip_migration does not exist, running pg-helper command" pg-helper rename-if-exists opscode_chef "$DBNAME" pg-helper ensure-service-database "$DBNAME" pg-helper create-extension "$DBNAME" "uuid-ossp" pg-helper sqitch-deploy "$DBNAME" "{{pkgPathFor "chef/oc_erchef"}}/schema/baseline" pg-helper sqitch-deploy "$DBNAME" "{{pkgPathFor "chef/oc_erchef"}}/schema/" pg-helper fix-permissions "$DBNAME" -else - echo "/hab/.skip_migration does exist, skipping pg-helper" fi # chef_server_data_bootstrap relies on the webui keys so create that first diff --git a/components/automate-cs-ocid/habitat/hooks/run b/components/automate-cs-ocid/habitat/hooks/run index 1145ccc0b5e..ddc5367fb52 100644 --- a/components/automate-cs-ocid/habitat/hooks/run +++ b/components/automate-cs-ocid/habitat/hooks/run @@ -21,13 +21,10 @@ export DBNAME="{{cfg.sql.db_name}}" mkdir -p "{{pkg.svc_var_path}}/etc" render-template pg.env "{{pkg.svc_var_path}}/etc/pg.env" if [ ! -f /hab/.skip_migration ]; then - echo "/hab/.skip_migration does not exist, running pg-helper command $(pwd)/$0 at $LINENO" pg-helper rename-if-exists oc_id "$DBNAME" pg-helper ensure-service-database "$DBNAME" pg-helper create-extension "$DBNAME" "uuid-ossp" pg-helper fix-permissions "$DBNAME" -else - echo "/hab/.skip_migration does exist, skipping pg-helper" fi source "{{pkg.svc_var_path}}/etc/pg.env" diff --git a/components/automate-dex/habitat/hooks/run b/components/automate-dex/habitat/hooks/run index 3f19125ae33..bcca8c5bda3 100644 --- a/components/automate-dex/habitat/hooks/run +++ b/components/automate-dex/habitat/hooks/run @@ -17,11 +17,8 @@ mkdir -p {{pkg.svc_var_path}}/etc render-template config.yml {{pkg.svc_var_path}}/etc/config.yml --conf {{pkg.svc_config_path}}/config.json if [ ! -f /hab/.skip_migration ]; then - echo "/hab/.skip_migration does not exist, running pg-helper command $(pwd)/$0 at $LINENO" pg-helper ensure-service-database "{{cfg.storage.database}}" pg-helper create-extension "{{cfg.storage.database}}" "pgcrypto" -else - echo "/hab/.skip_migration does exist, skipping pg-helper" fi diff --git a/components/automate-workflow-server/habitat/hooks/run b/components/automate-workflow-server/habitat/hooks/run index 7362039e7da..fc58d0808f0 100644 --- a/components/automate-workflow-server/habitat/hooks/run +++ b/components/automate-workflow-server/habitat/hooks/run @@ -81,7 +81,6 @@ fi mkdir -p "{{pkg.svc_var_path}}/etc" render-template sqerl.config "{{pkg.svc_var_path}}/etc/sqerl.config" if [ ! -f /hab/.skip_migration ]; then - echo "/hab/.skip_migration does not exist, running pg-helper command $(pwd)/$0 at $LINENO" pg-helper migrate-tables delivery "$DBNAME" "$DBUSER" pg-helper ensure-service-database "$DBNAME" "$DBUSER" @@ -94,8 +93,6 @@ if [ ! -f /hab/.skip_migration ]; then pg-helper create-extension "$DBNAME" "uuid-ossp" pg-helper sqitch-deploy "$DBNAME" "{{pkg.path}}/schema" pg-helper fix-permissions "$DBNAME" "$DBUSER" -else - echo "/hab/.skip_migration does exist, skipping pg-helper" fi diff --git a/components/cereal-service/habitat/hooks/run b/components/cereal-service/habitat/hooks/run index 760eff7aa9f..4ed2dcf6e92 100644 --- a/components/cereal-service/habitat/hooks/run +++ b/components/cereal-service/habitat/hooks/run @@ -5,10 +5,7 @@ exec 2>&1 # Call the script to block until user accepts the MLSA via the package's config {{pkgPathFor "chef/mlsa"}}/bin/accept {{cfg.mlsa.accept}} if [ ! -f /hab/.skip_migration ]; then - echo "/hab/.skip_migration does not exist, running pg-helper command $(pwd)/$0 at $LINENO" pg-helper ensure-service-database "chef_cereal_service" -else - echo "/hab/.skip_migration does exist, skipping pg-helper" fi diff --git a/components/compliance-service/habitat/hooks/run b/components/compliance-service/habitat/hooks/run index 2476e09cb75..10e11423cb8 100644 --- a/components/compliance-service/habitat/hooks/run +++ b/components/compliance-service/habitat/hooks/run @@ -21,7 +21,6 @@ export DBNAME="{{cfg.storage.database}}" export DBUSER="{{cfg.storage.user}}" if [ ! -f /hab/.skip_migration ]; then - echo "/hab/.skip_migration does not exist, running pg-helper command $(pwd)/$0 at $LINENO" # Migrate from A1's delivery database if it's present pg-helper migrate-tables-v2 delivery "$DBNAME" \ agents node_managers results profiles tags jobs jobs_nodes jobs_profiles \ @@ -32,9 +31,6 @@ if [ ! -f /hab/.skip_migration ]; then pg-helper create-extension "$DBNAME" pgcrypto pg-helper fix-permissions "$DBNAME" -else - - echo "/hab/.skip_migration does exist, skipping pg-helper" fi mkdir -p "{{pkg.svc_data_path}}/profiles" diff --git a/components/config-mgmt-service/habitat/hooks/run b/components/config-mgmt-service/habitat/hooks/run index d8994ae223f..337e6b49027 100755 --- a/components/config-mgmt-service/habitat/hooks/run +++ b/components/config-mgmt-service/habitat/hooks/run @@ -9,12 +9,9 @@ exec 2>&1 # We do this here because init hooks block the hab supervisor DBNAME="{{cfg.storage.database}}" if [ ! -f /hab/.skip_migration ]; then - echo "/hab/.skip_migration does not exist, running pg-helper command $(pwd)/$0 at $LINENO" pg-helper ensure-service-database "$DBNAME" pg-helper create-extension "$DBNAME" "pgcrypto" pg-helper fix-permissions "$DBNAME" -else - echo "/hab/.skip_migration does exist, skipping pg-helper" fi # Start our service diff --git a/components/data-feed-service/habitat/hooks/run b/components/data-feed-service/habitat/hooks/run index c96589d5b0e..45e9439edd0 100644 --- a/components/data-feed-service/habitat/hooks/run +++ b/components/data-feed-service/habitat/hooks/run @@ -9,10 +9,7 @@ export DBNAME="{{cfg.storage.database}}" {{pkgPathFor "chef/mlsa"}}/bin/accept {{cfg.mlsa.accept}} if [ ! -f /hab/.skip_migration ]; then - echo "/hab/.skip_migration does not exist, running pg-helper command $(pwd)/$0 at $LINENO" pg-helper ensure-service-database "$DBNAME" || exit 1 -else - echo "/hab/.skip_migration does exist, skipping pg-helper" fi diff --git a/components/infra-proxy-service/habitat/hooks/run b/components/infra-proxy-service/habitat/hooks/run index c766b75c630..18272ca6604 100644 --- a/components/infra-proxy-service/habitat/hooks/run +++ b/components/infra-proxy-service/habitat/hooks/run @@ -7,15 +7,12 @@ exec 2>&1 {{pkgPathFor "chef/mlsa"}}/bin/accept {{cfg.mlsa.accept}} if [ ! -f /hab/.skip_migration ]; then - echo "/hab/.skip_migration does not exist, running pg-helper command $(pwd)/$0 at $LINENO" echo "Creating database" pg-helper ensure-service-database "{{cfg.storage.database}}" echo "Creating extension" pg-helper create-extension "{{cfg.storage.database}}" "pgcrypto" pg-helper create-extension "{{cfg.storage.database}}" "uuid-ossp" -else - echo "/hab/.skip_migration does exist, skipping pg-helper" fi diff --git a/components/ingest-service/habitat/hooks/run b/components/ingest-service/habitat/hooks/run index 885e5699fed..32f1e843b74 100644 --- a/components/ingest-service/habitat/hooks/run +++ b/components/ingest-service/habitat/hooks/run @@ -121,10 +121,7 @@ CONFIG="$CONFIG --event-feed-address 127.0.0.1:{{service.cfg.port}}" {{~/eachAlive}} if [ ! -f /hab/.skip_migration ]; then - echo "/hab/.skip_migration does not exist, running pg-helper command $(pwd)/$0 at $LINENO" pg-helper ensure-service-database "$DBNAME" -else - echo "/hab/.skip_migration does exist, skipping pg-helper" fi diff --git a/components/license-control-service/habitat/hooks/run b/components/license-control-service/habitat/hooks/run index 9f8db276e79..6a6af54e5d2 100644 --- a/components/license-control-service/habitat/hooks/run +++ b/components/license-control-service/habitat/hooks/run @@ -8,10 +8,7 @@ exec 2>&1 {{pkgPathFor "chef/mlsa"}}/bin/accept {{cfg.mlsa.accept}} if [ ! -f /hab/.skip_migration ]; then - echo "/hab/.skip_migration does not exist, running pg-helper command $(pwd)/$0 at $LINENO" pg-helper ensure-service-database chef_license_control_service -else - echo "/hab/.skip_migration does exist, skipping pg-helper" fi diff --git a/components/nodemanager-service/habitat/hooks/run b/components/nodemanager-service/habitat/hooks/run index 0b3ec2db026..c579818c0a3 100644 --- a/components/nodemanager-service/habitat/hooks/run +++ b/components/nodemanager-service/habitat/hooks/run @@ -14,10 +14,7 @@ source {{pkg.svc_config_path}}/migration.sh trigger_migrations if [ ! -f /hab/.skip_migration ]; then - echo "/hab/.skip_migration does not exist, running pg-helper command $(pwd)/$0 at $LINENO" pg-helper ensure-service-database "$DBNAME" || exit 1 -else - echo "/hab/.skip_migration does exist, skipping pg-helper" fi # cleanup old migration files diff --git a/components/notifications-service/habitat/hooks/run b/components/notifications-service/habitat/hooks/run index a4d84258d2b..af0b91036fe 100644 --- a/components/notifications-service/habitat/hooks/run +++ b/components/notifications-service/habitat/hooks/run @@ -16,11 +16,8 @@ render-template pg-env "{{pkg.svc_var_path}}/etc/pg-env" source "{{pkg.svc_var_path}}/etc/pg-env" if [ ! -f /hab/.skip_migration ]; then - echo "/hab/.skip_migration does not exist, running pg-helper command $(pwd)/$0 at $LINENO" pg-helper ensure-service-database "notifications_service" pg-helper create-extension "notifications_service" "pgcrypto" -else - echo "/hab/.skip_migration does exist, skipping pg-helper" fi diff --git a/components/notifications-service2/habitat/hooks/run b/components/notifications-service2/habitat/hooks/run index 63f717ceabe..9e6b10b53a3 100644 --- a/components/notifications-service2/habitat/hooks/run +++ b/components/notifications-service2/habitat/hooks/run @@ -8,11 +8,8 @@ exec 2>&1 {{pkgPathFor "chef/mlsa"}}/bin/accept {{cfg.mlsa.accept}} if [ ! -f /hab/.skip_migration ]; then - echo "/hab/.skip_migration does not exist, running pg-helper command $(pwd)/$0 at $LINENO" pg-helper ensure-service-database "notifications_service" pg-helper create-extension "notifications_service" "pgcrypto" -else - echo "/hab/.skip_migration does exist, skipping pg-helper" fi source {{pkg.svc_config_path}}/init_proxy diff --git a/components/report-manager-service/habitat/hooks/run b/components/report-manager-service/habitat/hooks/run index 8a424d60be3..be242f043d1 100644 --- a/components/report-manager-service/habitat/hooks/run +++ b/components/report-manager-service/habitat/hooks/run @@ -6,12 +6,9 @@ exec 2>&1 {{pkgPathFor "chef/mlsa"}}/bin/accept {{cfg.mlsa.accept}} if [ ! -f /hab/.skip_migration ]; then - echo "/hab/.skip_migration does not exist, running pg-helper command $(pwd)/$0 at $LINENO" pg-helper ensure-service-database "{{cfg.storage.database}}" pg-helper create-extension "{{cfg.storage.database}}" "pgcrypto" pg-helper fix-permissions "{{cfg.storage.database}}" -else - echo "/hab/.skip_migration does exist, skipping pg-helper" fi # cleanup old migration files diff --git a/components/secrets-service/habitat/hooks/run b/components/secrets-service/habitat/hooks/run index 19a4ee7b4a6..afd3c738124 100644 --- a/components/secrets-service/habitat/hooks/run +++ b/components/secrets-service/habitat/hooks/run @@ -14,10 +14,7 @@ source {{pkg.svc_config_path}}/migration.sh trigger_migrations if [ ! -f /hab/.skip_migration ]; then - echo "/hab/.skip_migration does not exist, running pg-helper command $(pwd)/$0 at $LINENO" pg-helper ensure-service-database "$DBNAME" || exit 1 -else - echo "/hab/.skip_migration does exist, skipping pg-helper" fi # cleanup old migration files diff --git a/components/session-service/habitat/hooks/run b/components/session-service/habitat/hooks/run index b55b9e5f3a0..bf46de8216b 100644 --- a/components/session-service/habitat/hooks/run +++ b/components/session-service/habitat/hooks/run @@ -13,12 +13,9 @@ render-template config.yml "{{pkg.svc_var_path}}/etc/config.yml" \ --conf "{{pkg.svc_config_path}}/config.json" if [ ! -f /hab/.skip_migration ]; then - echo "/hab/.skip_migration does not exist, running pg-helper command $(pwd)/$0 at $LINENO" pg-helper ensure-service-database "{{cfg.storage.database}}" pg-helper create-extension "{{cfg.storage.database}}" "pgcrypto" -else - echo "/hab/.skip_migration does exist, skipping pg-helper" fi diff --git a/components/teams-service/habitat/hooks/run b/components/teams-service/habitat/hooks/run index 59d24ed4cb4..504a0ebf2b4 100644 --- a/components/teams-service/habitat/hooks/run +++ b/components/teams-service/habitat/hooks/run @@ -6,15 +6,12 @@ exec 2>&1 {{pkgPathFor "chef/mlsa"}}/bin/accept {{cfg.mlsa.accept}} if [ ! -f /hab/.skip_migration ]; then - echo "/hab/.skip_migration does not exist, running pg-helper command $(pwd)/$0 at $LINENO" echo "Creating database" pg-helper ensure-service-database "{{cfg.storage.database}}" echo "Creating extension" pg-helper create-extension "{{cfg.storage.database}}" "pgcrypto" pg-helper create-extension "{{cfg.storage.database}}" "uuid-ossp" -else - echo "/hab/.skip_migration does exist, skipping pg-helper" fi # cleanup old migration files diff --git a/components/user-settings-service/habitat/hooks/run b/components/user-settings-service/habitat/hooks/run index 7d8e79eb9fc..ffcba960017 100644 --- a/components/user-settings-service/habitat/hooks/run +++ b/components/user-settings-service/habitat/hooks/run @@ -12,12 +12,9 @@ exec 2>&1 DBNAME="{{cfg.storage.database}}" if [ ! -f /hab/.skip_migration ]; then - echo "/hab/.skip_migration does not exist, running pg-helper command $(pwd)/$0 at $LINENO" pg-helper ensure-service-database "$DBNAME" pg-helper create-extension "$DBNAME" "pgcrypto" pg-helper fix-permissions "$DBNAME" -else - echo "/hab/.skip_migration does exist, skipping pg-helper" fi # cleanup old migration files