Created
June 19, 2016 17:11
-
-
Save azirbel/9ca1f2933e083503dd9906cca4433f34 to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
set -euo pipefail | |
# This script controls stack-specific setup, like tools to download and | |
# install. It runs once when you run vagrant-spk vm up. When you modify this | |
# file, you must manually re-execute it. See below for details. | |
# | |
# This is the ideal place to apt-get install system packages your app relies | |
# on, or run other installers via curl|bash etc. Use this file to install: | |
# | |
# * Language runtimes (PHP, Node, Python, etc.) | |
# * Database engines (MySQL, PostgreSQL, Redis, etc.) | |
# * Frontend web servers (nginx, Apache) | |
# * When you modify this script, you must manually re-provision the Vagrant | |
# box: | |
# | |
# cd .sandstorm | |
# vagrant provision | |
# cd .. | |
# | |
# This is because vagrant-spk currently has no way to auto-detect that the | |
# setup.sh script needs to be re-executed. | |
export DEBIAN_FRONTEND=noninteractive | |
echo "[setup] Starting..." | |
echo "[setup] apt-get update..." | |
apt-get update | |
echo "[setup] install npm..." | |
curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash - | |
echo "[setup] apt-get dist-upgrade..." | |
apt-get dist-upgrade -y | |
echo "[setup] apt-get install..." | |
apt-get install -y git curl nginx nodejs libsqlite3-dev | |
echo "[setup] install ember-cli and bower..." | |
npm install -g ember-cli | |
npm install -g bower | |
echo "[setup] check for /usr/local/rbenv..." | |
if [ ! -e /usr/local/rbenv ]; then | |
echo "[setup] not found. git clone rbenv..." | |
git clone https://github.com/sstephenson/rbenv.git /usr/local/rbenv | |
fi | |
echo "[setup] check for ruby-build plugin..." | |
if [ ! -e /usr/local/rbenv/plugins/ruby-build ]; then | |
echo "[setup] not found. git clone ruby-build..." | |
git clone https://github.com/sstephenson/ruby-build.git /usr/local/rbenv/plugins/ruby-build | |
fi | |
echo "[setup] set environment variables..." | |
export RBENV_ROOT=/usr/local/rbenv | |
export PATH="$RBENV_ROOT/bin:$PATH" | |
export RBENV_VERSION=2.2.3 | |
echo "[setup] rbenv init..." | |
eval "$(rbenv init -)" | |
if [ ! -e /usr/local/rbenv/versions/$RBENV_VERSION ]; then | |
echo "[setup] rbenv install..." | |
rbenv install $RBENV_VERSION | |
fi | |
echo "[setup] gem install bundler..." | |
gem install bundler | |
mkdir /usr/local/lib/bundle | |
# TODO(azirbel): Do I need this? | |
chown -R 1000.1000 /usr/local/lib/bundle | |
echo "[setup] Done." | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment