Skip to content

JPLima/johnata_lima_test

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

The Application

Before start deploy

Before start to running the application you need install some things. Follow bellow the commands(This work for ubuntu16.4):

Ansible using Python3

$sudo pip3 install ansible

Install boto and boto3

$sudo pip3 install boto

$sudo pip3 install boto3

You need to create the file ~/.aws/credentials or set aws_secret_access_key and aws_access_key_id

Playbooks

The project is divided in two playbooks that calls task in the folder task/

Infrasctructure

The first playbook that must to be deployed to create the infrastructure from the application is main.yml

The main.yml playbook import tasks network.yml, rds.yml and instances.yml

network.yml - Must be deployed first at all. This task will create all network enviromment on aws(VPC,SG, LB, IGW) and create the infonetwork.json the save necessary network information to other deploy without the need to run it again.

rds.yml - It will create the subnet_group to RDS and the RDS instance. Get credentials from ./files/credentials.json that must to be set before run the playbook.

instances.yml - This playbook generete the key pair to access the ec2 instance and create the VM, also add the instance to host.txt file(if not exist, it will be created) and save the access key if does not exist.

Application

The application's playbook is deploy_app.yml that import the installreq.yml, createdb.yml and app.yml

installreq.ym - This task install all dependences that the application require.

createdb.ym - Create the database "demo" on RDS. This task can only be deployed from the VM because there is no external access to RDS.

app.yml - This is the task that run the application flask.

Run the playbooks

To run the playbooks is just need to add a password on files/credentials.json and run the commands below:

ansible-playbook main.yml

ansible-playbook -i host.txt deploy_app.yml

To add a new EC2 edit the main.yml file and comment the lines - include: ./task/network.yml - include: ./task/rds.yml and run it again, after finish run the deploy_app.yml playbook.
You can also change the instance type to scale UP the application

About

Challenge

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published