Created
July 9, 2015 00:00
-
-
Save shadedyin/6fc82e0ff806a72861bb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resource "aws_instance" "registry" { | |
ami = "ami-45c53d2e" | |
key_name = "psev-longsight" | |
instance_type = "t2.small" | |
associate_public_ip_address = true | |
subnet_id = "${aws_subnet.registry-b.id}" | |
vpc_security_group_ids = [ "${aws_security_group.registry.id}" ] | |
provisioner "file" { | |
source = "conf/registry.service" | |
destination = "/etc/systemd/system/registry.service" | |
} | |
provisioner "remote-exec" { | |
inline = [ | |
"cat <<EOF > /etc/systemd/system/registry.service | |
[Unit] | |
Description=Docker Registry Container | |
Requires=docker.service | |
After=docker.service | |
[Service] | |
TimeoutStartSec=0 | |
Restart=always | |
ExecStartPre=-/usr/bin/docker stop registry | |
ExecStartPre=-/usr/bin/docker rm registry | |
ExecStartPre=/usr/bin/docker pull psev/s3registry | |
ExecStart=/usr/bin/docker run \ | |
--name registry \ | |
-p 127.0.0.1:5000:5000 \ | |
-e LOG_SERVICE=vericite \ | |
-e LOG_ENVIRONMENT=production \ | |
-e S3_ACCESSKEY=${aws_iam_access_key.registry.id} \ | |
-e S3_SECRETKEY=${aws_iam_access_key.registry.secret} \ | |
-e S3_REGION=${var.region} \ | |
-e S3_BUCKET=${aws_s3_bucket.registry.bucket} \ | |
-e S3_ROOTDIRECTORY=/registry \ | |
-e LISTEN_ADDRESS=:5000 \ | |
psev/s3registry | |
ExecStop=/usr/bin/docker rm registry | |
EOF", | |
"pacman --noconfirm -Syu", | |
"pacman --noconfirm -S lxc docker", | |
"systmectl enable docker", | |
"systmectl start docker registry" | |
] | |
} | |
tags { | |
Name = "registry" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment