aboutsummaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2019-05-27 21:35:53 +0100
committerChristopher Baines <mail@cbaines.net>2019-05-30 08:33:03 +0100
commit859302774c4d719cf949f419d0efcfd8cbad6ca2 (patch)
treea83c053f6a0e95554ea30784caf2837eb6837179 /db
parent1acde9a21a50f4227930afb5b6b9eda1cace54b8 (diff)
downloadgovuk-mini-environment-admin-859302774c4d719cf949f419d0efcfd8cbad6ca2.tar
govuk-mini-environment-admin-859302774c4d719cf949f419d0efcfd8cbad6ca2.tar.gz
Add a new AWS backend using Amazon Machine Images
The existing AWS backend uses system containers backed on to the AWS hosted NFS service (EFS). This has some advantages, but also some disadvantages. Using the EFS service allows building a container on one instance, with the state being held on the EFS, and then launching a new instance to run the container. Using EFS also provides persistence, at least beyond individual EC2 instances. However, build performance when using EFS is poor compared with a local store without the overhead of the network latency. Additionally, the startup speed of the container running off EFS is slow compared to local storage. This backend doesn't use EFS, instead the Guix store sits on instance storage. Rather than using a system container for a Mini Environment, an Amazon Machine Image (AMI) is built instead. The fast local storage makes builds faster, and using EBS storage for the Mini Envirnoments as well as not having the overhead of starting Ubuntu, then starting the container also makes startup faster.
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20190519091614_terraform_aws_using_ami.rb17
-rw-r--r--db/structure.sql57
2 files changed, 73 insertions, 1 deletions
diff --git a/db/migrate/20190519091614_terraform_aws_using_ami.rb b/db/migrate/20190519091614_terraform_aws_using_ami.rb
new file mode 100644
index 0000000..0375a2a
--- /dev/null
+++ b/db/migrate/20190519091614_terraform_aws_using_ami.rb
@@ -0,0 +1,17 @@
+class TerraformAwsUsingAmi < ActiveRecord::Migration[5.2]
+ def change
+ create_table :terraform_aws_using_ami_backends do |t|
+ t.string :label
+ t.string :aws_region
+ t.string :aws_access_key_id
+ t.string :aws_secret_access_key
+ t.string :domain
+ t.string :route_53_zone_id, null: false
+ t.string :vpc_id, null: false
+ t.string :ssh_public_key
+ t.string :ssh_private_key
+
+ t.timestamps
+ end
+ end
+end
diff --git a/db/structure.sql b/db/structure.sql
index 5e5aaba..7fd8ca2 100644
--- a/db/structure.sql
+++ b/db/structure.sql
@@ -459,6 +459,45 @@ ALTER SEQUENCE public.terraform_aws_backends_id_seq OWNED BY public.terraform_aw
--
+-- Name: terraform_aws_using_ami_backends; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.terraform_aws_using_ami_backends (
+ id bigint NOT NULL,
+ label character varying,
+ aws_region character varying,
+ aws_access_key_id character varying,
+ aws_secret_access_key character varying,
+ domain character varying,
+ route_53_zone_id character varying NOT NULL,
+ vpc_id character varying NOT NULL,
+ ssh_public_key character varying,
+ ssh_private_key character varying,
+ created_at timestamp without time zone NOT NULL,
+ updated_at timestamp without time zone NOT NULL
+);
+
+
+--
+-- Name: terraform_aws_using_ami_backends_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.terraform_aws_using_ami_backends_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: terraform_aws_using_ami_backends_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.terraform_aws_using_ami_backends_id_seq OWNED BY public.terraform_aws_using_ami_backends.id;
+
+
+--
-- Name: terraform_libvirt_backends; Type: TABLE; Schema: public; Owner: -
--
@@ -595,6 +634,13 @@ ALTER TABLE ONLY public.terraform_aws_backends ALTER COLUMN id SET DEFAULT nextv
--
+-- Name: terraform_aws_using_ami_backends id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.terraform_aws_using_ami_backends ALTER COLUMN id SET DEFAULT nextval('public.terraform_aws_using_ami_backends_id_seq'::regclass);
+
+
+--
-- Name: terraform_libvirt_backends id; Type: DEFAULT; Schema: public; Owner: -
--
@@ -696,6 +742,14 @@ ALTER TABLE ONLY public.terraform_aws_backends
--
+-- Name: terraform_aws_using_ami_backends terraform_aws_using_ami_backends_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.terraform_aws_using_ami_backends
+ ADD CONSTRAINT terraform_aws_using_ami_backends_pkey PRIMARY KEY (id);
+
+
+--
-- Name: terraform_libvirt_backends terraform_libvirt_backends_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
@@ -879,6 +933,7 @@ INSERT INTO "schema_migrations" (version) VALUES
('20180621065525'),
('20180621220505'),
('20180623083735'),
-('20190106112141');
+('20190106112141'),
+('20190519091614');