From c410c7a2137e9f865292e1364573214294876f8d Mon Sep 17 00:00:00 2001 From: Santiago Lo Coco Date: Fri, 3 Nov 2023 17:12:33 -0300 Subject: [PATCH] Update run.sh --- .gitignore | 2 +- run.sh | 82 +++++++++++++++++++++++++++--------------------------- 2 files changed, 42 insertions(+), 42 deletions(-) diff --git a/.gitignore b/.gitignore index ff58439..b1dc5f3 100644 --- a/.gitignore +++ b/.gitignore @@ -7,5 +7,5 @@ node_modules *.xml notification-domain/ TODO.txt -*.sh +deploy.sh coverage/ \ No newline at end of file diff --git a/run.sh b/run.sh index b004c64..ec10ae7 100755 --- a/run.sh +++ b/run.sh @@ -5,38 +5,6 @@ usage() { exit 0 } -build_elk() { - export ELK=observability/elk - export ELK_VERSION=8.7.1 - export ELASTICSEARCH_IMAGE=$USER/elasticsearch:prod - export ELK_SETUP_IMAGE=$USER/elk-setup:prod - export LOGSTASH_IMAGE=$USER/logstash:prod - export KIBANA_IMAGE=$USER/kibana:prod - export CURATOR_IMAGE=$USER/curator:prod - export HEARTBEAT_IMAGE=$USER/heartbeat:prod - docker build $ELK/elasticsearch -f $ELK/elasticsearch/Dockerfile --build-arg "ELASTIC_VERSION=$ELK_VERSION" -t $ELASTICSEARCH_IMAGE - docker build $ELK/setup -f $ELK/setup/Dockerfile --build-arg "ELASTIC_VERSION=$ELK_VERSION" -t $ELK_SETUP_IMAGE - docker build $ELK/logstash -f $ELK/logstash/Dockerfile --build-arg "ELASTIC_VERSION=$ELK_VERSION" -t $LOGSTASH_IMAGE - docker build $ELK/kibana -f $ELK/kibana/Dockerfile --build-arg "ELASTIC_VERSION=$ELK_VERSION" -t $KIBANA_IMAGE - docker build $ELK/extensions/curator -f $ELK/extensions/curator/Dockerfile -t $CURATOR_IMAGE - docker build $ELK/extensions/heartbeat -f $ELK/extensions/heartbeat/Dockerfile --build-arg "ELASTIC_VERSION=$ELK_VERSION" -t $HEARTBEAT_IMAGE -} - -compose_elk() { - docker compose -f observability/docker-compose.yml --env-file observability/.env.prod --profile setup up -d - docker compose -f observability/docker-compose.yml -f observability/elk/extensions/curator/curator-compose.yml -f observability/elk/extensions/heartbeat/heartbeat-compose.yml --env-file observability/.env.prod up -d -} - -down_elk() { - export ELASTICSEARCH_IMAGE=$USER/elasticsearch:prod - export ELK_SETUP_IMAGE=$USER/elk-setup:prod - export LOGSTASH_IMAGE=$USER/logstash:prod - export KIBANA_IMAGE=$USER/kibana:prod - export CURATOR_IMAGE=$USER/curator:prod - export HEARTBEAT_IMAGE=$USER/heartbeat:prod - docker compose -f observability/docker-compose.yml -f observability/elk/extensions/curator/curator-compose.yml -f observability/elk/extensions/heartbeat/heartbeat-compose.yml --env-file observability/.env.prod down -} - domain= down= tests= @@ -73,7 +41,13 @@ if [ -n "$domain" ] && [ -n "$down" ]; then docker compose -f browser-domain/docker-compose.yml down ;; 'elk') - down_elk + export ELASTICSEARCH_IMAGE=$USER/elasticsearch:prod + export ELK_SETUP_IMAGE=$USER/elk-setup:prod + export LOGSTASH_IMAGE=$USER/logstash:prod + export KIBANA_IMAGE=$USER/kibana:prod + export CURATOR_IMAGE=$USER/curator:prod + export HEARTBEAT_IMAGE=$USER/heartbeat:prod + docker compose -f observability/docker-compose.yml -f observability/elk/extensions/curator/curator-compose.yml -f observability/elk/extensions/heartbeat/heartbeat-compose.yml --env-file observability/.env.prod down ;; 'subscription') export API_IMAGE=$USER/subs-manager:prod @@ -145,18 +119,44 @@ elif [ -n "$domain" ] && [ -z "$down" ]; then fi ;; 'screen') - docker build screen-domain -f screen-domain/Dockerfile.test --build-arg "REACT_APP_ORIGIN=$REACT_APP_ORIGIN" -t $USER/screen-client:test - export CLIENT_IMAGE=$USER/screen-client:test - docker compose -f screen-domain/docker-compose.yml up -d + if [ -n "$tests" ]; then + docker build screen-domain -f screen-domain/Dockerfile.test -t $USER/screen-client:test + export CLIENT_IMAGE=$USER/screen-client:test + docker compose -f screen-domain/docker-compose.yml up -d + else + docker build screen-domain -f screen-domain/Dockerfile.prod --build-arg "REACT_APP_ORIGIN=$REACT_APP_ORIGIN" -t $USER/screen-client:prod + export CLIENT_IMAGE=$USER/screen-client:prod + docker compose -f screen-domain/docker-compose.yml up -d + fi ;; 'browser') - docker build browser-domain -f browser-domain/Dockerfile.test -t $USER/browser-client:test - export CLIENT_IMAGE=$USER/browser-client:test - docker compose -f browser-domain/docker-compose.yml up -d + if [ -n "$tests" ]; then + docker build browser-domain -f browser-domain/Dockerfile.test -t $USER/browser-client:test + export CLIENT_IMAGE=$USER/browser-client:test + docker compose -f browser-domain/docker-compose.yml up -d + else + docker build browser-domain -f browser-domain/Dockerfile.prod -t $USER/browser-client:prod + export CLIENT_IMAGE=$USER/browser-client:prod + docker compose -f browser-domain/docker-compose.yml up -d + fi ;; 'elk') - build_elk - compose_elk + export ELK=observability/elk + export ELK_VERSION=8.7.1 + export ELASTICSEARCH_IMAGE=$USER/elasticsearch:prod + export ELK_SETUP_IMAGE=$USER/elk-setup:prod + export LOGSTASH_IMAGE=$USER/logstash:prod + export KIBANA_IMAGE=$USER/kibana:prod + export CURATOR_IMAGE=$USER/curator:prod + export HEARTBEAT_IMAGE=$USER/heartbeat:prod + docker build $ELK/elasticsearch -f $ELK/elasticsearch/Dockerfile --build-arg "ELASTIC_VERSION=$ELK_VERSION" -t $ELASTICSEARCH_IMAGE + docker build $ELK/setup -f $ELK/setup/Dockerfile --build-arg "ELASTIC_VERSION=$ELK_VERSION" -t $ELK_SETUP_IMAGE + docker build $ELK/logstash -f $ELK/logstash/Dockerfile --build-arg "ELASTIC_VERSION=$ELK_VERSION" -t $LOGSTASH_IMAGE + docker build $ELK/kibana -f $ELK/kibana/Dockerfile --build-arg "ELASTIC_VERSION=$ELK_VERSION" -t $KIBANA_IMAGE + docker build $ELK/extensions/curator -f $ELK/extensions/curator/Dockerfile -t $CURATOR_IMAGE + docker build $ELK/extensions/heartbeat -f $ELK/extensions/heartbeat/Dockerfile --build-arg "ELASTIC_VERSION=$ELK_VERSION" -t $HEARTBEAT_IMAGE + docker compose -f observability/docker-compose.yml --env-file observability/.env.prod --profile setup up -d + docker compose -f observability/docker-compose.yml -f $ELK/extensions/curator/curator-compose.yml -f $ELK/extensions/heartbeat/heartbeat-compose.yml --env-file observability/.env.prod up -d ;; *) exit 1 ;; esac