## Clone Git repo

```
$ git clone https://gitlab.trustai.uk/wuhanstudio/com2014
$ cd com2014
$ git submodule init && git submodule update
```



## TSP-Template (Python)

Prerequisites:

- docker
- python3

Install:

```
$ cd com2014-template/template
$ docker build -t com2014-tsp .
```

Copy template for JupyterHub:

```
$ cd com2014-template
$ cp -r Workshop* images output template /etc/skel
```



## Jupyter Hub

Prerequisites:

- python3
- nodejs


Install:

```
$ python3 -m pip install jupyterhub
$ npm install -g configurable-http-proxy
$ python3 -m pip install notebook

$ cd com2014
$ cp ./jupyterhub_config.py /etc/jupyterhub/jupyterhub_config.py
$ jupyterhub -f /etc/jupyterhub/jupyterhub_config.py
```



## TSP-Server (NodeJS)

Prerequisites:

- nodejs

Development:

```
$ cd com2014-server 
$ npm install
$ node server.js
```

Deployment (Local):

```
$ cd com2014-server

$ ln -s $PWD/uploads /uploads
$ ln -s $PWD/output /output
$ cp leaderboard.json.template leaderboard.json

$ docker build -t com2014-server .
$ docker container run -d -p 80:8080 -v /var/run/docker.sock:/var/run/docker.sock -v /uploads/:/app/uploads/ -v /output/:/app/output/ com2014-server
```

Furthur Deployment (Cloud)

```
$ cd com2014
$ docker swarm init && docker network create --driver=overlay traefik-public
$ mkdir ./letsencrypt
$ docker stack deploy -c traefik-compose.yml traefik

$ cd com2014-server
$ docker stack deploy -c tsp-compose.yml tsp
```

