diff options
author | Folker Bernitt <fbernitt@thoughtworks.com> | 2015-01-22 17:42:17 +0100 |
---|---|---|
committer | Folker Bernitt <fbernitt@thoughtworks.com> | 2015-01-22 17:42:17 +0100 |
commit | 895d1ae9e5d0260b3d55b352deab7be589d24a99 (patch) | |
tree | bf9b81b5811865482a0a9851374adc5271260dc0 | |
parent | 781c9b33bb23d94398078d520f06a6def823a754 (diff) |
Issue #244: Preparations for hackday vagrant image.
- To use it, do these steps:
build the box:
vagrant destroy && vagrant up source
vagrant package --output hackday-user-agent.box source
use the box:
vagrant box add hackday-user-agent hackday-user-agent.box
vagrant up hackday
vagrant ssh hackday
Scripts will be provided with next commit.
-rw-r--r-- | Vagrantfile | 4 | ||||
-rwxr-xr-x | install-pixelated.sh | 22 | ||||
-rw-r--r-- | provisioning/modules/pixelated/manifests/apt.pp | 4 | ||||
-rw-r--r-- | provisioning/modules/pixelated/manifests/source.pp | 11 |
4 files changed, 35 insertions, 6 deletions
diff --git a/Vagrantfile b/Vagrantfile index c2bf477b..a8fcc62d 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -47,6 +47,10 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| end end + config.vm.define "hackday", autostart: false do |hackday| + config.vm.box = "hackday-user-agent" + end + config.vm.network :forwarded_port, guest: 3333, host: 3333 config.vm.provider "virtualbox" do |v| diff --git a/install-pixelated.sh b/install-pixelated.sh index fa6cd1e4..3e430783 100755 --- a/install-pixelated.sh +++ b/install-pixelated.sh @@ -24,6 +24,22 @@ then export USERNAME=`whoami` fi +usage() { echo "Usage: $0 [-v <virtualenv path>]" 1>&2; exit 1; } + +VIRTUALENV_PATH=".virtualenv" + +while getopts "v:" OPT; do + case "${OPT}" in + v) + VIRTUALENV_PATH=${OPTARG} + ;; + *) + usage + ;; + esac +done +shift $((OPTIND-1)) + function check_installed() { which $1 if [ $? -ne 0 ]; then @@ -46,9 +62,9 @@ LC_ALL=en_US.UTF-8 ./go build # install service dependencies cd ../service -rm -rf .virtualenv -virtualenv .virtualenv -source .virtualenv/bin/activate +rm -rf "$VIRTUALENV_PATH" +virtualenv "$VIRTUALENV_PATH" +source "$VIRTUALENV_PATH/bin/activate" ./go setup --always-unzip pip uninstall -y enum34 pip install enum34 diff --git a/provisioning/modules/pixelated/manifests/apt.pp b/provisioning/modules/pixelated/manifests/apt.pp index 434ae01e..e1af0aba 100644 --- a/provisioning/modules/pixelated/manifests/apt.pp +++ b/provisioning/modules/pixelated/manifests/apt.pp @@ -5,7 +5,7 @@ class pixelated::apt { file { '/etc/apt/sources.list.d/pixelated.list': content => "deb http://packages.pixelated-project.org/debian wheezy-snapshots main\ndeb http://packages.pixelated-project.org/debian wheezy main\n", owner => 'root', - require => Exec[add_pixelated_key], + require => Exec['add_pixelated_key'], notify => Exec['apt_get_update'], } @@ -25,7 +25,7 @@ class pixelated::apt { file { '/etc/apt/sources.list.d/leap.list': content => "deb http://deb.leap.se/0.6 wheezy main", owner => 'root', - require => Exec[add_pixelated_key], + require => Exec['add_leap_key'], notify => Exec['apt_get_update'], } file { '/tmp/0x1E34A1828E20790_leap_archive_key': diff --git a/provisioning/modules/pixelated/manifests/source.pp b/provisioning/modules/pixelated/manifests/source.pp index 8fd98dda..5ebec288 100644 --- a/provisioning/modules/pixelated/manifests/source.pp +++ b/provisioning/modules/pixelated/manifests/source.pp @@ -25,13 +25,22 @@ class pixelated::source { } class install_pixelated { + $virtualenv_path = "/home/vagrant/user-agent-venv" + exec { 'install-pixelated': environment => 'USERNAME=vagrant', - command => '/bin/bash /vagrant/install-pixelated.sh', + command => "/vagrant/install-pixelated.sh -v \"${virtualenv_path}\"", cwd => '/vagrant', user => 'vagrant', timeout => 0 } + + exec { 'add_virtualenv_to_bashrc': + command => "/bin/bash -c 'echo \"source ${virtualenv_path} ; cd /vagrant\" >> /home/vagrant/.bashrc'", + unless => "/bin/grep \"source ${virtualenv_path}\" /home/vagrant/.bashrc", + user => 'vagrant', + require => Exec['install-pixelated'] + } } Stage['main'] -> Stage['install_pixelated'] |