From 50cf829d0e08186ec82741de0bdc5dbb50dda5c7 Mon Sep 17 00:00:00 2001 From: Mike Cugini Date: Sun, 10 Jan 2021 21:10:33 -0500 Subject: [PATCH] update matrix data dir and minor update to registration config --- nixos_configs/matrix.nix | 12 +++++++----- terraform/matrix.tf | 14 +++++++------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/nixos_configs/matrix.nix b/nixos_configs/matrix.nix index ae25706..7dc3e42 100644 --- a/nixos_configs/matrix.nix +++ b/nixos_configs/matrix.nix @@ -1,12 +1,12 @@ # adapted from https://nixos.org/manual/nixos/stable/index.html#module-services-matrix { modulesPath, config, lib, pkgs, ... }: -let +let matrix-registration = import ../../matrix-registration/default.nix; storage-device = "/dev/disk/by-id/scsi-0DO_Volume_matrix-storage"; - storage-dir = "/opt/matrix-data"; + storage-dir = "/srv/matrix-data"; matrix-reg-dir = "${storage-dir}/matrix-registration"; matrix-reg-key = (builtins.readFile ./matrix_reg_key); - fqdn = + fqdn = let join = hostName: domain: hostName + lib.optionalString (domain != null) ".${domain}"; in join config.networking.hostName config.networking.domain; @@ -23,7 +23,7 @@ in { (builtins.readFile "/home/mike/.ssh/id_mops.pub") ]; - ### app specific config + ### app specific config # mount DigitalOcean volume for use by postgres fileSystems."${storage-dir}" = { @@ -35,7 +35,7 @@ in { domain = "waffle.farm"; }; - services.postgresql = { + services.postgresql = { enable = true; dataDir = "${storage-dir}/db"; @@ -128,6 +128,7 @@ in { server_name = config.networking.domain; registration_shared_secret = matrix-reg-key; extraConfig = '' + allow_public_rooms_over_federation: true auto_join_rooms: - "#cryptic-chat:waffle.farm" ''; @@ -162,6 +163,7 @@ in { systemd.services.matrix-registration = let configFile = pkgs.writeText "matrix-reg-config.yaml" '' server_location: 'https://matrix.waffle.farm:443' +base_url: 'waffle.farm' server_name: 'waffle.farm' shared_secret: '${matrix-reg-key}' riot_instance: 'chat.waffle.farm' diff --git a/terraform/matrix.tf b/terraform/matrix.tf index 0b7f9ff..71761bb 100644 --- a/terraform/matrix.tf +++ b/terraform/matrix.tf @@ -2,13 +2,6 @@ data "digitalocean_image" "nixos_base" { name = "nixos-base" } -resource "digitalocean_volume" "matrix" { - region = "nyc3" - name = "matrix-storage" - size = 10 - initial_filesystem_type = "ext4" -} - resource "digitalocean_droplet" "matrix-0" { name = "matrix-0" @@ -19,6 +12,13 @@ resource "digitalocean_droplet" "matrix-0" { ssh_keys = [data.digitalocean_ssh_key.mops.id] } +resource "digitalocean_volume" "matrix" { + region = "nyc3" + name = "matrix-storage" + size = 10 + initial_filesystem_type = "ext4" +} + resource "digitalocean_volume_attachment" "matrix" { droplet_id = digitalocean_droplet.matrix-0.id volume_id = digitalocean_volume.matrix.id