AWS OpsWorks custom layer with support for PHP 5.6 and php application deployment from a private git repository. The project also contains a centos 7.1 virtual machine using Vagrant that emulate Amazon Linux AMI environment.
Please make sure to read opsworks user guide before using these cookbooks http://docs.aws.amazon.com/opsworks/latest/userguide/chef-12-linux.html
Based on https://www.chef.io/blog/2015/12/07/chef-community-cookbooks-with-aws-opsworks-chef-12/
- Chef Development Kit (chefdk)
- AWS CLI
- S3 bucket for chef cookbooks deployment
- Vagrant
- Download or clone this repository
- Run
berks package cookbooks.tar.gz
to bundle the cookbooks - Upload cookbooks bundle to S3
aws s3 cp cookbooks.tar.gz s3://YOURBUCKET/cookbooks.tar.gz
- Add a new stack (Chef 12 Stack)
- Use latest Amazon Linux AMI
- Under Advanced Settings:
- Pick
Use custom Chef cookbooks
- Repository type:
S3 Archive
- Repository URL
s3://YOURBUCKET/cookbooks.tar.gz
- Enter S3 credentials if your cookbooks are not public
- Pick
- Add a new layer.
- Edit the newly created layer, and add the custom chef recipes:
- add phpapp::setup_opsworks to the setup lifetime event
- add phpapp::deploy_opsworks in the deploy lifetime event
- If your VPC is public, make sure the Automatically
Assign Public IP Address
in the layer's network settings is turned on - Add an application from the "Applications" section. Make sure to enter your git deploy key
- Download Vagrant 1.6+ from http://www.vagrantup.com
- Download latest VirtualBox from https://www.virtualbox.org
- Install ChefDK ">= 0.6.0" https://downloads.getchef.com/chef-dk/mac/#/
- Install vagrant-omnibus
vagrant plugin install vagrant-omnibus
- Install vagrant-berkshelf
vagrant plugin install vagrant-berkshelf
- Create a new project with the supplied
Vagrantfile
and editchef.cookbooks_path
to point to the cookbooks folder