Skip to content
Snippets Groups Projects
Commit 936a604f authored by Jan Pokorný's avatar Jan Pokorný :lifter_tone2:
Browse files

Merge branch 'docker-work' into 'main'

Docker Rework

See merge request !43
parents 91e3f689 7344b06b
No related branches found
No related tags found
1 merge request!43Docker Rework
Pipeline #
Showing
with 138 additions and 38 deletions
......@@ -17,18 +17,16 @@
- Create a system for language school lecture management. Each lecture can occur on a given day and time and is related to some course. The course is defined by its (unique) name, language and proficiency level. However, each lecture will be independent. That means that each lecture can have a different topic. Different lecturers can give it, and an arbitrary number of students can enrol. Each lecturer will have a name, surname, and record of taught languages. In addition, the lecturer will indicate that they are a native speaker. Exercises can be prepared for each course to allow the students to learn the language. Each student can pick the exercises depending on the levels of difficulty.
- **Running the modules with metrics and monitoring using docker-compose**:
- **Running the modules with metrics and monitoring using docker compose**:
```console
cd ./application
mvn clean install
docker-compose build --parallel
docker-compose up
docker compose up --build
```
- **Running just the modules using docker**:
~~~console
sudo docker run -d -p 8080:8080 xpokorn8/sprachschulsystem:confidentialClient &&
sudo docker run -d -p 8080:8080 xpokorn8/sprachschulsystem:confidential-client &&
sudo docker run -d -p 8082:8082 xpokorn8/sprachschulsystem:certificate &&
sudo docker run -d -p 8083:8083 xpokorn8/sprachschulsystem:exercise &&
sudo docker run -d -p 8081:8081 xpokorn8/sprachschulsystem:language-school &&
......
# Defining the base building image
FROM maven:3.9.0-eclipse-temurin-17-alpine AS build
# Copy the pom.xml parent file and module dirs
COPY confidentialClient /build/confidentialClient
COPY model /build/model
COPY module-certificate /build/module-certificate
COPY module-exercise /build/module-exercise
COPY module-mail /build/module-mail
COPY module-language-school /build/module-language-school
COPY pom.xml /build/pom.xml
WORKDIR /build
RUN mvn clean install -DskipTests
FROM eclipse-temurin:17-jre-focal AS confidential-client
COPY --from=build /build/confidentialClient/target/*.jar ./confidential-client.jar
COPY --from=build /build/confidentialClient/src/main/resources/*.yml ./etc/app.yml
EXPOSE 8080
CMD ["java", "-Dspring.config.location=/etc/app.yml", "-jar", "confidential-client.jar"]
FROM eclipse-temurin:17-jre-focal AS language-school
COPY --from=build /build/module-language-school/target/*.jar ./language-school.jar
COPY --from=build /build/module-language-school/src/main/resources/external-app.properties ./etc/app.properties
EXPOSE 8081
CMD ["java", "-Dspring.config.location=/etc/app.properties", "-jar", "language-school.jar"]
FROM eclipse-temurin:17-jre-focal AS certificate
COPY --from=build /build/module-certificate/target/*.jar ./certificate.jar
COPY --from=build /build/module-certificate/src/main/resources/external-app.properties ./etc/app.properties
EXPOSE 8082
CMD ["java", "-Dspring.config.location=/etc/app.properties", "-jar", "certificate.jar"]
FROM eclipse-temurin:17-jre-focal AS exercise
COPY --from=build /build/module-exercise/target/*.jar ./exercise.jar
COPY --from=build /build/module-exercise/src/main/resources/external-app.properties ./etc/app.properties
EXPOSE 8083
CMD ["java", "-Dspring.config.location=/etc/app.properties", "-jar", "exercise.jar"]
FROM eclipse-temurin:17-jre-focal AS mail
COPY --from=build /build/module-mail/target/*.jar ./mail.jar
COPY --from=build /build/module-mail/src/main/resources/external-app.properties ./etc/app.properties
EXPOSE 8084
CMD ["java", "-Dspring.config.location=/etc/app.properties", "-jar", "mail.jar"]
version: '3'
volumes:
prometheus_data:
grafana-data:
services:
certificate:
build: ./module-certificate
container_name: certificate
build:
context: .
target: certificate
image: xpokorn8/sprachschulsystem:certificate
ports:
- "8082:8082"
......@@ -14,8 +14,9 @@ services:
- DOCKER_RUNNING=true
exercise:
build: ./module-exercise
container_name: exercise
build:
context: .
target: exercise
image: xpokorn8/sprachschulsystem:exercise
ports:
- "8083:8083"
......@@ -23,8 +24,9 @@ services:
- DOCKER_RUNNING=true
language-school:
build: ./module-language-school
container_name: language-school
build:
context: .
target: language-school
image: xpokorn8/sprachschulsystem:language-school
ports:
- "8081:8081"
......@@ -32,8 +34,9 @@ services:
- DOCKER_RUNNING=true
mail:
build: ./module-mail
container_name: mail
build:
context: .
target: mail
image: xpokorn8/sprachschulsystem:mail
ports:
- "8084:8084"
......@@ -41,8 +44,9 @@ services:
- DOCKER_RUNNING=true
confidential-client:
build: ./confidentialClient
container_name: confidential-client
build:
context: .
target: confidential-client
image: xpokorn8/sprachschulsystem:confidential-client
environment:
- DOCKER_RUNNING=true
......
FROM docker.io/library/eclipse-temurin:17-jre-focal
COPY ./target/confidentialClient-0.0.1-SNAPSHOT.jar /app.jar
ENV DOCKER_RUNNING=true
ENTRYPOINT ["java", "-jar", "/app.jar"]
\ No newline at end of file
FROM docker.io/library/eclipse-temurin:17-jre-focal
COPY ./target/module-certificate-0.0.1-SNAPSHOT.jar /app.jar
ENV DOCKER_RUNNING=true
ENTRYPOINT ["java", "-jar", "/app.jar"]
\ No newline at end of file
#TODO Copied base application properties, should be modified for production
server.port=8082
management.endpoints.web.exposure.include=health,metrics,prometheus
management.endpoint.health.show-details=always
management.health.defaults.enabled=true
management.endpoint.health.probes.enabled=true
spring.jpa.open-in-view=false
spring.datasource.url=jdbc:h2:mem:social-network;MODE=PostgreSQL
spring.datasource.driverClassName=org.h2.Driver
spring.datasource.username=SedaQ-app
spring.datasource.password=$argon2id$v=19$m=16,t=2,p=1$YmF0bWFuYmF0bWFu$MdHYB359HdivAb9J6CaILw
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
# showing SQL is generally good practice for running project locally to check whether there is not an issue with implementation of JPA methods.
spring.jpa.show-sql=true
spring.security.oauth2.resourceserver.opaque-token.introspection-uri=https://oidc.muni.cz/oidc/introspect
spring.security.oauth2.resourceserver.opaque-token.client-id=d57b3a8f-156e-46de-9f27-39c4daee05e1
spring.security.oauth2.resourceserver.opaque-token.client-secret=fa228ebc-4d54-4cda-901e-4d6287f8b1652a9c9c44-73c9-4502-973f-bcdb4a8ec96a
FROM docker.io/library/eclipse-temurin:17-jre-focal
COPY ./target/module-exercise-0.0.1-SNAPSHOT.jar /app.jar
ENV DOCKER_RUNNING=true
ENTRYPOINT ["java", "-jar", "/app.jar"]
#TODO Copied base application properties, should be modified for production
server.port=8083
management.endpoints.web.exposure.include=health,metrics,prometheus
management.endpoint.health.show-details=always
management.health.defaults.enabled=true
management.endpoint.health.probes.enabled=true
spring.h2.console.enabled=true
spring.datasource.url=jdbc:h2:mem:exercices
spring.security.oauth2.resourceserver.opaque-token.introspection-uri=https://oidc.muni.cz/oidc/introspect
spring.security.oauth2.resourceserver.opaque-token.client-id=d57b3a8f-156e-46de-9f27-39c4daee05e1
spring.security.oauth2.resourceserver.opaque-token.client-secret=fa228ebc-4d54-4cda-901e-4d6287f8b1652a9c9c44-73c9-4502-973f-bcdb4a8ec96a
FROM docker.io/library/eclipse-temurin:17-jre-focal
COPY ./target/module-language-school-0.0.1-SNAPSHOT.jar /app.jar
ENV DOCKER_RUNNING=true
ENTRYPOINT ["java", "-jar", "/app.jar"]
......@@ -16,6 +16,7 @@ spring.datasource.driverClassName=org.h2.Driver
spring.datasource.username=sa
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
# showing SQL is generally good practice for running project locally to check whether there is not an issue with implementation of JPA methods.
spring.jpa.show-sql=true
spring.jackson.property-naming-strategy=LOWER_CAMEL_CASE
spring.cache.type=NONE
......
#TODO Copied base application properties, should be modified for production
server.port=8081
spring.security.oauth2.resourceserver.opaque-token.introspection-uri=https://oidc.muni.cz/oidc/introspect
spring.security.oauth2.resourceserver.opaque-token.client-id=d57b3a8f-156e-46de-9f27-39c4daee05e1
spring.security.oauth2.resourceserver.opaque-token.client-secret=fa228ebc-4d54-4cda-901e-4d6287f8b1652a9c9c44-73c9-4502-973f-bcdb4a8ec96a
management.endpoints.web.exposure.include=health,metrics,prometheus
management.endpoint.health.show-details=always
management.health.defaults.enabled=true
management.endpoint.health.probes.enabled=true
spring.jpa.open-in-view=false
spring.h2.console.enabled=true
spring.datasource.url=jdbc:h2:mem:school
spring.datasource.driverClassName=org.h2.Driver
spring.datasource.username=sa
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
# showing SQL is generally good practice for running project locally to check whether there is not an issue with implementation of JPA methods.
spring.jpa.show-sql=true
spring.jackson.property-naming-strategy=LOWER_CAMEL_CASE
spring.cache.type=NONE
appconfig.enablecache=false
\ No newline at end of file
FROM docker.io/library/eclipse-temurin:17-jre-focal
COPY ./target/module-mail-0.0.1-SNAPSHOT.jar /app.jar
ENV DOCKER_RUNNING=true
ENTRYPOINT ["java", "-jar", "/app.jar"]
......@@ -5,8 +5,6 @@ management.endpoint.health.show-details=always
management.health.defaults.enabled=true
management.endpoint.health.probes.enabled=true
spring.mail.host=smtp.gmail.com
spring.mail.port=587
spring.mail.username=sprachschul@gmail.com
......
#TODO Copied base application properties, should be modified for production
server.port=8084
management.endpoints.web.exposure.include=health,metrics,prometheus
management.endpoint.health.show-details=always
management.health.defaults.enabled=true
management.endpoint.health.probes.enabled=true
spring.mail.host=smtp.gmail.com
spring.mail.port=587
spring.mail.username=sprachschul@gmail.com
spring.mail.password=xnyxsknctypmubbb
spring.mail.properties.mail.smtp.auth=true
spring.mail.properties.mail.smtp.starttls.enable=true
spring.security.oauth2.resourceserver.opaque-token.introspection-uri=https://oidc.muni.cz/oidc/introspect
spring.security.oauth2.resourceserver.opaque-token.client-id=d57b3a8f-156e-46de-9f27-39c4daee05e1
spring.security.oauth2.resourceserver.opaque-token.client-secret=fa228ebc-4d54-4cda-901e-4d6287f8b1652a9c9c44-73c9-4502-973f-bcdb4a8ec96a
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