Vagrant docs
Instaling Vagrant and set up an work environment through using Vagrant and VirtualBox. You need to install Vagrant (https://www.vagrantup.com/) and Virtualbox. For correct work of an environment you need version 1.7.4 of Vagrant. If allready Vagrant installed with older version then upgrade to 1.7.4
- Installing Vagrant and VirtualBox on Mac OSx.
1.1. Installing Cask (if allready installed follow step 2.1) to use this command: $ brew install caskroom/cask/brew-cask Also you can follow instructions (http://sourabhbajaj.com/mac-setup/Homebrew/Cask.html)
You check whether the earlier cask using the command below: $ brew info cask
1.2 For installing Vagrant as one of the variants use package manager such as brew or brew cask. Use the command below for installing vagrant: $ brew cask install vagrant
1.3 For installing VirtualBox using the commnad below: $ brew cask install virtualbox
Also you can follow instructions (http://sourabhbajaj.com/mac-setup/Vagrant/README.html)
- Deploying local environment. Vagrant box which using on helium project protected private settings -- you can download a vagrant box if you are an authorized user. Need to create an account on https://atlas.hashicorp.com/account/new.
2.2. To generate a token on https://atlas.hashicorp.com/settings/tokens. To exec the command below using the generated token instead your_token. $ vagrant login -t your_token
2.1. To download an vagrant box usign command below: $ vagrant box add quokka/helium
2.2 Clone the helium git repository in a separate folder if you need to work on the current project in other branches and if the feature-vagrant branch is not merged with the develop and master branch. Otherwise you can pull changes from a develop branch and go to step 2.3
2.2.1 You need to change path to the project folder for synchronization with a vagrant machine. For example. Path to your project folder is: $ /Users/User/helium
В функцию config.vm.synced_folder по умолчанию перевым параметром передается путь к проекту. По умолчанию: config.vm.synced_folder ".", "/home/vagrant/app", create: true
Change the path to our path /Users/User/helium. config.vm.synced_folder "/Users/User/helium", "/home/vagrant/app", create: true
2.3. For deploying an environment to use the comand in the root project folder: $ vagrant up
Its all :)
The application running in debugging mode (debug port 5467) and listen on the port 9003. If you need restart an app then exec command from the root project: $ vagrant ssh -c 'supervisorctl restart helium'
Installed tools on the vagrant machine: node, npm, n, bower, grunt node-inspector (https://github.com/node-inspector/node-inspector) pygments (http://pygments.org/) httpie (https://github.com/jkbrzt/httpie)
NOTES Perhaps at the moment you enter the command vagrant up some ports on the host machine are already binded, in this case, the guest machine will not run - and the emergency exit. Before restarting the machine, you must fulfill one condition:
- Shift ports are not binded other server;
- Stop the servers that hold the required ports;
Or pass the third parameter setting auto correct: true, for example: config.vm.network "forwarded_port", guest: 80, host: 9003, auto_correct: true
In this case, when you start you need to be traced back to any ports on the host machine were attached ports from the guest machine.
Usefull comands: show the current status of the application $ vagrant ssh -c 'supervisorctl status'
restart the application $ vagrant ssh -c 'supervisorctl restart helium'
start the application $ vagrant ssh -c 'supervisorctl start helium'
stop the application $ vagrant ssh -c 'supervisorctl stop helium'
show logs of the application from the stdout and stderr $ vagrant ssh -c 'cd /var/log/supervisor && sudo tail -f helium-std*'