Skip to content

Instantly share code, notes, and snippets.

@heat
Forked from DamonOehlman/README.md
Last active December 20, 2015 17:19
Show Gist options
  • Save heat/fcdc554078924711be26 to your computer and use it in GitHub Desktop.
Save heat/fcdc554078924711be26 to your computer and use it in GitHub Desktop.
Provisioning of node + nginx designed for use with vagrant shell provisioner. No need for chef, puppet.

Script para provisionar um ambiente de desenvolvimento ember em uma vm.

#!/bin/bash
# node settings
NODE_VERSION=5.3.0
WATCHMAN_VERSION=4.1.0
NODE_SOURCE=http://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION.tar.gz
# ensure we have all the required packages to install
echo "==> Checking Dependencies"
apt-get update
apt-get install -y --no-install-recommends \
git \
autoconf \
automake \
bzip2 \
file \
g++ \
gcc \
imagemagick \
libbz2-dev \
libc6-dev \
libcurl4-openssl-dev \
libevent-dev \
libffi-dev \
libgeoip-dev \
libglib2.0-dev \
libjpeg-dev \
liblzma-dev \
libmagickcore-dev \
libmagickwand-dev \
libmysqlclient-dev \
libncurses-dev \
libpng-dev \
libpq-dev \
libreadline-dev \
libsqlite3-dev \
libssl-dev \
libtool \
libwebp-dev \
libxml2-dev \
libxslt-dev \
libyaml-dev \
make \
patch \
python-dev \
xz-utils \
zlib1g-dev
rm -rf /var/lib/apt/lists/*
# if we don't have the latest node version, then install
echo "==> Checking Node version $NODE_VERSION installed";
if [ ! -e /usr/local/bin/node ]
then
echo "==> Installing Node.js version $NODE_VERSION"
echo "Downloading node dist $NODE_SOURCE"
cd /usr/src
wget --quiet "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-x64.tar.gz"
tar -xzf "node-v$NODE_VERSION-linux-x64.tar.gz" -C /usr/local --strip-components=1
fi
if [ ! -e /usr/local/bin/watchman ]
then
# Install watchman
cd /usr/src
git clone https://github.com/facebook/watchman.git
cd watchman
git checkout v$WATCHMAN_VERSION # the latest stable release
./autogen.sh
./configure
make
make install
fi
# Install ember-cli
npm install -g ember-cli
npm install -g phantomjs
npm install -g bower
# Template vagrant configuration file for rtc.io server
Vagrant.configure("2") do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.
# Every Vagrant virtual environment requires a box to build off of.
config.vm.box = "ubuntu/trusty64"
# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine. In the example below,
# accessing "localhost:8080" will access port 80 on the guest machine.
# config.vm.network :forwarded_port, guest: 80, host: 8080
config.vm.network "forwarded_port", guest: 4200, host: 4200
config.vm.network "forwarded_port", guest: 35729, host: 35729
config.vm.synced_folder "app/", "/src", type: "nfs"
# provision using the shell provisioner
config.vm.provision :shell do |shell|
shell.inline = "apt-get install -y curl && curl -s https://gist.githubusercontent.com/heat/fcdc554078924711be26/raw/provision-nginx-node.sh | sh"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment