aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2018-06-03 22:06:15 +0100
committerChristopher Baines <mail@cbaines.net>2018-06-03 22:06:15 +0100
commitf17724f4eb4f936619edf03894cbcffa7a03c31d (patch)
tree7d17456da1130b62c66fead8967e0ebb034193a5
parentd0332d05222169ffdbdb65d6d4e79b45a2bf789e (diff)
downloadgovuk-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.rb6
-rw-r--r--terraform/aws/mini_environment/main.tf1
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",