| OLD | NEW |
| 1 #!/bin/bash | 1 #!/bin/bash |
| 2 # | 2 # |
| 3 # Script to setup a GCE instance to run the webtry server. | 3 # Script to setup a GCE instance to run the webtry server. |
| 4 # For full instructions see the README file. | 4 # For full instructions see the README file. |
| 5 sudo apt-get install schroot debootstrap monit squid3 | 5 sudo apt-get install schroot debootstrap monit squid3 |
| 6 | 6 |
| 7 # although aufs is being replaced by overlayfs, it's not clear | 7 # although aufs is being replaced by overlayfs, it's not clear |
| 8 # to me if overlayfs is completely supported by schroot yet. | 8 # to me if overlayfs is completely supported by schroot yet. |
| 9 sudo apt-get install aufs-tools | 9 sudo apt-get install aufs-tools |
| 10 | 10 |
| 11 echo "Adding the webtry user account" | 11 echo "Adding the webtry user account" |
| 12 sudo adduser webtry | 12 sudo adduser webtry |
| 13 | 13 |
| 14 sudo mkdir /home/webtry/cache | 14 sudo mkdir /home/webtry/cache |
| 15 sudo mkdir /home/webtry/cache/src | 15 sudo mkdir /home/webtry/cache/src |
| 16 sudo mkdir /home/webtry/inout | 16 sudo mkdir /home/webtry/inout |
| 17 sudo chmod 777 /home/webtry/inout | 17 sudo chmod 777 /home/webtry/inout |
| 18 sudo chmod 777 /home/webtry/cache | 18 sudo chmod 777 /home/webtry/cache |
| 19 sudo chmod 777 /home/webtry/cache/src | 19 sudo chmod 777 /home/webtry/cache/src |
| 20 | 20 |
| 21 sudo cp ../sys/webtry_schroot /etc/schroot/chroot.d/webtry | 21 sudo cp ../sys/webtry_schroot /etc/schroot/chroot.d/webtry |
| 22 | 22 |
| 23 CHROOT_JAIL=/srv/chroot/webtry_gyp | 23 CHROOT_JAIL=/srv/chroot/webtry_gyp |
| 24 # Build the chroot environment | 24 # Build the chroot environment. |
| 25 if [ ! -d ${CHROOT_JAIL} ]; then | 25 if [ ! -d ${CHROOT_JAIL} ]; then |
| 26 sudo mkdir -p ${CHROOT_JAIL} | 26 sudo mkdir -p ${CHROOT_JAIL} |
| 27 | 27 |
| 28 sudo debootstrap --variant=minbase wheezy ${CHROOT_JAIL} | 28 sudo debootstrap --variant=minbase wheezy ${CHROOT_JAIL} |
| 29 sudo cp setup_jail.sh ${CHROOT_JAIL}/bin | 29 sudo cp setup_jail.sh ${CHROOT_JAIL}/bin |
| 30 sudo chmod 755 ${CHROOT_JAIL}/bin/setup_jail.sh | 30 sudo chmod 755 ${CHROOT_JAIL}/bin/setup_jail.sh |
| 31 sudo chroot ${CHROOT_JAIL} /bin/setup_jail.sh | 31 sudo chroot ${CHROOT_JAIL} /bin/setup_jail.sh |
| 32 sudo sh -c "echo 'none /dev/shm tmpfs rw,nosuid,nodev,noexec 0 0' >> ${C
HROOT_JAIL}/etc/fstab" | 32 sudo sh -c "echo 'none /dev/shm tmpfs rw,nosuid,nodev,noexec 0 0' >> ${C
HROOT_JAIL}/etc/fstab" |
| 33 fi | 33 fi |
| 34 | 34 |
| 35 # the continue_install script will fetch the latest versions of | 35 # The continue_install script will fetch the latest versions of |
| 36 # skia and depot_tools. We split up the installation process into | 36 # skia and depot_tools. We split up the installation process into |
| 37 # two pieces like this so that the continue_install script can | 37 # two pieces like this so that the continue_install script can |
| 38 # be run independently of this one to fetch and build the latest skia. | 38 # be run independently of this one to fetch and build the latest skia. |
| 39 | 39 |
| 40 ./continue_install.sh | 40 ./continue_install.sh |
| 41 | 41 |
| 42 sudo cp ../sys/webtry_init /etc/init.d/webtry | 42 sudo cp ../sys/webtry_init /etc/init.d/webtry |
| 43 sudo cp ../sys/webtry_monit /etc/monit/conf.d/webtry | 43 sudo cp ../sys/webtry_monit /etc/monit/conf.d/webtry |
| 44 sudo cp ../sys/webtry_squid /etc/squid3/squid.conf | 44 sudo cp ../sys/webtry_squid /etc/squid3/squid.conf |
| 45 sudo chmod 744 /etc/init.d/webtry | 45 sudo chmod 744 /etc/init.d/webtry |
| 46 | 46 |
| 47 # Confirm that monit is happy. | 47 # Confirm that monit is happy. |
| 48 | |
| 49 sudo monit -t | 48 sudo monit -t |
| 50 sudo monit reload | 49 sudo monit reload |
| 50 |
| 51 sudo /etc/init.d/webtry restart |
| OLD | NEW |