Skip to content

Commit

Permalink
irc: add CVTBot (#3583)
Browse files Browse the repository at this point in the history
  • Loading branch information
Universal-Omega authored Jan 4, 2024
1 parent ad3c3ac commit f8e5826
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 0 deletions.
56 changes: 56 additions & 0 deletions modules/irc/manifests/cvtbot.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# class: irc::cvtbot
class irc::cvtbot {
$install_path = '/srv/cvtbot'

# FIXME: should be cvtbot, using relaybot for now
$irc_password = lookup('passwords::irc::relaybot::irc_password')

stdlib::ensure_packages('mono-complete')

file { $install_path:
ensure => 'directory',
owner => 'irc',
group => 'irc',
mode => '0644',
recurse => true,
max_files => 1500,
}

git::clone { 'CVTBot':
ensure => present,
origin => 'https://github.com/Universal-Omega/CVTBot',
directory => $install_path,
owner => 'irc',
group => 'irc',
mode => '0644',
require => File[$install_path],
}

file { [
"${install_path}/src/CVTBot.ini",
"${install_path}/src/CVTBot-sample.ini"
]:
ensure => present,
owner => 'root',
group => 'root',
mode => '0644',
content => template('irc/cvtbot/CVTBot.ini.erb'),
require => Git::Clone['CVTBot'],
notify => Service['cvtbot'],
}

systemd::service { 'cvtbot':
ensure => present,
content => systemd_template('cvtbot'),
restart => true,
require => [
Git::Clone['CVTBot'],
Package['mono-complete'],
File["${install_path}/src/CVTBot.ini"],
],
}

monitoring::nrpe { 'CVT Bot':
command => '/usr/lib/nagios/plugins/check_procs -a cvtbot -c 2:2'
}
}
21 changes: 21 additions & 0 deletions modules/irc/templates/cvtbot/CVTBot.ini.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# User
botnick=MirahezeCVTBot
readerbotnick=CVTBotReader
botpass=<%= @irc_password %>
botrealname=MirahezeCVTBot
# Server
ircserver=irc.libera.chat
feedchannel=#miraheze-cvt-feed
controlchannel=None
broadcastchannel=#miraheze-cvt
readerfeedchannel=#miraheze-feed
# Project
centralproject=metawiki
projectsuffix=wiki
projectdomain=miraheze.org
interwikiprefix=mh:
# Files
lists=./Lists.sqlite
messages=./Console.msgs
projects=./Projects.xml
# Feed
14 changes: 14 additions & 0 deletions modules/irc/templates/initscripts/cvtbot.systemd.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[Unit]
Description=Miraheze IRC CVT bot

[Service]
Type=simple
User=irc
SyslogIdentifier=cvtbot
ExecStart=/usr/bin/dotnet run --project <%= @install_path %>/src/CVTBot/CVTBot.csproj --configuration Release
Restart=always
WorkingDirectory=<%= @install_path %>/src/CVTBot/bin/Release
Environment=HOME=<%= @install_path %>/src/CVTBot/bin/Release

[Install]
WantedBy=multi-user.target
1 change: 1 addition & 0 deletions modules/role/manifests/irc.pp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
class role::irc {
include irc::irclogbot
include irc::relaybot
# include irc::cvtbot

class { 'irc::ircrcbot':
nickname => 'MirahezeRC',
Expand Down

0 comments on commit f8e5826

Please sign in to comment.