diff options
-rw-r--r-- | Vagrantfile | 6 | ||||
-rwxr-xr-x | install-pixelated.sh | 3 | ||||
-rw-r--r-- | provisioning/manifests/source.pp | 4 | ||||
-rw-r--r-- | provisioning/modules/pixelated/manifests/source.pp | 17 | ||||
-rw-r--r-- | provisioning/modules/pixelated/manifests/source/install_useragent.pp | 30 | ||||
-rw-r--r-- | provisioning/modules/pixelated/manifests/source/npm.pp | 9 |
6 files changed, 49 insertions, 20 deletions
diff --git a/Vagrantfile b/Vagrantfile index 024a3517..e989c7e9 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -19,14 +19,14 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| # see https://leap.se/en/docs/platform/details/development#Verify.vagrantbox.download # for details - config.vm.box = "leap-jessie-amd64" + config.vm.box = "leap-wheezy" config.vm.define "source", primary: true do |source| source.vm.provider :virtualbox do |v, override| - override.vm.box_url = "https://downloads.leap.se/platform/vagrant/virtualbox/leap-debian-jessie-amd64-virtualbox.box" + override.vm.box_url = "https://downloads.leap.se/platform/vagrant/virtualbox/leap-wheezy.box" end source.vm.provider "libvirt" do |v, override| - override.vm.box_url = "https://downloads.leap.se/platform/vagrant/libvirt/Debian-jessie.beta1-amd64-netboot.box" + override.vm.box_url = "https://downloads.leap.se/platform/vagrant/libvirt/leap-wheezy.box" end source.vm.provision "puppet" do |puppet| puppet.manifests_path = "provisioning/manifests" diff --git a/install-pixelated.sh b/install-pixelated.sh index 1d67f942..541220aa 100755 --- a/install-pixelated.sh +++ b/install-pixelated.sh @@ -90,7 +90,8 @@ if [ -z "$CUSTOM_NODE_MODULES_LOCATION" ] ; then else install_node_modules_at_custom_location "$CUSTOM_NODE_MODULES_LOCATION" fi -node_modules/bower/bin/bower install --config.interactive=false --allow-root + +node_modules/bower/bin/bower -V install --config.interactive=false --allow-root LC_ALL=en_US.UTF-8 ./go build # install service dependencies diff --git a/provisioning/manifests/source.pp b/provisioning/manifests/source.pp index c45059f5..74859a63 100644 --- a/provisioning/manifests/source.pp +++ b/provisioning/manifests/source.pp @@ -1,5 +1,5 @@ class { '::pixelated::apt': } -> class { '::pixelated::common': } -> -class { '::pixelated::source': } -> -class { '::pixelated::cleanup':} +class { '::pixelated::source': } +#class { '::pixelated::cleanup':} diff --git a/provisioning/modules/pixelated/manifests/source.pp b/provisioning/modules/pixelated/manifests/source.pp index 3d0fa390..d4e9754a 100644 --- a/provisioning/modules/pixelated/manifests/source.pp +++ b/provisioning/modules/pixelated/manifests/source.pp @@ -4,7 +4,6 @@ class pixelated::source { package { [ 'git', 'nodejs-legacy', - 'npm', 'python-dev', 'python-virtualenv', 'libffi-dev', @@ -15,6 +14,8 @@ class pixelated::source { ensure => latest } + include pixelated::source::npm + package { 'compass': ensure => installed, provider => 'gem' @@ -22,21 +23,9 @@ class pixelated::source { stage { 'install_pixelated': } - class { 'install_pixelated' : + class { 'pixelated::source::install_useragent' : stage => install_pixelated } - class install_pixelated { - $virtualenv_path = '/home/vagrant/user-agent-venv' - - exec { 'install-pixelated': - environment => 'USERNAME=vagrant', - command => "/vagrant/install-pixelated.sh -v \"${virtualenv_path}\" -n /home/vagrant/boxed_node_modules", - cwd => '/vagrant', - user => 'vagrant', - timeout => 0 - } - } - Stage['main'] -> Stage['install_pixelated'] } diff --git a/provisioning/modules/pixelated/manifests/source/install_useragent.pp b/provisioning/modules/pixelated/manifests/source/install_useragent.pp new file mode 100644 index 00000000..8661f655 --- /dev/null +++ b/provisioning/modules/pixelated/manifests/source/install_useragent.pp @@ -0,0 +1,30 @@ +class pixelated::source::install_useragent { + + $virtualenv_path = '/home/vagrant/user-agent-venv' + + exec { 'install-pixelated': + # use of "user" parameter doesn't set env variables right, + # see https://projects.puppetlabs.com/issues/23053 + # therefore we need to explicitily set them here + environment => [ 'USERNAME=vagrant', 'HOME=/home/vagrant' ], + command => "/vagrant/install-pixelated.sh -v \"${virtualenv_path}\" -n /home/vagrant/boxed_node_modules", + cwd => '/vagrant', + user => 'vagrant', + # to debug use this + # logoutput => true, + timeout => 0 + } + + file { '/home/vagrant/.activate_custom_node_modules.sh': + owner => 'vagrant', + mode => '0600', + source => 'puppet:///modules/pixelated/activate_custom_node_modules.sh', + } + + exec { 'add_custom_node_modules_to_bashrc': + command => "/bin/bash -c 'echo \"source /home/vagrant/.activate_custom_node_modules.sh\" >> /home/vagrant/.bashrc'", + unless => "/bin/grep \"source /home/vagrant/.activate_custom_node_modules.sh\" /home/vagrant/.bashrc", + user => 'vagrant', + require => [Exec['install-pixelated'], File['/home/vagrant/.activate_custom_node_modules.sh']] + } +} diff --git a/provisioning/modules/pixelated/manifests/source/npm.pp b/provisioning/modules/pixelated/manifests/source/npm.pp new file mode 100644 index 00000000..8926d6fd --- /dev/null +++ b/provisioning/modules/pixelated/manifests/source/npm.pp @@ -0,0 +1,9 @@ +# installs npm from source +class pixelated::source::npm { + + exec { 'install_npm': + command => '/usr/bin/curl -s -L https://npmjs.org/install.sh | /bin/sh', + unless => '/usr/bin/test -e /usr/bin/npm', + require => Package['nodejs-legacy']; + } +} |