| OLD | NEW |
| (Empty) |
| 1 #!/bin/bash | |
| 2 # | |
| 3 # Script to setup a GCE instance to run the webtry server. | |
| 4 # For full instructions see the README file. | |
| 5 | |
| 6 function banner { | |
| 7 echo "" | |
| 8 echo "******************************************" | |
| 9 echo "*" | |
| 10 echo "* $1" | |
| 11 echo "*" | |
| 12 echo "******************************************" | |
| 13 echo "" | |
| 14 } | |
| 15 | |
| 16 banner "Installing debian packages needed for the server" | |
| 17 | |
| 18 sudo apt-get install schroot debootstrap monit squid3 | |
| 19 | |
| 20 # although aufs is being replaced by overlayfs, it's not clear | |
| 21 # to me if overlayfs is completely supported by schroot yet. | |
| 22 sudo apt-get install aufs-tools | |
| 23 | |
| 24 banner "Setting up the webtry user account" | |
| 25 sudo adduser webtry | |
| 26 | |
| 27 sudo mkdir /home/webtry/cache | |
| 28 sudo mkdir /home/webtry/cache/src | |
| 29 sudo mkdir /home/webtry/inout | |
| 30 sudo chmod 777 /home/webtry/inout | |
| 31 sudo chmod 777 /home/webtry/cache | |
| 32 sudo chmod 777 /home/webtry/cache/src | |
| 33 | |
| 34 sudo cp sys/webtry_schroot /etc/schroot/chroot.d/webtry | |
| 35 | |
| 36 CHROOT_JAIL=/srv/chroot/webtry_gyp | |
| 37 # Build the chroot environment. | |
| 38 if [ ! -d ${CHROOT_JAIL} ]; then | |
| 39 banner "Building the chroot jail" | |
| 40 sudo mkdir -p ${CHROOT_JAIL} | |
| 41 | |
| 42 sudo debootstrap --variant=minbase wheezy ${CHROOT_JAIL} | |
| 43 sudo cp setup_jail.sh ${CHROOT_JAIL}/bin | |
| 44 sudo chmod 755 ${CHROOT_JAIL}/bin/setup_jail.sh | |
| 45 sudo chroot ${CHROOT_JAIL} /bin/setup_jail.sh | |
| 46 sudo sh -c "echo 'none /dev/shm tmpfs rw,nosuid,nodev,noexec 0 0' >> ${C
HROOT_JAIL}/etc/fstab" | |
| 47 fi | |
| 48 | |
| 49 # The continue_install_jail script will update and build up the skia library | |
| 50 # inside the jail. | |
| 51 | |
| 52 banner "Installing and updating software on the chroot jail" | |
| 53 sudo cp continue_install_jail.sh ${CHROOT_JAIL}/bin/continue_install_jail.sh | |
| 54 sudo chmod 755 ${CHROOT_JAIL}/bin/continue_install_jail.sh | |
| 55 sudo chroot ${CHROOT_JAIL} /bin/continue_install_jail.sh | |
| 56 sudo chown -R webtry:webtry ${CHROOT_JAIL}/skia_build/skia | |
| 57 | |
| 58 # The continue_install script will fetch the latest versions of | |
| 59 # skia and depot_tools. We split up the installation process into | |
| 60 # two pieces like this so that the continue_install script can | |
| 61 # be run independently of this one to fetch and build the latest skia. | |
| 62 | |
| 63 banner "Building the webtry server outside the jail" | |
| 64 | |
| 65 sudo cp continue_install.sh /home/webtry | |
| 66 sudo chown webtry:webtry /home/webtry/continue_install.sh | |
| 67 sudo su - webtry -c /home/webtry/continue_install.sh | |
| 68 | |
| 69 banner "Setting up system initialization scripts" | |
| 70 | |
| 71 sudo cp sys/webtry_init /etc/init.d/webtry | |
| 72 sudo cp sys/logserver_init /etc/init.d/logserver | |
| 73 sudo cp sys/webtry_monit /etc/monit/conf.d/webtry | |
| 74 sudo cp sys/webtry_squid /etc/squid3/squid.conf | |
| 75 sudo chmod 744 /etc/init.d/webtry | |
| 76 sudo chmod 744 /etc/init.d/logserver | |
| 77 | |
| 78 # Confirm that monit is happy. | |
| 79 sudo monit -t | |
| 80 sudo monit reload | |
| 81 | |
| 82 banner "Restarting webtry server" | |
| 83 | |
| 84 sudo /etc/init.d/webtry restart | |
| 85 sudo /etc/init.d/logserver restart | |
| 86 | |
| 87 banner "All done!" | |
| OLD | NEW |