Umstellung auf podman in Arbeit
(cherry picked from commit 1a92c63ef6d60e9dcba513ebf60cbd9f18a142e8)
This commit is contained in:
@@ -1,38 +0,0 @@
|
||||
services:
|
||||
postgres:
|
||||
image: postgres
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
- POSTGRES_DB=kontor
|
||||
- POSTGRES_USER=kontor
|
||||
#- POSTGRES_PASSWORD_FILE=/run/secrets/db-password
|
||||
- POSTGRES_PASSWORD=kontor
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U kontor"]
|
||||
interval: 1s
|
||||
timeout: 5s
|
||||
retries: 10
|
||||
ports:
|
||||
- 5432:5432
|
||||
networks:
|
||||
- database
|
||||
volumes:
|
||||
- postgres-data:/var/lib/postgresql/data:rw
|
||||
secrets:
|
||||
- db-password
|
||||
adminer:
|
||||
image: adminer
|
||||
ports:
|
||||
- 8090:8080
|
||||
networks:
|
||||
- database
|
||||
- frontend
|
||||
volumes:
|
||||
postgres-data:
|
||||
secrets:
|
||||
db-password:
|
||||
file: db-password.txt
|
||||
networks:
|
||||
database:
|
||||
name: database
|
||||
external: true
|
||||
@@ -1,5 +1,3 @@
|
||||
include:
|
||||
- ./compose-postgres.yaml
|
||||
|
||||
services:
|
||||
postgres:
|
||||
|
||||
@@ -20,25 +20,8 @@ RUN uv sync
|
||||
# ------------------------------- Production Stage ------------------------------ ##
|
||||
FROM python:3.13-slim-bookworm AS production
|
||||
|
||||
# The following secrets are available during build time
|
||||
#RUN --mount=type=secret,id=DB_PASSWORD \
|
||||
# --mount=type=secret,id=DB_USER \
|
||||
# --mount=type=secret,id=DB_NAME \
|
||||
# --mount=type=secret,id=DB_HOST \
|
||||
# --mount=type=secret,id=DB_PORT \
|
||||
# DB_PASSWORD=/run/secrets/DB_PASSWORD \
|
||||
# DB_USER=$(cat /run/secrets/DB_USER) \
|
||||
# DB_NAME=$(cat /run/secrets/DB_NAME) \
|
||||
# DB_HOST=$(cat /run/secrets/DB_HOST) \
|
||||
# DB_PORT=$(cat /run/secrets/DB_PORT)
|
||||
|
||||
#RUN --mount=type=secret,id=secret-key,target=secrets.json
|
||||
|
||||
RUN apt-get update && apt-get install --no-install-recommends -y curl
|
||||
|
||||
RUN useradd --create-home appuser
|
||||
USER appuser
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY /src src
|
||||
@@ -48,8 +31,8 @@ COPY --from=builder /app/.venv .venv
|
||||
ENV PATH="/app/.venv/bin:$PATH"
|
||||
|
||||
# Expose the specified port for FastAPI
|
||||
EXPOSE $PORT
|
||||
EXPOSE 8200
|
||||
|
||||
# Start the application with Uvicorn in production mode, using environment variable references
|
||||
CMD ["uvicorn", "src.main:kontor", "--log-level", "info", "--host", "0.0.0.0" , "--port", "8500"]
|
||||
CMD ["uvicorn", "src.main:kontor", "--log-level", "info", "--host", "0.0.0.0" , "--port", "8200"]
|
||||
|
||||
@@ -9,7 +9,7 @@ load_dotenv(dotenv_path=env_path)
|
||||
|
||||
class Settings:
|
||||
PROJECT_NAME: str = "Kontor"
|
||||
PROJECT_VERSION: str = "0.2.0"
|
||||
PROJECT_VERSION: str = "0.3.0"
|
||||
|
||||
DB_USER: str = os.getenv("DB_USER", "kontor")
|
||||
DB_PASSWORD: str = os.getenv("DB_PASSWORD", "kontor")
|
||||
|
||||
@@ -10,27 +10,23 @@ RUN gradle build --no-daemon
|
||||
# ----------------------------------------------------------------------- #
|
||||
#FROM alpine/java:21-jdk AS run
|
||||
|
||||
#RUN adduser --system appuser
|
||||
#COPY --from=builder /build/libs/kontor-quarkus-0.2.0-SNAPSHOT.jar app.jar
|
||||
|
||||
#COPY --from=builder --chown=appuser:appuser /build/libs/kontor-quarkus-0.2.0-SNAPSHOT.jar app.jar
|
||||
|
||||
#EXPOSE 8800
|
||||
#USER appuser
|
||||
#EXPOSE 8300
|
||||
#CMD ["java", "-jar", "-Dquarkus.http.host=0.0.0.0", "app.jar"]
|
||||
|
||||
# ----------------------------------------------------------------------- #
|
||||
FROM registry.access.redhat.com/ubi9/openjdk-21:1.23
|
||||
|
||||
ENV LANGUAGE='en_US:en'
|
||||
ENV LANGUAGE='de_DE:de'
|
||||
|
||||
# We make four distinct layers so if there are application changes the library layers can be re-used
|
||||
COPY --from=builder --chown=185 build/quarkus-app/lib/ /deployments/lib/
|
||||
COPY --from=builder --chown=185 build/quarkus-app/*.jar /deployments/
|
||||
COPY --from=builder --chown=185 build/quarkus-app/app/ /deployments/app/
|
||||
COPY --from=builder --chown=185 build/quarkus-app/quarkus/ /deployments/quarkus/
|
||||
COPY --from=builder build/quarkus-app/lib/ /deployments/lib/
|
||||
COPY --from=builder build/quarkus-app/*.jar /deployments/
|
||||
COPY --from=builder build/quarkus-app/app/ /deployments/app/
|
||||
COPY --from=builder build/quarkus-app/quarkus/ /deployments/quarkus/
|
||||
|
||||
EXPOSE 8800
|
||||
USER 185
|
||||
EXPOSE 8300
|
||||
ENV JAVA_OPTS_APPEND="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager"
|
||||
ENV JAVA_APP_JAR="/deployments/quarkus-run.jar"
|
||||
|
||||
@@ -8,7 +8,7 @@ import org.eclipse.microprofile.openapi.annotations.tags.Tag
|
||||
@OpenAPIDefinition(
|
||||
info = Info(
|
||||
title = "Kontor",
|
||||
version = "0.2.0"
|
||||
version = "0.3.0"
|
||||
)
|
||||
)
|
||||
class KontorApplication: Application()
|
||||
@@ -1,4 +1,4 @@
|
||||
quarkus.http.port=8800
|
||||
quarkus.http.port=8300
|
||||
quarkus.swagger-ui.always-include=true
|
||||
quarkus.datasource.db-kind=postgresql
|
||||
quarkus.datasource.username=kontor
|
||||
|
||||
@@ -5,3 +5,4 @@ ADD build/libs/kontor-spring-0.2.0-SNAPSHOT.jar app.jar
|
||||
EXPOSE 8000
|
||||
CMD ["java", "-jar", "-Dspring.profiles.active=prod", "-Dvaadin.productionMode=true", "app.jar"]
|
||||
|
||||
CMD ["java", "-jar", "-Dspring.profiles.active=prod", "-Dvaadin.productionMode=true", "app.jar"]
|
||||
-1
@@ -14,7 +14,6 @@ import org.springframework.boot.test.context.SpringBootTest;
|
||||
import com.vaadin.flow.component.grid.Grid;
|
||||
|
||||
import de.thpeetz.kontor.comics.data.TradePaperback;
|
||||
import de.thpeetz.kontor.comics.data.Volume;
|
||||
|
||||
@SpringBootTest
|
||||
class TradePaperbackViewTest {
|
||||
|
||||
@@ -6,7 +6,6 @@ import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public interface ProfileRepository extends JpaRepository<Profile, String> {
|
||||
|
||||
|
||||
@@ -13,8 +13,10 @@ import lombok.extern.slf4j.Slf4j;
|
||||
@Slf4j
|
||||
public class AdminLayout extends AppLayout {
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private final AdminService adminService;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private final SecurityService securityService;
|
||||
|
||||
public AdminLayout(AdminService adminService, SecurityService securityService) {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package de.thpeetz.kontor.bookshelf;
|
||||
|
||||
import com.vaadin.flow.component.icon.VaadinIcon;
|
||||
import com.vaadin.flow.component.sidenav.SideNav;
|
||||
import com.vaadin.flow.component.sidenav.SideNavItem;
|
||||
import com.vaadin.flow.router.RouterLink;
|
||||
|
||||
|
||||
@@ -6,11 +6,9 @@ import org.springframework.context.event.ContextRefreshedEvent;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import de.thpeetz.kontor.bookshelf.data.ArticleAuthorRepository;
|
||||
import de.thpeetz.kontor.bookshelf.data.Author;
|
||||
import de.thpeetz.kontor.bookshelf.data.AuthorRepository;
|
||||
import de.thpeetz.kontor.bookshelf.data.BookAuthorRepository;
|
||||
import de.thpeetz.kontor.bookshelf.data.BookRepository;
|
||||
import de.thpeetz.kontor.bookshelf.data.BookshelfPublisher;
|
||||
import de.thpeetz.kontor.bookshelf.data.BookshelfPublisherRepository;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
|
||||
@@ -12,9 +12,11 @@ import lombok.extern.slf4j.Slf4j;
|
||||
public class BookshelfService {
|
||||
|
||||
private final AuthorRepository authorRepository;
|
||||
@SuppressWarnings("unused")
|
||||
private final ArticleAuthorRepository articleAuthorRepository;
|
||||
private final ArticleRepository articleRepository;
|
||||
private final BookRepository bookRepository;
|
||||
@SuppressWarnings("unused")
|
||||
private final BookAuthorRepository bookAuthorRepository;
|
||||
private final BookshelfPublisherRepository publisherRepository;
|
||||
|
||||
|
||||
@@ -15,8 +15,6 @@ import de.thpeetz.kontor.bookshelf.data.Article;
|
||||
import de.thpeetz.kontor.bookshelf.data.Author;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
public class ArticleForm extends FormLayout {
|
||||
|
||||
|
||||
@@ -12,16 +12,12 @@ import com.vaadin.flow.router.Route;
|
||||
import com.vaadin.flow.spring.annotation.SpringComponent;
|
||||
import de.thpeetz.kontor.bookshelf.BookshelfConstants;
|
||||
import de.thpeetz.kontor.bookshelf.data.Article;
|
||||
import de.thpeetz.kontor.bookshelf.data.Book;
|
||||
import de.thpeetz.kontor.bookshelf.data.BookAuthor;
|
||||
import de.thpeetz.kontor.bookshelf.services.BookshelfService;
|
||||
import de.thpeetz.kontor.common.views.MainLayout;
|
||||
import jakarta.annotation.security.PermitAll;
|
||||
import lombok.Getter;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@SpringComponent
|
||||
@Scope("prototype")
|
||||
@PermitAll
|
||||
|
||||
@@ -5,9 +5,7 @@ import com.vaadin.flow.component.ComponentEventListener;
|
||||
import com.vaadin.flow.component.Key;
|
||||
import com.vaadin.flow.component.button.Button;
|
||||
import com.vaadin.flow.component.button.ButtonVariant;
|
||||
import com.vaadin.flow.component.combobox.ComboBox;
|
||||
import com.vaadin.flow.component.formlayout.FormLayout;
|
||||
import com.vaadin.flow.component.grid.Grid;
|
||||
import com.vaadin.flow.component.listbox.ListBox;
|
||||
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
|
||||
import com.vaadin.flow.component.textfield.TextField;
|
||||
|
||||
@@ -11,8 +11,10 @@ import de.thpeetz.kontor.security.SecurityService;
|
||||
|
||||
public class BookshelfLayout extends AppLayout {
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private final AdminService adminService;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private final SecurityService securityService;
|
||||
|
||||
public BookshelfLayout(AdminService adminService, SecurityService securityService) {
|
||||
|
||||
-1
@@ -1,7 +1,6 @@
|
||||
package de.thpeetz.kontor.bookshelf.views;
|
||||
|
||||
import de.thpeetz.kontor.common.views.MainLayout;
|
||||
import de.thpeetz.kontor.common.views.SeparateMainLayout;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
|
||||
import com.vaadin.flow.component.Component;
|
||||
|
||||
@@ -22,7 +22,11 @@ else
|
||||
-p 5432:5432 \
|
||||
-p 8100:8100 \
|
||||
-p 8200:8200 \
|
||||
-p 8300:8300 \
|
||||
-p 8900:8080 \
|
||||
-p 61616:61616 \
|
||||
-p 8161:8161 \
|
||||
-p 5672:5672 \
|
||||
--network bridge
|
||||
fi
|
||||
|
||||
@@ -33,6 +37,13 @@ else
|
||||
podman volume create kontor-db
|
||||
fi
|
||||
|
||||
echo "==> Setting up volume activemq-data"
|
||||
if podman volume exists activemq-data; then
|
||||
echo " => volume kontor-db exists"
|
||||
else
|
||||
podman volume create activemq-data
|
||||
fi
|
||||
|
||||
echo "==> Setting up container postgres"
|
||||
if podman container exists postgres; then
|
||||
if podman ps -q --filter "name=postgres"; then
|
||||
@@ -44,8 +55,13 @@ else
|
||||
-e POSTGRES_DB=kontor \
|
||||
-e POSTGRES_USER=kontor \
|
||||
-v kontor-db:/var/lib/postgresql/data \
|
||||
--health-cmd='pg_isready -U kontor || exit 1' \
|
||||
--health-interval=1s \
|
||||
--health-timeout=5s \
|
||||
--health-retries=10 \
|
||||
postgres:17
|
||||
fi
|
||||
|
||||
echo "==> Setting up container adminer"
|
||||
if podman container exists adminer; then
|
||||
if podman ps -q --filter "name=adminer"; then
|
||||
@@ -55,3 +71,65 @@ else
|
||||
podman run -d --replace --pod kontor --name adminer adminer
|
||||
fi
|
||||
|
||||
echo "==> Setting up container activemq"
|
||||
if podman container exists activemq; then
|
||||
if podman ps -q --filter "name=activemq"; then
|
||||
echo " => adminer is running"
|
||||
fi
|
||||
else
|
||||
podman run -d --replace --pod kontor --name activemq \
|
||||
-v activemq-data:/var/lib/artemis-instance \
|
||||
docker.io/apache/activemq-artemis:latest-alpine
|
||||
fi
|
||||
|
||||
echo "==> Setting up container kontor-spring"
|
||||
if podman container exists kontor-spring; then
|
||||
if podman ps -q --filter "name=kontor-spring"; then
|
||||
echo " => kontor-spring is running"
|
||||
fi
|
||||
else
|
||||
podman run -d \
|
||||
--replace \
|
||||
--pod kontor \
|
||||
--name kontor-spring \
|
||||
--label "io.containers.autoupdate=local" \
|
||||
localhost/kontor-spring:0.3.0
|
||||
fi
|
||||
|
||||
echo "==> Setting up container kontor-api"
|
||||
if podman container exists kontor-api; then
|
||||
if podman ps -q --filter "name=kontor-api"; then
|
||||
echo " => kontor-api is running"
|
||||
fi
|
||||
else
|
||||
podman run -d \
|
||||
--replace \
|
||||
--pod kontor \
|
||||
--name kontor-api \
|
||||
--label "io.containers.autoupdate=local" \
|
||||
--label "PODMAN_SYSTEMD_UNIT=container-kontor-api.service" \
|
||||
--health-cmd='curl -f http://kontor-api:8200/health || exit 1' \
|
||||
--health-interval=1s \
|
||||
--health-timeout=5s \
|
||||
--health-retries=10 \
|
||||
localhost/kontor-api:0.3.0
|
||||
fi
|
||||
|
||||
echo "==> Setting up container kontor-quarkus"
|
||||
if podman container exists kontor-quarkus; then
|
||||
if podman ps -q --filter "name=kontor-quarkus"; then
|
||||
echo " => kontor-quarkus is running"
|
||||
fi
|
||||
else
|
||||
podman run -d \
|
||||
--replace \
|
||||
--pod kontor \
|
||||
--name kontor-quarkus \
|
||||
--label "io.containers.autoupdate=local" \
|
||||
--label "PODMAN_SYSTEMD_UNIT=container-kontor-quarkus.service" \
|
||||
--health-cmd='curl -f http://kontor-api:8300/q/health || exit 1' \
|
||||
--health-interval=1s \
|
||||
--health-timeout=5s \
|
||||
--health-retries=10 \
|
||||
localhost/kontor-quarkus:0.3.0
|
||||
fi
|
||||
|
||||
@@ -10,8 +10,6 @@ echo "==> Stopping and removing pod kontor"
|
||||
if podman pod exists kontor; then
|
||||
podman pod stop kontor
|
||||
podman pod rm kontor
|
||||
podman rm postgres
|
||||
podman rm adminer
|
||||
fi
|
||||
|
||||
script/setup
|
||||
|
||||
Reference in New Issue
Block a user