Skip to content
Snippets Groups Projects
Commit 818d1456 authored by Zachary Sabourin's avatar Zachary Sabourin Committed by Martin Lowe
Browse files

feat: Normalize build process + instructions

parent c91a0d58
No related branches found
No related tags found
1 merge request!19feat: Normalize build process + instructions
...@@ -2,27 +2,38 @@ SHELL = /bin/bash ...@@ -2,27 +2,38 @@ SHELL = /bin/bash
pre-setup:; pre-setup:;
@echo "Creating environment file from template" @echo "Creating environment file from template"
@rm -f .env && envsubst < config/.env.sample > .env @rm -f .env && envsubst < config/.env.sample > .env
setup:; setup:;
@echo "Generating secret files from templates using environment file + variables" @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 @source .env && rm -f ./config/application/secret.properties && envsubst < config/application/secret.properties.sample | tr -d '\r' > config/application/secret.properties
dev-start:; dev-start:;
mvn compile -e quarkus:dev -Dconfig.secret.path=$$PWD/config/application/secret.properties mvn compile -e quarkus:dev -Dconfig.secret.path=$$PWD/config/application/secret.properties
clean:; clean:;
mvn clean mvn clean
compile-java: generate-spec; yarn run clean
install-yarn:;
yarn install --frozen-lockfile --audit
compile-test-resources: install-yarn;
yarn run generate-json-schema
compile-java: compile-test-resources;
mvn compile package mvn compile package
compile-java-quick: generate-spec;
compile-java-quick: compile-test-resources;
mvn compile package -Dmaven.test.skip=true mvn compile package -Dmaven.test.skip=true
compile: clean compile-java; compile: clean compile-java;
compile-quick: clean compile-java-quick; compile-quick: clean compile-java-quick;
install-yarn:;
yarn install --frozen-lockfile --audit
generate-spec: install-yarn validate-spec;
yarn run generate-json-schema
validate-spec: install-yarn;
compile-start: compile-quick; compile-start: compile-quick;
docker compose down docker compose down
docker compose build docker compose build
docker compose up -d docker compose up -d
start-spec: validate-spec;
start-spec: compile-test-resources;
yarn run start yarn run start
...@@ -4,7 +4,7 @@ Eclipse Foundation API service for the retrieval of active mailing list data for ...@@ -4,7 +4,7 @@ Eclipse Foundation API service for the retrieval of active mailing list data for
## Starting a development environment ## Starting a development environment
Requirements: ### Requirements
* Docker * Docker
* Java 11 > * Java 11 >
...@@ -13,14 +13,58 @@ Requirements: ...@@ -13,14 +13,58 @@ Requirements:
* make * make
* Running MariaDB instance * Running MariaDB instance
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`. ### Setup
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.
You can run your application in dev mode that enables live coding using: Before running the application, some setup is required.
1. 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.
2. 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.
3. Run `make setup` to finish the setup process for this API, generating the secret file under `./config/application/secret.properties`.
4. To finish the setup, open the secrets file and add values to the missing fields before starting the server.
#### Build and Start Server
```bash
make compile-start
```
#### Live-coding Dev Mode
```bash ```bash
make dev-start make dev-start
``` ```
#### Generate Spec
```bash
make compile-test-resources
```
#### Running Tests
```bash
mvn test
```
#### Render a Live UI Preview of the API Spec
```bash
make start-spec
```
## Contributing
1. [Fork](https://docs.gitlab.com/ee/user/project/repository/forking_workflow.html) the [eclipsefdn-mailing-lists-api](https://gitlab.eclipse.org//eclipsefdn/it/api/eclipsefdn-mailing-lists-api) repository
2. Clone repository `git clone https://gitlab.eclipse.org/[your_eclipsefdn_username]/eclipsefdn-mailing-lists-api.git`
3. Create your feature branch: `git checkout -b my-new-feature`
4. Commit your changes: `git commit -m 'Add some feature' -s`
5. Push feature branch: `git push origin my-new-feature`
6. Submit a merge request
### Declared Project Licenses
This program and the accompanying materials are made available under the terms
of the Eclipse Public License v. 2.0 which is available at
[http://www.eclipse.org/legal/epl-2.0].
SPDX-License-Identifier: EPL-2.0
CREATE DATABASE `eclipse`;
USE `eclipse`;
CREATE TABLE `mailing_list_subscriptions` ( CREATE TABLE `mailing_list_subscriptions` (
`email` varchar(254) NOT NULL DEFAULT '', `email` varchar(254) NOT NULL DEFAULT '',
`list_name` varchar(254) NOT NULL DEFAULT '', `list_name` varchar(254) NOT NULL DEFAULT '',
......
...@@ -5,7 +5,7 @@ services: ...@@ -5,7 +5,7 @@ services:
context: . context: .
dockerfile: ./src/main/docker/Dockerfile.jvm dockerfile: ./src/main/docker/Dockerfile.jvm
ports: ports:
- "8090:8090" - "10114:8090"
environment: environment:
- VIRTUAL_HOST=api.eclipse.docker - VIRTUAL_HOST=api.eclipse.docker
- CONFIG_SECRET_PATH=/var/run/secrets/secret.properties - CONFIG_SECRET_PATH=/var/run/secrets/secret.properties
...@@ -26,17 +26,15 @@ services: ...@@ -26,17 +26,15 @@ services:
depends_on: depends_on:
- mariadb - mariadb
mariadb: mariadb:
profiles:
- full
image: mariadb:latest image: mariadb:latest
command: --max_allowed_packet=100000000 command: --max_allowed_packet=100000000
ports: ports:
- '3306:3306' - '10115:3306'
environment: environment:
MYSQL_ROOT_PASSWORD: ${MAILING_LISTS_MARIADB_PASSWORD} MYSQL_ROOT_PASSWORD: ${MAILING_LISTS_MARIADB_PASSWORD}
MYSQL_DATABASE: eclipse MYSQL_DATABASE: eclipse
volumes: volumes:
- ./config/mariadb/ddl.sql:/docker-entrypoint-initdb.d/ddl.sql - ./config/mariadb/main/init.d/init.sql:/docker-entrypoint-initdb.d/init.sql
- ./volumes/mariadb:/var/lib/mysql - ./volumes/mariadb:/var/lib/mysql
nginx-proxy: nginx-proxy:
image: jwilder/nginx-proxy image: jwilder/nginx-proxy
......
<?xml version="1.0"?> <?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" <project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>org.eclipsefoundation</groupId> <groupId>org.eclipsefoundation</groupId>
...@@ -49,7 +50,8 @@ ...@@ -49,7 +50,8 @@
<groupId>org.eclipsefoundation</groupId> <groupId>org.eclipsefoundation</groupId>
<artifactId>quarkus-core</artifactId> <artifactId>quarkus-core</artifactId>
<version>${eclipse-api-version}</version> <version>${eclipse-api-version}</version>
<!-- Can be removed once dependency is removed from base package https://stackoverflow.com/questions/67510802/logging-in-quarkus-works-in-dev-mode-but-doesnt-output-in-jvm-docker-image --> <!-- Can be removed once dependency is removed from base package
https://stackoverflow.com/questions/67510802/logging-in-quarkus-works-in-dev-mode-but-doesnt-output-in-jvm-docker-image -->
<exclusions> <exclusions>
<exclusion> <exclusion>
<groupId>org.jboss.logmanager</groupId> <groupId>org.jboss.logmanager</groupId>
...@@ -62,22 +64,6 @@ ...@@ -62,22 +64,6 @@
<artifactId>quarkus-persistence</artifactId> <artifactId>quarkus-persistence</artifactId>
<version>${eclipse-api-version}</version> <version>${eclipse-api-version}</version>
</dependency> </dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy-multipart</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy-jackson</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-oidc</artifactId>
</dependency>
<dependency> <dependency>
<groupId>io.quarkus</groupId> <groupId>io.quarkus</groupId>
<artifactId>quarkus-oidc-client-filter</artifactId> <artifactId>quarkus-oidc-client-filter</artifactId>
...@@ -86,36 +72,15 @@ ...@@ -86,36 +72,15 @@
<groupId>io.quarkus</groupId> <groupId>io.quarkus</groupId>
<artifactId>quarkus-rest-client</artifactId> <artifactId>quarkus-rest-client</artifactId>
</dependency> </dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-cache</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-arc</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-hibernate-validator</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-text</artifactId>
<version>1.9</version>
</dependency>
<!-- Required for Hibernate naming strategy > Look for smaller alt package for Google core --> <!-- Required for Hibernate naming strategy > Look for smaller alt package for Google core -->
<dependency> <dependency>
<groupId>com.google.guava</groupId> <groupId>com.google.guava</groupId>
<artifactId>guava</artifactId> <artifactId>guava</artifactId>
</dependency> </dependency>
<!-- Annotation preprocessors - reduce all of the boiler plate --> <!-- Annotation preprocessors - reduce all of the boiler plate -->
<dependency>
<groupId>com.google.auto.value</groupId>
<artifactId>auto-value</artifactId>
<version>${auto-value.version}</version>
<scope>provided</scope>
</dependency>
<dependency> <dependency>
<groupId>com.google.auto.value</groupId> <groupId>com.google.auto.value</groupId>
<artifactId>auto-value-annotations</artifactId> <artifactId>auto-value-annotations</artifactId>
...@@ -126,7 +91,7 @@ ...@@ -126,7 +91,7 @@
<version>3.0.0</version> <version>3.0.0</version>
</dependency> </dependency>
<!-- Testing dependencies only --> <!-- Testing dependencies only -->
<dependency> <dependency>
<groupId>io.quarkus</groupId> <groupId>io.quarkus</groupId>
<artifactId>quarkus-junit5</artifactId> <artifactId>quarkus-junit5</artifactId>
...@@ -137,24 +102,14 @@ ...@@ -137,24 +102,14 @@
<artifactId>rest-assured</artifactId> <artifactId>rest-assured</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>json-schema-validator</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-junit5-mockito</artifactId>
<scope>test</scope>
</dependency>
<dependency> <dependency>
<groupId>org.eclipsefoundation</groupId> <groupId>org.eclipsefoundation</groupId>
<artifactId>quarkus-test-common</artifactId> <artifactId>quarkus-test-common</artifactId>
<version>${eclipse-api-version}</version> <version>${eclipse-api-version}</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<!-- Following H2/devservices deps are made to circumvent need for docker --> <!-- Following H2/devservices deps are made to circumvent need for docker -->
<dependency> <dependency>
<groupId>io.quarkus</groupId> <groupId>io.quarkus</groupId>
<artifactId>quarkus-devservices-h2</artifactId> <artifactId>quarkus-devservices-h2</artifactId>
...@@ -170,7 +125,7 @@ ...@@ -170,7 +125,7 @@
<artifactId>h2</artifactId> <artifactId>h2</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<!-- Flyway specific dependencies, used to setup tables in test --> <!-- Flyway specific dependencies, used to setup tables in test -->
<dependency> <dependency>
<groupId>io.quarkus</groupId> <groupId>io.quarkus</groupId>
<artifactId>quarkus-flyway</artifactId> <artifactId>quarkus-flyway</artifactId>
...@@ -241,7 +196,8 @@ ...@@ -241,7 +196,8 @@
</goals> </goals>
<configuration> <configuration>
<systemPropertyVariables> <systemPropertyVariables>
<native.image.path>${project.build.directory}/${project.build.finalName}-runner</native.image.path> <native.image.path>
${project.build.directory}/${project.build.finalName}-runner</native.image.path>
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager> <java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
<maven.home>${maven.home}</maven.home> <maven.home>${maven.home}</maven.home>
</systemPropertyVariables> </systemPropertyVariables>
...@@ -256,4 +212,4 @@ ...@@ -256,4 +212,4 @@
</properties> </properties>
</profile> </profile>
</profiles> </profiles>
</project> </project>
\ 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