Last active
September 16, 2017 05:37
-
-
Save hopbit/ffdaa2ab514c4721e8772d98e0b7fcc0 to your computer and use it in GitHub Desktop.
Vagrant Initial Box 4 Angular 4 Workshops organised by Stacja.IT
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Below provision script is based on this blog post: | |
# http://tutorials.jumpstartlab.com/topics/vagrant_setup.html | |
# Stuff do an the provisioning start | |
sudo apt-get update --quiet | |
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash - | |
sudo apt-get install -y nodejs | |
sudo apt-get install -y build-essential | |
sudo npm install -g @angular/cli | |
echo 'Check Angular CLI Version -------------------------------------------------------' | |
ng --version | |
echo '---------------------------------------------------------------------------------' | |
echo 'provision.sh end <---------------------------------------------------------------' | |
# STEPS TO VERIFY INSTALLATION | |
# user@host-os$ vagrant up | |
# user@host-os$ vagrant ssh | |
# user@guest-os$ cd /vagrant/ | |
# user@guest-os$ ng new my-dream-app | |
# user@guest-os$ cd my-dream-app | |
# user@guest-os$ ng serve | |
# Che |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
# See: https://stefanwrobel.com/how-to-make-vagrant-performance-not-suck | |
Vagrant.configure(2) do |config| | |
config.vm.box = 'ubuntu/trusty64' | |
config.vm.provider :virtualbox do |vb| | |
host = RbConfig::CONFIG['host_os'] | |
# Give VM 1/4 system memory | |
if host =~ /darwin/ | |
# sysctl returns Bytes and we need to convert to MB | |
mem = `sysctl -n hw.memsize`.to_i / 2048 | |
elsif host =~ /linux/ | |
# meminfo shows KB and we need to convert to MB | |
mem = `grep 'MemTotal' /proc/meminfo | sed -e 's/MemTotal://' -e 's/ kB//'`.to_i | |
elsif host =~ /mswin|mingw|cygwin/ | |
# Windows code via https://github.com/rdsubhas/vagrant-faster | |
mem = `wmic computersystem Get TotalPhysicalMemory`.split[1].to_i / 2048 | |
end | |
mem = mem / 2048 / 4 | |
vb.customize ['modifyvm', :id, '--memory', mem ] | |
end | |
config.vm.network :forwarded_port, guest: 4200, host: 4200 | |
config.vm.provision 'shell', path: './provision.sh' | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment