From 9d2368ee08372a5e7e537fbb5399eab304873166 Mon Sep 17 00:00:00 2001 From: Priec Date: Tue, 30 Jun 2026 00:49:25 +0200 Subject: [PATCH] podman -> docker --- Caddyfile | 10 +++--- Cargo.lock | 2 +- Podmanfile => Dockerfile | 0 Makefile | 2 +- README.md | 15 +++++++-- ...ompose.prod.yml => docker-compose.prod.yml | 32 ++++--------------- 6 files changed, 26 insertions(+), 35 deletions(-) rename Podmanfile => Dockerfile (100%) rename podman-compose.prod.yml => docker-compose.prod.yml (67%) diff --git a/Caddyfile b/Caddyfile index c3c149e..ff5ef1f 100644 --- a/Caddyfile +++ b/Caddyfile @@ -1,8 +1,8 @@ -http://{$APP_DOMAIN:eshop.kompress.farmeris.sk} { - redir https://{$APP_DOMAIN:eshop.kompress.farmeris.sk}{uri} permanent -} - -https://{$APP_DOMAIN:eshop.kompress.farmeris.sk} { +# Caddyfile_kompress_eshop — imported by the central Caddy +# (docker-compose.caddy.yml). Caddy reaches the app by container name because +# it shares the external `kompress_eshop-net` network, same as gitea/biomed. +# Caddy serves automatic HTTPS and redirects http->https by default. +eshop.kompress.farmeris.sk { encode zstd gzip header { diff --git a/Cargo.lock b/Cargo.lock index 283cba7..db2443c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2640,7 +2640,7 @@ dependencies = [ [[package]] name = "kompress_eshop" -version = "0.1.0" +version = "0.5.0" dependencies = [ "async-trait", "axum", diff --git a/Podmanfile b/Dockerfile similarity index 100% rename from Podmanfile rename to Dockerfile diff --git a/Makefile b/Makefile index fb29878..a07a77f 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -COMPOSE ?= podman compose -f podman-compose.prod.yml --env-file .env.production +COMPOSE ?= docker compose -f docker-compose.prod.yml --env-file .env.production # --- Frontend (Tailwind v4 + PenguinUI) ----------------------------- # Uses the Tailwind v4 standalone binary (no Node required at runtime). diff --git a/README.md b/README.md index e6edc2e..730e5b7 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ listening on http://localhost:5150 You can check your [configuration](config/development.yaml) to pick either frontend setup or server-side rendered template, and activate the relevant configuration sections. -## Production Podman Deploy +## Production Docker Deploy Create the production environment file: @@ -60,13 +60,22 @@ Create the production environment file: cp .env.production.example .env.production ``` -Edit `.env.production` and set real secrets for `POSTGRES_PASSWORD`, `JWT_SECRET`, `OAUTH_PRIVATE_KEY`, and the OAuth client values. Then start the production stack: +Edit `.env.production` and set real secrets for `POSTGRES_PASSWORD`, `JWT_SECRET`, `OAUTH_PRIVATE_KEY`, and the OAuth client values. Create the shared network once (the central Caddy joins it too): + +```sh +docker network create kompress_eshop-net +``` + +Then start the production stack: ```sh make up ``` -The production Podman stack runs Caddy, the Loco app, and Postgres. Caddy publishes ports `80` and `443`; the app port `5150` stays private on the container network. HTTP requests on port `80` are redirected to HTTPS on port `443`. +The stack runs the Loco app + Postgres only — TLS/routing is handled by the +central Caddy (`docker-compose.caddy.yml`), which shares the external +`kompress_eshop-net` network and reaches the app as `kompress:5150` via the +imported `Caddyfile`. The app port `5150` is never published to the host. ## Getting help diff --git a/podman-compose.prod.yml b/docker-compose.prod.yml similarity index 67% rename from podman-compose.prod.yml rename to docker-compose.prod.yml index 118d3cc..00107d8 100644 --- a/podman-compose.prod.yml +++ b/docker-compose.prod.yml @@ -1,27 +1,9 @@ services: - caddy: - image: docker.io/library/caddy:2-alpine - container_name: kompress-caddy - env_file: - - .env.production - ports: - - "443:443" - - "443:443/udp" - volumes: - - ./Caddyfile:/etc/caddy/Caddyfile:ro - - caddy_data:/data - - caddy_config:/config - networks: - - kompress_eshop-net - restart: unless-stopped - depends_on: - - kompress - kompress: container_name: kompress build: context: . - dockerfile: Podmanfile + dockerfile: Dockerfile env_file: - .env.production environment: @@ -42,7 +24,7 @@ services: start_period: 20s postgres: - image: docker.io/library/postgres:16-alpine + image: postgres:16-alpine container_name: kompress-postgres env_file: - .env.production @@ -61,16 +43,16 @@ services: timeout: 5s retries: 5 +# External network shared with the central Caddy (docker-compose.caddy.yml). +# Create it once on the host: docker network create kompress_eshop-net +# Then add it to the caddy service's `networks:` list so Caddy can reach +# `kompress:5150` by container name — exactly like gitea-net etc. networks: kompress_eshop-net: - name: kompress_eshop-net + external: true volumes: kompress_eshop_data: name: kompress_eshop_data postgres_data: name: kompress_postgres_data - caddy_data: - name: kompress_caddy_data - caddy_config: - name: kompress_caddy_config