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

A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusZilliz
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbuapidays
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Zilliz
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 

Recently uploaded (20)

A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 

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