Skip to content

Docker Production Deployment

tkaixiang edited this page Nov 26, 2021 · 12 revisions

Dependencies

Get and Move Stuff To the Right Places

Setting up Sieberrsec CTF Platform can be done in a few simple steps. We are going to assume we are on an Ubuntu Server in this guide.

Firstly, clone the repo and move into it

git clone https://github.com/IRS-Cybersec/ctf_platform.git
cd ctf_platform

Build And Run The Containers

docker-compose up
  • After the containers are done building, the client will be running on localhost:20002 and the API is running on localhost:20001.
  • An admin account is automatically created on initial setup, and the login details can be found in the API docker logs.
docker logs ctf-web-api
  • A new secure salt & secret is generated automatically on initial setup as well.

Setup Nginx Reverse Proxy

We provide an example nginx config file ctf_platform.conf which you can use as a reference to setup nginx.conf or a virtualhost. Simply copy the config over and remember to restart your nginx server after editing the config.

Important: Please change server_name ctf.example.com to YOUR.DOMAIN.COM, or if you are not using any domains, place it as server_name _

Congratulations! The platform should now be accessible at YOUR.DOMAIN.COM. If you want HTTPS , you can consider looking at installing and setting up Certbot or acme.sh.

Remarks

  • If you want to change any part of the platform (such as changing the logo to your own CTF's logo), simply edit the source code & rebuild the docker
docker-compose up --build
  • Uploaded files and database data are saved in volumes permanently even if you rebuild the docker. If you want to refresh the instance and clear all data, simply run:
docker-compose down -v
docker-compose up -d
  • Updating the platform is as simply as:
git pull
docker-compose up --build

Edit cache database with config.json

If you want to use pre-saved settings on load, you can create a config.json inside /api that looks like this:

{
  "announcements": 0,
  "challenges": 0,
  "registerDisable": false,
  "adminShowDisable": false,
  "submissionDisabled": false,
  "uploadSize": 512000,
  "latestSolveSubmissionID": 0,
  "maxSockets": 5,
  "uploadPath": "/usr/share/nginx/static/profile"
}

The API will automatically insert these settings into the cache database. You only need to enter the settings you want to edit on load. Please delete this file after this is completed as it will load the settings on each restart and might override any settings you make in the platform afterwards.