From 69b0303b31f6f5c65d1f15035c8c8ac0a45acb1e Mon Sep 17 00:00:00 2001 From: Hisashi KOMINE <31605709+hisashi-komine@users.noreply.github.com> Date: Wed, 18 Oct 2017 10:18:12 +0900 Subject: [PATCH] Fix Vagrantfile to run discourse successfully (#378) * Update the vagrant box to "ubuntu/xenial64" * Ignore .vagrant/ * Don't create /var/discourse symlink on vagrant's provisioning * Add private network interface to vagrant vm * Raise exeption if vagrant-disksize plugin is not installed * Modify the instruction for vagrant * Remove unnecessary dependencies --- .gitignore | 1 + README.md | 2 +- Vagrantfile | 15 +++++++++------ 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index 195dd64..ae7ea2f 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,4 @@ image/docker-squash.tar.gz image/discourse_dev/postgres.template.yml image/discourse_dev/redis.template.yml .gc-state/* +.vagrant/ diff --git a/README.md b/README.md index 4cd6226..cfb1091 100644 --- a/README.md +++ b/README.md @@ -184,7 +184,7 @@ then run: This will spawn a new Ubuntu VM, install Docker, and then await your instructions. You can then SSH into the VM with `vagrant ssh`, become `root` with `sudo -i`, and then you're right to go. Your live git repo is -already available at `/var/discourse`, so you can just `cd /var/discourse` +already available at `/vagrant`, so you can just `cd /vagrant` and then start running `launcher`. diff --git a/Vagrantfile b/Vagrantfile index d9064a6..254e141 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -5,8 +5,15 @@ Vagrant.configure(2) do |config| end config.vm.define :dockerhost do |config| - config.vm.box = "trusty64" - config.vm.box_url = "http://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-amd64-vagrant-disk1.box" + config.vm.box = "ubuntu/xenial64" + config.vm.network "private_network", ip: ENV["DISCOURSE_DOCKER_HOST_IP"] || "192.168.33.11" + + if Vagrant.has_plugin?("vagrant-disksize") + config.disksize.size = ENV["DISCOURSE_DOCKER_HOST_DISKSIZE"] || "50GB" + else + raise "The vagrant-disksize plugin required to expand the vm disk size. " + + "Run 'vagrant plugin install vagrant-disksize'." + end if ENV["http_proxy"] config.vm.provision "shell", inline: <<-EOF @@ -25,11 +32,7 @@ Vagrant.configure(2) do |config| echo "Apt::Install-Recommends 'false';" >/etc/apt/apt.conf.d/02no-recommends echo "Acquire::Languages { 'none' };" >/etc/apt/apt.conf.d/05no-languages apt-get update - apt-get -y remove --purge puppet juju - apt-get -y autoremove --purge wget -qO- https://get.docker.com/ | sh - - ln -s /vagrant /var/discourse EOF end end -- 2.25.1