diff --git a/prod/syncthing-packer/.gitignore b/prod/syncthing-packer/.gitignore index 8131a23..49a53fe 100644 --- a/prod/syncthing-packer/.gitignore +++ b/prod/syncthing-packer/.gitignore @@ -1 +1,3 @@ packer/syncthing-config.xml +packer/syncthing-cert.pem +packer/syncthing-key.pem diff --git a/prod/syncthing-packer/packer/Makefile b/prod/syncthing-packer/packer/Makefile index 42cb620..d33a914 100644 --- a/prod/syncthing-packer/packer/Makefile +++ b/prod/syncthing-packer/packer/Makefile @@ -5,3 +5,9 @@ packer: syncthing-config.xml syncthing.json syncthing-config.xml: syncthing-config.xml.template sigil -p -f syncthing-config.xml.template > syncthing-config.xml + +syncthing-cert.pem: syncthing-cert.pem.template + sigil -p -f syncthing-cert.pem.template > syncthing-cert.pem + +syncthing-key.pem: syncthing-key.pem.template + sigil -p -f syncthing-key.pem.template > syncthing-key.pem diff --git a/prod/syncthing-packer/packer/syncthing-cert.pem.template b/prod/syncthing-packer/packer/syncthing-cert.pem.template new file mode 100644 index 0000000..b0e05d3 --- /dev/null +++ b/prod/syncthing-packer/packer/syncthing-cert.pem.template @@ -0,0 +1 @@ +${SYNCTHING_CERT_PEM:?} \ No newline at end of file diff --git a/prod/syncthing-packer/packer/syncthing-config.xml.template b/prod/syncthing-packer/packer/syncthing-config.xml.template index d1748c1..6802c8d 100644 --- a/prod/syncthing-packer/packer/syncthing-config.xml.template +++ b/prod/syncthing-packer/packer/syncthing-config.xml.template @@ -1,5 +1,5 @@ - + basic @@ -30,7 +30,7 @@ false standard - +
dynamic
false false diff --git a/prod/syncthing-packer/packer/syncthing-key.pem.template b/prod/syncthing-packer/packer/syncthing-key.pem.template new file mode 100644 index 0000000..55b2dcb --- /dev/null +++ b/prod/syncthing-packer/packer/syncthing-key.pem.template @@ -0,0 +1 @@ +${SYNCTHING_KEY_PEM:?} \ No newline at end of file diff --git a/prod/syncthing-packer/packer/syncthing.json b/prod/syncthing-packer/packer/syncthing.json index 9060d81..a7617bb 100644 --- a/prod/syncthing-packer/packer/syncthing.json +++ b/prod/syncthing-packer/packer/syncthing.json @@ -17,6 +17,7 @@ "sudo mkdir -p /mnt/syncthing-volume", "sudo chown syncthing:syncthing /mnt/syncthing-volume", "sudo echo \"/dev/disk/by-label/syncthing-volume /mnt/syncthing-volume ext4 defaults,nofail,discard,noatime 0 2\" >> /etc/fstab", + "sudo echo \"/mnt/syncthing-volume /home/syncthing/syncthing-volume fuse.bindfs force-user=syncthing,force-group=syncthing 0 0\"", "sudo findmnt --verify --verbose" ] }, @@ -30,6 +31,16 @@ "source": "syncthing-config.xml", "destination": "/tmp/syncthing-config.xml" }, + { + "type": "file", + "source": "syncthing-cert.pem", + "destination": "/tmp/syncthing-cert.pem" + }, + { + "type": "file", + "source": "syncthing-key.pem", + "destination": "/tmp/syncthing-key.pem" + }, { "type": "shell", "inline": [ @@ -39,6 +50,8 @@ "sudo apt-get install -y syncthing", "sudo mkdir -p /home/syncthing/.config/syncthing", "sudo mv /tmp/syncthing-config.xml /home/syncthing/.config/syncthing/config.xml", + "sudo mv /tmp/syncthing-cert.pem /home/syncthing/.config/syncthing/cert.pem", + "sudo mv /tmp/syncthing-key.pem /home/syncthing/.config/syncthing/key.pem", "sudo chown -R syncthing:syncthing /home/syncthing/.config/syncthing", "sudo mv /tmp/syncthing@.service /etc/systemd/system/syncthing@.service", "sudo systemctl daemon-reload", diff --git a/prod/syncthing-packer/terraform/main.tf b/prod/syncthing-packer/terraform/main.tf index 718abfc..d780346 100644 --- a/prod/syncthing-packer/terraform/main.tf +++ b/prod/syncthing-packer/terraform/main.tf @@ -5,7 +5,7 @@ provider "digitalocean" { } data "digitalocean_image" "syncthing" { - name = "syncthing-packer-1609271401" + name = "syncthing-packer-1609384536" } data "terraform_remote_state" "do_ssh_keys" {