-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from companieshouse/initial-skeleton-branch
✨ initial commit
- Loading branch information
Showing
33 changed files
with
1,335 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# Read Me First | ||
The following was discovered as part of building this project: | ||
|
||
* No Docker Compose services found. As of now, the application won't start! Please add at least one service to the `compose.yaml` file. | ||
|
||
# Getting Started | ||
|
||
### Reference Documentation | ||
For further reference, please consider the following sections: | ||
|
||
* [Official Apache Maven documentation](https://maven.apache.org/guides/index.html) | ||
* [Spring Boot Maven Plugin Reference Guide](https://docs.spring.io/spring-boot/3.4.2/maven-plugin) | ||
* [Create an OCI image](https://docs.spring.io/spring-boot/3.4.2/maven-plugin/build-image.html) | ||
* [Spring Boot Testcontainers support](https://docs.spring.io/spring-boot/3.4.2/reference/testing/testcontainers.html#testing.testcontainers) | ||
* [Testcontainers Kafka Modules Reference Guide](https://java.testcontainers.org/modules/kafka/) | ||
* [Spring for Apache Kafka](https://docs.spring.io/spring-boot/3.4.2/reference/messaging/kafka.html) | ||
* [Docker Compose Support](https://docs.spring.io/spring-boot/3.4.2/reference/features/dev-services.html#features.dev-services.docker-compose) | ||
* [Spring Security](https://docs.spring.io/spring-boot/3.4.2/reference/web/spring-security.html) | ||
* [Testcontainers](https://java.testcontainers.org/) | ||
|
||
### Guides | ||
The following guides illustrate how to use some features concretely: | ||
|
||
* [Securing a Web Application](https://spring.io/guides/gs/securing-web/) | ||
* [Spring Boot and OAuth2](https://spring.io/guides/tutorials/spring-boot-oauth2/) | ||
* [Authenticating a User with LDAP](https://spring.io/guides/gs/authenticating-ldap/) | ||
|
||
### Docker Compose support | ||
This project contains a Docker Compose file named `compose.yaml`. | ||
|
||
However, no services were found. As of now, the application won't start! | ||
|
||
Please make sure to add at least one service in the `compose.yaml` file. | ||
|
||
### Testcontainers support | ||
|
||
This project uses [Testcontainers at development time](https://docs.spring.io/spring-boot/3.4.2/reference/features/dev-services.html#features.dev-services.testcontainers). | ||
|
||
Testcontainers has been configured to use the following Docker images: | ||
|
||
* [`apache/kafka-native:latest`](https://hub.docker.com/r/apache/kafka-native) | ||
|
||
Please review the tags of the used images and set them to the same as you're running in production. | ||
|
||
### Maven Parent overrides | ||
|
||
Due to Maven's design, elements are inherited from the parent POM to the project POM. | ||
While most of the inheritance is fine, it also inherits unwanted elements like `<license>` and `<developers>` from the parent. | ||
To prevent this, the project POM contains empty overrides for these elements. | ||
If you manually switch to a different parent and actually want the inheritance, you need to remove those overrides. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
artifact_name := chs-notification-sender-api | ||
version := "unversioned" | ||
|
||
.PHONY: all | ||
all: build | ||
|
||
.PHONY: clean | ||
clean: | ||
mvn clean | ||
rm -f ./$(artifact_name).jar | ||
rm -f ./$(artifact_name)-*.zip | ||
rm -rf ./build-* | ||
rm -f ./build.log | ||
|
||
.PHONY: security-check | ||
security-check: | ||
mvn org.owasp:dependency-check-maven:update-only | ||
mvn org.owasp:dependency-check-maven:check -DfailBuildOnCVSS=4 -DassemblyAnalyzerEnabled=false | ||
|
||
.PHONY: build | ||
build: | ||
mvn versions:set -DnewVersion=$(version) -DgenerateBackupPoms=false | ||
mvn package -DskipTests=true | ||
cp ./target/$(artifact_name)-$(version).jar ./$(artifact_name).jar | ||
|
||
.PHONY: test | ||
test: clean | ||
mvn verify | ||
|
||
.PHONY: test-unit | ||
test-unit: clean | ||
mvn test -DexcludedGroups="integration-test" | ||
|
||
.PHONY: test-integration | ||
test-integration: clean | ||
mvn test -Dgroups="integration-test" | ||
|
||
.PHONY: package | ||
package: | ||
ifndef version | ||
$(error No version given. Aborting) | ||
endif | ||
$(info Packaging version: $(version)) | ||
mvn versions:set -DnewVersion=$(version) -DgenerateBackupPoms=false | ||
mvn package -DskipTests=true | ||
$(eval tmpdir:=$(shell mktemp -d build-XXXXXXXXXX)) | ||
cp ./start.sh $(tmpdir) | ||
cp ./routes.yaml $(tmpdir) | ||
cp ./target/$(artifact_name)-$(version).jar $(tmpdir)/$(artifact_name).jar | ||
cd $(tmpdir); zip -r ../$(artifact_name)-$(version).zip * | ||
rm -rf $(tmpdir) | ||
|
||
.PHONY: dist | ||
dist: clean build package | ||
|
||
.PHONY: sonar | ||
sonar: | ||
mvn sonar:sonar | ||
|
||
.PHONY: sonar-pr-analysis | ||
sonar-pr-analysis: | ||
mvn sonar:sonar -P sonar-pr-analysis |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
local_resource( | ||
name = 'dev:chs-notification-sender-api', | ||
cmd = 'mvn clean compile', | ||
deps = ['src'] | ||
) | ||
custom_build( | ||
ref = '416670754337.dkr.ecr.eu-west-2.amazonaws.com/chs-notification-sender-api:latest', | ||
command = 'mvn clean compile jib:dockerBuild -Dimage=$EXPECTED_REF', | ||
live_update = [ | ||
sync( | ||
local_path = './target/classes', | ||
remote_path = '/app/classes' | ||
), | ||
restart_container() | ||
], | ||
deps = ['./target/classes'] | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
ARG IMAGE_VERSION="latest" | ||
FROM 416670754337.dkr.ecr.eu-west-2.amazonaws.com/ci-corretto-runtime-21:${IMAGE_VERSION} | ||
|
||
WORKDIR /opt | ||
COPY /app . | ||
COPY docker_start.sh . | ||
|
||
CMD ["./docker_start.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/bash | ||
# | ||
# Start script for accounts-association-service | ||
|
||
PORT=8080 | ||
|
||
exec java -jar -Dserver.port="${PORT}" "chs-notification-sender-api.jar" |
Oops, something went wrong.