This is the developer box to use for web application development/demo/experiments through Vagrant.
- Install Vagrant v1.9+ on your machine. Setup Instructions
git clonethis repo to your work directory.vagrant upto initialize and provision the box. (supporting 2 providers)vagrant up --provider=virtualbox vagrant up --provider=docker //or VAGRANT_DEFAULT_PROVIDER=virtualbox (or docker) vagrant upvagrant sshinto the box and run
Now, open your favourite text editor and start coding! The directory containing the Vagrantfile is shared into the vm at path /vagrant. Your ~/Projects folder (if there is one and hopefully holding all the git repos) will be mapped into the vm at ~/Projects. Also you can modify the content inside the www folder and the settings folder to change our default nginx setup in the vm (e.g add servers and static web files for different projects).
Tip: Don't worry about vagrant destroy. Reconstructing the virtual machine will not override your changes made in www, settings and ~/Projects.
Note: You can use multiple boxes but for development purposes only one or two would be enough.You can put all your web applications under a ~/Projects folder on the host machine and by default (see Vagrantfile config.vm.synced_folder setting) will be mapped to ~/Projects (you will see this folder after vagrant ssh into the vm) to share the web server, database, cache server and message queues made available within the vm. If you want to test deployment or want to use a DevOps environment for development please consider using Docker containers
with Fig(Compose).
- Git
- Nodejs (with Bower, Gulp, Less, Http-Server, Forever)
- Python 2/3 (with pip/pip3 and virtualenv)
- Go
- Supervisor
- Nginx
- PostgreSQL
- MongoDB
- Redis
- RabbitMQ
- Celery
- GraphicsMagick
Tip: The services are listening to their default ports and without secured setups since only your applications can access them.
See settings for default settings of Nginx, PostgreSQL, MongoDB, Redis and RabbitMQ.
Put some static content under the www folder, and access 192.168.3.100 from your host machine.The www folder has a symlink at /usr/share/nginx/html. You might consider building into the www folder's subfolders with your project build tools and organize them using a site intro index.html.
Tip: Proxy your Ajax api calls to your applications using the Nginx web server's proxy_pass and uwsgi_pass directives. Add them in settings/nginx-confg.
To connect to databases, k-v stores and message queues see settings
vagrant sshinto the box and run/stop your applications and services.- Scaffold and code/test outside the box (on host
~/Projects/<your project>); Build and run inside the box (on vm aftervagrant ssh). - Change the
Vagrantfileconfigure to include more vm-to-localhost port forwardings for demoing purposes. - Put/Change service configure files inside
settingsand reload services inside the vm throughsudo systemctl restart/reload <service>.
You can run vagrant reload after changing the networking and folder sharing settings in Vagrantfile to apply the changes to the box.
Note: Although it wouldn't hurt to run the vagrant provision command to execute the provision script again, it is usually not needed.