Skip to content
alexnederlof edited this page Jan 10, 2013 · 6 revisions

Installing DevHub server environment on Ubuntu.

Prepare the server

Become root user

sudo su

Run the updates:

apt-get update
apt-get upgrade
apt-get dist-upgrade

Set the server hostname

echo devhub.nl > /etc/hostname
/etc/init.d/hostname restart

Also add the servername in /etc/hosts.

Setup ntpd server

sudo apt-get install ntp ntpdate

Setup the firewal using UFW.

ufw allow 22/tcp
ufw allow 80/tcp

You can check the firewall status by running sudo ufw status.

Set up mail by running

sudo dpkg-reconfigure postfix

Select internet-site as the configuration and fill in the other necessary options. Hostname is devhub.nl and devhub.ewi.tudelft.nl and the relay host should only be 127.0.0.1.

All domains listed in the mynetworks variable of /etc/postfix/main.cf are kept local and not send over the network. This is why devhub.nl is not listed here, otherwise we cannot send email to team@devhub.nl.

You can test email by sending a test email like this (replace with your mail address)

echo "Whoho test" | mail -s "Test email" your@mail.com

Java

Devhub requires Java 7. We can use OpenJDK:

install java 7

sudo apt-get install openjdk-7-jdk

Then set Java 7 as the default by running update-alternatives --config java and selecting java 7.

Verify you are running Java 7 using java -version.

##Nginx Instlal nginx and curl

apt-get install nginx curl

Create a the config file /etc/nginx/sites-available/devhub.nl that looks like this:

upstream jenkins_server {
    server 127.0.0.1:8080 fail_timeout=0;
}

server {
    listen 80;
    listen [::]:80 default ipv6only=on;
    server_name devhub.nl devhub.ewi.tudelft.nl;

    location / {
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_redirect off;

        if (!-f $request_filename) {
            proxy_pass http://jenkins_server;
            break;
        }
    }
}

Now enable the site by placing a symlink and restarting nginx:

ln -s /etc/nginx/sites-available/devhub.nl /etc/nginx/sites-enabled/devhub.nl
service nginx restart

Jenkins

See the Jenkins-setup guide.

Gitolite

See the Gitolite setup guide.

DevHub

Postgres

apt-get install postgresql

Then we add the DevHub user with a password (this will start psql, \q ends it.)

sudo -u postgres psql
CREATE USER devhub WITH PASSWORD 'Fax5Ged9va8a7et7ApEpePudU';
CREATE DATABASE devhub OWNER devhub;
\q

Application

Create a system user for devhub

adduser --system --gecos 'DevHub' --group --disabled-password --home /opt/devhub devhub

Download the latest Jetty wrapper

curl -O http://search.maven.org/remotecontent?filepath=org/eclipse/jetty/jetty-runner/9.0.0.M4/jetty-runner-9.0.0.M4.jar

Get the latest startup script from DevHub and install it in /etc/init.d/devhub.

Make the script startable and start it at boot.

chown devhub:devhub /etc/init.d/devhub
chmod u+x /etc/init.d/devhub
sudo update-rc.d devhub defaults

Add an entry in Ngix to make the URL work:

location / {
	proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
	proxy_set_header Host $http_host;
	proxy_redirect off;
	proxy_pass http://localhost:8083/;
}

Disable strict hostname filtering in for the devhub user by modifying /opt/devhub/.ssh/config to:

Host *
   StrictHostKeyChecking no
   UserKnownHostsFile=/dev/null

Get the lates devhub.war in the devhub home folder and start it. Everthing should now work!

Clone this wiki locally