Skip to content
Snippets Groups Projects
Commit 53c201f9 authored by Martin Lowe's avatar Martin Lowe :flag_ca:
Browse files

Update make commands to use templates, made maria optional w/ profile

parent 1c60882f
No related branches found
No related tags found
No related merge requests found
setup:; setup:;
test -f ".env" || cp config/.env.sample .env rm .env && envsubst < config/.env.sample > .env
test -f "./config/secret.properties" || cp config/secret.properties.sample config/secret.properties rm ./config/secret.properties && envsubst < config/secret.properties.sample > config/secret.properties
test -f "./config/foundationdb/secret.properties" || cp config/foundationdb/secret.properties.sample config/foundationdb/secret.properties rm ./config/foundationdb/secret.properties && envsubst < config/foundationdb/secret.properties.sample > config/foundationdb/secret.properties
\ No newline at end of file \ No newline at end of file
...@@ -4,9 +4,9 @@ This project uses Quarkus, the Supersonic Subatomic Java Framework. If you want ...@@ -4,9 +4,9 @@ This project uses Quarkus, the Supersonic Subatomic Java Framework. If you want
## Setting up environment ## Setting up environment
Before running the application, the initial setup should be observed. The initial setup of this server can be started by running the command `make setup` which will instantiate the secrets file and environment hidden file. To finish the setup of the environment file, open it and add values to the missing fields before starting docker for this project. The missing fields are primarily passwords for the various services running in docker for the project. Set them to some values and save the file. Once finished you can run the docker-compose command for this project successfully. Before running the application, the initial setup should be observed. The initial setup of this server can be started by running the command `make setup` which will instantiate the secrets file and environment hidden file. To finish the setup of the environment file, open it and add values to the missing fields before starting docker for this project. The missing fields are primarily passwords for the various services running in docker for the project. Set them to some values and save the file. Once finished you can run the docker-compose command for this project successfully. If you need to start MariaDB (not using a shared volume) you can use `docker-compose --profile full up` to start MariaDB along with other services.
Additionally, some of the values in the .env file will need to be set into the secret.properties files in `./config/secret.properties` and `./config/foundationdb/secret.properties`. The value for `WGAPI_MYSQL_PASSWORD` will need to be set as the value for the `quarkus.datasource.password` property in both files. This will give the applications access to make changes to the databases. Additionally, some of the values in the .env file will need to be set into the secret.properties files in `./config/secret.properties` and `./config/foundationdb/secret.properties`. The value for `WGAPI_MYSQL_PASSWORD` will need to be set as the value for the `quarkus.datasource.password` property in both files. This will give the applications access to make changes to the databases.
Once the stack is running, navigate to http://localhost:8080 and log into Keycloak using the credentials set in the `.env` file. Upon logging in in the top left corner, if the text says `Master`, then hover over the text and select `Foundation` in the pop up that appears below the text. This switches your realm to the one configured at boot time by the embedded configuration files. In the left hand menu, select `Clients` and open the `foundation` client by clicking on the name of the client. Once here, navigate to the `Credentials` tab and regenerate the secret. That text will be the value of the `quarkus.oidc.credentials.client-secret.value` property in the `./config/foundationdb/secret.properties` file. Do the same thing for the `working_groups_api` client, instead setting the value of `quarkus.oidc.credentials.secret` property in the `./config/secret.properties` file. Once the stack is running, navigate to http://localhost:8080 and log into Keycloak using the credentials set in the `.env` file. Upon logging in in the top left corner, if the text says `Master`, then hover over the text and select `Foundation` in the pop up that appears below the text. This switches your realm to the one configured at boot time by the embedded configuration files. In the left hand menu, select `Clients` and open the `foundation` client by clicking on the name of the client. Once here, navigate to the `Credentials` tab and regenerate the secret. That text will be the value of the `quarkus.oidc.credentials.client-secret.value` property in the `./config/foundationdb/secret.properties` file. Do the same thing for the `working_groups_api` client, instead setting the value of `quarkus.oidc.credentials.secret` property in the `./config/secret.properties` file.
......
WGAPI_MYSQL_PASSWORD= WGAPI_MYSQL_PASSWORD=$MYSQL_PASSWORD
WGAPI_POSTGRES_DB=ef_wgapi WGAPI_MYSQL_PORT=3306
WGAPI_POSTGRES_USER=root CONFIG_SECRET_PATH=$PWD/config/secret.properties
WGAPI_POSTGRES_PASSWORD= \ No newline at end of file
WGAPI_KEYCLOAK_USER=admin
WGAPI_KEYCLOAK_PASSWORD=
CONFIG_SECRET_PATH=/localdev/eclipsefdn-working-groups-api/config/secret.properties
\ No newline at end of file
quarkus.datasource.jdbc.url=jdbc:mariadb://localhost:$FOUNDATIONDB_DB_PORT/$FOUNDATIONDB_DB_NAME
quarkus.datasource.username=$MYSQL_USER
quarkus.datasource.password=$MYSQL_PASSWORD
quarkus.datasource.jdbc.url = jdbc:mariadb://mariadb/efclone quarkus.oauth2.introspection-url=http://localhost:8080/auth/realms/foundation
quarkus.datasource.username = root
quarkus.datasource.password = sample
quarkus.oauth2.introspection-url=http://keycloak/auth/realms/foundation
quarkus.oauth2.client-id=foundation quarkus.oauth2.client-id=foundation
quarkus.oauth2.client-secret=sample quarkus.oauth2.client-secret=sample
......
quarkus.oidc.auth-server-url=http://keycloak/auth/realms/foundation quarkus.oidc.auth-server-url=http://keycloak/auth/realms/foundation
quarkus.oidc.client-id=working_groups_api quarkus.oidc.client-id=working_groups_api
quarkus.oidc.credentials.secret=sample quarkus.oidc.credentials.secret=sample
\ No newline at end of file
#
#
#
\ No newline at end of file
...@@ -21,19 +21,7 @@ services: ...@@ -21,19 +21,7 @@ services:
cpus: '0.001' cpus: '0.001'
memory: 128M memory: 128M
depends_on: depends_on:
- mariadb
- foundationdb - foundationdb
mariadb:
image: mariadb:latest
command: --max_allowed_packet=100000000
ports:
- '3306:3306'
environment:
MYSQL_ROOT_PASSWORD: ${WGAPI_MYSQL_PASSWORD}
MYSQL_DATABASE: working_groups_api
volumes:
- ./config/mariadb/init.sql:/docker-entrypoint-initdb.d/init.sql
- ./volumes/mariadb:/var/lib/mysql
foundationdb: foundationdb:
image: eclipsefdn/foundationdb-api:production-b43bc82-7 image: eclipsefdn/foundationdb-api:production-b43bc82-7
ports: ports:
...@@ -53,38 +41,16 @@ services: ...@@ -53,38 +41,16 @@ services:
reservations: reservations:
cpus: '0.001' cpus: '0.001'
memory: 256M memory: 256M
depends_on: mariadb:
- mariadb image: mariadb:latest
- keycloak command: --max_allowed_packet=100000000
postgres: profiles:
image: postgres:12.4 - full
volumes:
- ./volumes/postgres:/var/lib/postgresql/data
environment:
- POSTGRES_DB=${WGAPI_POSTGRES_DB}
- POSTGRES_USER=${WGAPI_POSTGRES_USER}
- POSTGRES_PASSWORD=${WGAPI_POSTGRES_PASSWORD}
ports: ports:
- 5432 - "${WGAPI_MYSQL_PORT:-3306}:3306"
keycloak:
image: jboss/keycloak:11.0.1
volumes:
- ./config/keycloak/:/opt/jboss/keycloak/imports/
command:
- "-b 0.0.0.0 -Dkeycloak.import=/opt/jboss/keycloak/imports/realm-export.json"
environment: environment:
- VIRTUAL_HOST=keycloak MYSQL_ROOT_PASSWORD: ${WGAPI_MYSQL_PASSWORD}
- VIRTUAL_PORT=8080 MYSQL_DATABASE: working_groups_api
- DB_VENDOR=POSTGRES volumes:
- DB_DATABASE=${WGAPI_POSTGRES_DB} - ./config/mariadb/init.sql:/docker-entrypoint-initdb.d/init.sql
- DB_SCHEMA=public - ./volumes/mariadb:/var/lib/mysql
- DB_ADDR=postgres \ No newline at end of file
- DB_PORT=5432
- DB_USER=${WGAPI_POSTGRES_USER}
- DB_PASSWORD=${WGAPI_POSTGRES_PASSWORD}
- KEYCLOAK_USER=${WGAPI_KEYCLOAK_USER}
- KEYCLOAK_PASSWORD=${WGAPI_KEYCLOAK_PASSWORD}
ports:
- '8080:8080'
depends_on:
- postgres
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment