|Daniel Carrillo ff04c06abc||9 months ago|
|builder||9 months ago|
|group_vars||10 months ago|
|inventory||9 months ago|
|pics||9 months ago|
|roles||9 months ago|
|.gitignore||10 months ago|
|README.md||9 months ago|
|ansible.cfg||10 months ago|
|app_deployer.yml||10 months ago|
|infra_deployer.yml||10 months ago|
|requirements.txt||9 months ago|
|requirements_dev.txt||9 months ago|
Enable your virtual environment
Deploying the infrastructure of a new environment
Deploying a minimal VPC for automatic AMI creation
Deploying the application in the new infrastructure
Please be patient, wait for the application to be ready and point your browser to your new endpoint
The preferred way to run this deployer is using python virtualenvs, you can fulfill the requirements from requirements.txt using your distro packages but it is not recommended.
mkvirtualenv --python python3 -r requirements.txt deployer
python3 -m venv venv source venv/bin/activate pip install -r requirements.txt
Remember to activate your venv (
workon deployer or
source venv/bin/activate depending on your work mode).
A recent version of
docker is required and the user running the app deployer is expected to be allowed to manage docker without using sudo
The following env variables need to be exported (use of .env file is encouraged):
export AWS_ACCESS_KEY_ID=XXXXXXXXXXXXXXXX export AWS_SECRET_ACCESS_KEY=YYYYYYYYYYYYYY export BOTO_USE_ENDPOINT_HEURISTICS=True
AWS_SECRET_ACCESS_KEY are credentials of a user with full permission to create/delete AWS infrastructure.
To build AMIs this deployer uses packer so please make sure
to place packer binary somewhere on your
ansible-playbook -i inventory/pro infra_deployer.yml
The name of the inventory file (pro in the previous example) is used as prefix for tagging the environment elements, so take this into account before creating a new configuration file.
Another environment can be deployed in the same AWS account with a different name:
ansible-playbook -i inventory/dev infra_deployer.yml
ansible-playbook -i inventory/pro infra_deployer.yml --tag get_endpoint
In order to build AMIs (self-contained application), a minimal independent VPC is needed, the same procedure used by the deployer can be here used but deploying with the minimum set of blocks necessary.
ansible-playbook -i ./inventory/builder infra_deployer.yml --tags vpc,subnets,internet_gateway,route_tables
The name of the inventory file (
builder) is used as prefix for tagging the environment, this name can NOT be changed since the app builder expects to found a VPC tagged with this name.
Build a backed AMI with the dockerized application and deploy it
ansible-playbook -i inventory/pro app_deployer.yml
Build a backed AMI with the dockerized application without deploying it
ansible-playbook -i inventory/pro app_deployer.yml --tags artifact,packer
Perform a rolling deploy of the pre-build AMI (the AMI must exists)
ansible-playbook -i inventory/pro app_deployer.yml --tag deploy
ansible-playbook -i inventory/pro infra_deployer.yml -e destroy=true ansible-playbook -i inventory/builder infra_deployer.yml -e destroy=true --tags vpc,subnets,internet_gateway,route_tables