Skip to content

Commit

Permalink
update var for test
Browse files Browse the repository at this point in the history
  • Loading branch information
thoomasbro committed Jun 12, 2024
1 parent 3f855d8 commit 14b85f4
Show file tree
Hide file tree
Showing 5 changed files with 101 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .env.dev.defaults
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
PROJECT_NAME=monitorenv
ENVIRONMENT=dev
MONITORENV_API_KEY=DUMMY-API-KEY
MONITORENV_URL=http://localhost:8880
BACKEND_HTTP_PORT=8880
MONITORENV_API_KEY=DUMMY-API-KEY

# Spring
MONITORENV_FLYWAY_LOCATIONS=classpath:/db/migration,classpath:/db/testdata
Expand Down
90 changes: 88 additions & 2 deletions .env.test.defaults
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
PROJECT_NAME=monitorenv
ENVIRONMENT=test
MONITORENV_URL=http://localhost:8880
MONITORENV_API_KEY=DUMMY-API-KEY
MONITORENV_URL=http://localhost:8880
MONITORENV_IMAGE=monitorenv-app
BACKEND_HTTP_PORT=8880

# Spring
MONITORENV_FLYWAY_LOCATIONS=classpath:/db/migration,classpath:/db/testdata
ENV_DB_URL=jdbc:postgresql://localhost:5432/monitorenvdb?user=postgres&password=postgres

# Sentry
MONITORENV_SENTRY_ENABLED=false
Expand All @@ -17,6 +21,88 @@ MONITORFISH_API_KEY=changeme
RAPPORTNAV_URL=http://localhost:8083

# OICD
MONITORENV_OIDC_CLIENT_ID=monitorenv
MONITORENV_OIDC_ENABLED=true
MONITORENV_OIDC_ISSUER_URI==http://localhost:8085/realms/monitor
MONITORENV_OIDC_USERINFO_ENDPOINT=/protocol/openid-connect/userinfo
MONITORENV_OIDC_USERINFO_ENDPOINT=/protocol/openid-connect/userinfo


################################################################################
# PostgreSQL

POSTGRES_PORT=5432
POSTGRES_USER=postgres
POSTGRES_DB=monitorenvdb
POSTGRES_HOST=localhost
POSTGRES_SCHEMA=public
POSTGRES_PASSWORD=postgres

MONITORENV_DATA_FOLDER=./datascience/src/pipeline/data

################################################################################
# Monitoring & Backup

MONITORENV_LOGS_AND_BACKUPS_GID=1001
MONITORENV_LOGS_FOLDER=./logs
MONITORENV_BACKUPS_FOLDER=./backups


##### FRONTEND #####
################################################################################
################################################################################
################################################################################
# GeoServer

FRONTEND_GEOSERVER_NAMESPACE=monitorenv
FRONTEND_GEOSERVER_REMOTE_URL=//localhost:8081
# Production:
# FRONTEND_GEOSERVER_REMOTE_URL=https://monitorenv.din.developpement-durable.gouv.fr

################################################################################
# Google Maps

FRONTEND_GOOGLEMAPS_API_KEY=NOT_SET

################################################################################
# Mapbox

FRONTEND_MAPBOX_KEY=

################################################################################
# Sentry

FRONTEND_SENTRY_ENV=dev
FRONTEND_SENTRY_DSN=
FRONTEND_SENTRY_TRACING_ORIGIN=localhost
# Staging
# FRONTEND_SENTRY_TRACING_ORIGIN=monitorenv-test.csam.e2.rie.gouv.fr
# Production
# FRONTEND_SENTRY_TRACING_ORIGIN=monitorenv.din.developpement-durable.gouv.fr

################################################################################
# Shom

FRONTEND_SHOM_KEY=

################################################################################
# Feature flags

FRONTEND_MISSION_FORM_AUTO_UPDATE=true
FRONTEND_MISSION_FORM_AUTO_SAVE_ENABLED=true
FRONTEND_REPORTING_FORM_AUTO_SAVE_ENABLED=true
FRONTEND_REPORTING_FORM_AUTO_UPDATE=true

################################################################################
# Version

FRONTEND_MONITORENV_VERSION=0.0.0

################################################################################
# OICD

FRONTEND_OIDC_AUTHORITY=http://localhost:8085/realms/monitor
FRONTEND_OIDC_CLIENT_ID=monitorenv
FRONTEND_OIDC_ENABLED=true
FRONTEND_OIDC_REDIRECT_URI=http://localhost:3000/login

################################################################################
3 changes: 2 additions & 1 deletion .github/workflows/cicd-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,8 @@ jobs:

- name: Run docker images
run: |
make run-infra-for-frontend-tests
make test-init-backend-env
make test-run-infra-for-frontend
until $(curl --output /dev/null --silent --fail "http://localhost:8081/geoserver/wfs?service=WFS&version=1.1.0&request=GetFeature&typename=monitorenv:regulations&outputFormat=application/json&CQL_FILTER=topic=%27Ouest%20Cotentin%20Bivalves%27%20AND%20zone=%27Praires%20Ouest%20cotentin%27"); do printf '.'; sleep 5; done;
- name: Run multi-windows tests
Expand Down
13 changes: 7 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,6 @@ lint-back:

clean: dev-erase-db dev-clean-build-env

test: test-back
cd frontend && CI=true npm run test:unit

.PHONY: docker-build-app
docker-build-app:
docker build --no-cache -f infra/docker/app/Dockerfile . -t monitorenv-app:$(VERSION) \
Expand Down Expand Up @@ -127,13 +124,17 @@ update-python-dependencies:


# CI commands - app
.PHONY: docker-tag-app docker-push-app run-infra-for-frontend-tests
.PHONY: docker-tag-app docker-push-app test-run-infra-for-frontend test-init-backend-env
docker-tag-app:
docker tag monitorenv-app:$(VERSION) ghcr.io/mtes-mct/monitorenv/monitorenv-app:$(VERSION)
docker-push-app:
docker push ghcr.io/mtes-mct/monitorenv/monitorenv-app:$(VERSION)
run-infra-for-frontend-tests:
export MONITORENV_VERSION=$(VERSION) && docker compose -f ./infra/docker/docker-compose.test.yml up -d
test-init-backend-env:
./frontend/node_modules/.bin/import-meta-env-prepare -u -x ./.env.backend.example -p ./.env.dev.defaults
test-run-infra-for-frontend:
export MONITORENV_VERSION=$(VERSION) && docker compose --profile=test up -d
test: test-back
cd frontend && CI=true npm run test:unit

# CI commands - pipeline
.PHONY: docker-build-pipeline docker-test-pipeline docker-tag-pipeline docker-push-pipeline
Expand Down
5 changes: 3 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
services:
app:
profiles: ["production"]
profiles: ["production", "test"]
image: $MONITORENV_IMAGE:$MONITORENV_VERSION
container_name: monitorenv_backend
user: "monitorenv:${MONITORENV_LOGS_AND_BACKUPS_GID}"
Expand Down Expand Up @@ -72,6 +72,7 @@ services:

geoserver:
container_name: monitorenv_geoserver
profiles: ["dev"]
image: kartoza/geoserver:2.20.2
environment:
- GEOSERVER_ADMIN_PASSWORD=${GEOSERVER_ADMIN_PASSWORD}
Expand All @@ -92,7 +93,7 @@ services:

keycloak:
container_name: monitorenv_keycloak
profiles: ["dev"]
profiles: ["dev", "test"]
image: quay.io/keycloak/keycloak:latest
environment:
- KEYCLOAK_ADMIN=admin
Expand Down

0 comments on commit 14b85f4

Please sign in to comment.