aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Eilertsen <haraldei@anduin.net>2014-01-11 16:20:21 +0100
committerHarald Eilertsen <haraldei@anduin.net>2014-01-11 16:20:21 +0100
commit3b29ca76240e26d31d5fdef50c699d185f3daa82 (patch)
tree8b0119ff331d68910b6502b4373553591329f430
parenta6302289c005e96520969a8abff3d5b262dfffb9 (diff)
downloadhmnoweb-3b29ca76240e26d31d5fdef50c699d185f3daa82.tar.gz
hmnoweb-3b29ca76240e26d31d5fdef50c699d185f3daa82.tar.bz2
hmnoweb-3b29ca76240e26d31d5fdef50c699d185f3daa82.zip
Add vagrant setup to make deploying dev env easier.
Run 'vagrant up' to bootstrap the environment. The first time you do this, takes quite some time as it will download the base image, and provision it for the dev environment. Onse up you should be able to log in the the dev website by pointing your web browser to localhost:4567. The first time you will have to register a new user, and off you go. Run 'vagrant halt' to stop the vm. Next time you restart it using 'vagrant up' it should boot a lot faster, since the provisioning is already done. Run 'vagrant destroy' to clean up the VM and reclaim any disk space used by it. This will not remove the base image, only the instance in this dev environment. Notice: Due to a problem, the dev web server fails to start when doing a 'vagrant up' after the initial provisioning. To overcome this issue the following commands and you should be fine again: vagrant ssh sudo systemctl start rails logout Now wait a few seconds and the web server should respond again. I'll try to fix this problem later. requires vagrant and VirtualBox to work. See http://www.vagrantup.com for instructions on how to install vagrant for your system.
-rw-r--r--Vagrantfile9
-rw-r--r--vagrant/bootstrap.sh12
-rw-r--r--vagrant/rails.service12
3 files changed, 33 insertions, 0 deletions
diff --git a/Vagrantfile b/Vagrantfile
new file mode 100644
index 0000000..b685bb5
--- /dev/null
+++ b/Vagrantfile
@@ -0,0 +1,9 @@
+# -*- mode: ruby -*-
+# vi: set ft=ruby :
+
+Vagrant.configure("2") do |config|
+ config.vm.box = "vagrant-archlinux-2013-8"
+ config.vm.box_url = "https://googledrive.com/host/0B_BLFE4aPn5zUVpyaHdLanVnMTg/vagrant-archlinux-2013-8.box"
+ config.vm.provision :shell, :path => "vagrant/bootstrap.sh"
+ config.vm.network :forwarded_port, host: 4567, guest: 80
+end
diff --git a/vagrant/bootstrap.sh b/vagrant/bootstrap.sh
new file mode 100644
index 0000000..14c42f3
--- /dev/null
+++ b/vagrant/bootstrap.sh
@@ -0,0 +1,12 @@
+#!/usr/bin/env bash
+
+pacman -Suyq --noconfirm
+pacman -Sq ruby gcc make sqlite3 nodejs --noconfirm
+echo "export GEM_HOME=`gem env gemdir`" > /etc/profile.d/rubygems.sh
+source /etc/profile.d/rubygems.sh
+gem install bundler --no-rdoc --no-ri --no-user-install
+cd /vagrant
+./script/setup
+cp vagrant/rails.service /usr/lib/systemd/system
+systemctl enable rails
+systemctl start rails
diff --git a/vagrant/rails.service b/vagrant/rails.service
new file mode 100644
index 0000000..c37116e
--- /dev/null
+++ b/vagrant/rails.service
@@ -0,0 +1,12 @@
+[Unit]
+Description="Systemd service to boot rails server when booting VM"
+
+[Install]
+WantedBy=multi-user.target
+After=remote-fs.target
+After=dhcpcd.service
+
+[Service]
+Type=simple
+ExecStart=/vagrant/script/rails server --port=80
+