Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 27 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ Edit [this whitelist](https://github.com/HaliteChallenge/Halite/edit/master/webs
- `website/` - The website that hosts the competition. Includes the API that manages the game servers.
- `worker/` - The source for the worker servers that compile bots and run games safely

## Installing the website on Ubuntu
## Installation

### Installing the website on Ubuntu

Clone the repo:

Expand All @@ -33,7 +35,7 @@ Run the website install script with root user permissions. This will install php

cd website; sudo ./install.sh

Run the database install script with root user permissions. This will install mysql and insert our schema into a database titled Halite.
Run the database install script with root user permissions. This will install mysql, insert our schema into a database titled Halite, and import some dummy users.

cd sql; sudo ./install.sh

Expand All @@ -44,3 +46,26 @@ Create a `halite.ini` file using your favorite text editor in the root project d
username = YOUR_LOCAL_MYSQL_USERNAME
password = YOUR_LOCAL_MYSQL_PASSWORD
name = Halite

### Setting up the manager and worker on Ubuntu

We assume that you have already followed "Installing the website on Ubuntu."

Run the worker install script. It will install some required libraries, switch your default compiler to g++4.9, build our docker sandbox, and enable swap memory:

cd worker; sudo ./install.sh

Add these lines to your `halite.ini` file:

[hce]
managerURl = http://localhost/website/api/manager/
apiKey = 1
secretFolder = blah_blah_blah

Reboot your system (because of the enabling of swap memory):

sudo reboot

Start a worker:

cd worker; sudo python3 worker.py
2 changes: 1 addition & 1 deletion website/api/manager/ManagerAPI.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ protected function game() {
}


$s3Client->putObject($args);
//$s3Client->putObject($args);
}

// Check that we arent stoing too many games in db
Expand Down
3 changes: 2 additions & 1 deletion website/sql/dummyData.sql
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
DELETE FROM User;

INSERT INTO User (username, email, compileStatus, isRunning, language, organization) VALUES ('John Doe', '[email protected]', 0, 1, 'Java', 'Other'), ('Jane Doe', '[email protected]', 0, 1, 'Python', 'Other');
INSERT INTO User (userID, username, email, compileStatus, isRunning, language, organization) VALUES (2609, 'erdman', '[email protected]', 0, 1, 'Python', 'Other'), (1017, 'djma', '[email protected]', 0, 1, 'Java', 'Other'), (3063, 'daniel-shields', '[email protected]', 0, 1, 'Python', 'Other');
INSERT INTO Worker (apiKey, ipAddress) VALUES (1, "127.0.0.1");
12 changes: 3 additions & 9 deletions website/sql/importDummyData.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
#!/bin/bash

echo "Are you sure that you want to run this script??? It will erase everything in your db. Answer [y/n]:"

read ANSWER

if [ "$ANSWER" == "y" ]; then
echo "drop database Halite; create database Halite;" | mysql -u root
mysql -u root Halite < schema.sql
mysql -u root Halite < dummyData.sql
fi
echo "drop database Halite; create database Halite;" | mysql -u root -p
mysql -u root Halite < schema.sql -p
mysql -u root Halite < dummyData.sql -p
3 changes: 1 addition & 2 deletions website/sql/install.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
sudo apt-get install -y mysql-server

echo "Starting MySql setup"
echo "create database Halite;" | mysql -u root -p
mysql -u root -p Halite < schema.sql
./importDummyData.sh
2 changes: 0 additions & 2 deletions worker/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@
parser.read("../halite.ini")

RUN_GAME_FILE_NAME = "runGame.sh"
HALITE_EMAIL = parser["email"]["email"]
HALITE_EMAIL_PASSWORD = parser["email"]["password"]
SECRET_FOLDER = parser["hce"]["secretFolder"]

def makePath(path):
Expand Down