diff options
author | Christopher Baines <mail@cbaines.net> | 2018-06-03 22:06:15 +0100 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2018-06-03 22:06:15 +0100 |
commit | f17724f4eb4f936619edf03894cbcffa7a03c31d (patch) | |
tree | 7d17456da1130b62c66fead8967e0ebb034193a5 | |
parent | d0332d05222169ffdbdb65d6d4e79b45a2bf789e (diff) | |
download | govuk-mini-environment-admin-f17724f4eb4f936619edf03894cbcffa7a03c31d.tar govuk-mini-environment-admin-f17724f4eb4f936619edf03894cbcffa7a03c31d.tar.gz |
Share /var/cache and /var/lib with the host
In the AWS backend. This means that they don't end up on a tmpfs and
using up RAM.
-rw-r--r-- | app/models/backends/terraform_aws.rb | 6 | ||||
-rw-r--r-- | terraform/aws/mini_environment/main.tf | 1 |
2 files changed, 6 insertions, 1 deletions
diff --git a/app/models/backends/terraform_aws.rb b/app/models/backends/terraform_aws.rb index 299b5b5..f538cbf 100644 --- a/app/models/backends/terraform_aws.rb +++ b/app/models/backends/terraform_aws.rb @@ -65,7 +65,11 @@ class Backends::TerraformAws < ApplicationRecord signon_instance_name: slug, admin_environment_label: mini_environment.name, use_error_pages: 'true', - origin_basic_auth: "#{slug}=#{slug}" + origin_basic_auth: "#{slug}=#{slug}", + share: [ + '/var/cache/govuk-mini-environment-admin=/var/cache', + '/var/lib/govuk-mini-environment-admin=/var/lib' + ] }, run_remotely_on_host: "ubuntu@guix-daemon.#{domain}" ) diff --git a/terraform/aws/mini_environment/main.tf b/terraform/aws/mini_environment/main.tf index 6dd7ac6..b69f8f5 100644 --- a/terraform/aws/mini_environment/main.tf +++ b/terraform/aws/mini_environment/main.tf @@ -101,6 +101,7 @@ resource "aws_spot_instance_request" "main" { "sudo iptables -A PREROUTING -t nat -i eth0 -p tcp --dport 443 -j REDIRECT --to-port 8443", "sudo iptables -A OUTPUT -t nat -o lo -p tcp --dport 80 -j REDIRECT --to-port 8080", "sudo iptables -A OUTPUT -t nat -o lo -p tcp --dport 443 -j REDIRECT --to-port 8443", + "sudo mkdir -p /var/cache/govuk-mini-environment-admin /var/lib/govuk-mini-environment-admin", "sudo mv /home/ubuntu/govuk.service /etc/systemd/system/govuk.service", "sudo systemctl daemon-reload", "sudo systemctl enable govuk.service", |