Giter Club home page Giter Club logo

ssl-simulation-setup's Introduction

Simulation Setup for virtual Small Size League Tournament

This repository contains the configuration for a virtual Small Size League tournament with multiple fields and all components that are required.

Setup idea

  • A single powerful root server is used per field
  • Teams only access the server via Browser with Guacamole
  • A team has access to its own VNC session (a virtual desktop)
  • All teams have view access to all VNC sessions, to make sure nobody is touching their system during a match
  • A team may submit a custom docker image with additional dependencies
  • The home folder is backed by a docker volume. Teams can check out their code here, and it will survive container restarts and rebuilds
  • The field can be viewed with the ssl-vision-client in the browser
  • The ssl-status-board shows the game state in the browser
  • The ssl-game-controller is protected with user/password. Only the refereeing team and the admin is activated per match.
  • The ssl-simulation-controller manages manual ball and robot placement and simulation configuration

Requirements

Following software is required, which should be available on all major operating systems:

  • Docker and Docker-Compose
  • Bash
  • Python 3

Preparations for teams

As a team, you need to make sure that your software can run on Ubuntu 20.04 and without root permissions. If you require a GPU or have other specific requirements, ask the technical committee if it will be possible.

Each team has its own docker container including a simple desktop environment. If you need additional libraries to run and/or build your software, create a custom docker image based on src/ubuntu-vnc. Use src/ubuntu-vnc-java as a template. Then submit a pull-request with the new docker image. It is possible to copy files into the container, so you can also build your software locally and only copy the binaries over.

Your container will have a volume mounted to the home folder. The volume will be used for all fields, while there will be individual containers per field. You do not need to worry about changing any network addresses or ports, they will always be the same. You should be able to handle multiple network interfaces, though.

To integrate your own container, add a new service to docker-compose-teams.yaml. Take the tigers or erforce service as a template. Also, add your team name to config/teams. It should be all-lower-case without any special characters.

Setup

If you want to use a remote server, change the root domain and field name first in ./config/root_domain and ./config/field_name. Else, the defaults are fine.

Before you start anything, you need to initialize some secrets with:

./config/docker/init.sh

This will generate passwords and an SSH key and put them at the right places.

Next, generate the initial Caddyfile for the webserver:

./config/caddy/generate_caddyfile.py

Now, you can spin up the field:

# Start all containers and keep showing the log in the foreground (ctrl+c will stop everything again)
docker-compose up
# Or alternatively run all containers in the background:
docker-compose up -d

Next, setup Guacamole and caddy:

# Sets up the running Guacamole (VNC) server. Will also generate team passwords.
./config/guacamole/update_guacamole.py
# Convert all passwords into a caddy format for the game-controller
./config/caddy/update_caddy_passwords.sh
# Regenerate the Caddyfile with the newly created passwords
./config/caddy/generate_caddyfile.py
# Reload the running caddy webserver
./config/caddy/update_caddy_config.sh

Finally, spin up the team containers that you need:

# Start team containers (individually or all together)
docker-compose -f docker-compose-teams.yaml up [team-container]

Access

You can access the field through your browser now. The URL is https://localhost or whatever you chose as the root domain.

If you are running locally, you might want to add the local CA from caddy to your system with:

# Note: Have a look at this script for more details
./caddy/install_local_CA.sh

All credentials were generated to ./config/passwords.

Usage notes

  • In Guacamole, you can press Ctrl + Shift + Alt to open a menu where you can copy files from/to the VNC session.
  • You can also drag&drop files into the browser tab to copy files into the home folder
  • The home folder is backed by a volume, so all files in the home folder will survive container rebuilds
  • To paste text into the terminal, use Shift+Insert

Shutdown and cleanup

Stop and remove all containers, networks and volumes (-v) for a specific field:

docker-compose down -v

Run on AWS

The full setup can be deployed to AWS with terraform:

cd terraform
terraform init
terraform apply

Make sure to make yourself familiar with AWS and terraform, before doing this.

Update

The database setup scripts are pre-generated already, but if the guacamole version changes, the script might need to be generated again with:

docker run --rm guacamole/guacamole /opt/guacamole/bin/initdb.sh --postgres > init/postgres/01_initdb.sql

ssl-simulation-setup's People

Contributors

antoniospg avatar bollos00 avatar g3force avatar jarokuiken avatar kotet avatar lhcavalcanti avatar mlipkovich avatar paul1999 avatar phild71 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.