Skip to content

Installation

tkaixiang edited this page Aug 21, 2021 · 21 revisions

Development Deployment

Dependencies

  • Nodejs
  • MongoDB

Get The Repo

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

Install Stuff

cd ctf_platform
cd client && npm i
cd ../api && npm i

Start the API & React dev server

Please make sure that your MongoDB server is running beforehand on localhost:20001 Setting up MongoDB

# Starting the API
cd api
npm run dev

# Starting the client
cd client
npm start

Start development 😄

Footnotes:

  • You will likely want to change the Sieberrsec CTF logos to your own logos, and window.ipAddress in /client/public/index.html to point to your own API address
  • A variable (production) in /client/public/index.html determines whether to use localhost:20001 as the API address, or to use the production ip address specified by you
  • The API will automatically insert Validation & Indexes into MongoDB
  • When in development mode, eruda is activated for easier debugging on Mobile Devices

Manual Production Deployment

Dependencies

  • Nodejs
  • MongoDB
  • A web server (we will be using Nginx here)

Get and Move Stuff To the Right Places

We are going to assume we are creating a folder called "ctf_platform" in the web server folder (/var/www) and dump everything there

We will set-up the API first as the client needs to be built manually later on to point to the right API address

mkdir /var/www/ctf_platform && mkdir /var/www/ctf_platform/api && mkdir /var/www/ctf_platform/client

git clone https://github.com/IRS-Cybersec/ctf_platform.git
cd ctf_platform
cp -R api /var/www/ctf_platform/api

Setting Up The API

cd /var/www/ctf_platform/api
npm i

Client

  • Install NodeJS
  • Run npm i inside /client to install the dependencies
  • Modify window.ipAddress inside /client/src/app.js to wherever your API is hosted at
  • Make any other modifications you want in src and then npm run build to compile the client.
  • The resulting client files will be located in /client/build. Copy them into a place where you can serve them to the web.

Server

  • Install MongoDB by following this and NodeJS (if you haven't)
  • Run npm i inside /api to install the dependencies
  • Use pm2 or anything else to run api.js in the background (E.g pm2 start api.js)