Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 52 lines (42 sloc) 1.25 KB
#! /bin/bash
# Exit with failure immediately if any command fails
set -e
# Install Ruby + Mongo + Npm + Node + Git
sudo DEBIAN_FRONTEND=noninteractive \
apt-get -y install mongodb npm ruby-dev git-core nginx
# Use "node" command with nodejs (required to disambiguate node packages)
sudo update-alternatives --install /usr/bin/node node /usr/bin/nodejs 10
# Install gem bindings
sudo gem install mongo
# Install required global npm packages
sudo npm install -g gulp
# Install basic nginx site file
cat << EOF | sudo tee /etc/nginx/sites-available/default
server {
server_name localhost;
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /vagrant/dist;
index index.html;
# @see Virtualbox under
# https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/
sendfile off;
location / {
try_files \$uri \$uri/ =404;
}
}
EOF
sudo /etc/init.d/nginx reload
# Install an hourly cron job to run gulp
cat << EOF | sudo tee /etc/cron.hourly/ferment
#!/bin/sh
test -x /usr/local/bin/gulp || exit 0
cd /vagrant
su vagrant -c "/usr/local/bin/gulp"
EOF
sudo chmod +x /etc/cron.hourly/ferment
# As unprivileged user, install local npm dependencies
cd /vagrant
npm install
# As unprivileged user, run default gulp task
gulp