summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2023-11-04 13:58:56 +0200
committerPaul Buetow <paul@buetow.org>2023-11-04 13:58:56 +0200
commit4c5be7bdc9f9d02558877154bafe5ab860a159f6 (patch)
tree79af062c285a8e8b81d1960b9aec7293e2d3e627
parent6e8bc6a6b29124bca57a2b196cc00907b3495302 (diff)
add gorum configuration
-rw-r--r--frontends/Rexfile47
-rw-r--r--frontends/etc/gorum.json.tpl16
-rwxr-xr-xfrontends/etc/rc.d/gorum.tpl16
3 files changed, 61 insertions, 18 deletions
diff --git a/frontends/Rexfile b/frontends/Rexfile
index 0d8ae95..ca43d24 100644
--- a/frontends/Rexfile
+++ b/frontends/Rexfile
@@ -362,6 +362,9 @@ task 'dtail', group => 'frontends',
sub {
my $restart = FALSE;
+ run 'adduser -class nologin -group _dserver -batch _dserver', unless => 'id _dserver';
+ run 'usermod -d /var/run/dserver _dserver';
+
file '/etc/rc.d/dserver',
content => template('./etc/rc.d/dserver.tpl'),
owner => 'root',
@@ -390,9 +393,6 @@ task 'dtail', group => 'frontends',
append_if_no_such_line '/etc/daily.local', '/usr/local/bin/dserver-update-key-cache.sh';
- run 'adduser -class nologin -group _dserver -batch _dserver', unless => 'id _dserver';
- run 'usermod -d /var/run/dserver _dserver';
-
service 'dserver' => 'restart' if $restart;
service 'dserver', ensure => 'started';
};
@@ -415,6 +415,13 @@ task 'gogios', group => 'frontends',
my $gogios_path = '/usr/local/bin/gogios';
+ unless (is_file($gogios_path)) {
+ Rex::Logger::info("Gogios not installed to $gogios_path! Run task 'gogios_install'", 'error');
+ }
+
+ run 'adduser -group _gogios -batch _gogios', unless => 'id _gogios';
+ run 'usermod -d /var/run/gogios _gogios';
+
file '/etc/gogios.json',
content => template('./etc/gogios.json.tpl',
acme_hosts => \@acme_hosts),
@@ -428,13 +435,6 @@ task 'gogios', group => 'frontends',
group => '_gogios',
mode => '755';
- unless (is_file($gogios_path)) {
- Rex::Logger::info("Gogios not installed to $gogios_path! Run task 'gogios_install'", 'error');
- }
-
- run 'adduser -group _gogios -batch _gogios', unless => 'id _gogios';
- run 'usermod -d /var/run/gogios _gogios';
-
file '/tmp/gogios.cron',
ensure => 'file',
content => template('./etc/gogios.cron.tpl',
@@ -472,14 +472,22 @@ task 'gorum_install', group => 'frontends',
desc 'Setup Gorum quorum system';
task 'gorum', group => 'frontends',
sub {
+ my $restart = FALSE;
my $gorum_path = '/usr/local/bin/gorum';
+ unless (is_file($gorum_path)) {
+ Rex::Logger::info("gorum not installed to $gorum_path! Run task 'gorum_install'", 'error');
+ }
+
+ run 'adduser -class nologin -group _gorum -batch _gorum', unless => 'id _gorum';
+ run 'usermod -d /var/run/gorum _gorum';
+
file '/etc/gorum.json',
- content => template('./etc/gorum.json.tpl',
- acme_hosts => \@acme_hosts),
+ content => template('./etc/gorum.json.tpl'),
owner => 'root',
group => 'wheel',
- mode => '744';
+ mode => '744',
+ on_change => sub { $restart = TRUE };
file '/var/run/gorum',
ensure => 'directory',
@@ -487,12 +495,15 @@ task 'gorum', group => 'frontends',
group => '_gorum',
mode => '755';
- unless (is_file($gorum_path)) {
- Rex::Logger::info("gorum not installed to $gorum_path! Run task 'gorum_install'", 'error');
- }
+ file '/etc/rc.d/gorum',
+ content => template('./etc/rc.d/gorum.tpl'),
+ owner => 'root',
+ group => 'wheel',
+ mode => '755',
+ on_change => sub { $restart = TRUE };
- run 'adduser -group _gorum -batch _gorum', unless => 'id _gorum';
- run 'usermod -d /var/run/gorum _gorum';
+ service 'gorum' => 'restart' if $restart;
+ service 'gorum', ensure => 'started';
};
desc 'Setup IRC bouncer';
diff --git a/frontends/etc/gorum.json.tpl b/frontends/etc/gorum.json.tpl
new file mode 100644
index 0000000..3065c74
--- /dev/null
+++ b/frontends/etc/gorum.json.tpl
@@ -0,0 +1,16 @@
+{
+ "StateDir": "/var/run/gorum",
+ "Address": "<%= $hostname.'.'.$domain %>:4321",
+ "Nodes": {
+ "Blowfish": {
+ "Hostname": "blowfish.buetow.org",
+ "Port": 4321,
+ "Priority": 100
+ },
+ "Fishfinger": {
+ "Hostname": "fishfinger.buetow.org",
+ "Port": 4321,
+ "Priority": 50
+ }
+ }
+}
diff --git a/frontends/etc/rc.d/gorum.tpl b/frontends/etc/rc.d/gorum.tpl
new file mode 100755
index 0000000..73b92c3
--- /dev/null
+++ b/frontends/etc/rc.d/gorum.tpl
@@ -0,0 +1,16 @@
+#!/bin/ksh
+
+daemon="/usr/local/bin/gorum"
+daemon_flags="-cfg /etc/gorum.json"
+daemon_user="_gorum"
+
+. /etc/rc.d/rc.subr
+
+rc_reload=NO
+
+rc_pre() {
+ install -d -o _gorum /var/log/gorum
+ install -d -o _gorum /var/run/gorum/cache
+}
+
+rc_cmd $1 &