allura
修訂 | c0c52d558c403c21370cf72f917140e05eb94e08 (tree) |
---|---|
時間 | 2012-07-19 04:00:03 |
作者 | Tim Van Steenburgh <tvansteenburgh@gmai...> |
Commiter | Tim Van Steenburgh |
Merge branch 'dev' of git://sfi-engr-scm-1/forge into dev
@@ -1,7 +1,8 @@ | ||
1 | +#!/bin/bash | |
1 | 2 | for APP in Allura* *Forge* NoWarnings |
2 | 3 | do |
3 | - echo "# installing $APP dependencies" | |
4 | - pushd $APP | |
5 | - python setup.py develop || exit | |
6 | - popd | |
4 | + echo "# setting up $APP dependencies" | |
5 | + pushd $APP > /dev/null | |
6 | + python setup.py -q develop || exit | |
7 | + popd > /dev/null | |
7 | 8 | done |
@@ -4,10 +4,10 @@ $ mkdir ~/vagrant_allura && cd ~/vagrant_allura | ||
4 | 4 | |
5 | 5 | # Get the base box |
6 | 6 | $ vagrant box add ubuntu-1110-server-amd64 http://timhuegdon.com/vagrant-boxes/ubuntu-11.10.box |
7 | -$ vagrant init | |
7 | +$ vagrant init ubuntu-1110-server-amd64 | |
8 | 8 | |
9 | 9 | # Get a copy of the provisioning scripts |
10 | -$ cp /var/local/allura/vagrant/* . | |
10 | +$ cp -R /var/local/allura/vagrant/* . | |
11 | 11 | |
12 | 12 | # At this point you can make whatever changes you want to the provisioning |
13 | 13 | # scripts |
@@ -15,15 +15,18 @@ $ cp /var/local/allura/vagrant/* . | ||
15 | 15 | # Provision the box (this will take a while) |
16 | 16 | $ vagrant up |
17 | 17 | |
18 | +# If you get an error, you can run `vagrant destroy` to start over | |
19 | + | |
18 | 20 | # Package the Allura box |
19 | 21 | $ vagrant package --vagrantfile Vagrantfile.pkg |
20 | 22 | |
21 | 23 | # Test your new box |
22 | -$ mkdir ~/vagrant_allura_test and cd ~/vagrant_allura_test | |
24 | +$ mkdir ~/vagrant_allura_test && cd ~/vagrant_allura_test | |
23 | 25 | $ vagrant box add allura ~/vagrant_allura/package.box |
24 | -$ vagrant init | |
26 | +$ vagrant init allura | |
27 | +$ vagrant up | |
25 | 28 | $ vagrant ssh |
26 | 29 | |
27 | 30 | # Do whatever testing you want... |
28 | 31 | |
29 | -# If everything checks out, you can rename your package.box and upload it | |
32 | +# If everything checks out, you can rename your package.box and upload it |
@@ -30,6 +30,7 @@ Vagrant::Config.run do |config| | ||
30 | 30 | # Forward a port from the guest to the host, which allows for outside |
31 | 31 | # computers to access the VM, whereas host only networking does not. |
32 | 32 | config.vm.forward_port 8080, 8080 |
33 | + config.vm.forward_port 8983, 8983 # solr | |
33 | 34 | |
34 | 35 | # Share an additional folder to the guest VM. The first argument is |
35 | 36 | # an identifier, the second is the path on the guest to mount the |
@@ -62,7 +63,7 @@ Vagrant::Config.run do |config| | ||
62 | 63 | config.vm.provision :shell, :path => "allura_setup.sh" |
63 | 64 | |
64 | 65 | # Enable provisioning with chef solo, specifying a cookbooks path, roles |
65 | - # path, and data_bags path (all relative to this Vagrantfile), and adding | |
66 | + # path, and data_bags path (all relative to this Vagrantfile), and adding | |
66 | 67 | # some recipes and/or roles. |
67 | 68 | # |
68 | 69 | # config.vm.provision :chef_solo do |chef| |
@@ -2,4 +2,5 @@ Vagrant::Config.run do |config| | ||
2 | 2 | # Forward Allura web port so you can browse the site at |
3 | 3 | # http://localhost:8080 (local port is the second number) |
4 | 4 | config.vm.forward_port 8080, 8080 |
5 | + config.vm.forward_port 8983, 8983 # solr | |
5 | 6 | end |
@@ -1,5 +1,18 @@ | ||
1 | 1 | #!/bin/bash |
2 | 2 | |
3 | +# Install Solr | |
4 | +cd /home/vagrant/src | |
5 | +if [ ! -d apache-solr-1.4.1 ] | |
6 | +then | |
7 | + echo "Installing Solr..." | |
8 | + wget -q http://apache.mirrors.tds.net/lucene/solr/1.4.1/apache-solr-1.4.1.tgz | |
9 | + tar xf apache-solr-1.4.1.tgz && rm -f apache-solr-1.4.1.tgz | |
10 | + cd apache-solr-1.4.1/example/ | |
11 | + mkdir -p /home/vagrant/src/forge/solr_config/conf | |
12 | + cp solr/conf/solrconfig.xml /home/vagrant/src/forge/solr_config/conf/ | |
13 | + chown -R vagrant:vagrant /home/vagrant/src/apache-solr* /home/vagrant/src/forge/solr_config/conf/ | |
14 | +fi | |
15 | + | |
3 | 16 | # Create log dir |
4 | 17 | if [ ! -d /var/log/allura ] |
5 | 18 | then |
@@ -24,27 +37,30 @@ then | ||
24 | 37 | chown vagrant:vagrant /home/vagrant/.bash_profile |
25 | 38 | fi |
26 | 39 | |
27 | -. /home/vagrant/anvil/bin/activate | |
28 | - | |
29 | -cd /home/vagrant/src/forge | |
30 | - | |
31 | 40 | # Setup Allura python packages |
32 | -echo "Setting up Allura python packages..." | |
33 | -for APP in Allura* Forge* NoWarnings | |
34 | -do | |
35 | - pushd $APP | |
36 | - python setup.py develop | |
37 | - popd | |
38 | -done | |
41 | +cd /home/vagrant/src/forge | |
42 | +sudo -u vagrant bash -c '. /home/vagrant/anvil/bin/activate; ./rebuild.bash' | |
39 | 43 | |
40 | 44 | echo "Purging unneeded packages..." |
41 | 45 | aptitude clean |
42 | 46 | aptitude -y -q purge ri |
43 | -aptitude -y -q purge installation-report landscape-common wireless-tools wpasupplicant ubuntu-serverguide | |
44 | -aptitude -y -q purge python-dbus libnl1 python-smartpm linux-headers-2.6.32-21-generic python-twisted-core libiw30 | |
45 | -aptitude -y -q purge python-twisted-bin libdbus-glib-1-2 python-pexpect python-pycurl python-serial python-gobject python-pam libffi5 | |
47 | +aptitude -y -q purge installation-report landscape-common wireless-tools wpasupplicant | |
48 | +aptitude -y -q purge python-dbus libnl1 python-smartpm linux-headers-server python-twisted-core libiw30 language-selector-common | |
49 | +aptitude -y -q purge python-twisted-bin libdbus-glib-1-2 python-pexpect python-pycurl python-serial python-gobject python-pam accountsservice libaccountsservice0 | |
46 | 50 | |
47 | 51 | echo "Zeroing free space to aid VM compression..." |
48 | -cat /dev/zero > zero.fill;sync;sleep 1;sync;rm -f zero.fill | |
52 | +cat /dev/zero > zero.fill; | |
53 | +echo "Errors about 'No space left' are ok; carrying on..." | |
54 | +sync;sleep 1;sync;rm -f zero.fill | |
49 | 55 | dd if=/dev/zero of=/EMPTY bs=1M |
50 | 56 | rm -f /EMPTY |
57 | +echo "Done with allura_setup.sh" | |
58 | + | |
59 | +# sometimes mongo ends up stopped | |
60 | +# maybe due to that disk-filling exercise | |
61 | +# make sure it's still running | |
62 | +service mongodb status | |
63 | +if [ "$?" -ne "0" ]; then | |
64 | + rm /var/lib/mongodb/mongod.lock | |
65 | + service mongodb start | |
66 | +fi |
@@ -3,6 +3,10 @@ group { "puppet": | ||
3 | 3 | ensure => "present", |
4 | 4 | } |
5 | 5 | |
6 | +exec { "package index update": | |
7 | + command => "/usr/bin/apt-get update", | |
8 | +} | |
9 | + | |
6 | 10 | # install required system packages |
7 | 11 | Package { ensure => "installed" } |
8 | 12 |
@@ -21,7 +25,9 @@ $packages = [ | ||
21 | 25 | "python-pip" |
22 | 26 | ] |
23 | 27 | |
24 | -package { $packages: } | |
28 | +package { $packages: | |
29 | + require => Exec[ "package index update" ], | |
30 | +} | |
25 | 31 | |
26 | 32 | file { '/usr/lib/libz.so': |
27 | 33 | ensure => 'link', |
@@ -43,7 +49,7 @@ exec { "install venv": | ||
43 | 49 | |
44 | 50 | # create Allura virtualenv |
45 | 51 | exec { "create allura venv": |
46 | - command => "/usr/local/bin/virtualenv --system-site-packages anvil && chown -R vagrant:vagrant /home/vagrant/anvil", | |
52 | + command => "/usr/local/bin/virtualenv --system-site-packages anvil", | |
47 | 53 | cwd => "/home/vagrant", |
48 | 54 | creates => "/home/vagrant/anvil", |
49 | 55 | user => "vagrant", |
@@ -75,21 +81,13 @@ exec { "clone repo": | ||
75 | 81 | require => [ File[ "/home/vagrant/src" ], Package[ "git-core" ] ], |
76 | 82 | } |
77 | 83 | |
78 | -# pre-install Paste and PasteDeploy to work around problem in TG2 install | |
79 | -exec { "prereqs": | |
80 | - command => "/home/vagrant/anvil/bin/pip install Paste==1.7.5.1 PasteDeploy==1.5.0", | |
81 | - user => "vagrant", | |
82 | - group => "vagrant", | |
83 | - require => Exec[ "create allura venv" ], | |
84 | -} | |
85 | - | |
86 | -# install remainder of Allura dependencies | |
87 | -exec { "/usr/bin/sudo /home/vagrant/anvil/bin/pip install -r requirements.txt": | |
84 | +# install Allura dependencies | |
85 | +exec { "/home/vagrant/anvil/bin/pip install -r requirements.txt": | |
88 | 86 | cwd => "/home/vagrant/src/forge", |
89 | 87 | user => "vagrant", |
90 | 88 | group => "vagrant", |
91 | 89 | timeout => 0, |
92 | - require => [ Exec[ "clone repo"], Exec[ "prereqs" ] ], | |
90 | + require => [ Exec[ "clone repo"], Exec[ "create allura venv" ] ], | |
93 | 91 | } |
94 | 92 | |
95 | 93 | # create SCM repo dirs |
@@ -12,18 +12,6 @@ then | ||
12 | 12 | fi |
13 | 13 | echo "Logs are in /var/log/allura" |
14 | 14 | |
15 | -# Install Solr | |
16 | -cd /home/vagrant/src | |
17 | -if [ ! -d apache-solr-1.4.1 ] | |
18 | -then | |
19 | - echo "Installing Solr..." | |
20 | - wget -q http://apache.mirrors.tds.net/lucene/solr/1.4.1/apache-solr-1.4.1.tgz | |
21 | - tar xf apache-solr-1.4.1.tgz && rm -f apache-solr-1.4.1.tgz | |
22 | - cd apache-solr-1.4.1/example/ | |
23 | - mkdir -p /home/vagrant/src/forge/solr_config/conf | |
24 | - cp solr/conf/solrconfig.xml /home/vagrant/src/forge/solr_config/conf/ | |
25 | -fi | |
26 | - | |
27 | 15 | # Start solr |
28 | 16 | if pgrep -f solr.*start.jar >/dev/null |
29 | 17 | then |