mirror of
https://git.sr.ht/~magic_rb/cluster
synced 2024-11-22 08:04:20 +01:00
Add reicio, useless quote generator for civics
Signed-off-by: main <magic_rb@redalder.org>
This commit is contained in:
parent
51f2b82468
commit
ca34d4229c
77
containers/reicio.nix
Normal file
77
containers/reicio.nix
Normal file
|
@ -0,0 +1,77 @@
|
|||
/*
|
||||
* NixNG
|
||||
* Copyright (c) 2021 GPL Magic_RB <magic_rb@redalder.org>
|
||||
*
|
||||
* This file is free software: you may copy, redistribute and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This file is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
{ nglib, nixpkgs }:
|
||||
nglib.makeSystem {
|
||||
system = "x86_64-linux";
|
||||
name = "nixng-reicio";
|
||||
inherit nixpkgs;
|
||||
config = ({ pkgs, ... }:
|
||||
{
|
||||
dumb-init = {
|
||||
enable = true;
|
||||
type.services = { };
|
||||
};
|
||||
|
||||
users.users."reicio" = {
|
||||
uid = 1002;
|
||||
home = "/var/empty";
|
||||
group = "reicio";
|
||||
description = "vmail user.";
|
||||
};
|
||||
|
||||
users.groups."reicio" = {
|
||||
gid = 1002;
|
||||
};
|
||||
|
||||
init.services.reicio =
|
||||
let
|
||||
reicio = with pkgs;
|
||||
rustPlatform.buildRustPackage {
|
||||
pname = "reicio-web";
|
||||
version = "0.1.0";
|
||||
src = fetchgit {
|
||||
url = "https://gitea.redalder.org/ThyW/reicio-web";
|
||||
sha256 = "sha256-zAflDChM1szzESocMuzag+Umheku+AOeCb+4TYznJII=";
|
||||
};
|
||||
cargoSha256 = "sha256-LmeJxYS11OEWEnw7YIOyR1vCqgXOCpnM28Yo+kPSxPg=";
|
||||
|
||||
postInstall =
|
||||
''
|
||||
mkdir -p $out/share/reicio
|
||||
cp -r quotes.json portraits templates $out/share/reicio
|
||||
cat <<EOF > $out/share/reicio/Rocket.toml
|
||||
[global]
|
||||
address = "0.0.0.0"
|
||||
EOF
|
||||
'';
|
||||
};
|
||||
in
|
||||
{
|
||||
shutdownOnExit = true;
|
||||
enabled = true;
|
||||
script = pkgs.writeShellScript "reicio-run"
|
||||
''
|
||||
export PATH=${with pkgs; lib.makeBinPath [ runit busybox reicio ]}
|
||||
|
||||
cd ${pkgs.lib.trace reicio.outPath reicio}/share/reicio
|
||||
chpst -u reicio:reicio reicio-web
|
||||
'';
|
||||
};
|
||||
});
|
||||
}
|
|
@ -40,6 +40,7 @@
|
|||
syncthing = import ./containers/syncthing.nix base;
|
||||
zigbee2mqtt = import ./containers/zigbee2mqtt.nix base;
|
||||
home-assistant = import ./containers/home-assistant.nix base;
|
||||
reicio = import ./containers/reicio.nix base;
|
||||
};
|
||||
in
|
||||
{
|
||||
|
|
|
@ -96,6 +96,16 @@ job "ingress" {
|
|||
mode = "local"
|
||||
}
|
||||
}
|
||||
|
||||
upstreams {
|
||||
destination_name = "reicio"
|
||||
local_bind_port = 8000
|
||||
datacenter = "homelab-1"
|
||||
|
||||
mesh_gateway {
|
||||
mode = "local"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -203,6 +213,10 @@ upstream website {
|
|||
server {{ env "NOMAD_UPSTREAM_ADDR_website" }};
|
||||
}
|
||||
|
||||
upstream reicio {
|
||||
server {{ env "NOMAD_UPSTREAM_ADDR_reicio" }};
|
||||
}
|
||||
|
||||
server {
|
||||
listen 443 ssl;
|
||||
|
||||
|
@ -256,6 +270,11 @@ server {
|
|||
proxy_pass http://nextcloud/;
|
||||
}
|
||||
|
||||
location /reicio/ {
|
||||
include /local/headers.conf;
|
||||
proxy_pass http://reicio/;
|
||||
}
|
||||
|
||||
location / {
|
||||
include /local/headers.conf;
|
||||
proxy_pass http://website;
|
||||
|
|
44
infrastructure/reicio/reicio.hcl
Normal file
44
infrastructure/reicio/reicio.hcl
Normal file
|
@ -0,0 +1,44 @@
|
|||
job "reicio" {
|
||||
datacenters = [ "homelab-1" ]
|
||||
type = "service"
|
||||
|
||||
group "reicio" {
|
||||
count = 1
|
||||
|
||||
network {
|
||||
mode = "bridge"
|
||||
}
|
||||
|
||||
service {
|
||||
name = "reicio"
|
||||
port = "8000"
|
||||
|
||||
check {
|
||||
type = "http"
|
||||
address_mode = "alloc"
|
||||
path = "/"
|
||||
port = "8000"
|
||||
interval = "2s"
|
||||
timeout = "2s"
|
||||
}
|
||||
|
||||
connect {
|
||||
sidecar_service {}
|
||||
}
|
||||
}
|
||||
|
||||
task "reicio" {
|
||||
driver = "docker"
|
||||
|
||||
config {
|
||||
image = "nixng-reicio:local"
|
||||
memory_hard_limit = 32
|
||||
}
|
||||
|
||||
resources {
|
||||
cpu = 64
|
||||
memory = 16
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue