Update run.sh and README.md

This commit is contained in:
Santiago Lo Coco 2023-11-07 11:28:00 -03:00
parent 234646749f
commit 52bf0974ed
2 changed files with 37 additions and 11 deletions

View File

@ -32,7 +32,8 @@ Primero, deberá configurar los `.env` como usted prefiera. Copie y modifique lo
```
cp flights-domain/.env.prod.example flights-domain/.env.prod
cp user-domain/.env.prod.example user-domain/.env.prod
cp auth-domain/.env.prod.example auth-domain/.env.prod
cp subscription-domain/.env.prod.example subscription-domain/.env.prod
```
Luego, para levantar todos los componentes, basta con ejecutar:
@ -41,8 +42,31 @@ Luego, para levantar todos los componentes, basta con ejecutar:
./run.sh
```
Por último, si quiere bajarlos:
```
./run.sh -x
```
## Contribuir
Primero, instale el hook de `pre-commit` en su repositorio local (probablemente deba instalar antes `pre-commit`, vea cómo hacerlo [aquí](https://pre-commit.com/)):
```
pre-commit install
```
Luego, puede usar el script de `run.sh` para probar sus cambios. Por ejemplo, si quiere bajar y levantar un servicio en particular:
```
./run.sh -d flights -x
./run.sh -d flights
```
En este caso el parámetro `-d` indica el tipo de servicio (puede ser `subscription`, `browser`, `screen`, `gateway`, `flights`, `auth` o `elk`) y el parámetro `-x` indica que se quiere bajar el servicio.
Si quiere testear un servicio lo puede hacer corriendo:
```
./run.sh -d flights -t
```

22
run.sh
View File

@ -64,8 +64,10 @@ elif [ -n "$domain" ] && [ -z "$down" ]; then
if [ -n "$tests" ]; then
docker build $USER_MANAGER -f $USER_MANAGER/Dockerfile.test -t $USER/user-manager:test
export API_IMAGE=$USER/user-manager:test
docker compose -f auth-domain/docker-compose.yml --env-file auth-domain/.env.prod down
docker compose -f auth-domain/docker-compose.yml --env-file auth-domain/.env.dev up --abort-on-container-exit
docker compose -f auth-domain/docker-compose.dev.yml --env-file auth-domain/.env.prod down
docker compose -f auth-domain/docker-compose.dev.yml --env-file auth-domain/.env.dev up --abort-on-container-exit
docker compose -f auth-domain/docker-compose.dev.yml --env-file auth-domain/.env.prod exec usermanager-api python manage.py recreate_db
docker compose -f auth-domain/docker-compose.dev.yml --env-file auth-domain/.env.prod exec usermanager-api python manage.py seed_db
else
export API_IMAGE=$USER/user-manager:prod
docker compose -f auth-domain/docker-compose.yml --env-file auth-domain/.env.prod down
@ -81,8 +83,8 @@ elif [ -n "$domain" ] && [ -z "$down" ]; then
if [ -n "$tests" ]; then
docker build $FLIGHTS_INFORMATION -f $FLIGHTS_INFORMATION/Dockerfile.test -t $USER/flights-information:test
export API_IMAGE=$USER/flights-information:test
docker compose -f flights-domain/docker-compose.yml --env-file flights-domain/.env.dev down
docker compose -f flights-domain/docker-compose.yml --env-file flights-domain/.env.dev up --abort-on-container-exit
docker compose -f flights-domain/docker-compose.dev.yml --env-file flights-domain/.env.dev down
docker compose -f flights-domain/docker-compose.dev.yml --env-file flights-domain/.env.dev up --abort-on-container-exit
else
export API_IMAGE=$USER/flights-information:prod
docker compose -f flights-domain/docker-compose.yml --env-file flights-domain/.env.prod down
@ -96,8 +98,8 @@ elif [ -n "$domain" ] && [ -z "$down" ]; then
if [ -n "$tests" ]; then
docker build $SUBSCRIPTION_MANAGER -f $SUBSCRIPTION_MANAGER/Dockerfile.test -t $USER/subs-manager:test
export API_IMAGE=$USER/subs-manager:test
docker compose -f subscription-domain/docker-compose.yml --env-file subscription-domain/.env.dev down
docker compose -f subscription-domain/docker-compose.yml --env-file subscription-domain/.env.dev up --abort-on-container-exit
docker compose -f subscription-domain/docker-compose.dev.yml --env-file subscription-domain/.env.dev down
docker compose -f subscription-domain/docker-compose.dev.yml --env-file subscription-domain/.env.dev up --abort-on-container-exit
else
export API_IMAGE=$USER/subs-manager:prod
docker compose -f subscription-domain/docker-compose.yml --env-file subscription-domain/.env.prod down
@ -110,8 +112,8 @@ elif [ -n "$domain" ] && [ -z "$down" ]; then
if [ -n "$tests" ]; then
docker build gateway -f gateway/Dockerfile.test -t $USER/gateway:test
export API_IMAGE=$USER/gateway:test
docker compose -f gateway/docker-compose.yml down
docker compose -f gateway/docker-compose.yml up -d
docker compose -f gateway/docker-compose.dev.yml down
docker compose -f gateway/docker-compose.dev.yml up -d
else
export API_IMAGE=$USER/gateway:prod
docker compose -f gateway/docker-compose.yml down
@ -122,7 +124,7 @@ elif [ -n "$domain" ] && [ -z "$down" ]; then
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
docker compose -f screen-domain/docker-compose.dev.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
@ -133,7 +135,7 @@ elif [ -n "$domain" ] && [ -z "$down" ]; then
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
docker compose -f browser-domain/docker-compose.dev.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