From 8f894239944d331e7c13d715e089598865b98b39 Mon Sep 17 00:00:00 2001 From: filipriec Date: Wed, 20 May 2026 11:01:23 +0000 Subject: [PATCH] prod setup --- Caddyfile | 15 +++++---------- Cargo.toml | 6 +++--- Dockerfile | 9 +++++---- docker-compose.prod.yml | 15 +++++++-------- 4 files changed, 20 insertions(+), 25 deletions(-) diff --git a/Caddyfile b/Caddyfile index 3abc9fc..69611a9 100644 --- a/Caddyfile +++ b/Caddyfile @@ -1,17 +1,12 @@ -# Reverse-proxy config for temp.sk. -# -# This file is intended to be imported by the central Caddyfile on the server. -# Caddy provisions and renews the HTTPS certificate automatically. - gitara.farmeris.sk { - encode gzip + encode gzip - @static path /static/* - header @static Cache-Control "public, max-age=2592000" + @static path /static/* + header @static Cache-Control "public, max-age=2592000" - reverse_proxy universal-web:5150 + reverse_proxy gitara-web:5150 } www.gitara.farmeris.sk { - redir https://temp.sk{uri} permanent + redir https://gitara.farmeris.sk{uri} permanent } diff --git a/Cargo.toml b/Cargo.toml index 8b9a81e..705229a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,11 +1,11 @@ [workspace] [package] -name = "universal_web" +name = "gitara_web" version = "0.1.0" edition = "2021" publish = false -default-run = "universal_web-cli" +default-run = "gitara_web-cli" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html @@ -45,7 +45,7 @@ axum-extra = { version = "0.10", features = ["form"] } bytes = { version = "1" } [[bin]] -name = "universal_web-cli" +name = "gitara_web-cli" path = "src/bin/main.rs" required-features = [] diff --git a/Dockerfile b/Dockerfile index 9d04fad..f1fbf19 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,11 @@ -FROM rust:1.87.0-slim-bookworm AS builder +FROM rust:1-slim-bookworm AS builder + WORKDIR /usr/src COPY . . -RUN cargo build --release --bin universal_web-cli +RUN cargo build --release --bin gitara_web-cli FROM debian:bookworm-slim @@ -16,9 +17,9 @@ WORKDIR /usr/app COPY --from=builder /usr/src/assets assets COPY --from=builder /usr/src/config config -COPY --from=builder /usr/src/target/release/universal_web-cli universal_web-cli +COPY --from=builder /usr/src/target/release/gitara_web-cli gitara_web-cli ENV LOCO_ENV=production EXPOSE 5150 -ENTRYPOINT ["/usr/app/universal_web-cli"] +ENTRYPOINT ["/usr/app/gitara_web-cli"] CMD ["start"] diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index eed1a5a..26c74e3 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -1,28 +1,27 @@ services: universal-web: - container_name: ${CONTAINER_NAME:?set CONTAINER_NAME} + container_name: gitara-web build: context: . dockerfile: Dockerfile env_file: - .env.production volumes: - - universal_web_uploads:/usr/app/data/uploads + - gitara_web_data:/usr/app/data networks: - - reverse-proxy + - gitara-net restart: unless-stopped healthcheck: - test: ["CMD-SHELL", "curl -fsS http://localhost:$${PORT:-5150}/_ping"] + test: ["CMD-SHELL", "curl -fsS http://localhost:5150/_ping"] interval: 30s timeout: 5s retries: 3 start_period: 20s networks: - reverse-proxy: + gitara-net: external: true - name: ${REVERSE_PROXY_NETWORK:?set REVERSE_PROXY_NETWORK} volumes: - universal_web_uploads: - name: ${UPLOADS_VOLUME_NAME:?set UPLOADS_VOLUME_NAME} + gitara_web_data: + name: gitara_web_data