diff --git a/.gitignore b/.gitignore index 91e922f4d4d181935699b57e11e91bd09dff58db..8861b7c42adb9738d898f8990ab9efcab5398128 100644 --- a/.gitignore +++ b/.gitignore @@ -36,7 +36,9 @@ nb-configuration.xml *.rej # Local environment +/volumes .env +/config/**/*secret.properties /node_modules /src/test/resources/schemas \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..9b177e60a95c7a99c87eaf99cfe2b1dbd9e60f1e --- /dev/null +++ b/Makefile @@ -0,0 +1,3 @@ +setup:; + test -f ".env" || cp config/.env.sample .env + test -f "./config/secret.properties" || cp config/secret.properties.sample config/secret.properties \ No newline at end of file diff --git a/README.md b/README.md index 057a8c54d46f538b63bc22fbe274c65a52e61cdd..dd9e8b33a9ed01cadb8f05a00fa711a579ff5293 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,16 @@ # eclipsefdn-working-group-api Project -This project uses Quarkus, the Supersonic Subatomic Java Framework. +This project uses Quarkus, the Supersonic Subatomic Java Framework. If you want to learn more about Quarkus, please visit its website: https://quarkus.io/ . -If you want to learn more about Quarkus, please visit its website: https://quarkus.io/ . +## 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. ## Running the application in dev mode You can run your application in dev mode that enables live coding using: ```shell script -./mvnw compile quarkus:dev +mvn compile quarkus:dev ``` > **_NOTE:_** Quarkus now ships with a Dev UI, which is available in dev mode only at http://localhost:8080/q/dev/. @@ -17,7 +19,7 @@ You can run your application in dev mode that enables live coding using: The application can be packaged using: ```shell script -./mvnw package +mvn package ``` It produces the `quarkus-run.jar` file in the `target/quarkus-app/` directory. Be aware that it’s not an _über-jar_ as the dependencies are copied into the `target/quarkus-app/lib/` directory. @@ -26,7 +28,7 @@ The application is now runnable using `java -jar target/quarkus-app/quarkus-run. If you want to build an _über-jar_, execute the following command: ```shell script -./mvnw package -Dquarkus.package.type=uber-jar +mvn package -Dquarkus.package.type=uber-jar ``` The application, packaged as an _über-jar_, is now runnable using `java -jar target/*-runner.jar`. @@ -35,12 +37,12 @@ The application, packaged as an _über-jar_, is now runnable using `java -jar ta You can create a native executable using: ```shell script -./mvnw package -Pnative +mvn package -Pnative ``` Or, if you don't have GraalVM installed, you can run the native executable build in a container using: ```shell script -./mvnw package -Pnative -Dquarkus.native.container-build=true +mvn package -Pnative -Dquarkus.native.container-build=true ``` You can then execute your native executable with: `./target/eclipsefdn-working-group-api-1.0.0-SNAPSHOT-runner` diff --git a/config/.env.sample b/config/.env.sample new file mode 100644 index 0000000000000000000000000000000000000000..07c010cc829c4e02b56e7e536601b30eb85898dc --- /dev/null +++ b/config/.env.sample @@ -0,0 +1,7 @@ +WGAPI_MYSQL_PASSWORD= +WGAPI_POSTGRES_DB=ef_wgapi +WGAPI_POSTGRES_USER=root +WGAPI_POSTGRES_PASSWORD= +WGAPI_KEYCLOAK_USER=admin +WGAPI_KEYCLOAK_PASSWORD= +CONFIG_SECRET_PATH=/localdev/eclipsefdn-working-groups-api/config/secret.properties \ No newline at end of file diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000000000000000000000000000000000000..0a2842f8a8e4a1dc7e7f952914fccc360500a449 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,61 @@ +version: '3' +services: + application: + build: + dockerfile: ./src/main/docker/Dockerfile.jvm + ports: + - 8090:8090 + environment: + - CONFIG_SECRET_PATH=/var/run/secrets/secret.properties + volumes: + - ./config/secret.properties:/var/run/secrets/secret.properties + deploy: + restart_policy: + condition: on-failure + max_attempts: 5 + resources: + limits: + cpus: '0.5' + memory: 192M + reservations: + cpus: '0.001' + memory: 128M + 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 + postgres: + image: postgres:12.4 + volumes: + - ./volumes/postgres:/var/lib/postgresql/data + environment: + - POSTGRES_DB=${WGAPI_POSTGRES_DB} + - POSTGRES_USER=${WGAPI_POSTGRES_USER} + - POSTGRES_PASSWORD=${WGAPI_POSTGRES_PASSWORD} + ports: + - 5432 + keycloak: + image: jboss/keycloak:11.0.1 + environment: + - VIRTUAL_HOST=keycloak + - VIRTUAL_PORT=8080 + - DB_VENDOR=POSTGRES + - DB_DATABASE=${WGAPI_POSTGRES_DB} + - DB_SCHEMA=public + - DB_ADDR=postgres + - 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 diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..7f6dfba86e264acb6608e5e299ac9699fef4aac5 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -0,0 +1,2 @@ +quarkus.oauth.enabled=false +quarkus.oidc.enabled=false \ No newline at end of file