Update run.sh

This commit is contained in:
Santiago Lo Coco 2023-11-03 17:12:33 -03:00
parent fe3edc9288
commit c410c7a213
2 changed files with 42 additions and 42 deletions

2
.gitignore vendored
View File

@ -7,5 +7,5 @@ node_modules
*.xml
notification-domain/
TODO.txt
*.sh
deploy.sh
coverage/

82
run.sh
View File

@ -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