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

Merge branch 'zacharysabourin/main/8' into 'main'

feat: Normalize build process + instructions

Closes #8

See merge request !19
parents c91a0d58 818d1456
No related branches found
No related tags found
1 merge request!19feat: Normalize build process + instructions
Pipeline #15530 passed
......@@ -2,27 +2,38 @@ 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:;
mvn compile -e quarkus:dev -Dconfig.secret.path=$$PWD/config/application/secret.properties
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
compile-java-quick: generate-spec;
compile-java-quick: compile-test-resources;
mvn compile package -Dmaven.test.skip=true
compile: clean compile-java;
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;
docker compose down
docker compose build
docker compose up -d
start-spec: validate-spec;
start-spec: compile-test-resources;
yarn run start
......@@ -4,7 +4,7 @@ Eclipse Foundation API service for the retrieval of active mailing list data for
## Starting a development environment
Requirements:
### Requirements
* Docker
* Java 11 >
......@@ -13,14 +13,58 @@ Requirements:
* make
* 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`.
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.
### Setup
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
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` (
`email` varchar(254) NOT NULL DEFAULT '',
`list_name` varchar(254) NOT NULL DEFAULT '',
......
......@@ -5,7 +5,7 @@ services:
context: .
dockerfile: ./src/main/docker/Dockerfile.jvm
ports:
- "8090:8090"
- "10114:8090"
environment:
- VIRTUAL_HOST=api.eclipse.docker
- CONFIG_SECRET_PATH=/var/run/secrets/secret.properties
......@@ -26,17 +26,15 @@ services:
depends_on:
- mariadb
mariadb:
profiles:
- full
image: mariadb:latest
command: --max_allowed_packet=100000000
ports:
- '3306:3306'
- '10115:3306'
environment:
MYSQL_ROOT_PASSWORD: ${MAILING_LISTS_MARIADB_PASSWORD}
MYSQL_DATABASE: eclipse
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
nginx-proxy:
image: jwilder/nginx-proxy
......
<?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">
<modelVersion>4.0.0</modelVersion>
<groupId>org.eclipsefoundation</groupId>
......@@ -49,7 +50,8 @@
<groupId>org.eclipsefoundation</groupId>
<artifactId>quarkus-core</artifactId>
<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>
<exclusion>
<groupId>org.jboss.logmanager</groupId>
......@@ -62,22 +64,6 @@
<artifactId>quarkus-persistence</artifactId>
<version>${eclipse-api-version}</version>
</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>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-oidc-client-filter</artifactId>
......@@ -86,36 +72,15 @@
<groupId>io.quarkus</groupId>
<artifactId>quarkus-rest-client</artifactId>
</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 -->
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>
<!-- 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>
<!-- Annotation preprocessors - reduce all of the boiler plate -->
<dependency>
<groupId>com.google.auto.value</groupId>
<artifactId>auto-value-annotations</artifactId>
......@@ -126,7 +91,7 @@
<version>3.0.0</version>
</dependency>
<!-- Testing dependencies only -->
<!-- Testing dependencies only -->
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-junit5</artifactId>
......@@ -137,24 +102,14 @@
<artifactId>rest-assured</artifactId>
<scope>test</scope>
</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>
<groupId>org.eclipsefoundation</groupId>
<artifactId>quarkus-test-common</artifactId>
<version>${eclipse-api-version}</version>
<scope>test</scope>
</dependency>
<!-- Following H2/devservices deps are made to circumvent need for docker -->
<!-- Following H2/devservices deps are made to circumvent need for docker -->
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-devservices-h2</artifactId>
......@@ -170,7 +125,7 @@
<artifactId>h2</artifactId>
<scope>test</scope>
</dependency>
<!-- Flyway specific dependencies, used to setup tables in test -->
<!-- Flyway specific dependencies, used to setup tables in test -->
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-flyway</artifactId>
......@@ -241,7 +196,8 @@
</goals>
<configuration>
<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>
<maven.home>${maven.home}</maven.home>
</systemPropertyVariables>
......@@ -256,4 +212,4 @@
</properties>
</profile>
</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