Commit f2683121 authored by Zachary Sabourin's avatar Zachary Sabourin
Browse files

feat: Update build process

Issue #4
parent 2c9d3016
SHELL = /bin/bash
pre-setup:;
@echo "Creating environment file from template"
@rm -f .env && envsubst < config/.env.sample > .env
setup:;
@echo "Generating secret files from templates using environment file + variables"
@source .env && rm -f ./config/application/secret.properties && envsubst < config/application/secret.properties.sample | tr -d '\r' > config/application/secret.properties
dev-start:;
source .env && mvn compile quarkus:dev
clean:;
mvn clean
compile-java: validate-spec generate-spec;
......@@ -12,13 +21,13 @@ generate-spec: install-yarn;
yarn run generate-json-schema
validate-spec: install-yarn;
compile-start: compile-quick;
docker-compose down
docker-compose build
docker-compose up
docker compose down
docker compose build
docker compose up
compile-start-headless: compile-quick;
docker-compose down
docker-compose build
docker-compose up -d
docker compose down
docker compose build
docker compose up -d
start-spec: validate-spec;
yarn run start
generate-notice-src:;
......
......@@ -4,23 +4,26 @@
Requirements:
* Docker
* docker-compose
* Java 11 or greater
* mvn
* Docker
* Java 11 >
* mvn
* node.js + npm
* make
* Running MariaDB instance
Recommended:
1. In MariaDB instance, create a new database called `eclipse` as that is what is configured out of the box. The table definitions for the database can be found under `./config/mariadb/ddl.sql`.
2. Run `make pre-setup`. This command will setup a basic .env file, using some basic variables used in Eclipse development to accelerate the generation of secret files.
3. Ensure that the `.env` file properties reflect the connection settings used for the MariaDB instance and the credentials needed to access the DB created in step 1.
4. Run `make setup` to finish the setup process for this API, generating the secret file under `./config/application/secret.properties`.
5. Run `compile-start` or `make compile-start-headless`. The first option binds the docker containers to the current terminal, and ends the processes when the terminal is closed. The second option starts the docker containers as part of the daemon and persists beyond the terminal session.
* make
The application can be checked by visiting http://localhost:8090/downloads/releases/2022-03. At this address, a return should be visible that represents the 2022-03 release of the Eclipse IDE.
Before starting, an environment file should be created to ensure that variables are properly available to the docker-compose instance that will hold the development environment. A copy of the base variables and some sample values are available under `./config/.env.sample`, and a copy for this workspace can be created by copying this file to the project root under the name `.env`. It is recommended that the base values for passwords be updated to ensure better security for the given system.
You can run your application in dev mode that enables live coding using:
Once created, a copy of the `sample.secret.properties` file in the `./config` folder should be created in the same folder with the name `secret.properties`. Once created, if the `.env` file was updated from the base, the `quarkus.datasource.password` should be updated to reflect the value for `DOWNLOADS_MYSQL_PASSWORD`.
After both the `.env` and the `./config/secret.properties` files have been created and configured, run either `make compile-start` or `make compile-start-headless`. The first option binds the docker containers to the current terminal, and ends the processes when the terminal is closed. The second option starts the docker containers as part of the daemon and persists beyond the terminal session.
The application can be checked by visiting http://localhost:8090/downloads/release/2022-03. At this address, a return should be visible that represents the 2022-03 release of the Eclipse IDE.
```bash
make dev-start
```
## Updating notice
......
DOWNLOADS_MYSQL_PASSWORD=eclipse_sample
\ No newline at end of file
export DOWNLOADS_MARIADB_USERNAME=$MARIADB_USERNAME
export DOWNLOADS_MARIADB_PASSWORD=$MARIADB_PASSWORD
export DOWNLOADS_MARIADB_HOST=$MARIADB_HOST
export DOWNLOADS_MARIADB_PORT=$MARIADB_PORT
\ No newline at end of file
quarkus.datasource.username=$DOWNLOADS_MARIADB_USERNAME
quarkus.datasource.password=$DOWNLOADS_MARIADB_PASSWORD
quarkus.datasource.jdbc.url=jdbc:mariadb://$DOWNLOADS_MARIADB_HOST:$DOWNLOADS_MARIADB_PORT/eclipse
\ No newline at end of file
quarkus.datasource.username = root
quarkus.datasource.password = eclipse_sample
quarkus.datasource.jdbc.url=jdbc:mariadb://mariadb/eclipse
\ No newline at end of file
......@@ -11,7 +11,7 @@ services:
- CONFIG_SECRET_PATH=/var/run/secrets/secret.properties
- VIRTUAL_PORT=8090
volumes:
- ./config/secret.properties:/var/run/secrets/secret.properties
- ./config/application/secret.properties:/var/run/secrets/secret.properties
deploy:
restart_policy:
condition: on-failure
......@@ -26,12 +26,14 @@ services:
depends_on:
- mariadb
mariadb:
profiles:
- full
image: mariadb:latest
command: --max_allowed_packet=100000000
ports:
- '3306:3306'
environment:
MYSQL_ROOT_PASSWORD: ${DOWNLOADS_MYSQL_PASSWORD}
MYSQL_ROOT_PASSWORD: ${DOWNLOADS_MARIADB_PASSWORD}
MYSQL_DATABASE: eclipse
volumes:
- ./config/mariadb/ddl.sql:/docker-entrypoint-initdb.d/ddl.sql
......
......@@ -5,7 +5,7 @@
<artifactId>eclipsefdn-downloads-api</artifactId>
<version>0.0.1-SNAPSHOT</version>
<properties>
<eclipse-api-version>0.6.1-SNAPSHOT</eclipse-api-version>
<eclipse-api-version>0.6.5-SNAPSHOT</eclipse-api-version>
<surefire-plugin.version>2.22.1</surefire-plugin.version>
<compiler-plugin.version>3.8.1</compiler-plugin.version>
<maven.compiler.target>11</maven.compiler.target>
......
......@@ -3,6 +3,7 @@ quarkus.http.port=8090
quarkus.http.cors=true
quarkus.http.enable-compression=true
security.csrf.enabled=true
security.csrf.distributed-mode.default-provider=false
## DATASOURCE CONFIG
eclipse.db.default.limit=10
......@@ -10,11 +11,12 @@ eclipse.db.default.limit.max=100
quarkus.datasource.db-kind=mariadb
quarkus.datasource.jdbc.min-size = 5
quarkus.datasource.jdbc.max-size = 15
quarkus.oidc.enabled=false
drupal/mp-rest/url=https://eclipse.org
drupal/mp-rest/followRedirects=true
# Tells Quarkus which objects are associated with what databases (used to generate entity tables internally)
quarkus.hibernate-orm.packages=org.eclipsefoundation.downloads.dto
quarkus.hibernate-orm.packages=org.eclipsefoundation.downloads.dto,org.eclipsefoundation.persistence.dto
quarkus.hibernate-orm.datasource=<default>
quarkus.hibernate-orm.physical-naming-strategy=org.eclipsefoundation.downloads.config.DefaultPhysicalNamingStrategy
\ No newline at end of file
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment