Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/docker compose with dev users in file #116

Merged
merged 4 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,4 @@ Thumbs.db
/src/app/api/generated

.env
docker/backend/dev-users.csv
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ To do a manual deployment to staging though, run `npm run build` to produce the
## Environment-specific configuration
To enable environment-specific configuration without having to create a separate artifact per environment or resort to running a dedicated node server or container, a config.js file is used.

This config.js is loaded in index.html using a regular <script> tag. It is therefore not compiled with the application (like external configuration should be). For development (local) the file is listed in angular.json as a asset. Therefore the default config.js is available when running `ng serve`. When building a production version however, config.js is not output. Per environment, a config.js should be deployed together with the created artifact's files, this enabling per-environment configuration while deploying the application as a static resource (suitable for CDNs).
This config.js is loaded in index.html using a regular `<script>` tag. It is therefore not compiled with the application (like external configuration should be). For development (local) the file is listed in angular.json as a asset. Therefore the default config.js is available when running `ng serve`. When building a production version however, config.js is not output. Per environment, a config.js should be deployed together with the created artifact's files, this enabling per-environment configuration while deploying the application as a static resource (suitable for CDNs).

## Further help

Expand All @@ -86,3 +86,10 @@ docker-compose up -d
The version of the backend defaults to latest, but it can be set in the `.env` file using `LITTIL_BACKEND_VERSION`

Look for the available tags at [ghcr.io/devoxx4kids-NP/littil-backend](https://ghcr.io/devoxx4kids-NPO/littil-backend)

### dev users

When running the backend as a developer you can add previously created users at startup.
Create a `dev-users.csv` file in the folder `docker\backend` with the users you would like to add when the backend is started.
Additional information can be found in the file `docker\backend\dev-users.example`.
To use this functionality use the latest image or >=1.3.2 of the backend.
15 changes: 14 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,36 @@ services:
MYSQL_ROOT_PASSWORD: littil
ports:
- "3306:3306"
healthcheck:
test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
interval: 5s
timeout: 5s
retries: 5
backend:
image: ghcr.io/devoxx4kids-npo/littil-backend:${LITTIL_BACKEND_VERSION:-latest}
depends_on:
- dbhost
dbhost:
condition: service_healthy
volumes:
- type: bind
source: ./docker/backend
target: /app
environment:
- QUARKUS_BANNER_ENABLED=true
- CLOUDWATCH_ENABLED=false
- LITTIL_DEV_DATA=true
- LITTIL_DEV_DATA_FILE=/app/dev-users.csv
- DATASOURCE_HOST=dbhost
- HTTP_CORS_ORIGINS=http://localhost:4200
- OIDC_CLIENT_ID=${OIDC_CLIENT_ID}
- OIDC_CLIENT_SECRET=${OIDC_CLIENT_SECRET}
- OIDC_TENANT=${OIDC_TENANT}
- M2M_CLIENT_ID=${M2M_CLIENT_ID}
- M2M_CLIENT_SECRET=${M2M_CLIENT_SECRET}
- QUARKUS_MAILER_MOCK=true
- SMTP_HOST=smtp-stub.local
- SMTP_USERNAME=username
- SMTP_PASSWORD=password
- QUARKUS_LOG_CATEGORY__ORG_LITTIL__LEVEL=DEBUG
ports:
- "8080:8080"
14 changes: 14 additions & 0 deletions docker/backend/dev-users.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# You can use a file 'docker/backend/dev-users.csv' to add users add startup of the backend.
# for each user add the following information in one line, separated by a comma ,
# - email-address
# - address
# - zipcode (with format 9999AA)
# The users are only added to the database when
# - the email is valid
# - the zipcode is valid (format 9999AA)
# - the email is present in auth0
# example :
# empty lines and lines with # are skipped

[email protected],Some adress 1,1000AA
[email protected],other address 2, 2000BB