From 6338573a8a4b416d5bce384dac712197f90637dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isma=C3=ABl=20Bouya?= Date: Sun, 7 Jun 2020 18:46:27 +0200 Subject: Add comment engine --- .../private/websites/tools/commento/default.nix | 60 ++++++++++++++++++++++ .../websites/tools/tools/landing/config.yml | 3 ++ .../tools/tools/landing/icons/commento.svg | 10 ++++ 3 files changed, 73 insertions(+) create mode 100644 modules/private/websites/tools/commento/default.nix create mode 100644 modules/private/websites/tools/tools/landing/icons/commento.svg (limited to 'modules/private/websites/tools') diff --git a/modules/private/websites/tools/commento/default.nix b/modules/private/websites/tools/commento/default.nix new file mode 100644 index 0000000..d0e7d24 --- /dev/null +++ b/modules/private/websites/tools/commento/default.nix @@ -0,0 +1,60 @@ +{ lib, pkgs, config, ... }: +let + cfg = config.myServices.websites.tools.commento; + env = config.myEnv.tools.commento; + webPort = "${host}:${port}"; + port = toString env.listenPort; + host = "localhost"; + postgresql_url = "postgres://${env.postgresql.user}:${env.postgresql.password}@localhost:${env.postgresql.port}/${env.postgresql.database}?sslmode=disable"; +in +{ + options.myServices.websites.tools.commento = { + enable = lib.mkEnableOption "Enable commento website"; + }; + config = lib.mkIf cfg.enable { + secrets.keys = [ + { + dest = "commento/env"; + permission = "0400"; + text = '' + COMMENTO_ORIGIN=https://commento.immae.eu/ + COMMENTO_PORT=${port} + COMMENTO_POSTGRES=${postgresql_url} + COMMENTO_FORBID_NEW_OWNERS=true + COMMENTO_BIND_ADDRESS=${host} + COMMENTO_GZIP_STATIC=true + COMMENTO_SMTP_HOST=${env.smtp.host} + COMMENTO_SMTP_PORT=${env.smtp.port} + COMMENTO_SMTP_USERNAME=${env.smtp.email} + COMMENTO_SMTP_PASSWORD=${env.smtp.password} + COMMENTO_SMTP_FROM_ADDRESS=${env.smtp.email} + ''; + } + ]; + + services.websites.env.tools.vhostConfs.commento = { + certName = "eldiron"; + addToCerts = true; + hosts = [ "commento.immae.eu" ]; + root = null; + extraConfig = [ + '' + ProxyPass / http://${webPort}/ + ProxyPassReverse / http://${webPort}/ + ProxyPreserveHost On + '' + ]; + }; + systemd.services.commento = { + description = "Commento"; + wantedBy = [ "multi-user.target" ]; + requires = ["postgresql.service"]; + after = ["network.target" "postgresql.service"]; + serviceConfig = { + User = "wwwrun"; + ExecStart = "${pkgs.commento}/commento"; + EnvironmentFile = config.secrets.fullPaths."commento/env"; + }; + }; + }; +} diff --git a/modules/private/websites/tools/tools/landing/config.yml b/modules/private/websites/tools/tools/landing/config.yml index f3de6fc..e86dc19 100644 --- a/modules/private/websites/tools/tools/landing/config.yml +++ b/modules/private/websites/tools/tools/landing/config.yml @@ -71,6 +71,9 @@ services: - name: "Social" icon: "fas fa-users" items: + - name: "Commento" + logo: "assets/tools/commento.svg" + url: "https://commento.immae.eu" - name: "Diaspora" logo: "assets/tools/diaspora.png" url: "https://diaspora.immae.eu" diff --git a/modules/private/websites/tools/tools/landing/icons/commento.svg b/modules/private/websites/tools/tools/landing/icons/commento.svg new file mode 100644 index 0000000..39da47a --- /dev/null +++ b/modules/private/websites/tools/tools/landing/icons/commento.svg @@ -0,0 +1,10 @@ + + + +assets + + + + + + -- cgit v1.2.3