Bootstrap

David Hovemeyer edited this page Jun 4, 2014 · 44 revisions

Note: Please email dhovemey@ycp.edu if you have any questions about installing CloudCoder.

This document describes how to "bootstrap" a new CloudCoder installation. The good news is that CloudCoder is fairly easy to install, as long as you are comfortable running Linux commands using ssh.

Prerequisites

You will need two (or more) servers running Ubuntu Linux. (We believe that these instructions should also work fine for any recent version of Debian Linux: let us know if you try this on Debian and run into a problem.) If you are using a version of Linux or Unix other than Ubuntu or Debian, see the AlternateBootstrap instructions.

The webapp server will host the CloudCoder web application. This server should have 512M or more of RAM and 2G or more of disk space. Ideally, it should be accessible via the public internet. Cloud hosting services such as Amazon EC2 are an excellent option. (CloudCoder runs well on an EC2 micro instance.) Our UsingEC2 page describes how to provision an EC2 server. Other cloud hosting services should work well, too. Make sure you choose Ubuntu Linux as the OS. (Ubuntu Server 14.04 LTS works well.)

The build server is a server that builds and tests student submissions. It does not need to be accessible via the internet, so if you have a spare PC that you can install Linux on, and an ethernet jack that you can connect it to, that can be your build server. The build server (or build servers - you can have more than one) should have sufficient CPU power and RAM for compiling and testing student submissions: a multi-core CPU is desirable.

Installing the webapp

Use ssh to log into the server on which you will run the webapp. Log into an account that has permission to use sudo to run commands as the superuser: for example, on Amazon EC2 Ubuntu Server, this is the ubuntu account.

Once you have logged in, run the following commands:

wget https://s3.amazonaws.com/cloudcoder-binaries/bootstrap.pl
chmod a+x bootstrap.pl
./bootstrap.pl

You will be prompted for some configuration information.

Important note: for the configurable options, such as the MySQL passwords, do not use a value that contains a comma. The bootstrap.pl script communicates options to commands using comma-separated lists in some cases, which won't work if any of the data values contain a comma.

Here is an example transcript:

Welcome to the CloudCoder bootstrap script.

By running this script, you will create a basic CloudCoder
installation on a server running Ubuntu Linux.

Make sure to run this script from a user account that has
permission to run the "sudo" command.  If you see the
following prompt:

  sudo password>>

then you will need to type the account password and press
enter.  On some Ubuntu systems, such as Ubuntu server on
Amazon EC2, no password is required for sudo, so don't be
concerned if you don't see the prompt.

Ready to start? (yes/no)
==> yes

First, please enter some configuration information...

What username do you want for your CloudCoder account?
==> dhovemey
What password do you want for your CloudCoder account?
==> hax0r4lif3
What is your first name?
==> David
What is your last name?
==> Hovemeyer
What is your email address?
==> dhovemey@ycp.edu
What is the URL of your personal website?
==> http://faculty.ycp.edu/~dhovemey
What is the name of your institution?
==> York College of Pennsylvania
What password do you want for the MySQL root user?
==> fr0b0zz
What password do you want for the MySQL cloudcoder user?
==> wurbl3
What is the hostname of this server?
==> ec2-107-22-92-250.compute-1.amazonaws.com

Are you ready to start the installation? (yes/no)
==>

The personal information is for your user account. The MySQL passwords are used for access to the MySQL database CloudCoder will use to store exercises and student work.

In the example above, the hostname I entered identifies an Amazon EC2 server I used to install CloudCoder: you should enter the hostname of your webapp server. If you have a DNS name for your server (something like cloudcoder.yourschool.edu), use that instead.

After entering this information, the script will install and configure CloudCoder and the other software it requires. If everything is successful, you should see a message similar to the following:

########################################################################
 >>> CloudCoder installation successful! <<<
########################################################################

It looks like CloudCoder was installed successfully.

You should be able to test your new installation by opening the
following web page:

  https://ec2-107-22-92-250.compute-1.amazonaws.com/cloudcoder

Note that no builders are running, so you won't be able to
test submissions yet.  The builder jar file (cloudcoderBuilder-v0.0.6.jar)
is in the /home/ubuntu directory: you will need to copy
it to the server(s) which will be responsible for building
and testing submissions.

You should be able to open the URL in your web browser and log in using the username and password you chose earlier. Note that you will receive a security warning because the server will be using a self-signed certificate. You can install a real (trusted) certificate later: see PostInstall.

Installing the builder

The bootstrap.pl script will leave the configured builder jar file in the home directory of the account from which you ran the script. However, you will need to install this jar file on the build server(s). This section explains how to install the jar file on a build server.

This section is a bit complicated because there are three computers involved:

  1. Your local machine (the one you are physically using), which we'll call localmachine. The instructions below assume that you have ssh and scp commands that you can execute from a terminal window: any Linux or Mac computer should be fine, as well as any Windows computer with cygwin and the openssh package installed.
  2. The webapp server, which we'll call webappserver.
  3. The server you will run the builder on, which we'll call buildserver.

Substitute the hostnames of the webapp and build servers for webappserver and buildserver as appropriate.

These instructions assume that you have an ssh keyfile that allows you to log into accounts on both webappserver and buildserver that have permission to run the sudo command. We'll refer to this as keyfile. (If you're using Amazon EC2, it will probably have a .pem file extension.) We'll refer to the accounts on each server as waccount and baccount ("webapp" and "builder" accounts). These might be the same (for example, ubuntu if you're using Amazon EC2). waccount should be the account you used to run the bootstrap.pl script.

Note: Make sure that the file permissions on your keyfile do not allow other users to access its contents. You can ensure this using the command

chmod 0600 keyfile

First, run the following commands on localmachine to copy the configured builder jar file from webappserver to buildserver:

scp -i keyfile waccount@webappserver:'cloudcoderBuilder-*.jar' .
scp -i keyfile cloudcoderBuilder-*.jar baccount@buildserver:

Next, log into baccount on the build server. Install software needed by the builder:

sudo apt-get update
sudo apt-get install openjdk-7-jdk gcc g++

Next, create a builder user account:

sudo adduser --disabled-password --home /home/builder --gecos '' builder

Copy the builder jarfile to the home directory of the builder account:

sudo cp cloudcoderBuilder-*.jar /home/builder
sudo chown builder /home/builder/cloudcoderBuilder-*.jar

Next, start a shell running as the builder user:

sudo su builder

Now you're ready to install and start the builder jar file:

cd /home/builder
mkdir -p builder
mv cloudcoderBuilder-*.jar builder
cd builder
java -jar cloudcoderBuilder-*.jar start
ls

The last command (ls) should show a directory listing which includes files called instance.pid and instance-NNNN.fifo, where NNNN is a process id. If you see these files, then the builder should be running.

Important: TCP port 47374 on webappserver must be open to accept incoming connections: see PostInstall.

You can use multiple build servers, so you can repeat this procedure on other machines if you choose to.

Testing your installation

To test your new installation, log into the web app, choose the "CloudCoder demo course", choose the "hello" problem, and click "Load Problem". Add the code

printf("Hello, world\n");

to the code you see and click "Submit!". If you see the message "You rock" and a green bar, then everything is working. Congratulations.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.