Skip to content

Commit 4787576

Browse files
Merge pull request #2 from AStA-HSRM/dev-java-julian
merge deployment files into main dev branch
2 parents 69f1270 + 5106380 commit 4787576

6 files changed

+124
-5
lines changed

.gitignore

+4-1
Original file line numberDiff line numberDiff line change
@@ -208,4 +208,7 @@ docker-persistence/*
208208
!docker-persistence/.gitkeep
209209

210210
# ignore secret configuration files
211-
secret.properties
211+
secret.properties
212+
213+
# Gzipped log file
214+
*.log.*.gz

Dockerfile

+25
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,31 @@
11
FROM openjdk:11-jdk-slim
2+
3+
# Create user and group to run as
24
RUN addgroup --system spring && adduser --system --group spring
5+
6+
ARG SPRING_FOLDER=/srv/spring
7+
8+
# Create settings and logs folder
9+
RUN mkdir -pv ${SPRING_FOLDER}/logs && \
10+
mkdir -pv ${SPRING_FOLDER}/config
11+
12+
# Set path for log file
13+
ENV LOGGING_FILE_NAME=${SPRING_FOLDER}/logs/error.log
14+
15+
# Copy over override.properties file to container (ENV variables take precedence)
16+
ENV SPRING_CONFIG_IMPORT=optional:file:${SPRING_FOLDER}/config/override.properties
17+
COPY src/main/resources/application.properties.sample ${SPRING_FOLDER}/config/override.properties
18+
19+
# Set proper perms
20+
RUN chown -R spring:spring ${SPRING_FOLDER}
21+
22+
# Set run user and group
323
USER spring:spring
24+
25+
# Copy over compiled jar
426
ARG JAR_FILE=build/libs/gremiomat-0.0.1-SNAPSHOT.jar
527
COPY ${JAR_FILE} app.jar
28+
29+
WORKDIR ${SPRING_FOLDER}
30+
631
ENTRYPOINT ["java","-jar","/app.jar"]

build.gradle

+8
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@ group = 'de.astahsrm'
1010
version = '0.0.1-SNAPSHOT'
1111
sourceCompatibility = '11'
1212

13+
jar {
14+
manifest {
15+
attributes(
16+
'Main-Class': 'de.astahsrm.gremiomat.GremiomatApplication'
17+
)
18+
}
19+
}
20+
1321
repositories {
1422
mavenCentral()
1523
}

docker-compose-prod.yml

+17-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,22 @@
11
version: "2"
22

3-
services:
4-
tomcat-test:
3+
services:
4+
spring:
55
build: .
66
restart: always
7-
container_name: tomcat-test
7+
environment:
8+
# required arguments
9+
- SPRING_DATASOURCE_URL=jdbc:mariadb://db:3306/temp_db
10+
- SPRING_DATASOURCE_USERNAME=dev
11+
- SPRING_DATASOURCE_PASSWORD=dev123
12+
- SPRING_DATASOURCE_DRIVER-CLASS-NAME=org.mariadb.jdbc.Driver
13+
- SPRING_MAIL_USERNAME=mail@example.com
14+
- SPRING_MAIL_PASSWORD=N0tTh3Actu4lP4SSw0rd
15+
# optional arguments
16+
# - SERVER_PORT=8090
17+
# - DEBUG=true
18+
# - SPRING_THYMELEAF_CACHE=false
19+
# - LOGGING_LEVEL_WEB=DEBUG
20+
# network_mode: host
821
ports:
9-
- 8080:8080
22+
- 8090:8090
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Server config
2+
# server.port=8090
3+
# debug=false
4+
# spring.thymeleaf.cache=false
5+
6+
# logging config for Errors
7+
# logging.file.name=error.log
8+
# logging.level.web=DEBUG
9+
# logging.level.org.springframework.web=debug
10+
11+
# Database config
12+
# spring.datasource.url=jdbc:mariadb://localhost:3306/temp_db
13+
# spring.datasource.username=dev
14+
# spring.datasource.password=dev123
15+
# spring.datasource.driver-class-name=org.mariadb.jdbc.Driver
16+
# spring.jpa.hibernate.ddl-auto=create-drop
17+
# spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MariaDB103Dialect
18+
19+
# For initialising DB with data.sql
20+
# spring.sql.init.mode=always
21+
# spring.jpa.defer-datasource-initialization=true
22+
23+
# logging.level.org.springframework.boot.autoconfigure=ERROR
24+
25+
# Mail config
26+
spring.mail.default-encoding=UTF-8
27+
spring.mail.host=host.boi
28+
spring.mail.port=69
29+
spring.mail.username=boi
30+
spring.mail.password=b01
31+
spring.mail.test-connection=false
32+
spring.mail.properties.mail.smtp.auth=true
33+
spring.mail.properties.mail.smtp.starttls.enable=true
34+
35+
spring.config.import=optional:file:/srv/spring/config/override.properties
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Server config
2+
# server.port=8090
3+
# debug=false
4+
# spring.thymeleaf.cache=false
5+
6+
# logging config for Errors
7+
# logging.file.name=error.log
8+
# logging.level.web=DEBUG
9+
# logging.level.org.springframework.web=debug
10+
11+
# Database config
12+
# spring.datasource.url=jdbc:mariadb://localhost:3306/temp_db
13+
# spring.datasource.username=dev
14+
# spring.datasource.password=dev123
15+
# spring.datasource.driver-class-name=org.mariadb.jdbc.Driver
16+
# spring.jpa.hibernate.ddl-auto=create-drop
17+
# spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MariaDB103Dialect
18+
19+
# For initialising DB with data.sql
20+
# spring.sql.init.mode=always
21+
# spring.jpa.defer-datasource-initialization=true
22+
23+
# logging.level.org.springframework.boot.autoconfigure=ERROR
24+
25+
# Mail config
26+
# spring.mail.default-encoding=UTF-8
27+
# spring.mail.host=host.boi
28+
# spring.mail.port=69
29+
# spring.mail.username=boi
30+
# spring.mail.password=b01
31+
# spring.mail.test-connection=false
32+
# spring.mail.properties.mail.smtp.auth=true
33+
# spring.mail.properties.mail.smtp.starttls.enable=true
34+
35+
# spring.config.import=optional:file:/srv/spring/config/override.properties

0 commit comments

Comments
 (0)