Skip to content

Commit

Permalink
Merge pull request #165 from jembi/snake-code-minor-fixes
Browse files Browse the repository at this point in the history
Snake code for local vars + some minor fixes
  • Loading branch information
michaelloosen authored Oct 25, 2022
2 parents fac9dac + d94b198 commit 052fb59
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ configs:
file: ./fhir-enrich-reports.json
name: fhir-enrich-reports.json-${fhir_enrich_reports_json_DIGEST:?err}
labels:
name: elastic-search
name: elasticsearch
4 changes: 2 additions & 2 deletions analytics-datastore-elastic-search/swarm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import_elastic_index() {
log info "Importing Elasticsearch index mapping"
config::set_config_digests "${COMPOSE_FILE_PATH}"/importer/docker-compose.config.yml
try "docker stack deploy -c ${COMPOSE_FILE_PATH}/importer/docker-compose.config.yml instant" "Failed to start elastic search config importer"
config::remove_stale_service_configs "${COMPOSE_FILE_PATH}"/importer/docker-compose.config.yml "elastic-search"
config::remove_stale_service_configs "${COMPOSE_FILE_PATH}"/importer/docker-compose.config.yml "elasticsearch"
config::remove_config_importer elastic-search-config-importer
}

Expand Down Expand Up @@ -161,7 +161,7 @@ elif [[ "$ACTION" == "destroy" ]]; then
fi

docker::try_remove_volume es-data
docker::prune_configs "elastic-search"
docker::prune_configs "elasticsearch"
else
log error "Valid options are: init, up, down, or destroy"
fi
22 changes: 11 additions & 11 deletions client-registry-santempi/swarm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,34 +34,34 @@ await_postgres_start() {
main() {
if [ "${STATEFUL_NODES}" == "cluster" ]; then
log info "Running Client Registry SanteMPI package in Cluster node mode"
local POSTGRES_CLUSTER_COMPOSE_PARAM="-c ${COMPOSE_FILE_PATH}/docker-compose-postgres.cluster.yml"
local postgres_cluster_compose_param="-c ${COMPOSE_FILE_PATH}/docker-compose-postgres.cluster.yml"
else
log info "Running Client Registry SanteMPI package in Single node mode"
local POSTGRES_CLUSTER_COMPOSE_PARAM=""
local postgres_cluster_compose_param=""
fi

if [ "$MODE" == "dev" ]; then
log info "Running Client Registry SanteMPI package in DEV mode"
local POSTGRES_DEV_COMPOSE_PARAM="-c ${COMPOSE_FILE_PATH}/docker-compose-postgres.dev.yml"
local SANTE_MPI_DEV_COMPOSE_PARAM="-c ${COMPOSE_FILE_PATH}/docker-compose.dev.yml"
local postgres_dev_compose_param="-c ${COMPOSE_FILE_PATH}/docker-compose-postgres.dev.yml"
local sante_mpi_dev_compose_param="-c ${COMPOSE_FILE_PATH}/docker-compose.dev.yml"
else
log info "Running Client Registry SanteMPI package in PROD mode"
local POSTGRES_DEV_COMPOSE_PARAM=""
local SANTE_MPI_DEV_COMPOSE_PARAM=""
local postgres_dev_compose_param=""
local sante_mpi_dev_compose_param=""
fi

if [ "$ACTION" == "init" ]; then
try "docker stack deploy -c $COMPOSE_FILE_PATH/docker-compose-postgres.yml $POSTGRES_CLUSTER_COMPOSE_PARAM $POSTGRES_DEV_COMPOSE_PARAM instant" "Failed to deploy SanteMPI Postgres"
try "docker stack deploy -c $COMPOSE_FILE_PATH/docker-compose-postgres.yml $postgres_cluster_compose_param $postgres_dev_compose_param instant" "Failed to deploy SanteMPI Postgres"

await_postgres_start

try "docker stack deploy -c "$COMPOSE_FILE_PATH"/docker-compose.yml $SANTE_MPI_DEV_COMPOSE_PARAM instant" "Failed to deploy SanteMPI"
try "docker stack deploy -c ""$COMPOSE_FILE_PATH""/docker-compose.yml $sante_mpi_dev_compose_param instant" "Failed to deploy SanteMPI"
elif [ "$ACTION" == "up" ]; then
try "docker stack deploy -c $COMPOSE_FILE_PATH/docker-compose-postgres.yml $POSTGRES_CLUSTER_COMPOSE_PARAM $POSTGRES_DEV_COMPOSE_PARAM instant" "Failed to stand up SanteMPI Postgres"
try "docker stack deploy -c $COMPOSE_FILE_PATH/docker-compose-postgres.yml $postgres_cluster_compose_param $postgres_dev_compose_param instant" "Failed to stand up SanteMPI Postgres"

await_postgres_start

try "docker stack deploy -c "$COMPOSE_FILE_PATH"/docker-compose.yml $SANTE_MPI_DEV_COMPOSE_PARAM instant" "Failed to stand up SanteMPI"
try "docker stack deploy -c ""$COMPOSE_FILE_PATH""/docker-compose.yml $sante_mpi_dev_compose_param instant" "Failed to stand up SanteMPI"
elif [ "$ACTION" == "down" ]; then
try "docker service scale instant_santedb-mpi=0 instant_santempi-psql-1=0" "Failed to scale down santeMPI"

Expand All @@ -70,7 +70,7 @@ main() {
fi

elif [ "$ACTION" == "destroy" ]; then
docker::service_destroy santedb-www
docker::service_destroy santedb-www
docker::service_destroy santedb-mpi
docker::service_destroy santempi-psql-1
docker::try_remove_volume santedb-data
Expand Down
12 changes: 6 additions & 6 deletions data-mapper-logstash/swarm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ inject_pipeline_elastic_hosts() {

if [[ "$MODE" == "dev" ]]; then
log info "Running Data Mapper Logstash package in DEV mode"
LogstashDevComposeParam="-c ${COMPOSE_FILE_PATH}/docker-compose.dev.yml"
logstash_dev_compose_param="-c ${COMPOSE_FILE_PATH}/docker-compose.dev.yml"
else
log info "Running Data Mapper Logstash package in PROD mode"
LogstashDevComposeParam=""
logstash_dev_compose_param=""
fi

if [[ "$LOGSTASH_DEV_MOUNT" == "true" ]]; then
Expand All @@ -39,9 +39,9 @@ if [[ "$LOGSTASH_DEV_MOUNT" == "true" ]]; then
fi

log info "Running Data Mapper Logstash package with dev mount"
LogstashDevMountComposeParam="-c ${COMPOSE_FILE_PATH}/docker-compose.dev-mnt.yml"
logstash_dev_mount_compose_param="-c ${COMPOSE_FILE_PATH}/docker-compose.dev-mnt.yml"
else
LogstashDevMountComposeParam=""
logstash_dev_mount_compose_param=""
fi

if [[ "${ACTION}" == "init" ]] || [[ "${ACTION}" == "up" ]]; then
Expand All @@ -57,9 +57,9 @@ if [[ "${ACTION}" == "init" ]] || [[ "${ACTION}" == "up" ]]; then
config::set_config_digests "${COMPOSE_FILE_PATH}"/docker-compose.yml

config::generate_service_configs data-mapper-logstash /usr/share/logstash "${COMPOSE_FILE_PATH}/pipeline" "${COMPOSE_FILE_PATH}" logstash
LogstashTempComposeParam="-c ${COMPOSE_FILE_PATH}/docker-compose.tmp.yml"
logstash_temp_compose_param="-c ${COMPOSE_FILE_PATH}/docker-compose.tmp.yml"

try "docker stack deploy -c ${COMPOSE_FILE_PATH}/docker-compose.yml $LogstashDevComposeParam $LogstashDevMountComposeParam $LogstashTempComposeParam instant" "Failed to deploy Data Mapper Logstash"
try "docker stack deploy -c ${COMPOSE_FILE_PATH}/docker-compose.yml $logstash_dev_compose_param $logstash_dev_mount_compose_param $logstash_temp_compose_param instant" "Failed to deploy Data Mapper Logstash"

docker::await_container_startup data-mapper-logstash
docker::await_container_status data-mapper-logstash Running
Expand Down
20 changes: 10 additions & 10 deletions fhir-datastore-hapi-fhir/swarm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,34 +33,34 @@ await_postgres_start() {

if [ "${STATEFUL_NODES}" == "cluster" ]; then
log info "Running FHIR Datastore HAPI FHIR package in Cluster node mode"
postgresClusterComposeParam="-c ${COMPOSE_FILE_PATH}/docker-compose-postgres.cluster.yml"
postgres_cluster_compose_param="-c ${COMPOSE_FILE_PATH}/docker-compose-postgres.cluster.yml"
else
log info "Running FHIR Datastore HAPI FHIR package in Single node mode"
postgresClusterComposeParam=""
postgres_cluster_compose_param=""
fi

if [ "${MODE}" == "dev" ]; then
log info "Running FHIR Datastore HAPI FHIR package in DEV mode"
postgresDevComposeParam="-c ${COMPOSE_FILE_PATH}/docker-compose-postgres.dev.yml"
hapiFhirDevComposeParam="-c ${COMPOSE_FILE_PATH}/docker-compose.dev.yml"
postgres_dev_compose_param="-c ${COMPOSE_FILE_PATH}/docker-compose-postgres.dev.yml"
hapi_fhir_dev_compose_param="-c ${COMPOSE_FILE_PATH}/docker-compose.dev.yml"
else
log info "Running FHIR Datastore HAPI FHIR package in PROD mode"
postgresDevComposeParam=""
hapiFhirDevComposeParam=""
postgres_dev_compose_param=""
hapi_fhir_dev_compose_param=""
fi

if [ "${ACTION}" == "init" ]; then
try "docker stack deploy -c ${COMPOSE_FILE_PATH}/docker-compose-postgres.yml $postgresClusterComposeParam $postgresDevComposeParam instant" "Failed to deploy FHIR Datastore HAPI FHIR Postgres"
try "docker stack deploy -c ${COMPOSE_FILE_PATH}/docker-compose-postgres.yml $postgres_cluster_compose_param $postgres_dev_compose_param instant" "Failed to deploy FHIR Datastore HAPI FHIR Postgres"

await_postgres_start

try "docker stack deploy -c ${COMPOSE_FILE_PATH}/docker-compose.yml $hapiFhirDevComposeParam instant" "Failed to deploy FHIR Datastore HAPI FHIR"
try "docker stack deploy -c ${COMPOSE_FILE_PATH}/docker-compose.yml $hapi_fhir_dev_compose_param instant" "Failed to deploy FHIR Datastore HAPI FHIR"
elif [ "${ACTION}" == "up" ]; then
try "docker stack deploy -c ${COMPOSE_FILE_PATH}/docker-compose-postgres.yml $postgresClusterComposeParam $postgresDevComposeParam instant" "Failed to stand up hapi-fhir postgres"
try "docker stack deploy -c ${COMPOSE_FILE_PATH}/docker-compose-postgres.yml $postgres_cluster_compose_param $postgres_dev_compose_param instant" "Failed to stand up hapi-fhir postgres"

await_postgres_start

try "docker stack deploy -c ${COMPOSE_FILE_PATH}/docker-compose.yml $hapiFhirDevComposeParam instant" "Failed to stand up hapi-fhir"
try "docker stack deploy -c ${COMPOSE_FILE_PATH}/docker-compose.yml $hapi_fhir_dev_compose_param instant" "Failed to stand up hapi-fhir"
elif [ "${ACTION}" == "down" ]; then
try "docker service scale instant_hapi-fhir=0 instant_postgres-1=0" "Failed to scale down hapi-fhir"

Expand Down
5 changes: 3 additions & 2 deletions job-scheduler-ofelia/swarm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ COMPOSE_FILE_PATH=$(
)
readonly COMPOSE_FILE_PATH

# Import libraries
ROOT_PATH="${COMPOSE_FILE_PATH}/.."
readonly ROOT_PATH

. "${ROOT_PATH}/utils/config-utils.sh"
. "${ROOT_PATH}/utils/docker-utils.sh"
. "${ROOT_PATH}/utils/log.sh"
Expand All @@ -29,6 +28,8 @@ main() {
try "docker service scale instant_job-scheduler-ofelia=0" "Failed to scale down job-scheduler-ofelia"
elif [[ "${ACTION}" == "destroy" ]]; then
docker::service_destroy job-scheduler-ofelia

docker::prune_configs "ofelia"
else
log error "Valid options are: init, up, down, or destroy"
fi
Expand Down
11 changes: 5 additions & 6 deletions message-bus-kafka/swarm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,26 @@ ROOT_PATH="${COMPOSE_FILE_PATH}/.."
. "${ROOT_PATH}/utils/docker-utils.sh"
. "${ROOT_PATH}/utils/log.sh"


if [[ $STATEFUL_NODES == "cluster" ]]; then
log info "Running Message Bus Kafka package in Cluster node mode"
kafkaClusterComposeParam="-c ${COMPOSE_FILE_PATH}/docker-compose.cluster.yml"
kafka_cluster_compose_param="-c ${COMPOSE_FILE_PATH}/docker-compose.cluster.yml"
else
log info "Running Message Bus Kafka package in Single node mode"
kafkaClusterComposeParam=""
kafka_cluster_compose_param=""
fi

if [[ "${MODE}" == "dev" ]]; then
log info "Running Message Bus Kafka package in DEV mode"
kafkaDevComposeParam="-c ${COMPOSE_FILE_PATH}/docker-compose.dev.yml"
kafka_dev_compose_param="-c ${COMPOSE_FILE_PATH}/docker-compose.dev.yml"
else
log info "Running Message Bus Kafka package in PROD mode"
kafkaDevComposeParam=""
kafka_dev_compose_param=""
fi

if [[ "${ACTION}" == "init" ]] || [[ "${ACTION}" == "up" ]]; then
config::set_config_digests "${COMPOSE_FILE_PATH}"/importer/docker-compose.config.yml

try "docker stack deploy -c ${COMPOSE_FILE_PATH}/docker-compose.yml $kafkaClusterComposeParam $kafkaDevComposeParam instant" "Failed to deploy Message Bus Kafka"
try "docker stack deploy -c ${COMPOSE_FILE_PATH}/docker-compose.yml $kafka_cluster_compose_param $kafka_dev_compose_param instant" "Failed to deploy Message Bus Kafka"

config::await_service_running "kafka" "${COMPOSE_FILE_PATH}"/docker-compose.await-helper.yml "${KAFKA_INSTANCES}"

Expand Down
5 changes: 3 additions & 2 deletions reverse-proxy-nginx/swarm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ readonly TIMESTAMPED_NGINX="${TIMESTAMP}-nginx.conf"

# Import libraries
ROOT_PATH="${COMPOSE_FILE_PATH}/.."
. "${ROOT_PATH}/utils/log.sh"
. "${ROOT_PATH}/utils/config-utils.sh"
. "${ROOT_PATH}/utils/docker-utils.sh"
. "${ROOT_PATH}/utils/log.sh"

main() {
if [[ "${ACTION}" == "init" ]] || [[ "${ACTION}" == "up" ]]; then
Expand Down Expand Up @@ -188,7 +189,7 @@ main() {

try "docker volume rm renew-certbot-conf data-certbot-conf dummy-data-certbot-conf" "Failed to remove certbot volumes"

docker::prune_configs nginx
docker::prune_configs "nginx"
else
log error "Valid options are: init, up, down or destroy"
fi
Expand Down

0 comments on commit 052fb59

Please sign in to comment.