Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update ruby on Vagrant VM and related document #135

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

kamataryo
Copy link
Contributor

Related to #131 and maybe #104.
This PR adopts rbenv the version switcher, updates ruby and make Vagrant setup easy.

@timwaters
Copy link
Owner

This is good, thank you. Is there any chance of using RVM instead of rbenv? It's what I use on the servers. It's almost identical it seems, though.

btw: I'm looking into updating this for ubuntu 16:04 which would probably require compiling mapserver (and maybe gdal) using a versioned ruby. ergh.

@kamataryo
Copy link
Contributor Author

Thanks for the response.

OK, I will try to exchange them.
RVM might be more simple to install than rbenv.

@timwaters
Copy link
Owner

Hello, I recently changed the vagrant file to try to work with Ubuntu 16.04. And I think it will break your work, sorry. I think the provision script needs fixing also in master. However for 16.04 it needs gdal and mapserver to be manually compiled, if we are using rvm. It only needs gdal compiled if we use the system ruby. mapserver is quick to compile, gdal takes some time.

However, the code should work the same with vagrant set to work with 14.04, and 14.04 is quicker to get started (no compilations) I think we might have to make two vagrant files / configs. What do you think?

@timwaters
Copy link
Owner

timwaters commented Nov 2, 2017

It's running on 16.04 on mapwarper.net and on my local dev machine. I think the Ruby version has been updated too - but it's not that different from 14.04. There was no code changes related to newer Ruby versions anyhow.

@kamataryo
Copy link
Contributor Author

kamataryo commented Nov 5, 2017

Cool! Thanks for the notice. I will try with Ubuntu 16.04.
I think the vagrant developmental environment is enough with single Vagrantfile. Vagrant CLI seems not to have options to specify certain Vagrantfile, so several Vagrantfiles sometimes seems to be troublesome. How about to branch conditions with environmental variable when vagrant up ?

The Vagrantfile below should work with all commands vagrant up, UBUNTU_VERSION=16.04 vagrant up and UBUNTU_VERSION=14.04 vagrant up. Also we can provide 2 provisioners for both environment, 16.04 is preferable to be set as default.

# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  
  case ENV["UBUNTU_VERSION"]
    when "14.04" then
      BOX_NAME = "bento/ubuntu-14.04"
      PROVISION_FILE_NAME = "lib/vagrant/provision-14.04.sh"
    else
      BOX_NAME = "bento/ubuntu-16.04"
      PROVISION_FILE_NAME = "lib/vagrant/provision.sh"
  end
  
  config.vm.box = BOX_NAME
  config.vm.network :forwarded_port, guest: 3000, host: 3000
  config.vm.synced_folder ".", "/srv/mapwarper"
  config.vm.provision :shell, :path => PROVISION_FILE_NAME
  config.vm.provider :virtualbox do |v|
    v.memory = 4096
    v.cpus = 4
  end
end

@kamataryo
Copy link
Contributor Author

The other idea is to provide official Map Warper Vagrant box, which includes GDAL and MapServer on Ubuntu 16.04. This seems to be a fastest way for developers to get vagrant environment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants