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 | |
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 | |
5 sudo apt-get install schroot debootstrap monit squid3 | 18 sudo apt-get install schroot debootstrap monit squid3 |
6 | 19 |
7 # although aufs is being replaced by overlayfs, it's not clear | 20 # although aufs is being replaced by overlayfs, it's not clear |
8 # to me if overlayfs is completely supported by schroot yet. | 21 # to me if overlayfs is completely supported by schroot yet. |
9 sudo apt-get install aufs-tools | 22 sudo apt-get install aufs-tools |
10 | 23 |
11 echo "Adding the webtry user account" | 24 banner "Setting up the webtry user account" |
12 sudo adduser webtry | 25 sudo adduser webtry |
13 | 26 |
14 sudo mkdir /home/webtry/cache | 27 sudo mkdir /home/webtry/cache |
15 sudo mkdir /home/webtry/cache/src | 28 sudo mkdir /home/webtry/cache/src |
16 sudo mkdir /home/webtry/inout | 29 sudo mkdir /home/webtry/inout |
17 sudo chmod 777 /home/webtry/inout | 30 sudo chmod 777 /home/webtry/inout |
18 sudo chmod 777 /home/webtry/cache | 31 sudo chmod 777 /home/webtry/cache |
19 sudo chmod 777 /home/webtry/cache/src | 32 sudo chmod 777 /home/webtry/cache/src |
20 | 33 |
21 sudo cp ../sys/webtry_schroot /etc/schroot/chroot.d/webtry | 34 sudo cp ../sys/webtry_schroot /etc/schroot/chroot.d/webtry |
22 | 35 |
23 CHROOT_JAIL=/srv/chroot/webtry_gyp | 36 CHROOT_JAIL=/srv/chroot/webtry_gyp |
24 # Build the chroot environment. | 37 # Build the chroot environment. |
25 if [ ! -d ${CHROOT_JAIL} ]; then | 38 if [ ! -d ${CHROOT_JAIL} ]; then |
39 banner "Building the chroot jail" | |
26 sudo mkdir -p ${CHROOT_JAIL} | 40 sudo mkdir -p ${CHROOT_JAIL} |
27 | 41 |
28 sudo debootstrap --variant=minbase wheezy ${CHROOT_JAIL} | 42 sudo debootstrap --variant=minbase wheezy ${CHROOT_JAIL} |
29 sudo cp setup_jail.sh ${CHROOT_JAIL}/bin | 43 sudo cp setup_jail.sh ${CHROOT_JAIL}/bin |
30 sudo chmod 755 ${CHROOT_JAIL}/bin/setup_jail.sh | 44 sudo chmod 755 ${CHROOT_JAIL}/bin/setup_jail.sh |
31 sudo chroot ${CHROOT_JAIL} /bin/setup_jail.sh | 45 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" | 46 sudo sh -c "echo 'none /dev/shm tmpfs rw,nosuid,nodev,noexec 0 0' >> ${C HROOT_JAIL}/etc/fstab" |
33 fi | 47 fi |
34 | 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 | |
35 # The continue_install script will fetch the latest versions of | 58 # The continue_install script will fetch the latest versions of |
36 # skia and depot_tools. We split up the installation process into | 59 # skia and depot_tools. We split up the installation process into |
37 # two pieces like this so that the continue_install script can | 60 # 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. | 61 # be run independently of this one to fetch and build the latest skia. |
39 | 62 |
40 ./continue_install.sh | 63 banner "Building the webtry server outside the jail" |
64 | |
65 sudo cp continue_install.sh ~webtry | |
tfarina
2014/10/08 16:01:14
what does '~webtry' mean?
Did you mean to copy it
| |
66 sudo chown webtry:webtry ~webtry/continue_install.sh | |
67 sudo su - webtry -c ~webtry/continue_install.sh | |
68 | |
69 banner "Setting up system initialization scripts" | |
41 | 70 |
42 sudo cp ../sys/webtry_init /etc/init.d/webtry | 71 sudo cp ../sys/webtry_init /etc/init.d/webtry |
43 sudo cp ../sys/webtry_monit /etc/monit/conf.d/webtry | 72 sudo cp ../sys/webtry_monit /etc/monit/conf.d/webtry |
44 sudo cp ../sys/webtry_squid /etc/squid3/squid.conf | 73 sudo cp ../sys/webtry_squid /etc/squid3/squid.conf |
45 sudo chmod 744 /etc/init.d/webtry | 74 sudo chmod 744 /etc/init.d/webtry |
46 | 75 |
47 # Confirm that monit is happy. | 76 # Confirm that monit is happy. |
48 sudo monit -t | 77 sudo monit -t |
49 sudo monit reload | 78 sudo monit reload |
50 | 79 |
80 banner "Restarting webtry server" | |
81 | |
51 sudo /etc/init.d/webtry restart | 82 sudo /etc/init.d/webtry restart |
83 | |
84 banner "All done!" | |
OLD | NEW |