Initial Commit

This commit is contained in:
Han Wu 2021-01-09 19:25:58 +00:00
commit 87b68473c9
6 changed files with 1382 additions and 0 deletions

6
.gitmodules vendored Normal file
View File

@ -0,0 +1,6 @@
[submodule "com2014-server"]
path = com2014-server
url = https://gitlab.trustai.uk/wuhanstudio/com2014-server
[submodule "com2014-template"]
path = com2014-template
url = https://gitlab.trustai.uk/wuhanstudio/com2014-template

94
README.md Normal file
View File

@ -0,0 +1,94 @@
## 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
```

1
com2014-server Submodule

@ -0,0 +1 @@
Subproject commit f6d23303790c1ee34e97bc117037cc618cd43e8c

1
com2014-template Submodule

@ -0,0 +1 @@
Subproject commit 352639f91bd92e2077eb32b64be522e7e6b0158d

1244
jupyterhub_config.py Normal file

File diff suppressed because it is too large Load Diff

36
traefik-compose.yml Normal file
View File

@ -0,0 +1,36 @@
version: '3'
services:
traefik:
# The official v2.0 Traefik docker image
image: traefik:v2.0
# Enables the web UI and tells Traefik to listen to docker
command:
#- "--api.insecure=true"
- "--providers.docker=true"
- "--providers.docker.swarmMode=true"
- "--providers.docker.exposedbydefault=false"
- "--entrypoints.web.address=:80"
- "--entryPoints.websecure.address=:443"
- "--certificatesresolvers.myhttpchallenge.acme.httpchallenge=true"
- "--certificatesresolvers.myhttpchallenge.acme.httpchallenge.entrypoint=web"
- "--certificatesresolvers.myhttpchallenge.acme.email=wuhanstudio@qq.com"
- "--certificatesresolvers.myhttpchallenge.acme.storage=/letsencrypt/acme.json"
ports:
#- "8080:8080"
- "80:80"
- "443:443"
volumes:
# So that Traefik can listen to the Docker events
- /var/run/docker.sock:/var/run/docker.sock
- ./letsencrypt:/letsencrypt
networks:
- traefik-public
deploy:
placement:
constraints:
- node.role == manager
networks:
traefik-public:
external: true