@@ -4,43 +4,39 @@ Website repo for the Kent Hack It CTF
44## What is this?
55The frontend uses ReactJS that communicates to a ExpressJS backend that handles: user login/registration, team creation/joining, and flag submission.
66
7- ## :hammer : Install Dependencies
7+ ## :computer : Development Installation
8+ ### :hammer : Install Dependencies
89``` bash
910# if you do not have NodeJS installed
1011sudo apt update && sudo apt install nodejs npm
11-
12- # use npm to install latest node
13- sudo npm install -g n && sudo n stable
14-
15- # if you do not want to keep the older nodejs binary on the system:
16- # replace old nodejs for new nodejs
17- $oldNode = $( which nodejs)
18- sudo rm -f $oldNode
19-
20- # create a symlink named nodejs to execute the node binary
21- sudo ln -s $( which node) $oldNode
2212```
2313
24- ## :wrench : Build
14+ ### :wrench : Build
2515``` bash
2616# installs dependencies/packages tracked by this project
2717npm install .
2818# compile and run the frontend locally
2919npm start
3020```
3121
32- Move the ` .env ` file into the project root directory, then run the following to run the backend locally.
22+ Move the web related ` .env ` file into the project root directory, then run the following to run the backend locally.
3323``` bash
34- # if you want to use the latest node binary replace nodejs -> node
35- nodejs ./src/backend/server.js
24+ nodejs backend/server.mjs
3625```
3726
3827## :chart_with_upwards_trend : Production
39- You will need to install a dependency to use ` serve ` , this is recommended after running ` npm run build ` .
28+ This project uses Docker :whale : for production set-up
29+ ``` bash
30+ sudo apt update && sudo apt install docker.io docker-compose
31+ ```
32+ The following commands will build the docker via compose which builds the multi-docker system.
33+ You will need to move the ` .env ` into the project root folder before running the following:
4034``` bash
41- sudo npm install -g serve
35+ docker network create traefik
36+ docker-compose --env-file .env -p khi -f docker/docker-compose.yml up --build
4237```
43- Prepare production build and serve as a static server .
38+ The following commands will build ONLY the khi website docker image that you later start via ` docker run -d ... ` .
4439``` bash
45- npm run build && server -s build
40+ docker build -f docker/Dockerfile -t image_name .
41+ docker run -d -p 8080:80 --name docker_name image_name
4642```
0 commit comments