Coder Social home page Coder Social logo

mean-vagrant's Introduction

Creating a Vagrant Virtual Development Environment for MEAN Development

Vagrant

Vagrant is open-source software used to create lightweight and portable virtual development environments. Vagrant works like a "wrapper" for VirtualBox that can create, configure, and destroy virtual machines with the use of its own terminal commands. Vagrant facilitates the setup of environments without any direct interaction with VirtualBox and allows developers to use preferred editors and browsers in their native operating system.

M.E.A.N

MEAN is a boilerplate that provides a nice starting point for MongoDB, Node.js, Express, and AngularJS based applications. It is designed to give you quick and organized way to start developing of MEAN based web apps with useful modules like mongoose and passport pre-bundled and configured. We mainly try to take care of the connection points between existing popular frameworks and solve common integration problems.

❗Note: This document is for setting up a virtual environment on a Unix host.

Install Vagrant

  • Download and install VirtualBox 4.3.12
    • Do not open VirtualBox or create a virtual machine. This will be handled by Vagrant.
  • Download and install Vagrant 1.6.5
    • Package managers like apt-get and gem install will install an older version of Vagrant so it is required to use the download page.

Configure Environment

Vagrantfile is a main Vagrant configuration. Typically it is supposed to be placed at the root of your project. Just put it whenever you want your box root should be. Additional documentation can be found here.

Cheffile describes sources of cookbooks we use to provision packages you demanded. It's used by Librarian to download all the cookbooks you need including referenced dependencies. Unless you already have it install it using sudo gem install librarian-chef command. To finalize the setup and run your box you should:

  • put both of files to the root of your project (it will be the root of a virtual box)
  • run librarian-chef install to grab required cookbooks

Connect to the Virtual Machine

Install VirtualBox Guest Additions Plugin

$ vagrant plugin install vagrant-vbguest

Run vagrant up to download, provision and start your brand new box environment.

$ vagrant up

Connect to the virtual machine via ssh:

$ vagrant ssh

To Stop the Virtual Machine

$ vagrant halt

To Suspend it

$ vagrant suspend

Back to init again

$ vagrant up

To reload if it is running:

$ vagrant reload

To remove completly:

$ vagrant destroy

Run Hello World

src folder contains the source code for your project. This example contains a 'hello.js' file that only puts 'hello world!' on your console.

Installed Software

  • Ubuntu v14.04 LTS

  • Git v1.9.1

  • Node.js v0.10.31

  • Vim v7.4.52

  • MongoDB v2.4.9

    • DB Path: /var/lib/mongodb
    • Log Path: /var/log/mongodb
    • Port: 27017
  • Redis v2.8.4

    • Config Path: /etc/redis/redis.conf
    • Bind: 127.0.0.1
    • Port: 6379
  • Nginx v1.4.6

    • Path: /etc/nginx
    • Log Path: /var/log/nginx
  • Forwarded Ports:

    • 3000 Node.js App
    • 80 Nginx Port
    • 35729 Livereload port

mean-vagrant's People

Contributors

brunobatista avatar carlosazaustre avatar liamondrop avatar semmypurewal avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

mean-vagrant's Issues

Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)

$ git clone https://github.com/carlosazaustre/mean-vagrant.git .
$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'ubuntu/trusty64'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'ubuntu/trusty64' is up to date...
==> default: A newer version of the box 'ubuntu/trusty64' is available! You currently
==> default: have version '20151008.0.2'. The latest is version '20151217.0.0'. Run
==> default: `vagrant box update` to update.
==> default: Setting the name of the VM: link_default_1450519746109_87623
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
==> default: You are trying to forward to privileged ports (ports <= 1024). Most
==> default: operating systems restrict this to only privileged process (typically
==> default: processes running as an administrative user). This is a warning in case
==> default: the port forwarding doesn't work. If any problems occur, please try a
==> default: port higher than 1024.
==> default: Forwarding ports...
    default: 3000 => 3000 (adapter 1)
    default: 35729 => 35729 (adapter 1)
    default: 80 => 80 (adapter 1)
    default: 22 => 2222 (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key
    default: Warning: Connection timeout. Retrying...
    default:
    default: Vagrant insecure key detected. Vagrant will automatically replace
    default: this with a newly generated keypair for better security.
    default:
    default: Inserting generated public key within guest...
    default: Removing insecure key from the guest if it's present...
    default: Key inserted! Disconnecting and reconnecting using new SSH key...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
    default: The guest additions on this VM do not match the installed version of
    default: VirtualBox! In most cases this is fine, but in rare cases it can
    default: prevent things such as shared folders from working properly. If you see
    default: shared folder errors, please make sure the guest additions within the
    default: virtual machine match the version of VirtualBox you have installed on
    default: your host and reload your VM.
    default:
    default: Guest Additions Version: 4.3.10
    default: VirtualBox Version: 5.0
==> default: Mounting shared folders...
    default: /vagrant => /Users/mv/tmp/link
    default: /home/vagrant/development => /Users/mv/tmp/link/development
    default: /tmp/vagrant-chef/1f36b3d47a3caa62bd655580ca7a7942/cookbooks => /Users/mv/tmp/link/cookbooks
==> default: Running provisioner: chef_solo...
    default: Installing Chef (latest)...
Generating chef JSON and uploading...
==> default: Running chef-solo...
==> default: stdin: is not a tty
==> default: [2015-12-19T10:10:06+00:00] INFO: Forking chef instance to converge...
==> default: Starting Chef Client, version 12.5.1
==> default: [2015-12-19T10:10:06+00:00] INFO: *** Chef 12.5.1 ***
==> default: [2015-12-19T10:10:06+00:00] INFO: Chef-client pid: 2574
==> default: [2015-12-19T10:10:07+00:00] INFO: Setting the run_list to ["recipe[apt]", "recipe[redis]", "recipe[git]", "recipe[nginx]", "recipe[vim]", "recipe[nodejs]", "recipe[mongodb::default]"] from CLI options
==> default: [2015-12-19T10:10:07+00:00] INFO: Run List is [recipe[apt], recipe[redis], recipe[git], recipe[nginx], recipe[vim], recipe[nodejs], recipe[mongodb::default]]
==> default: [2015-12-19T10:10:07+00:00] INFO: Run List expands to [apt, redis, git, nginx, vim, nodejs, mongodb::default]
==> default: [2015-12-19T10:10:07+00:00] INFO: Starting Chef Run for vagrant-ubuntu-trusty-64
==> default: [2015-12-19T10:10:07+00:00] INFO: Running start handlers
==> default: [2015-12-19T10:10:07+00:00] INFO: Start handlers complete.
==> default: [2015-12-19T10:10:07+00:00] WARN: found a directory redis in the cookbook path, but it contains no cookbook files. skipping.
==> default: Compiling Cookbooks...
==> default:
==> default: Running handlers:
==> default: [2015-12-19T10:10:07+00:00] ERROR: Running exception handlers
==> default: Running handlers complete
==> default:
==> default: [2015-12-19T10:10:07+00:00] ERROR: Exception handlers complete
==> default: Chef Client failed. 0 resources updated in 01 seconds
==> default: [2015-12-19T10:10:07+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
==> default: [2015-12-19T10:10:07+00:00] ERROR: Cookbook redis not found. If you're loading redis from another cookbook, make sure you configure the dependency in your metadata
==> default: [2015-12-19T10:10:07+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
Chef never successfully completed! Any errors should be visible in the
output above. Please fix your recipes so that they properly complete.

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.