Git Product home page Git Product logo

devbox's Introduction

devbox

devbox is a Vagrant development machine provisioned and preconfigured for working with Node.js (PHP and the Laravel framework) out of the box.

Features / Stack

Debian 8 64bit, Nginx, PHP5.5, php-fpm, xdebug, composer, MySQL 5.5, Redis, Beanstalkd, supervisord, Sphinx, ngrok, Node.js, MongoDB, Apache2, npm

Requirements

  • VirtualBox - Free virtualization software
  • Vagrant - Tool for working with VirtualBox images

Initial Setup

  • Install VirtualBox and Vagrant ( >= 1.5.0)
  • Clone this repository git clone https://github.com/jbinder/devbox.git.
  • Run vagrant up inside the newly created directory
  • Now just clone/copy your projects into www/html and open http://127.0.0.1:10080/[project] in your browser. To run Node.js applications you can use `vagrant ssh -c "bash -c 'cd /var/www/html/[project]; npm start'". By default following ports are mapped: 80 => 10080, 8000 => 18000, 8080 => 18080.

Shared Folders

The www folder is automatically synced to the VM (/var/www). This is why we clone our Laravel project into this folder. The sync works in both directions. So any files generated by Laravel (/storage folder for example) will be accessible from your host machine.

Credentials

  • SSH User: vagrant PW: vagrant
  • MySQL User: root PW: root (access MySQL through SSH)

Vagrant Commands

  • vagrant up starts the virtual machine and provisions it
  • vagrant ssh gives you shell access to the virtual machine
  • vagrant suspend will essentially put the machine to 'sleep' with vagrant resume waking it back up
  • vagrant reload will reload the VM. Do this when the VM config changed. For exmpale when you changed one of the configs (e.g. php.ini, sphinx.conf, etc. or after a git pull of this repo)
  • vagrant halt attempts a graceful shutdown of the machine and will need to be brought back with vagrant up
  • vagrant halt --force force shutdown if normal halt doesn't work
  • vagrant destroy you broke something? this will destroy the VM and reprovisions it again completely. Takes some time.

For more: Vagrant is very well documented

Please fork, improve, extend, make pull request, wrap it as a gift. Use the GitHub Issues!

Ngrok

Ngrok creates a tunnel from the public internet (http://subdomain.ngrok.com) to a website on your local machine. You can give this URL to anyone to allow them to try out a website you're developing without doing any deployment. For all the features and documentation, check their site: http://ngrok.com and usage guide: http://ngrok.com/usage.

Setup:

  • In /etc/nginx/sites-available/ngrok.dev change root path (ie. replace yoursite.dev with your site directory)
  • Make ngrok configuration active by symlinking it: sudo ln -s /etc/nginx/sites-available/ngrok.dev /etc/nginx/sites-enabled/ngrok.dev
  • Restart nginx by doing sudo /etc/init.d/nginx restart
  • Start ngrok service with: ngrok :80

Node.js

  • Execute npm install commands with the --no-bin-links option if using a Windows host (see Troubleshoot for infos).
  • Run commands from the host using vagrant ssh -c "bash -c '[command]'".

Troubleshoot

  • NFS folders do not work on Windows hosts. Vagrant will ignore your request for NFS synced folders on Windows.
  • npm cannot find module or install fails: use --no-bin-links, as symbolic links do not seem to work very well on shared folders on Windows hosts

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.