SlideShare a Scribd company logo
1 of 21
Dev Ninja
Vagrant + Virtualbox +
Chef-Solo + Git + EC2
Como isso pode ajudar no meu trabalho ?
Vagrant (v 1.5)
- Overview
- Vagrant Boxes (packer)
- Vagrantfile
- Basic commands:
● Vagrant up
● Vagrant provision
● Vagrant destroy
● Vagrant ssh
● Vagrant http share
VirtualBox (provider)
- Overview
- Vboxmanager
EC2 (Provider)
- Overview
- Tecnologias (IAM, AMI, Elastic IP, Route53)
Chef-Solo (Chef-repo)
- Overview
- Cookbooks
1 2 3 4
Layers
Juntando tudo (Stack)
Requisitos
● Linux Ubuntu 13.04
● Install Virtual Box
● Install vagrant
● Install vagrant aws plugin
● Install Git
Mão na massa
Install Virtual Box
$ sudo apt-get install software-properties-common python-software-properties -y
$ sudo sudo add-apt-repository ppa:debfx/virtualbox
$ sudo apt-get install virtualbox -y
Install Vagrant
$ wget https://dl.bintray.com/mitchellh/vagrant/vagrant_1.5.2_x86_64.deb
$ sudo dpkg -i vagrant_1.5.2_x86_64.deb
$ sudo vagrant plugin install vagrant-aws
Install Git
$ sudo apt-get install git
My Workspace
$ mkdir workspace
$ cd wokspace
$ mkdir cookbooks
$ mkdir data_bags
$ mkdir roles
Recipes (Opscode)
$ cd workspace/cookbooks
Apache
$ git clone http://github.com/opscode-cookbooks/apache2 apache2
Mysql
$ git clone http://github.com/opscode-cookbooks/mysql mysql
Database
$ git clone http://github.com/opscode-cookbooks/database database
PHP
$ git clone http://github.com/opscode-cookbooks/php php
My Application Cookbook
CookBook Tree
├── attributes
│ └── default.rb
├── metadata.rb
├── recipes
│ ├── deploy.rb
│ ├── database.rb
│
└── templates
├── database..erb
└── site_config.erb
● Recipes
● Attributes
● Metadata
● Templates
My Application Cookbook Recipes
# FILE: deploy.rb
deploy_revision node['webapp']['home'] do
repo node["webapp"]["repo"]
revision node["webapp"]["revision"]
# Disabling rails links and folders
migrate false
action :deploy # or :rollback
before_restart do
current_release = release_path
end
end
["database.php","site_config.php"].each do |php|
template "#{current_release}/app/Config/#{php}" do
source "#{php}.erb"
mode 00644
end
restart_command do
service "apache2" do
action :restart
end
end
# FILE: database.rb
# externalize conection info in a ruby hash
mysql_connection_info = {
:host => "localhost",
:username => 'root',
:password => node['mysql']['server_root_password']
}
# create a mysql database named DB_NAME
mysql_database '#{node['webapp']['database']['database']}' do
connection mysql_connection_info
action [:create]
end
#or import from a dump file
mysql_database "node['webapp']['database']['database']" do
connection mysql_connection_info
sql "source #{node['webapp']['current_release']}#{node['webapp']['databasedumpfile']};"
end
# query a database from a sql script on disk
mysql_database "#{node['webapp']['database']['database']}" do
connection mysql_connection_info
sql { ::File.open("#{node['webapp']['current_release']}#{node['webapp']['dbupdatefile']}").read }
action :query
end
My Application Cookbook Templates Files
● site_config.erb
● database.erb
My Application Cookbook Attributes
# Repositorio
default["webapp"]["home"] = "/var/lib/webapp"
default["webapp"]["repo"] = "git@github.com:yrosaguiar/webappcode.git"
default["webapp"]["revision"] = "0.0.1"
# Database Config File Params
default["webapp"]["database"]["host"] = "localhost"
default["webapp"]["database"]["port"] = "3306"
default["webapp"]["database"]["login"] = "webapp"
default["webapp"]["database"]["password"] = "webapp123"
default["webapp"]["database"]["database"] = "webappdb"
default["webapp"]["databasedumpfile"] = "/Config/webappdump.sql"
default["webapp"]["dbupdatefile"] = "/Config/webappdbupdate.sql"
# Site Config File Params
default["webapp"]["url"] = "www.webapp.com.br"
Vagrantfile - Virtual Box Provider
Vagrant.configure("2") do |config|
config.vm.define "webapp" do |define|
define.vm.box_url = "http://files.vagrantup.com/precise64.box"
define.vm.box = "webapp"
define.ssh.forward_agent = true
define.vm.hostname = "webapp"
define.vm.network :private_network, ip: "172.16.0.100"
# Configuration provision
define.vm.provision :chef_solo do |chef|
chef.cookbooks_path = "./cookbooks"
# Recipes
chef.add_recipe "apt"
chef.add_recipe "git"
chef.add_recipe "apache2"
chef.add_recipe "php"
chef.add_recipe "mysql"
chef.add_recipe "webapp:deploy"
chef.json.merge!({
})
end
end
end
Vagrantfile - AWS Provider
Vagrant.configure("2") do |config|
config.vm.provider :aws do |aws, override|
override.vm.box_url ="http://files.vagrantup.com/precise64.box"
aws.access_key_id = "YOUR AWS ACCESS KEY"
aws.secret_access_key = "YOUR AWS SECRET KEY"
aws.keypair_name = "YOUR AWS KEYPAIR NAME"
aws.ami = "ami-23d9a94a"
aws.instance_type = "m1.large"
aws.region = "us-east-1"
aws.security_groups = ["open"]
aws.user_data = File.read('ec2-setup.sh')
override.ssh.username = "vagrant"
override.ssh.private_key_path = "AWS PRIVATE KEY"
define.vm.provision :chef_solo do |chef|
chef.cookbooks_path = "../cookbooks"
# Recipes
chef.add_recipe "apt"
chef.add_recipe "git"
chef.add_recipe "apache2"
chef.add_recipe "php"
chef.add_recipe "mysql"
#chef.add_recipe "webapp:deploy"
chef.json.merge!({
} )
end
end
end
Override Attributes
Atributos no Vagrantfile
chef.json.merge!({
}
:mysql => {
:server_root_password => "pass123"
:bind_address => "0.0.0.0"
},
}
})
Arquivo de atributos - Ex: default.rb
default['mysql']['data_dir'] = '/var/lib/mysql'
default['mysql']['server_root_password'] = '123'
default['mysql']['packages'] = %w{ mysql-server apparmor-utils }
default['mysql']['slow_query_log'] = 1
default['mysql']['slow_query_log_file'] = '/var/log/mysql/slow.log'
default['mysql']['bind_address']= '127.0.0.1'
# Platformisms.. filesystem locations and such.
default['mysql']['basedir'] = '/usr'
default['mysql']['tmpdir'] = ['/tmp']
Colher os frutos do trabalho
Criar o ambiente dev/homolog local
$ vagrant up
Atualizar/reconfigurar o seu ambiente
$ vagrant provision
Acessar o sua VM virtual box
$ vagrant ssh
Criar login no Vagrantcloud
Publicar na internet seu ambiente local
$ vagrant share
Criar o ambiente Prod/Homolog na AWS
$ vagrant up --provider=aws
Atualizar/reconfigurar o seu ambiente
$ vagrant provision
Acessar o sua instancia AWS
$ vagrant ssh
Publicar na internet seu ambiente local
$ vagrant ssh-config (pegar o IP)
Associar Elastic IP, Configurar DNS route53
Referências e Dicas
http://www.opscode.com
http://www.vagrantup.com
http://aws.amazon.com
https://www.eucalyptus.com/
http://rove.io/
https://github.com/yrosaguiar/vagrantworkspace.git
Thank you
Twitter: yrosaguiar
Email: yrosaguiar@gmail.com
Site: www.cloudadmin.com.br

More Related Content

What's hot

Best practices for ansible
Best practices for ansibleBest practices for ansible
Best practices for ansibleGeorge Shuklin
 
Network Automation: Ansible 102
Network Automation: Ansible 102Network Automation: Ansible 102
Network Automation: Ansible 102APNIC
 
More tips n tricks
More tips n tricksMore tips n tricks
More tips n tricksbcoca
 
Fabric workshop(1) - (MOSG)
Fabric workshop(1) - (MOSG)Fabric workshop(1) - (MOSG)
Fabric workshop(1) - (MOSG)Soshi Nemoto
 
Ansible presentation
Ansible presentationAnsible presentation
Ansible presentationJohn Lynch
 
Getting Started with Ansible
Getting Started with AnsibleGetting Started with Ansible
Getting Started with AnsibleAhmed AbouZaid
 
“warpdrive”, making Python web application deployment magically easy.
“warpdrive”, making Python web application deployment magically easy.“warpdrive”, making Python web application deployment magically easy.
“warpdrive”, making Python web application deployment magically easy.Graham Dumpleton
 
Ansible for beginners
Ansible for beginnersAnsible for beginners
Ansible for beginnersKuo-Le Mei
 
Getting started with Ansible
Getting started with AnsibleGetting started with Ansible
Getting started with AnsibleIvan Serdyuk
 
Ansible is the simplest way to automate. MoldCamp, 2015
Ansible is the simplest way to automate. MoldCamp, 2015Ansible is the simplest way to automate. MoldCamp, 2015
Ansible is the simplest way to automate. MoldCamp, 2015Alex S
 
Introduction to Ansible
Introduction to AnsibleIntroduction to Ansible
Introduction to AnsibleCoreStack
 
Ansible presentation
Ansible presentationAnsible presentation
Ansible presentationKumar Y
 
Ansible for beginners ...?
Ansible for beginners ...?Ansible for beginners ...?
Ansible for beginners ...?shirou wakayama
 
PyCon AU 2010 - Getting Started With Apache/mod_wsgi.
PyCon AU 2010 - Getting Started With Apache/mod_wsgi.PyCon AU 2010 - Getting Started With Apache/mod_wsgi.
PyCon AU 2010 - Getting Started With Apache/mod_wsgi.Graham Dumpleton
 
Ansible basics workshop
Ansible basics workshopAnsible basics workshop
Ansible basics workshopDavid Karban
 

What's hot (20)

Best practices for ansible
Best practices for ansibleBest practices for ansible
Best practices for ansible
 
Network Automation: Ansible 102
Network Automation: Ansible 102Network Automation: Ansible 102
Network Automation: Ansible 102
 
Ansible presentation
Ansible presentationAnsible presentation
Ansible presentation
 
Ansible intro
Ansible introAnsible intro
Ansible intro
 
More tips n tricks
More tips n tricksMore tips n tricks
More tips n tricks
 
Fabric workshop(1) - (MOSG)
Fabric workshop(1) - (MOSG)Fabric workshop(1) - (MOSG)
Fabric workshop(1) - (MOSG)
 
Puppet fundamentals
Puppet fundamentalsPuppet fundamentals
Puppet fundamentals
 
Ansible presentation
Ansible presentationAnsible presentation
Ansible presentation
 
Getting Started with Ansible
Getting Started with AnsibleGetting Started with Ansible
Getting Started with Ansible
 
Ansible - Crash course
Ansible - Crash courseAnsible - Crash course
Ansible - Crash course
 
“warpdrive”, making Python web application deployment magically easy.
“warpdrive”, making Python web application deployment magically easy.“warpdrive”, making Python web application deployment magically easy.
“warpdrive”, making Python web application deployment magically easy.
 
Ansible for beginners
Ansible for beginnersAnsible for beginners
Ansible for beginners
 
Getting started with Ansible
Getting started with AnsibleGetting started with Ansible
Getting started with Ansible
 
Ansible is the simplest way to automate. MoldCamp, 2015
Ansible is the simplest way to automate. MoldCamp, 2015Ansible is the simplest way to automate. MoldCamp, 2015
Ansible is the simplest way to automate. MoldCamp, 2015
 
Introduction to Ansible
Introduction to AnsibleIntroduction to Ansible
Introduction to Ansible
 
Ansible presentation
Ansible presentationAnsible presentation
Ansible presentation
 
Configuration Management in Ansible
Configuration Management in Ansible Configuration Management in Ansible
Configuration Management in Ansible
 
Ansible for beginners ...?
Ansible for beginners ...?Ansible for beginners ...?
Ansible for beginners ...?
 
PyCon AU 2010 - Getting Started With Apache/mod_wsgi.
PyCon AU 2010 - Getting Started With Apache/mod_wsgi.PyCon AU 2010 - Getting Started With Apache/mod_wsgi.
PyCon AU 2010 - Getting Started With Apache/mod_wsgi.
 
Ansible basics workshop
Ansible basics workshopAnsible basics workshop
Ansible basics workshop
 

Viewers also liked

Mini-curso de Linux - SECCOMP 2009
Mini-curso de Linux - SECCOMP 2009Mini-curso de Linux - SECCOMP 2009
Mini-curso de Linux - SECCOMP 2009CI&T
 
PHP - Programação para seres humanos
PHP - Programação para seres humanosPHP - Programação para seres humanos
PHP - Programação para seres humanosCaike Souza
 
IaaS: Implantação e gerenciamento de configurações de ambientes Cloud usando...
 IaaS: Implantação e gerenciamento de configurações de ambientes Cloud usando... IaaS: Implantação e gerenciamento de configurações de ambientes Cloud usando...
IaaS: Implantação e gerenciamento de configurações de ambientes Cloud usando...Diego Santos
 
Infraestrutura ágil com Puppet - CISL
Infraestrutura ágil com Puppet - CISLInfraestrutura ágil com Puppet - CISL
Infraestrutura ágil com Puppet - CISLJose Augusto Carvalho
 
Gestão automática de configuração usando puppet
Gestão automática de configuração usando puppetGestão automática de configuração usando puppet
Gestão automática de configuração usando puppetDaniel Sobral
 
Ferramentas para infraestrutura ágil
Ferramentas para infraestrutura ágilFerramentas para infraestrutura ágil
Ferramentas para infraestrutura ágilJose Augusto Carvalho
 
Aula 1 sistema operacional linux
Aula 1 sistema operacional linuxAula 1 sistema operacional linux
Aula 1 sistema operacional linuxRogério Cardoso
 
Php e mysql aplicacao completa a partir do zero
Php e mysql   aplicacao completa a partir do zeroPhp e mysql   aplicacao completa a partir do zero
Php e mysql aplicacao completa a partir do zeroFred Ramos
 

Viewers also liked (11)

Mini-curso de Linux - SECCOMP 2009
Mini-curso de Linux - SECCOMP 2009Mini-curso de Linux - SECCOMP 2009
Mini-curso de Linux - SECCOMP 2009
 
Git Básico
Git BásicoGit Básico
Git Básico
 
PHP - Programação para seres humanos
PHP - Programação para seres humanosPHP - Programação para seres humanos
PHP - Programação para seres humanos
 
IaaS: Implantação e gerenciamento de configurações de ambientes Cloud usando...
 IaaS: Implantação e gerenciamento de configurações de ambientes Cloud usando... IaaS: Implantação e gerenciamento de configurações de ambientes Cloud usando...
IaaS: Implantação e gerenciamento de configurações de ambientes Cloud usando...
 
Infraestrutura ágil com Puppet - CISL
Infraestrutura ágil com Puppet - CISLInfraestrutura ágil com Puppet - CISL
Infraestrutura ágil com Puppet - CISL
 
Gestão automática de configuração usando puppet
Gestão automática de configuração usando puppetGestão automática de configuração usando puppet
Gestão automática de configuração usando puppet
 
GIT Básico
GIT BásicoGIT Básico
GIT Básico
 
Ferramentas para infraestrutura ágil
Ferramentas para infraestrutura ágilFerramentas para infraestrutura ágil
Ferramentas para infraestrutura ágil
 
Firewall linux virtual para windows
Firewall linux virtual para windowsFirewall linux virtual para windows
Firewall linux virtual para windows
 
Aula 1 sistema operacional linux
Aula 1 sistema operacional linuxAula 1 sistema operacional linux
Aula 1 sistema operacional linux
 
Php e mysql aplicacao completa a partir do zero
Php e mysql   aplicacao completa a partir do zeroPhp e mysql   aplicacao completa a partir do zero
Php e mysql aplicacao completa a partir do zero
 

Similar to Dev ninja -> vagrant + virtualbox + chef-solo + git + ec2

Postgres the hardway
Postgres the hardwayPostgres the hardway
Postgres the hardwayDave Pitts
 
Vagrant WordCamp Hamilton
Vagrant  WordCamp HamiltonVagrant  WordCamp Hamilton
Vagrant WordCamp HamiltonPaul Bearne
 
Practical Chef and Capistrano for Your Rails App
Practical Chef and Capistrano for Your Rails AppPractical Chef and Capistrano for Your Rails App
Practical Chef and Capistrano for Your Rails AppSmartLogic
 
Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014biicode
 
Into The Box 2018 Going live with commandbox and docker
Into The Box 2018 Going live with commandbox and dockerInto The Box 2018 Going live with commandbox and docker
Into The Box 2018 Going live with commandbox and dockerOrtus Solutions, Corp
 
Going live with BommandBox and docker Into The Box 2018
Going live with BommandBox and docker Into The Box 2018Going live with BommandBox and docker Into The Box 2018
Going live with BommandBox and docker Into The Box 2018Ortus Solutions, Corp
 
How I hack on puppet modules
How I hack on puppet modulesHow I hack on puppet modules
How I hack on puppet modulesKris Buytaert
 
Practical introduction to dev ops with chef
Practical introduction to dev ops with chefPractical introduction to dev ops with chef
Practical introduction to dev ops with chefLeanDog
 
Bangpypers april-meetup-2012
Bangpypers april-meetup-2012Bangpypers april-meetup-2012
Bangpypers april-meetup-2012Deepak Garg
 
Automating Complex Setups with Puppet
Automating Complex Setups with PuppetAutomating Complex Setups with Puppet
Automating Complex Setups with PuppetKris Buytaert
 
Deployment with Fabric
Deployment with FabricDeployment with Fabric
Deployment with Fabricandymccurdy
 
Toolbox of a Ruby Team
Toolbox of a Ruby TeamToolbox of a Ruby Team
Toolbox of a Ruby TeamArto Artnik
 
Python Deployment with Fabric
Python Deployment with FabricPython Deployment with Fabric
Python Deployment with Fabricandymccurdy
 
NetDevOps Developer Environments with Vagrant @ SCALE16x
NetDevOps Developer Environments with Vagrant @ SCALE16xNetDevOps Developer Environments with Vagrant @ SCALE16x
NetDevOps Developer Environments with Vagrant @ SCALE16xHank Preston
 
Vagrant introduction for Developers
Vagrant introduction for DevelopersVagrant introduction for Developers
Vagrant introduction for DevelopersAntons Kranga
 
[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview
[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview
[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis OverviewLeo Lorieri
 
Create your very own Development Environment with Vagrant and Packer
Create your very own Development Environment with Vagrant and PackerCreate your very own Development Environment with Vagrant and Packer
Create your very own Development Environment with Vagrant and Packerfrastel
 
PDXPortland - Dockerize Django
PDXPortland - Dockerize DjangoPDXPortland - Dockerize Django
PDXPortland - Dockerize DjangoHannes Hapke
 
2012 coscup - Build your PHP application on Heroku
2012 coscup - Build your PHP application on Heroku2012 coscup - Build your PHP application on Heroku
2012 coscup - Build your PHP application on Herokuronnywang_tw
 

Similar to Dev ninja -> vagrant + virtualbox + chef-solo + git + ec2 (20)

Postgres the hardway
Postgres the hardwayPostgres the hardway
Postgres the hardway
 
Vagrant WordCamp Hamilton
Vagrant  WordCamp HamiltonVagrant  WordCamp Hamilton
Vagrant WordCamp Hamilton
 
Practical Chef and Capistrano for Your Rails App
Practical Chef and Capistrano for Your Rails AppPractical Chef and Capistrano for Your Rails App
Practical Chef and Capistrano for Your Rails App
 
Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014
 
Into The Box 2018 Going live with commandbox and docker
Into The Box 2018 Going live with commandbox and dockerInto The Box 2018 Going live with commandbox and docker
Into The Box 2018 Going live with commandbox and docker
 
Going live with BommandBox and docker Into The Box 2018
Going live with BommandBox and docker Into The Box 2018Going live with BommandBox and docker Into The Box 2018
Going live with BommandBox and docker Into The Box 2018
 
infra-as-code
infra-as-codeinfra-as-code
infra-as-code
 
How I hack on puppet modules
How I hack on puppet modulesHow I hack on puppet modules
How I hack on puppet modules
 
Practical introduction to dev ops with chef
Practical introduction to dev ops with chefPractical introduction to dev ops with chef
Practical introduction to dev ops with chef
 
Bangpypers april-meetup-2012
Bangpypers april-meetup-2012Bangpypers april-meetup-2012
Bangpypers april-meetup-2012
 
Automating Complex Setups with Puppet
Automating Complex Setups with PuppetAutomating Complex Setups with Puppet
Automating Complex Setups with Puppet
 
Deployment with Fabric
Deployment with FabricDeployment with Fabric
Deployment with Fabric
 
Toolbox of a Ruby Team
Toolbox of a Ruby TeamToolbox of a Ruby Team
Toolbox of a Ruby Team
 
Python Deployment with Fabric
Python Deployment with FabricPython Deployment with Fabric
Python Deployment with Fabric
 
NetDevOps Developer Environments with Vagrant @ SCALE16x
NetDevOps Developer Environments with Vagrant @ SCALE16xNetDevOps Developer Environments with Vagrant @ SCALE16x
NetDevOps Developer Environments with Vagrant @ SCALE16x
 
Vagrant introduction for Developers
Vagrant introduction for DevelopersVagrant introduction for Developers
Vagrant introduction for Developers
 
[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview
[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview
[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview
 
Create your very own Development Environment with Vagrant and Packer
Create your very own Development Environment with Vagrant and PackerCreate your very own Development Environment with Vagrant and Packer
Create your very own Development Environment with Vagrant and Packer
 
PDXPortland - Dockerize Django
PDXPortland - Dockerize DjangoPDXPortland - Dockerize Django
PDXPortland - Dockerize Django
 
2012 coscup - Build your PHP application on Heroku
2012 coscup - Build your PHP application on Heroku2012 coscup - Build your PHP application on Heroku
2012 coscup - Build your PHP application on Heroku
 

More from Yros

Do zero ao GitOps DevopsDaysSP
Do zero ao GitOps   DevopsDaysSPDo zero ao GitOps   DevopsDaysSP
Do zero ao GitOps DevopsDaysSPYros
 
CI/CD - Automatizando a entrega da sua aplicação
CI/CD - Automatizando a entrega da sua aplicaçãoCI/CD - Automatizando a entrega da sua aplicação
CI/CD - Automatizando a entrega da sua aplicaçãoYros
 
Docker and Infrastructure Evolution
Docker and Infrastructure EvolutionDocker and Infrastructure Evolution
Docker and Infrastructure EvolutionYros
 
Presentation yros | aws solution provider
Presentation yros | aws solution providerPresentation yros | aws solution provider
Presentation yros | aws solution providerYros
 
OnPremise to Cloud (o2c) - WhitePaper- yros
OnPremise to Cloud (o2c) - WhitePaper- yrosOnPremise to Cloud (o2c) - WhitePaper- yros
OnPremise to Cloud (o2c) - WhitePaper- yrosYros
 
On-premise to Cloud (o2c) - WhitePaper | yros
On-premise to Cloud (o2c) - WhitePaper | yros On-premise to Cloud (o2c) - WhitePaper | yros
On-premise to Cloud (o2c) - WhitePaper | yros Yros
 
OpenAM - Fast SSO
OpenAM - Fast SSOOpenAM - Fast SSO
OpenAM - Fast SSOYros
 
Amazon Aws - Tecnologias e Beneficios
Amazon Aws - Tecnologias e BeneficiosAmazon Aws - Tecnologias e Beneficios
Amazon Aws - Tecnologias e BeneficiosYros
 

More from Yros (8)

Do zero ao GitOps DevopsDaysSP
Do zero ao GitOps   DevopsDaysSPDo zero ao GitOps   DevopsDaysSP
Do zero ao GitOps DevopsDaysSP
 
CI/CD - Automatizando a entrega da sua aplicação
CI/CD - Automatizando a entrega da sua aplicaçãoCI/CD - Automatizando a entrega da sua aplicação
CI/CD - Automatizando a entrega da sua aplicação
 
Docker and Infrastructure Evolution
Docker and Infrastructure EvolutionDocker and Infrastructure Evolution
Docker and Infrastructure Evolution
 
Presentation yros | aws solution provider
Presentation yros | aws solution providerPresentation yros | aws solution provider
Presentation yros | aws solution provider
 
OnPremise to Cloud (o2c) - WhitePaper- yros
OnPremise to Cloud (o2c) - WhitePaper- yrosOnPremise to Cloud (o2c) - WhitePaper- yros
OnPremise to Cloud (o2c) - WhitePaper- yros
 
On-premise to Cloud (o2c) - WhitePaper | yros
On-premise to Cloud (o2c) - WhitePaper | yros On-premise to Cloud (o2c) - WhitePaper | yros
On-premise to Cloud (o2c) - WhitePaper | yros
 
OpenAM - Fast SSO
OpenAM - Fast SSOOpenAM - Fast SSO
OpenAM - Fast SSO
 
Amazon Aws - Tecnologias e Beneficios
Amazon Aws - Tecnologias e BeneficiosAmazon Aws - Tecnologias e Beneficios
Amazon Aws - Tecnologias e Beneficios
 

Recently uploaded

The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 

Recently uploaded (20)

The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 

Dev ninja -> vagrant + virtualbox + chef-solo + git + ec2

  • 1. Dev Ninja Vagrant + Virtualbox + Chef-Solo + Git + EC2
  • 2. Como isso pode ajudar no meu trabalho ?
  • 3. Vagrant (v 1.5) - Overview - Vagrant Boxes (packer) - Vagrantfile - Basic commands: ● Vagrant up ● Vagrant provision ● Vagrant destroy ● Vagrant ssh ● Vagrant http share
  • 5. EC2 (Provider) - Overview - Tecnologias (IAM, AMI, Elastic IP, Route53)
  • 7. 1 2 3 4 Layers Juntando tudo (Stack)
  • 8. Requisitos ● Linux Ubuntu 13.04 ● Install Virtual Box ● Install vagrant ● Install vagrant aws plugin ● Install Git
  • 9. Mão na massa Install Virtual Box $ sudo apt-get install software-properties-common python-software-properties -y $ sudo sudo add-apt-repository ppa:debfx/virtualbox $ sudo apt-get install virtualbox -y Install Vagrant $ wget https://dl.bintray.com/mitchellh/vagrant/vagrant_1.5.2_x86_64.deb $ sudo dpkg -i vagrant_1.5.2_x86_64.deb $ sudo vagrant plugin install vagrant-aws Install Git $ sudo apt-get install git
  • 10. My Workspace $ mkdir workspace $ cd wokspace $ mkdir cookbooks $ mkdir data_bags $ mkdir roles
  • 11. Recipes (Opscode) $ cd workspace/cookbooks Apache $ git clone http://github.com/opscode-cookbooks/apache2 apache2 Mysql $ git clone http://github.com/opscode-cookbooks/mysql mysql Database $ git clone http://github.com/opscode-cookbooks/database database PHP $ git clone http://github.com/opscode-cookbooks/php php
  • 12. My Application Cookbook CookBook Tree ├── attributes │ └── default.rb ├── metadata.rb ├── recipes │ ├── deploy.rb │ ├── database.rb │ └── templates ├── database..erb └── site_config.erb ● Recipes ● Attributes ● Metadata ● Templates
  • 13. My Application Cookbook Recipes # FILE: deploy.rb deploy_revision node['webapp']['home'] do repo node["webapp"]["repo"] revision node["webapp"]["revision"] # Disabling rails links and folders migrate false action :deploy # or :rollback before_restart do current_release = release_path end end ["database.php","site_config.php"].each do |php| template "#{current_release}/app/Config/#{php}" do source "#{php}.erb" mode 00644 end restart_command do service "apache2" do action :restart end end # FILE: database.rb # externalize conection info in a ruby hash mysql_connection_info = { :host => "localhost", :username => 'root', :password => node['mysql']['server_root_password'] } # create a mysql database named DB_NAME mysql_database '#{node['webapp']['database']['database']}' do connection mysql_connection_info action [:create] end #or import from a dump file mysql_database "node['webapp']['database']['database']" do connection mysql_connection_info sql "source #{node['webapp']['current_release']}#{node['webapp']['databasedumpfile']};" end # query a database from a sql script on disk mysql_database "#{node['webapp']['database']['database']}" do connection mysql_connection_info sql { ::File.open("#{node['webapp']['current_release']}#{node['webapp']['dbupdatefile']}").read } action :query end
  • 14. My Application Cookbook Templates Files ● site_config.erb ● database.erb
  • 15. My Application Cookbook Attributes # Repositorio default["webapp"]["home"] = "/var/lib/webapp" default["webapp"]["repo"] = "git@github.com:yrosaguiar/webappcode.git" default["webapp"]["revision"] = "0.0.1" # Database Config File Params default["webapp"]["database"]["host"] = "localhost" default["webapp"]["database"]["port"] = "3306" default["webapp"]["database"]["login"] = "webapp" default["webapp"]["database"]["password"] = "webapp123" default["webapp"]["database"]["database"] = "webappdb" default["webapp"]["databasedumpfile"] = "/Config/webappdump.sql" default["webapp"]["dbupdatefile"] = "/Config/webappdbupdate.sql" # Site Config File Params default["webapp"]["url"] = "www.webapp.com.br"
  • 16. Vagrantfile - Virtual Box Provider Vagrant.configure("2") do |config| config.vm.define "webapp" do |define| define.vm.box_url = "http://files.vagrantup.com/precise64.box" define.vm.box = "webapp" define.ssh.forward_agent = true define.vm.hostname = "webapp" define.vm.network :private_network, ip: "172.16.0.100" # Configuration provision define.vm.provision :chef_solo do |chef| chef.cookbooks_path = "./cookbooks" # Recipes chef.add_recipe "apt" chef.add_recipe "git" chef.add_recipe "apache2" chef.add_recipe "php" chef.add_recipe "mysql" chef.add_recipe "webapp:deploy" chef.json.merge!({ }) end end end
  • 17. Vagrantfile - AWS Provider Vagrant.configure("2") do |config| config.vm.provider :aws do |aws, override| override.vm.box_url ="http://files.vagrantup.com/precise64.box" aws.access_key_id = "YOUR AWS ACCESS KEY" aws.secret_access_key = "YOUR AWS SECRET KEY" aws.keypair_name = "YOUR AWS KEYPAIR NAME" aws.ami = "ami-23d9a94a" aws.instance_type = "m1.large" aws.region = "us-east-1" aws.security_groups = ["open"] aws.user_data = File.read('ec2-setup.sh') override.ssh.username = "vagrant" override.ssh.private_key_path = "AWS PRIVATE KEY" define.vm.provision :chef_solo do |chef| chef.cookbooks_path = "../cookbooks" # Recipes chef.add_recipe "apt" chef.add_recipe "git" chef.add_recipe "apache2" chef.add_recipe "php" chef.add_recipe "mysql" #chef.add_recipe "webapp:deploy" chef.json.merge!({ } ) end end end
  • 18. Override Attributes Atributos no Vagrantfile chef.json.merge!({ } :mysql => { :server_root_password => "pass123" :bind_address => "0.0.0.0" }, } }) Arquivo de atributos - Ex: default.rb default['mysql']['data_dir'] = '/var/lib/mysql' default['mysql']['server_root_password'] = '123' default['mysql']['packages'] = %w{ mysql-server apparmor-utils } default['mysql']['slow_query_log'] = 1 default['mysql']['slow_query_log_file'] = '/var/log/mysql/slow.log' default['mysql']['bind_address']= '127.0.0.1' # Platformisms.. filesystem locations and such. default['mysql']['basedir'] = '/usr' default['mysql']['tmpdir'] = ['/tmp']
  • 19. Colher os frutos do trabalho Criar o ambiente dev/homolog local $ vagrant up Atualizar/reconfigurar o seu ambiente $ vagrant provision Acessar o sua VM virtual box $ vagrant ssh Criar login no Vagrantcloud Publicar na internet seu ambiente local $ vagrant share Criar o ambiente Prod/Homolog na AWS $ vagrant up --provider=aws Atualizar/reconfigurar o seu ambiente $ vagrant provision Acessar o sua instancia AWS $ vagrant ssh Publicar na internet seu ambiente local $ vagrant ssh-config (pegar o IP) Associar Elastic IP, Configurar DNS route53
  • 21. Thank you Twitter: yrosaguiar Email: yrosaguiar@gmail.com Site: www.cloudadmin.com.br