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 *.xml
notification-domain/ notification-domain/
TODO.txt TODO.txt
*.sh deploy.sh
coverage/ coverage/

82
run.sh
View File

@ -5,38 +5,6 @@ usage() {
exit 0 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= domain=
down= down=
tests= tests=
@ -73,7 +41,13 @@ if [ -n "$domain" ] && [ -n "$down" ]; then
docker compose -f browser-domain/docker-compose.yml down docker compose -f browser-domain/docker-compose.yml down
;; ;;
'elk') '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') 'subscription')
export API_IMAGE=$USER/subs-manager:prod export API_IMAGE=$USER/subs-manager:prod
@ -145,18 +119,44 @@ elif [ -n "$domain" ] && [ -z "$down" ]; then
fi fi
;; ;;
'screen') 'screen')
docker build screen-domain -f screen-domain/Dockerfile.test --build-arg "REACT_APP_ORIGIN=$REACT_APP_ORIGIN" -t $USER/screen-client:test if [ -n "$tests" ]; then
export CLIENT_IMAGE=$USER/screen-client:test docker build screen-domain -f screen-domain/Dockerfile.test -t $USER/screen-client:test
docker compose -f screen-domain/docker-compose.yml up -d 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') 'browser')
docker build browser-domain -f browser-domain/Dockerfile.test -t $USER/browser-client:test if [ -n "$tests" ]; then
export CLIENT_IMAGE=$USER/browser-client:test docker build browser-domain -f browser-domain/Dockerfile.test -t $USER/browser-client:test
docker compose -f browser-domain/docker-compose.yml up -d 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') 'elk')
build_elk export ELK=observability/elk
compose_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 ;; *) exit 1 ;;
esac esac