-
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.
- Loading branch information
0 parents
commit a662e57
Showing
29 changed files
with
1,238 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
target/ | ||
!.mvn/wrapper/maven-wrapper.jar | ||
|
||
### STS ### | ||
.apt_generated | ||
.classpath | ||
.factorypath | ||
.project | ||
.settings | ||
.springBeans | ||
.sts4-cache | ||
|
||
### IntelliJ IDEA ### | ||
.idea | ||
*.iws | ||
*.iml | ||
*.ipr | ||
|
||
### Visual Studio Code | ||
.vscode | ||
|
||
### NetBeans ### | ||
nbproject/private/ | ||
nbbuild/ | ||
dist/ | ||
nbdist/ | ||
.nb-gradle/ | ||
|
||
mvnw | ||
mvnw.cmd | ||
.DS_Store | ||
|
||
### Build stuff | ||
build/ | ||
build.sh | ||
build.bat |
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,4 @@ | ||
PORT=8080 | ||
LOGGING_LEVEL=INFO | ||
MONGODB_URI=mongodb://mongo-node1:27017,mongo-node2:27018,mongo-node3:27019/electicity-prices | ||
SPRING_PROFILES_ACTIVE=prod |
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,16 @@ | ||
name: Build Docker image | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
branches: ["main"] | ||
|
||
jobs: | ||
build: | ||
name: Build docker image | ||
runs-on: self-hosted | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Build the Docker image | ||
run: docker build . --file Dockerfile |
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,47 @@ | ||
name: Publish to Dockerhub | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
publish: | ||
name: Build and Publish docker image to dockerhub | ||
permissions: | ||
contents: write | ||
pull-requests: write | ||
packages: read | ||
runs-on: self-hosted | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Update Version | ||
run: echo "${{ github.ref_name }}" > .version | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
- name: Publish to Registry | ||
uses: elgohr/Publish-Docker-Github-Action@v5 | ||
with: | ||
name: daithihearn/electricity-prices | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
platforms: linux/amd64,linux/arm64/v8 | ||
tags: "latest,${{ github.ref_name }}" | ||
- name: Create PR with version changes | ||
uses: peter-evans/create-pull-request@v4 | ||
with: | ||
token: ${{ secrets.PAT_PR }} | ||
commit-message: Update latest version (${{ github.ref_name }}) | ||
title: Update latest version (${{ github.ref_name }}) | ||
body: | | ||
Update latest version (${{ github.ref_name }}) | ||
branch: update-version-${{ github.ref_name }} | ||
base: main | ||
add-paths: | | ||
.version | ||
labels: | | ||
update | ||
assignees: | | ||
${{ github.actor }} |
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,25 @@ | ||
name: Run unit tests | ||
|
||
on: | ||
pull_request: | ||
branches: [ "main" ] | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
unit-tests: | ||
name: Run unit tests | ||
runs-on: self-hosted | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up JDK 19 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '19' | ||
distribution: 'temurin' | ||
- name: Build with Gradle | ||
uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1 | ||
with: | ||
arguments: test |
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,45 @@ | ||
# Compiled class file | ||
*.class | ||
|
||
# Log file | ||
*.log | ||
logs/ | ||
|
||
# BlueJ files | ||
*.ctxt | ||
|
||
# Mobile Tools for Java (J2ME) | ||
.mtj.tmp/ | ||
|
||
# Package Files # | ||
*.war | ||
*.nar | ||
*.ear | ||
*.zip | ||
*.tar.gz | ||
*.rar | ||
|
||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml | ||
hs_err_pid* | ||
|
||
.gradle/ | ||
.idea/ | ||
id-core.iml | ||
**/*.iml | ||
build/ | ||
.settings/ | ||
.classpath | ||
.DS_Store | ||
.project | ||
classes/ | ||
frontend | ||
/output/ | ||
dump.rdb | ||
/root | ||
/out | ||
velocity.log* | ||
bin/ | ||
.vscode/ | ||
|
||
# Deployment Script | ||
deploy.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 @@ | ||
0.0.1 |
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,24 @@ | ||
FROM eclipse-temurin:19 AS builder | ||
|
||
WORKDIR /opt/app | ||
|
||
COPY ./gradle ./gradle | ||
COPY ./gradlew ./ | ||
|
||
RUN ./gradlew | ||
|
||
COPY ./build.gradle.kts ./ | ||
COPY ./settings.gradle ./ | ||
COPY ./system.properties ./ | ||
COPY ./.version ./ | ||
COPY ./src ./src | ||
|
||
RUN ./gradlew build publishToMavenLocal | ||
|
||
FROM eclipse-temurin:19 | ||
|
||
WORKDIR /opt/app | ||
|
||
COPY --from=builder /opt/app/build/libs/electricity-prices*.jar /opt/app/app.jar | ||
|
||
ENTRYPOINT ["java", "-Djdk.tls.client.protocols=TLSv1.2", "-jar", "./app.jar", "-XX:+UseContainerSupport"] |
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,29 @@ | ||
# Read Me First | ||
The following was discovered as part of building this project: | ||
|
||
* The original package name 'ie.daithi.electricity-prices' is invalid and this project uses 'ie.daithi.electricityprices' instead. | ||
|
||
# Getting Started | ||
|
||
### Reference Documentation | ||
For further reference, please consider the following sections: | ||
|
||
* [Official Gradle documentation](https://docs.gradle.org) | ||
* [Spring Boot Gradle Plugin Reference Guide](https://docs.spring.io/spring-boot/docs/3.1.0-M2/gradle-plugin/reference/html/) | ||
* [Create an OCI image](https://docs.spring.io/spring-boot/docs/3.1.0-M2/gradle-plugin/reference/html/#build-image) | ||
* [Spring Web](https://docs.spring.io/spring-boot/docs/3.1.0-M2/reference/htmlsingle/#web) | ||
* [Spring Data MongoDB](https://docs.spring.io/spring-boot/docs/3.1.0-M2/reference/htmlsingle/#data.nosql.mongodb) | ||
|
||
### Guides | ||
The following guides illustrate how to use some features concretely: | ||
|
||
* [Building a RESTful Web Service](https://spring.io/guides/gs/rest-service/) | ||
* [Serving Web Content with Spring MVC](https://spring.io/guides/gs/serving-web-content/) | ||
* [Building REST services with Spring](https://spring.io/guides/tutorials/rest/) | ||
* [Accessing Data with MongoDB](https://spring.io/guides/gs/accessing-data-mongodb/) | ||
|
||
### Additional Links | ||
These additional references should also help you: | ||
|
||
* [Gradle Build Scans – insights for your project's build](https://scans.gradle.com#gradle) | ||
|
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,97 @@ | ||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile | ||
import org.springframework.boot.gradle.tasks.bundling.BootJar | ||
|
||
buildscript { | ||
val kotlinVersion = "1.6.10" | ||
val springBootVersion = "2.7.7" | ||
repositories { | ||
mavenLocal() | ||
mavenCentral() | ||
} | ||
dependencies { | ||
classpath("org.springframework.boot:spring-boot-gradle-plugin:$springBootVersion") | ||
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion") | ||
} | ||
} | ||
|
||
plugins { | ||
id("org.springframework.boot") version "2.7.7" | ||
id("maven-publish") | ||
id("org.jetbrains.kotlin.jvm") version "1.6.10" | ||
kotlin("plugin.spring") version "1.6.10" | ||
} | ||
|
||
apply(plugin = "maven-publish") | ||
apply(plugin = "io.spring.dependency-management") | ||
|
||
tasks.withType<JavaCompile> { | ||
options.encoding = "UTF-8" | ||
} | ||
|
||
repositories { | ||
mavenLocal() | ||
mavenCentral() | ||
} | ||
|
||
version=File(".version").readText(Charsets.UTF_8) | ||
|
||
group = "ie.daithi.electricityprices" | ||
java.sourceCompatibility = JavaVersion.VERSION_19 | ||
|
||
description = "api" | ||
|
||
val springBootVersion: String = "2.7.7" | ||
val swaggerVersion: String = "2.9.2" | ||
|
||
dependencies { | ||
|
||
// Internal Dependencies | ||
|
||
// External Dependencies | ||
|
||
// Kotlin dependencies | ||
implementation("org.jetbrains.kotlin:kotlin-reflect:1.6.10") | ||
implementation("org.jetbrains.kotlin:kotlin-stdlib:1.6.10") | ||
|
||
// Spring dependencies | ||
implementation("org.springframework.boot:spring-boot-starter:$springBootVersion") | ||
implementation("org.springframework.boot:spring-boot-starter-web:$springBootVersion") | ||
implementation("org.springframework.boot:spring-boot-starter-webflux:$springBootVersion") | ||
implementation("org.springframework.boot:spring-boot-starter-data-mongodb:$springBootVersion") | ||
|
||
// Springfox | ||
implementation("io.springfox:springfox-swagger2:$swaggerVersion") | ||
implementation("io.springfox:springfox-swagger-ui:$swaggerVersion") | ||
|
||
// Other | ||
implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.14.0") | ||
implementation("org.apache.commons:commons-text:1.10.0") | ||
|
||
//Test | ||
testImplementation("org.springframework.boot:spring-boot-starter-test:$springBootVersion") | ||
testImplementation("io.mockk:mockk:1.13.2") | ||
|
||
|
||
} | ||
|
||
tasks.withType<Test> { | ||
useJUnitPlatform() | ||
testLogging { | ||
events("passed", "skipped", "failed") | ||
} | ||
} | ||
|
||
tasks.withType<KotlinCompile> { | ||
kotlinOptions { | ||
freeCompilerArgs = listOf("-Xjsr305=strict") | ||
jvmTarget = "17" | ||
} | ||
} | ||
|
||
tasks.getByName<BootJar>("bootJar") { | ||
enabled = true | ||
} | ||
|
||
tasks.getByName<Jar>("jar") { | ||
enabled = false | ||
} |
Binary file not shown.
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,5 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
Oops, something went wrong.