Compare commits

...

10 Commits

Author SHA1 Message Date
8ddd3444b7
Add all terminfo files in environment 2025-07-01 14:59:39 +02:00
0bc69789d9 Disable registration in Gitea
Get rid of all the spam accounts they are trying to register.

Reviewed-by: Aleix Boné <abonerib@bsc.es>
Reviewed-by: Aleix Roca Nonell <aleix.rocanonell@bsc.es>
2025-06-18 15:36:18 +02:00
09bc9d9c25 Enable msmtp configuration in tent
Allows gitea to send notifications via email.

Reviewed-by: Aleix Boné <abonerib@bsc.es>
Reviewed-by: Aleix Roca Nonell <aleix.rocanonell@bsc.es>
2025-06-18 15:36:15 +02:00
6b53ab4413 Add GitLab runner with debian docker for PM
Reviewed-by: Aleix Boné <abonerib@bsc.es>
Reviewed-by: Aleix Roca Nonell <aleix.rocanonell@bsc.es>
2025-06-18 15:36:13 +02:00
4618a149b3 Monitor nix-daemon in tent
Reviewed-by: Aleix Boné <abonerib@bsc.es>
Reviewed-by: Aleix Roca Nonell <aleix.rocanonell@bsc.es>
2025-06-18 15:36:11 +02:00
448d85ef9d Move nix-daemon exporter to modules
Reviewed-by: Aleix Boné <abonerib@bsc.es>
Reviewed-by: Aleix Roca Nonell <aleix.rocanonell@bsc.es>
2025-06-18 15:36:09 +02:00
956b99f02a Add p service for pastes
Reviewed-by: Aleix Boné <abonerib@bsc.es>
Reviewed-by: Aleix Roca Nonell <aleix.rocanonell@bsc.es>
2025-06-18 15:36:07 +02:00
ec2eb8c3ed Enable public-inbox service in tent
Reviewed-by: Aleix Boné <abonerib@bsc.es>
Reviewed-by: Aleix Roca Nonell <aleix.rocanonell@bsc.es>
2025-06-18 15:36:06 +02:00
09a5bdfbe4 Enable gitea in tent
Reviewed-by: Aleix Boné <abonerib@bsc.es>
Reviewed-by: Aleix Roca Nonell <aleix.rocanonell@bsc.es>
2025-06-18 15:36:04 +02:00
c49dd15303 Add bsc.es to resolve domain names
Reviewed-by: Aleix Boné <abonerib@bsc.es>
Reviewed-by: Aleix Roca Nonell <aleix.rocanonell@bsc.es>
2025-06-18 15:36:02 +02:00
12 changed files with 139 additions and 9 deletions

View File

@ -21,6 +21,8 @@
} }
]; ];
environment.enableAllTerminfo = true;
environment.variables = { environment.variables = {
EDITOR = "vim"; EDITOR = "vim";
VISUAL = "vim"; VISUAL = "vim";

View File

@ -6,7 +6,7 @@
../module/meteocat-exporter.nix ../module/meteocat-exporter.nix
../module/upc-qaire-exporter.nix ../module/upc-qaire-exporter.nix
./gpfs-probe.nix ./gpfs-probe.nix
./nix-daemon-exporter.nix ../module/nix-daemon-exporter.nix
]; ];
age.secrets.grafanaJungleRobotPassword = { age.secrets.grafanaJungleRobotPassword = {

68
m/module/p.nix Normal file
View File

@ -0,0 +1,68 @@
{ config, lib, pkgs, ... }:
let
cfg = config.services.p;
in
{
options = {
services.p = {
enable = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Whether to enable the p service.";
};
path = lib.mkOption {
type = lib.types.str;
default = "/var/lib/p";
description = "Where to save the pasted files on disk.";
};
url = lib.mkOption {
type = lib.types.str;
default = "https://jungle.bsc.es/p";
description = "URL prefix for the printed file.";
};
};
};
config = lib.mkIf cfg.enable {
environment.systemPackages = let
p = pkgs.writeShellScriptBin "p" ''
set -e
pastedir="${cfg.path}/$USER"
cd "$pastedir"
ext="txt"
if [ -n "$1" ]; then
ext="$1"
fi
out=$(mktemp "XXXXXXXX.$ext")
cat > "$out"
chmod go+r "$out"
echo "${cfg.url}/$USER/$out"
'';
in [ p ];
systemd.services.p = let
# Take only normal users
users = lib.filterAttrs (_: v: v.isNormalUser) config.users.users;
# Create a directory for each user
commands = lib.concatLists (lib.mapAttrsToList (_: user: [
"install -d -o ${user.name} -g ${user.group} -m 0755 ${cfg.path}/${user.name}"
]) users);
in {
description = "P service setup";
requires = [ "network-online.target" ];
#wants = [ "remote-fs.target" ];
#after = [ "remote-fs.target" ];
wantedBy = [ "multi-user.target" ];
serviceConfig = {
ExecStart = pkgs.writeShellScript "p-init.sh" (''
install -d -o root -g root -m 0755 ${cfg.path}
'' + (lib.concatLines commands));
};
};
};
}

View File

@ -10,6 +10,10 @@
./nginx.nix ./nginx.nix
./nix-serve.nix ./nix-serve.nix
./gitlab-runner.nix ./gitlab-runner.nix
./gitea.nix
../hut/public-inbox.nix
../hut/msmtp.nix
../module/p.nix
]; ];
# Select the this using the ID to avoid mismatches # Select the this using the ID to avoid mismatches
@ -26,9 +30,12 @@
# Only BSC DNSs seem to be reachable from the office VLAN # Only BSC DNSs seem to be reachable from the office VLAN
nameservers = [ "84.88.52.35" "84.88.52.36" ]; nameservers = [ "84.88.52.35" "84.88.52.36" ];
search = [ "bsc.es" ];
defaultGateway = "10.0.44.1"; defaultGateway = "10.0.44.1";
}; };
services.p.enable = true;
services.prometheus.exporters.node = { services.prometheus.exporters.node = {
enable = true; enable = true;
enabledCollectors = [ "systemd" ]; enabledCollectors = [ "systemd" ];

30
m/tent/gitea.nix Normal file
View File

@ -0,0 +1,30 @@
{ config, lib, ... }:
{
services.gitea = {
enable = true;
appName = "Gitea in the jungle";
settings = {
server = {
ROOT_URL = "https://jungle.bsc.es/git/";
LOCAL_ROOT_URL = "https://jungle.bsc.es/git/";
LANDING_PAGE = "explore";
};
metrics.ENABLED = true;
service = {
DISABLE_REGISTRATION = true;
REGISTER_MANUAL_CONFIRM = true;
ENABLE_NOTIFY_MAIL = true;
};
log.LEVEL = "Warn";
mailer = {
ENABLED = true;
FROM = "jungle-robot@bsc.es";
PROTOCOL = "sendmail";
SENDMAIL_PATH = "/run/wrappers/bin/sendmail";
SENDMAIL_ARGS = "--";
};
};
};
}

View File

@ -2,6 +2,7 @@
{ {
age.secrets.tent-gitlab-runner-pm-shell.file = ../../secrets/tent-gitlab-runner-pm-shell-token.age; age.secrets.tent-gitlab-runner-pm-shell.file = ../../secrets/tent-gitlab-runner-pm-shell-token.age;
age.secrets.tent-gitlab-runner-pm-docker.file = ../../secrets/tent-gitlab-runner-pm-docker-token.age;
age.secrets.tent-gitlab-runner-bsc-docker.file = ../../secrets/tent-gitlab-runner-bsc-docker-token.age; age.secrets.tent-gitlab-runner-bsc-docker.file = ../../secrets/tent-gitlab-runner-bsc-docker-token.age;
services.gitlab-runner = let sec = config.age.secrets; in { services.gitlab-runner = let sec = config.age.secrets; in {
@ -20,6 +21,13 @@
env env
''; '';
}; };
gitlab-pm-docker = {
authenticationTokenConfigFile = sec.tent-gitlab-runner-pm-docker.path;
executor = "docker";
dockerImage = "debian:stable";
};
# For gitlab.bsc.es
gitlab-bsc-docker = { gitlab-bsc-docker = {
# gitlab.bsc.es still uses the old token mechanism # gitlab.bsc.es still uses the old token mechanism
registrationConfigFile = sec.tent-gitlab-runner-bsc-docker.path; registrationConfigFile = sec.tent-gitlab-runner-bsc-docker.path;

View File

@ -4,6 +4,7 @@
imports = [ imports = [
../module/meteocat-exporter.nix ../module/meteocat-exporter.nix
../module/upc-qaire-exporter.nix ../module/upc-qaire-exporter.nix
../module/nix-daemon-exporter.nix
]; ];
age.secrets.grafanaJungleRobotPassword = { age.secrets.grafanaJungleRobotPassword = {
@ -116,6 +117,7 @@
"127.0.0.1:9290" # IPMI exporter for local node "127.0.0.1:9290" # IPMI exporter for local node
"127.0.0.1:9928" # UPC Qaire custom exporter "127.0.0.1:9928" # UPC Qaire custom exporter
"127.0.0.1:9929" # Meteocat custom exporter "127.0.0.1:9929" # Meteocat custom exporter
"127.0.0.1:9999" # Nix-daemon custom exporter
]; ];
}]; }];
} }

View File

@ -34,11 +34,21 @@ in
real_ip_recursive on; real_ip_recursive on;
real_ip_header X-Forwarded-For; real_ip_header X-Forwarded-For;
location /git {
rewrite ^/git$ / break;
rewrite ^/git/(.*) /$1 break;
proxy_pass http://127.0.0.1:3000;
proxy_redirect http:// $scheme://;
}
location /cache { location /cache {
rewrite ^/cache/(.*) /$1 break; rewrite ^/cache/(.*) /$1 break;
proxy_pass http://127.0.0.1:5000; proxy_pass http://127.0.0.1:5000;
proxy_redirect http:// $scheme://; proxy_redirect http:// $scheme://;
} }
location /lists {
proxy_pass http://127.0.0.1:8081;
proxy_redirect http:// $scheme://;
}
location /grafana { location /grafana {
proxy_pass http://127.0.0.1:2342; proxy_pass http://127.0.0.1:2342;
proxy_redirect http:// $scheme://; proxy_redirect http:// $scheme://;
@ -54,6 +64,9 @@ in
autoindex on; autoindex on;
absolute_redirect off; absolute_redirect off;
} }
location /p/ {
alias /var/lib/p/;
}
''; '';
}; };
}; };

Binary file not shown.

View File

@ -5,13 +5,13 @@ author: "Rodrigo Arias Mallo"
date: 2024-09-20 date: 2024-09-20
--- ---
The hut machine provides a paste service using the program `p` (as in paste). The tent machine provides a paste service using the program `p` (as in paste).
You can use it directly from the hut machine or remotely if you have [SSH You can use it directly from the tent machine or remotely if you have [SSH
access](/access) to hut using the following alias: access](/access) to tent using the following alias:
``` ```
alias p="ssh hut p" alias p="ssh tent p"
``` ```
You can add it to bashrc or zshrc for persistent installation. You can add it to bashrc or zshrc for persistent installation.
@ -19,7 +19,7 @@ You can add it to bashrc or zshrc for persistent installation.
## Usage ## Usage
The `p` command reads from the standard input, uploads the content to a file The `p` command reads from the standard input, uploads the content to a file
in the ceph filesystem and prints the URL to access it. It only accepts an in the local filesystem and prints the URL to access it. It only accepts an
optional argument, which is the extension of the file that will be stored on optional argument, which is the extension of the file that will be stored on
disk (without the dot). By default it uses the `txt` extension, so plain text disk (without the dot). By default it uses the `txt` extension, so plain text
can be read in the browser directly. can be read in the browser directly.
@ -28,21 +28,21 @@ can be read in the browser directly.
p [extension] p [extension]
``` ```
To remove files, go to `/ceph/p/$USER` and remove them manually. To remove files, go to `/var/lib/p/$USER` and remove them manually.
## Examples ## Examples
Share a text file, in this case the source of p itself: Share a text file, in this case the source of p itself:
``` ```
hut% p < m/hut/p.nix tent% p < m/tent/p.nix
https://jungle.bsc.es/p/rarias/okbtG130.txt https://jungle.bsc.es/p/rarias/okbtG130.txt
``` ```
Paste the last dmesg lines directly from a pipe: Paste the last dmesg lines directly from a pipe:
``` ```
hut% dmesg | tail -5 | p tent% dmesg | tail -5 | p
https://jungle.bsc.es/p/rarias/luX4STm9.txt https://jungle.bsc.es/p/rarias/luX4STm9.txt
``` ```