mirror of
https://github.com/Noratrieb/vps.git
synced 2026-01-14 16:55:00 +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, ... }:
|
{ config, lib, pkgs, ... }:
|
||||||
let
|
let
|
||||||
dockerLogin = {
|
jarfile = pkgs.fetchurl {
|
||||||
registry = "docker.noratrieb.dev";
|
url =
|
||||||
username = "nils";
|
"https://github.com/C0RR1T/HugoChat/releases/download/2024-08-05/HugoServer.jar";
|
||||||
passwordFile = config.age.secrets.docker_registry_password.path;
|
hash = "sha256-hCe2UPqrSR6u3/UxsURI2KzRxN5saeTteCRq5Zfay4M=";
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
age.secrets.hugochat_db_password.file = ../../secrets/hugochat_db_password.age;
|
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 = {
|
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 = {
|
hugo-chat-db = {
|
||||||
image = "postgres:16";
|
image = "postgres:16";
|
||||||
|
ports = [ "127.0.0.1:5003:5432" ];
|
||||||
volumes = [ "/var/lib/hugo-chat/data:/var/lib/postgresql/data" ];
|
volumes = [ "/var/lib/hugo-chat/data:/var/lib/postgresql/data" ];
|
||||||
environment = {
|
environment = {
|
||||||
PGDATA = "/var/lib/postgresql/data/pgdata";
|
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";
|
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";
|
slides = fetchTarball "https://github.com/Noratrieb/slides/archive/${my-projects-versions.slides}.tar.gz";
|
||||||
website-build = website { inherit pkgs slides blog; };
|
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
|
in
|
||||||
{
|
{
|
||||||
environment.systemPackages = [ caddy ];
|
environment.systemPackages = [ caddy ];
|
||||||
|
|
@ -84,6 +89,23 @@ in
|
||||||
'' else ""
|
'' 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
|
if name == "vps1" || name == "vps3" || name == "vps4" then
|
||||||
builtins.readFile ./${name}.Caddyfile else ""
|
builtins.readFile ./${name}.Caddyfile else ""
|
||||||
|
|
|
||||||
|
|
@ -3,12 +3,6 @@ www.noratrieb.dev {
|
||||||
redir https://noratrieb.dev{uri} permanent
|
redir https://noratrieb.dev{uri} permanent
|
||||||
}
|
}
|
||||||
|
|
||||||
hugo-chat.noratrieb.dev {
|
|
||||||
log
|
|
||||||
encode zstd gzip
|
|
||||||
reverse_proxy * localhost:5002
|
|
||||||
}
|
|
||||||
|
|
||||||
api.hugo-chat.noratrieb.dev {
|
api.hugo-chat.noratrieb.dev {
|
||||||
log
|
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"
|
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