Skip to content

Instantly share code, notes, and snippets.

@holms

holms/app.rb

Forked from jgarber/app.rb
Created Nov 7, 2013
Embed
What would you like to do?
run_list(
'recipe[chef-solo-search]',
'recipe[rails_application]'
)
default_attributes(
rails: {
app: {name: "sample_app"},
deploy: {
repository: "https://github.com/jgarber/sample_app_2nd_ed.git"
}
}
)
# Download from http://downloads.vagrantup.com/
vagrant -v
vagrant plugin install vagrant-vbguest
vagrant plugin install vagrant-vbox-snapshot
mkdir madison-jenkins
cd madison-jenkins
vagrant init precise64-vanilla
tree
vi Vagrantfile
# config.vm.hostname = "madison-jenkins-vagrant"
# Uncomment forwarded_port; ***change 80 to 8080
vagrant up
vagrant ssh
exit
vagrant ssh-config --host vagrant >> ~/.ssh/config
ssh vagrant
exit
bundle init
vi Gemfile
# gem 'berkshelf'
# gem 'knife-solo'
bundle
knife solo init --berkshelf .
vi Berksfile
# cookbook 'apt'
# cookbook 'jenkins', github: 'opscode-cookbooks/jenkins'
berks install
knife solo prepare vagrant
vagrant snapshot take prepared
vi nodes/vagrant.json
# add "recipe[apt]", "recipe[jenkins::server]" to runlist
knife solo cook vagrant
# open http://localhost:8080
# Now, deploying sample_app_2nd_ed
cd ..
mkdir madison-sample-app
cd madison-sample-app/
vagrant init precise64-vanilla
vi Vagrantfile
# config.vm.hostname = "madison-sample-app"
# Uncomment forwarded_port; port 8081
vagrant up
bundle init
vi Gemfile
# gem 'berkshelf'
# gem 'knife-solo'
bundle
knife solo init --berkshelf .
vi Berksfile
# cookbook 'chef-solo-search'
# cookbook 'rails_application', github: 'jgarber/chef-rails_application'
berks
# Put app.rb from the gist in roles/
knife solo prepare vagrant --run-list "role[app]"
vagrant snapshot take prepared
knife solo cook vagrant
# open http://localhost:8081
# Set knife[:digital_ocean_client_id] and knife[:digital_ocean_api_key]
# in .chef/knife.rb
vi Gemfile
# gem 'knife-digital_ocean'
bundle
knife digital_ocean region list
knife digital_ocean size list
knife digital_ocean sshkey list
knife digital_ocean image list --global | grep "Ubuntu 12.04"
knife digital_ocean droplet create --server-name madison-sample-app --image 284203 --location 4 --size 66 --ssh-keys 10904 --solo --run-list "role[app]"
# Visit the IP address of the droplet. It's live!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment