mmb/meme_captain_web

View on GitHub
aws/packer.json

Summary

Maintainability
Test Coverage
{
  "builders": [
    {
      "ami_block_device_mappings": [
        {
          "device_name": "/dev/xvda",
          "volume_type": "gp2"
        }
      ],
      "ami_name": "memecaptain-{{timestamp}}",
      "associate_public_ip_address": true,
      "instance_type": "c4.xlarge",
      "region": "us-east-1",
      "source_ami": "ami-8fcee4e5",
      "spot_price": "0.10",
      "ssh_pty": true,
      "ssh_username": "ec2-user",
      "subnet_id": "subnet-c7219bec",
      "type": "amazon-ebs",
      "vpc_id": "vpc-732e0c16"
    }
  ],
  "provisioners": [
    {
      "inline": [
        "sudo mkdir /fonts",
        "sudo chown ec2-user:ec2-user /fonts"
      ],
      "type": "shell"
    },
    {
      "destination": "/fonts",
      "source": "fonts/",
      "type": "file"
    },
    {
      "inline": [
        "sudo chkconfig atd off",
        "sudo chkconfig ip6tables off",
        "sudo chkconfig netfs off",
        "sudo chkconfig nfs off",
        "sudo chkconfig nfslock off",
        "sudo chkconfig rpcbind off",
        "sudo chkconfig rpcgssd off",
        "sudo chkconfig rpcsvcgssd off",
        "sudo chkconfig sendmail off",
        "sudo sed -i.prev 's/tty\\[1-6\\]/tty[1-1]/' /etc/sysconfig/init",
        "echo 'repo_upgrade: none' | sudo tee /etc/cloud/cloud.cfg.d/15_repo_upgrade_none.cfg",
        "sudo yum update -y",
        "sudo yum install -y docker git",
        "sudo service docker start",
        "sudo docker build --rm=true --tag=meme_captain https://github.com/mmb/meme_captain_web.git#deploy",
        "cat << EOF > startup",
        "export INSTANCE_ID=\\$(curl http://169.254.169.254/latest/meta-data/instance-id)",
        "export POOL=\\$(cat /pool)",
        "docker run \\",
        "  --name meme_captain \\",
        "  --env=INSTANCE_ID \\",
        "  --env=POOL \\",
        "  --env-file=/env \\",
        "  --privileged=true \\",
        "  --ulimit memlock=83968000 \\",
        "  --ulimit nofile=131072 \\",
        "  -d \\",
        "  -h \"\\${POOL}-\\${INSTANCE_ID}\" \\",
        "  -p 80:6081 \\",
        "  -v /database.yml:/app/config/database.yml \\",
        "  -v /fonts:/app/fonts \\",
        "  meme_captain",
        "EOF",
        "sudo mv startup /startup"
      ],
      "type": "shell"
    },
    {
      "destination": "/home/ec2-user/.bashrc-packer",
      "source": "bashrc",
      "type": "file"
    },
    {
      "inline": [
        "echo '[ -f ~/.bashrc-packer ] && . ~/.bashrc-packer' >> /home/ec2-user/.bashrc"
      ],
      "type": "shell"
    }
  ]
}