summaryrefslogtreecommitdiffstats
path: root/tozt
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2018-10-27 08:59:42 -0400
committerJesse Luehrs <doy@tozt.net>2018-10-27 08:59:42 -0400
commit10abb22da92a164225e5f3141c84eebe7c767b28 (patch)
tree78aabadd2c0efadf9f81420ba0b7d5f089dc76eb /tozt
parentcc2244cd13317c482f082d55bebb359289f20a14 (diff)
downloadpuppet-tozt-10abb22da92a164225e5f3141c84eebe7c767b28.tar.gz
puppet-tozt-10abb22da92a164225e5f3141c84eebe7c767b28.zip
install ttrss
Diffstat (limited to 'tozt')
-rw-r--r--tozt/systemd/manifests/init.pp5
-rw-r--r--tozt/tozt/files/nginx/ttrss-tls.conf12
-rw-r--r--tozt/tozt/files/nginx/ttrss.conf10
-rw-r--r--tozt/tozt/manifests/ttrss.pp17
-rw-r--r--tozt/ttrss/files/config.php43
-rw-r--r--tozt/ttrss/manifests/init.pp109
-rw-r--r--tozt/ttrss/templates/postgres-service3
7 files changed, 199 insertions, 0 deletions
diff --git a/tozt/systemd/manifests/init.pp b/tozt/systemd/manifests/init.pp
new file mode 100644
index 0000000..4ffb4e4
--- /dev/null
+++ b/tozt/systemd/manifests/init.pp
@@ -0,0 +1,5 @@
+class systemd {
+ exec { "systemctl daemon-reload":
+ refreshonly => true;
+ }
+}
diff --git a/tozt/tozt/files/nginx/ttrss-tls.conf b/tozt/tozt/files/nginx/ttrss-tls.conf
new file mode 100644
index 0000000..b438e7a
--- /dev/null
+++ b/tozt/tozt/files/nginx/ttrss-tls.conf
@@ -0,0 +1,12 @@
+server {
+ listen 443;
+ server_name rss.tozt.net;
+
+ access_log /var/log/nginx/rss.access.log;
+ error_log /var/log/nginx/rss.error.log;
+
+ include ssl;
+
+ root /usr/share/webapps/tt-rss;
+}
+# vim:ft=nginx
diff --git a/tozt/tozt/files/nginx/ttrss.conf b/tozt/tozt/files/nginx/ttrss.conf
new file mode 100644
index 0000000..8680dcb
--- /dev/null
+++ b/tozt/tozt/files/nginx/ttrss.conf
@@ -0,0 +1,10 @@
+server {
+ listen 80;
+ server_name rss.tozt.net;
+
+ access_log /var/log/nginx/rss.access.log;
+ error_log /var/log/nginx/rss.error.log;
+
+ rewrite ^(.*) https://$host$1 permanent;
+}
+# vim:ft=nginx
diff --git a/tozt/tozt/manifests/ttrss.pp b/tozt/tozt/manifests/ttrss.pp
new file mode 100644
index 0000000..575a093
--- /dev/null
+++ b/tozt/tozt/manifests/ttrss.pp
@@ -0,0 +1,17 @@
+class tozt::ttrss {
+ include tozt::certbot
+ include tozt::persistent
+
+ class ttrss {
+ dbpath => "/media/persistent/ttrss",
+ require => Class["tozt::persistent"];
+ }
+
+ nginx::site {
+ "ttrss-tls":
+ source => 'puppet:///modules/tozt/nginx/ttrss-tls.conf',
+ require => Class['certbot'];
+ "ttrss":
+ source => 'puppet:///modules/tozt/nginx/ttrss.conf';
+ }
+}
diff --git a/tozt/ttrss/files/config.php b/tozt/ttrss/files/config.php
new file mode 100644
index 0000000..eba0957
--- /dev/null
+++ b/tozt/ttrss/files/config.php
@@ -0,0 +1,43 @@
+<?php
+
+define('DB_TYPE', "pgsql");
+define('DB_HOST', "localhost");
+define('DB_USER', "ttrss");
+define('DB_NAME', "ttrss");
+define('DB_PASS', "");
+define('DB_PORT', '5432');
+
+define('SELF_URL_PATH', 'https://rss.tozt.net/');
+define('SINGLE_USER_MODE', false);
+define('SIMPLE_UPDATE_MODE', false);
+
+define('PHP_EXECUTABLE', '/usr/bin/php');
+define('LOCK_DIRECTORY', 'lock');
+define('CACHE_DIR', 'cache');
+define('ICONS_DIR', 'feed-icons');
+define('ICONS_URL', 'feed-icons');
+
+define('AUTH_AUTO_CREATE', true);
+define('AUTH_AUTO_LOGIN', true);
+
+define('FORCE_ARTICLE_PURGE', 0);
+
+define('ENABLE_REGISTRATION', false);
+define('REG_NOTIFY_ADDRESS', 'ttrss@tozt.net');
+define('REG_MAX_USERS', 2);
+
+define('SESSION_COOKIE_LIFETIME', 86400);
+
+define('SMTP_FROM_NAME', 'Tiny Tiny RSS');
+define('SMTP_FROM_ADDRESS', 'ttrss-noreply@tozt.net');
+define('DIGEST_SUBJECT', '[tt-rss] New headlines for last 24 hours');
+define('SMTP_SERVER', '');
+define('SMTP_LOGIN', '');
+define('SMTP_PASSWORD', '');
+define('SMTP_SECURE', 'tls');
+
+define('CHECK_FOR_UPDATES', false);
+define('ENABLE_GZIP_OUTPUT', false);
+define('PLUGINS', 'auth_internal, note');
+define('LOG_DESTINATION', 'sql');
+define('CONFIG_VERSION', 26);
diff --git a/tozt/ttrss/manifests/init.pp b/tozt/ttrss/manifests/init.pp
new file mode 100644
index 0000000..6902796
--- /dev/null
+++ b/tozt/ttrss/manifests/init.pp
@@ -0,0 +1,109 @@
+class ttrss($dbpath) {
+ include systemd
+
+ package {
+ [
+ "tt-rss",
+ "postgres",
+ "php-pgsql",
+ ]:
+ ensure => installed;
+ }
+
+ file {
+ $dbpath:
+ owner => 'postgres',
+ group => 'postgres',
+ require => Package["postgres"];
+ "$dbpath/data":
+ owner => 'postgres',
+ group => 'postgres',
+ require => [
+ Package["postgres"],
+ File[$dbpath],
+ ];
+ "/etc/systemd/system/postgresql.service.d":
+ ensure => directory;
+ "/etc/systemd/system/postgresql.service.d/override.conf":
+ content => template('ttrss/postgres-service'),
+ notify => Exec["systemctl daemon-reload"],
+ require => File["/etc/systemd/system/postgresql.service.d"];
+ "/etc/webapps/tt-rss/config.php":
+ source => "puppet:///modules/ttrss/config.php",
+ require => Package["tt-rss"];
+ "/etc/pacman.d/hooks":
+ ensure => directory;
+ "/etc/pacman.d/hooks/tt-rss.hook":
+ source => "puppet:///modules/ttrss/pacman-hook",
+ require => [
+ File["/etc/pacman.d/hooks"],
+ Package["tt-rss"],
+ ]
+ }
+
+ exec { "initialize db path":
+ command => "/usr/bin/initdb -D $dbpath/data",
+ user => 'postgres',
+ creates => "$dbpath/data/PG_VERSION",
+ require => Package["postgres"];
+ }
+
+ service { "postgres":
+ ensure => running,
+ require => Exec["initialize db path"];
+ }
+
+ exec { "create db user":
+ provider => shell,
+ command => "createuser -d ttrss",
+ user => 'postgres',
+ unless => "psql -Atc 'select usename from pg_catalog.pg_user' | grep -F ttrss",
+ require => [
+ Package["postgres"],
+ Service["postgres"],
+ ];
+ }
+
+ exec { "create db":
+ provider => shell,
+ command => "createdb -U ttrss ttrss",
+ user => 'postgres',
+ unless => "psql -Atc 'select datname from pg_catalog.pg_database' | grep -F ttrss",
+ require => [
+ Exec["create db user"],
+ Package["postgres"],
+ Service["postgres"],
+ ];
+ }
+
+ exec { "fixup php.ini":
+ provider => shell,
+ command => "sed -i 's/^;\(extension=.*pgsql\)$/\\1/' /etc/php/php.ini",
+ unless => "grep -q '^extension=pgsql$' /etc/php/php.ini && grep -q '^extension=pdo_pgsql$' /etc/php/php.ini",
+ require => Package["php-pgsql"];
+ }
+
+ exec { "initialize tt-rss db":
+ provider => shell,
+ command => "psql ttrss -U ttrss -f /usr/share/webapps/tt-rss/schema/ttrss_schema_pgsql.sql",
+ user => 'postgres',
+ unless "psql -d ttrss -Atc 'select relname from pg_catalog.pg_class;' | grep -q '^ttrss'",
+ require => [
+ Package["postgres"],
+ Service["postgres"],
+ Exec["create db"],
+ Package["tt-rss"],
+ File["/etc/webapps/tt-rss/config.php"],
+ ]
+ }
+
+ service { "tt-rss":
+ ensure => running,
+ require => [
+ Package["tt-rss"],
+ Exec["fixup php.ini"],
+ File["/etc/webapps/tt-rss/config.php"],
+ Exec["create db"],
+ ]
+ }
+}
diff --git a/tozt/ttrss/templates/postgres-service b/tozt/ttrss/templates/postgres-service
new file mode 100644
index 0000000..aa63550
--- /dev/null
+++ b/tozt/ttrss/templates/postgres-service
@@ -0,0 +1,3 @@
+[Service]
+Environment=PGROOT=<%= @dbpath %>
+PIDFile=<%= @dbpath %>/data/postmaster.pid