mirror of
https://github.com/Noratrieb/vps.git
synced 2026-01-14 08:45:02 +01:00
hugo-chat is gaming
This commit is contained in:
parent
f3326c4310
commit
eaa5b01356
3 changed files with 41 additions and 29 deletions
|
|
@ -1,36 +1,32 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
let
|
||||
dockerLogin = {
|
||||
registry = "docker.noratrieb.dev";
|
||||
username = "nils";
|
||||
passwordFile = config.age.secrets.docker_registry_password.path;
|
||||
jarfile = pkgs.fetchurl {
|
||||
url =
|
||||
"https://github.com/C0RR1T/HugoChat/releases/download/2024-08-05/HugoServer.jar";
|
||||
hash = "sha256-hCe2UPqrSR6u3/UxsURI2KzRxN5saeTteCRq5Zfay4M=";
|
||||
};
|
||||
in
|
||||
{
|
||||
age.secrets.hugochat_db_password.file = ../../secrets/hugochat_db_password.age;
|
||||
|
||||
systemd.services.hugo-chat-server = {
|
||||
description = "HugoChat server, a chat platform";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
after = [ "network.target" ];
|
||||
environment = {
|
||||
SPRING_DATASOURCE_URL = "jdbc:postgresql://localhost:5003/postgres";
|
||||
};
|
||||
serviceConfig = {
|
||||
DynamicUser = true;
|
||||
ExecStart = "${lib.getExe' pkgs.jdk21 "java"} -jar ${jarfile} --server.port=5001";
|
||||
EnvironmentFile = [ config.age.secrets.hugochat_db_password.path ];
|
||||
};
|
||||
};
|
||||
|
||||
virtualisation.oci-containers.containers = {
|
||||
hugo-chat-client = {
|
||||
image = "docker.noratrieb.dev/hugo-chat-client:89ce0b07";
|
||||
login = dockerLogin;
|
||||
ports = [ "127.0.0.1:5002:80" ];
|
||||
};
|
||||
|
||||
hugo-chat-server = {
|
||||
image = "docker.noratrieb.dev/hugo-chat-server:89ce0b07";
|
||||
ports = [ "127.0.0.1:5001:8080" ];
|
||||
environment = {
|
||||
SPRING_DATASOURCE_URL = "jdbc:postgresql://hugo-chat-db:5432/postgres";
|
||||
};
|
||||
environmentFiles = [ config.age.secrets.hugochat_db_password.path ];
|
||||
extraOptions = [ "--network=hugo-chat" ];
|
||||
|
||||
dependsOn = [ "hugo-chat-db" ];
|
||||
login = dockerLogin;
|
||||
};
|
||||
|
||||
hugo-chat-db = {
|
||||
image = "postgres:16";
|
||||
ports = [ "127.0.0.1:5003:5432" ];
|
||||
volumes = [ "/var/lib/hugo-chat/data:/var/lib/postgresql/data" ];
|
||||
environment = {
|
||||
PGDATA = "/var/lib/postgresql/data/pgdata";
|
||||
|
|
|
|||
|
|
@ -15,6 +15,11 @@ let
|
|||
blog = fetchTarball "https://github.com/Noratrieb/blog/archive/${my-projects-versions.blog}.tar.gz";
|
||||
slides = fetchTarball "https://github.com/Noratrieb/slides/archive/${my-projects-versions.slides}.tar.gz";
|
||||
website-build = website { inherit pkgs slides blog; };
|
||||
hugo-chat-client = fetchTarball {
|
||||
url =
|
||||
"https://github.com/C0RR1T/HugoChat/releases/download/2024-08-05/hugo-client.tar.xz";
|
||||
sha256 = "sha256:121ai8q6bm7gp0pl1ajfk0k2nrfg05zid61i20z0j5gpb2qyhsib";
|
||||
};
|
||||
in
|
||||
{
|
||||
environment.systemPackages = [ caddy ];
|
||||
|
|
@ -84,6 +89,23 @@ in
|
|||
'' else ""
|
||||
}
|
||||
|
||||
${if name == "vps1" then ''
|
||||
hugo-chat.noratrieb.dev {
|
||||
log
|
||||
encode zstd gzip
|
||||
root * ${import ./caddy-static-prepare {
|
||||
name = "hugo-chat-client";
|
||||
src = hugo-chat-client;
|
||||
inherit pkgs lib;
|
||||
}}
|
||||
try_files {path} /index.html
|
||||
file_server {
|
||||
etag_file_extensions .sha256
|
||||
precompressed zstd gzip br
|
||||
}
|
||||
}
|
||||
'' else ""}
|
||||
|
||||
${
|
||||
if name == "vps1" || name == "vps3" || name == "vps4" then
|
||||
builtins.readFile ./${name}.Caddyfile else ""
|
||||
|
|
|
|||
|
|
@ -3,12 +3,6 @@ www.noratrieb.dev {
|
|||
redir https://noratrieb.dev{uri} permanent
|
||||
}
|
||||
|
||||
hugo-chat.noratrieb.dev {
|
||||
log
|
||||
encode zstd gzip
|
||||
reverse_proxy * localhost:5002
|
||||
}
|
||||
|
||||
api.hugo-chat.noratrieb.dev {
|
||||
log
|
||||
import cors https://hugo-chat.noratrieb.dev "DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue