Add postgresql support to pom, create sample stack 4 docker

master
Dmitry Isaenko 2024-01-15 21:08:44 +03:00
parent abec14663e
commit 218fa6553e
7 changed files with 90 additions and 3 deletions

6
.gitignore vendored
View File

@ -1,3 +1,5 @@
postgres/docker-compose.yml
docker/deloyment-example/files/library/*
docker/deloyment-example/files/postgresql/*
docker/deloyment-example/files/root/*
target/
lib/
lib/

12
.vscode/launch.json vendored
View File

@ -2,13 +2,23 @@
"configurations": [
{
"type": "java",
"name": "Spring Boot-MarinescoApplication<marinesco>",
"name": "Marinesco DEV",
"request": "launch",
"cwd": "${workspaceFolder}",
"mainClass": "ru.redrise.marinesco.MarinescoApplication",
"projectName": "marinesco",
"args": "",
"envFile": "${workspaceFolder}/.env"
},
{
"type": "java",
"name": "Marinesco PROD",
"request": "launch",
"cwd": "${workspaceFolder}",
"mainClass": "ru.redrise.marinesco.MarinescoApplication",
"projectName": "marinesco",
"args": "--spring.profiles.active=prod",
"envFile": "${workspaceFolder}/.env"
}
]
}

View File

@ -0,0 +1,5 @@
### How to
1. Place `marinesco.jar` to `files/root/`. Rename artifact if needed.
2. Extract `inpx`-file-containing folder into `files/library/`
3. Optionally remove `pgadmin` section from `docker-compose.yml` file
4. Run via `docker compose up`

View File

@ -0,0 +1,9 @@
FROM openjdk:21-jdk-slim
ENV TZ=Europe/Moscow
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
WORKDIR /root
CMD java -jar marinesco.jar

View File

@ -0,0 +1,34 @@
version: '3.1'
services:
marinesco:
build: ./build
image: loper:marinesco
links:
- postgres
ports:
- 80:8080
volumes:
- ./files/root:/root
- ./files/library:/library
environment:
- SPRING_PROFILES_ACTIVE=prod
logging:
driver: syslog
postgres:
image: postgres
volumes:
- ./files/postgresql:/var/lib/postgresql
environment:
- POSTGRES_USER=mari
- POSTGRES_PASSWORD=example
- POSTGRES_DB=marinesco
pgadmin:
image: dpage/pgadmin4
links:
- postgres
ports:
- 3334:80
environment:
- PGADMIN_DEFAULT_EMAIL=root@srv.lan
- PGADMIN_DEFAULT_PASSWORD=example

View File

@ -80,6 +80,12 @@
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
</dependency>
</dependencies>
<build>

View File

@ -0,0 +1,21 @@
spring:
thymeleaf:
cache: true
datasource:
driver-class-name: org.postgresql.Driver
url: jdbc:postgresql://postgres:5432/marinesco
username: mari
password: example
jpa:
properties:
hibernate:
database-platform: org.hibernate.dialect.PostgreSQL94Dialect
hibernate:
ddl-auto: update
logging:
level:
org:
springframework: INFO
marinesco:
library:
filesLocation: "/library"