|
| 1 | +# -*- mode: ruby -*- |
| 2 | +# vi: set ft=ruby : |
| 3 | + |
| 4 | +require 'yaml' |
| 5 | + |
| 6 | +SETTINGS = YAML.load_file(File.join(File.dirname(__FILE__), '.scaleway')) |
| 7 | + |
| 8 | +# All Vagrant configuration is done below. The "2" in Vagrant.configure |
| 9 | +# configures the configuration version (we support older styles for |
| 10 | +# backwards compatibility). Please don't change it unless you know what |
| 11 | +# you're doing. |
| 12 | +Vagrant.configure("2") do |config| |
| 13 | + |
| 14 | + config.vm.provider :scaleway do |scaleway, override| |
| 15 | + scaleway.organization = SETTINGS['organization'] |
| 16 | + scaleway.token = SETTINGS['token'] |
| 17 | + scaleway.commercial_type = 'ARM64-2GB' |
| 18 | + scaleway.image = 'e1a0daf2-a61f-40bf-ba3c-f86ec4baa3bf' |
| 19 | + scaleway.region = 'par1' |
| 20 | + override.ssh.private_key_path = '~/.ssh/id_rsa' |
| 21 | + end |
| 22 | + |
| 23 | + if ARGV[0] == 'ssh' |
| 24 | + config.ssh.username = 'vagrant' |
| 25 | + end |
| 26 | + |
| 27 | + # Share an additional folder to the guest VM. The first argument is |
| 28 | + # the path on the host to the actual folder. The second argument is |
| 29 | + # the path on the guest to mount the folder. And the optional third |
| 30 | + # argument is a set of non-required options. |
| 31 | + config.vm.synced_folder "../../.git", "/libv8/.git" |
| 32 | + |
| 33 | + # Enable provisioning with a shell script. Additional provisioners such as |
| 34 | + # Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the |
| 35 | + # documentation for more information about their specific syntax and use. |
| 36 | + |
| 37 | + config.vm.provision "shell", inline: <<-SHELL |
| 38 | + apt-get update |
| 39 | + apt-get install -y software-properties-common |
| 40 | + apt-get dist-upgrade -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" |
| 41 | + apt-get install -y build-essential git ruby ruby-dev |
| 42 | + gem install bundler |
| 43 | + useradd -m -s /bin/bash vagrant |
| 44 | + mkdir -p /home/vagrant/.ssh |
| 45 | + cp /root/.ssh/authorized_keys /home/vagrant/.ssh/ |
| 46 | + chown -R vagrant:vagrant /home/vagrant/.ssh |
| 47 | + chmod go-rw /home/vagrant/.ssh |
| 48 | + SHELL |
| 49 | +end |
0 commit comments