File: setup.sh

package info (click to toggle)
vagrant 1.0.3-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 3,084 kB
  • sloc: ruby: 15,045; python: 230; sh: 66; makefile: 2; lisp: 1
file content (107 lines) | stat: -rw-r--r-- 2,778 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#!/bin/sh
#
# This shell script installs and prepares all the software necessary
# to run the build master. This script is expected to be run as root.
# This script is made to be run only on Ubuntu 10.04 LTS at the moment.

# Update the source list
apt-get update

# Install the basic sysadmin stuff
apt-get install -y htop

# Fix the mountall bug in the AMI
sed -i -e 's/nobootwait,//' /etc/fstab

#----------------------------------------------------------------------
# Python Setup
#----------------------------------------------------------------------
# Install Python and pip
apt-get install -y python python-dev python-setuptools
easy_install pip

# Install virtualenv
pip install virtualenv

#----------------------------------------------------------------------
# Deploy Setup
#----------------------------------------------------------------------
# Install Git, which is used for all the deploys of the build master
apt-get install -y git-core

# Create the user/group for the buildmaster
groupadd buildmaster
useradd -d /home/buildmaster -g buildmaster -s /bin/bash buildmaster
mkdir /home/buildmaster
chown -R buildmaster:buildmaster /home/buildmaster

# Make the folder which will contain the buildmaster code
mkdir -p /srv/buildmaster
chown buildmaster:buildmaster /srv/buildmaster

# Make the folder which will contain the configuration for the
# buildmaster
mkdir -p /etc/buildmaster
chown buildmaster:buildmaster /etc/buildmaster

#----------------------------------------------------------------------
# Nginx Setup
#----------------------------------------------------------------------
# Install Nginx
apt-get install -y nginx

# Setup the basic directories
mkdir -p /etc/nginx/conf.d
mkdir -p /etc/nginx/sites-available
mkdir -p /etc/nginx/sites-enabled

# Setup the configuration
cat <<EOF > /etc/nginx/nginx.conf
user             www-data;
worker_processes 1;

# Raise the limit on open file descriptors
worker_rlimit_nofile 30000;

error_log /var/log/nginx/error.log;
pid       /var/run/nginx.pid;

events {
    worker_connections 1024;
    use epoll;
}

http {
    include      /etc/nginx/mime.types;
    default_type application/octet-stream;

    access_log   /var/log/nginx/access.log;

    sendfile on;
    tcp_nopush on;
    tcp_nodelay on;

    keepalive_timeout 65;

    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;
}
EOF

# Setup the buildbot site
cat <<EOF > /etc/nginx/sites-available/buildmaster.conf
server {
  listen 80;

  location / {
    proxy_pass http://localhost:8000;
  }
}
EOF

# Activate the buildbot site, remove the default
rm /etc/nginx/sites-enabled/default
ln -f -s /etc/nginx/sites-available/buildmaster.conf /etc/nginx/sites-enabled/buildmaster.conf

# Restart nginx
/etc/init.d/nginx restart