about summary refs log tree commit diff
diff options
context:
space:
mode:
authorvjackson725 <vjackson725@users.noreply.github.com>2017-01-12 23:20:55 +1100
committervjackson725 <vjackson725@users.noreply.github.com>2017-01-12 23:20:55 +1100
commit91dc21c46947a7a7da4dd25b665a772c97eba8f6 (patch)
tree5f1d45009c31b519b6a7e6a6fff46f4272072a2d
parent8f54a8851a64ffa3cff4604dc798ff428b6da95e (diff)
fix Vagrantfile so that the correct ruby is installed
Prior to this commit, the vagrantfile installs ruby 2.3.3. Due to commit mastodon@7951e7f, this no longer works.

Change the provision scrip so that 2.3.1 is installed via rbenv. Note this drastically increases provision time.
-rw-r--r--Vagrantfile30
1 files changed, 19 insertions, 11 deletions
diff --git a/Vagrantfile b/Vagrantfile
index 56762f679..154d0e895 100644
--- a/Vagrantfile
+++ b/Vagrantfile
@@ -9,9 +9,6 @@ cd /vagrant # This is where the host folder/repo is mounted
 curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
 sudo apt-add-repository 'deb https://dl.yarnpkg.com/debian/ stable main'
 
-# Add repo for Ruby 2.3 binaries
-sudo apt-add-repository ppa:brightbox/ruby-ng
-
 # Add repo for NodeJS
 curl -sL https://deb.nodesource.com/setup_4.x | sudo bash -
 
@@ -24,31 +21,43 @@ sudo apt-get install iptables-persistent -y
 # Add packages to build and run Mastodon
 sudo apt-get install \
   git-core \
-  ruby-build \
+  g++ \
   libpq-dev \
   libxml2-dev \
   libxslt1-dev \
   imagemagick \
   nodejs \
-  ruby2.3 \
-  ruby2.3-dev \
-  ruby-switch \
   redis-server \
   redis-tools \
   postgresql \
   postgresql-contrib \
   yarn \
+  libreadline-dev \
   -y
 
-# Set Ruby 2.3 as 'ruby'
-sudo ruby-switch --set ruby2.3
+# Install rbenv
+git clone https://github.com/rbenv/rbenv.git ~/.rbenv
+cd ~/.rbenv && src/configure && make -C src
+echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
+echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
+
+git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
+
+export PATH="$HOME/.rbenv/bin::$PATH"
+eval "$(rbenv init -)"
+
+echo "Compiling Ruby 2.3.1: warning, this takes a while!!!"
+rbenv install 2.3.1
+rbenv global 2.3.1
+
+cd /vagrant
 
 # Configure database
 sudo -u postgres createuser -U postgres vagrant -s
 sudo -u postgres createdb -U postgres mastodon_development
 
 # Install gems and node modules
-sudo gem install bundler
+gem install bundler
 bundle install
 yarn install
 
@@ -62,7 +71,6 @@ $start = <<SCRIPT
 
 cd /vagrant
 export $(cat ".env.vagrant" | xargs)
-killall ruby2.3
 rails s -d -b 0.0.0.0
 
 SCRIPT