Skip to content

Commit

Permalink
docs: infrastructure
Browse files Browse the repository at this point in the history
  • Loading branch information
ElaBosak233 committed Jun 7, 2024
1 parent 86e955b commit b5a0310
Show file tree
Hide file tree
Showing 21 changed files with 134 additions and 253 deletions.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
# Cloudsdale

The **Cloudsdale** project is an *open-source, light-weight, Jeopardy-style's* CTF platform.
[![Go Report Card](https://goreportcard.com/badge/github.com/elabosak233/cloudsdale)](https://goreportcard.com/report/github.com/elabosak233/cloudsdale)

The **Cloudsdale** project is an _open-source, light-weight, Jeopardy-style's_ CTF platform.

You can read more in the [Documentation](https://docs.ctf.e23.dev).

## Special Thanks

Thanks to everyone who has contributed to the project! Without you, Cloudsdale would not be what it is today.

![](https://contrib.rocks/image?repo=ElaBosak233/Cloudsdale)

The current version of Cloudsdale, while ensuring the originality of the code, largely draws inspiration from [GZ::CTF](https://github.com/GZTimeWalker/GZCTF) in its frontend design. Therefore, I express my highest respect to [GZTimeWalker](https://github.com/GZTimeWalker), the author of GZ::CTF. At the same time, I also thank GZTime for his suggestions on Cloudsdale.
1 change: 1 addition & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Security Policy
86 changes: 0 additions & 86 deletions config/application.json

This file was deleted.

19 changes: 0 additions & 19 deletions config/platform.json

This file was deleted.

12 changes: 8 additions & 4 deletions docs/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,15 @@ markdown_extensions:

nav:
- 简介: index.md
- 快速上手: quick-start/index.md
- 部署:
- Docker: deploy/docker.md
- Docker + K8s: deploy/docker-k8s.md
- K8s: deploy/k8s.md
- 配置文件:
- 配置:
- config/index.md
- 代理与流量捕获:
- proxy/index.md
- 数据库: config/database.md
- 缓存: config/cache.md
- 代理与流量捕获: config/proxy/index.md
- 题目: challenge/index.md
- 比赛: game/index.md
- FAQ: faq/index.md
3 changes: 3 additions & 0 deletions docs/pages/challenge/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# 题目

## 创建第一道题目
3 changes: 3 additions & 0 deletions docs/pages/config/cache.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# 缓存

Cloudsdale 有两种缓存实现方式,一种是基于 `go-cache`,另一种是基于 `go-redis`,如果你有分布式需求,请使用 `go-redis` 保证缓存的正确性。
3 changes: 3 additions & 0 deletions docs/pages/config/database.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# 数据库

Cloudsdale 目前支持三种数据库,PostgreSQL,MySQL 和 SQLite
4 changes: 2 additions & 2 deletions docs/pages/config/index.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# 配置文件
# 配置

对于 Cloudsdale 而言,配置文件通常指的是 `application.json`
对于 Cloudsdale 而言,配置通常指的是 `application.json`
13 changes: 13 additions & 0 deletions docs/pages/config/proxy/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# 代理与流量捕获

Cloudsdale 的代理功能主要是为了流量捕获功能服务的。

当然,如果你不希望选手直接通过 IP 地址进入容器,你可以使用平台代理。你只需要保证 Cloudsdale 能够访问容器即可。

Clousdale 通过 **TCP over Websocket** 进行代理,简单来说,TCP over Websocket 就是通过一个 Websocket 链接(在 Cloudsdale 中是 `/api/proxies/[UUID]`)作为桥梁,连接靶机。

那又产生了一个问题,我是不是需要以 `ws://` 这样的形式来访问题目呢?这时候你就需要连接器。

所谓无感交互,就是让连接器在本地开启一个 TCP 端口,做题的时候你只需要向连接器提供 `ws://` 链接,然后访问被分配到的 TCP 端口即可,做题的体验没什么太大的区别。

Cloudsdale 推荐使用 [WebsocketReflectorX(简称 WSRX)](https://github.com/XDSEC/WebsocketReflectorX) 作为你的连接器。
2 changes: 1 addition & 1 deletion docs/pages/deploy/docker-k8s.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
# Docker + K8s 联合部署
# Docker + K8s 部署
77 changes: 74 additions & 3 deletions docs/pages/deploy/docker.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,75 @@
# Docker 部署
# Docker 部署

!!! info "提示"
如果你在举办一场小型的比赛,纯 Docker 部署可以大大节约你在平台配置上的时间
本篇将教会你如何快速地部署一个 Cloudsdale 实例。这个实例具有以下特点:

- 使用 PostgreSQL 作为数据库
- 使用 Docker 单机实例,承担平台和动态容器后端

部署她的方式非常简单,你只需要准备一个 `docker-compose.yml` 即可,当然,你可以直接从仓库中的 [deploys](https://github.com/ElaBosak233/Cloudsdale/blob/main/deploy) 目录中找到你所需要的,一个简单的 `docker-compose.yml` 应该长这样:

```yaml
version: "3.0"
services:
core:
image: elabosak233/cloudsdale:main
restart: always
ports:
- "8888:8888"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock" # 映射 Docker 守护进程,使得 Cloudsdale 可以控制宿主机 Docker
- "./configs:/app/configs" # 映射配置文件夹,里面存放 application.json
- "./media:/app/media" # 映射媒体资源文件夹,里面存放题目附件、用户头像等
- "./logs:/app/logs" # 映射日志文件夹
depends_on:
- db # 依赖于 db

db:
image: postgres:alpine
restart: always
ports:
- "5432:5432"
environment:
POSTGRES_USER: cloudsdale
POSTGRES_PASSWORD: cloudsdale
POSTGRES_DB: cloudsdale
volumes:
- "./db:/var/lib/postgresql/data"
```
你需要在你的服务器上建一个新的空文件夹,然后将 `docker-compose.yml` 放入其中,然后运行:

```
docker compose up
```
第一次运行大概率是失败的,因为 Cloudsdale 默认生成的配置中,依赖的数据库不是 PostgreSQL,我们需要在初始化后进入 `/configs/application.json` 进行些许修改
```json
"db": {
"provider": "postgres", // 修改这里
"postgres": {
"dbname": "cloudsdale",
"host": "db",
"username": "cloudsdale",
"password": "cloudsdale",
"port": 5432,
"sslmode": "disable"
},
"mysql": {
"dbname": "cloudsdale",
"host": "db",
"username": "cloudsdale",
"password": "cloudsdale",
"port": 3306
},
"sqlite": {
"path": "./db/db.sqlite"
}
},
```

修改完成后,再运行一遍 `docker compose up`,如果你看到下面这样的输出,那么恭喜你,Cloudsdale 启动的很成功,此后,你可以使用 `docker compose up -d` 将 Cloudsdale 以后台的形式启动

![](./img/1.png)

然后,你就可以通过 `http://localhost:8888` 进入 Cloudsdale,端口你可以通过编辑 `docker-compose.yml` 中的 `ports` 进行更改
File renamed without changes
2 changes: 1 addition & 1 deletion docs/pages/deploy/k8s.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
# K8s 部署
# K8s 部署
1 change: 1 addition & 0 deletions docs/pages/faq/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# FAQ
9 changes: 9 additions & 0 deletions docs/pages/game/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# 比赛

在介绍比赛功能前,需要先捋清一个关系,即用户、团队和比赛之间的关系。

用户是比赛的间接参与者,用户可以创建团队,并邀请其他用户加入团队;

团队是比赛的直接参与者,团队可以参与比赛,且参与比赛必须以团队为单位。

也就是说,不论是团队赛还是个人赛,用户都需要创建或者加入一个团队来参赛。
4 changes: 2 additions & 2 deletions docs/pages/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
!!! warning "警告"
Cloudsdale 仍然处于未发布阶段,快照构建成果可能十分不稳定,功能也可能未完善,快照的品质不能代表正式版本的品质。

**Cloudsdale** 是一个基于 GO 构建、使用解题模式(Jeopardy)的 CTF 平台。她非常地轻量,并且可以使用 _非常简单(可能)_ 的配置文件快速部署。
**Cloudsdale** 是一个基于 GO 构建、使用解题模式(Jeopardy)的 CTF 平台。她非常地 _轻量_,并且可以使用 _非常简单(可能)_ 的配置文件快速部署。

本项目灵感来源于 [CTFd](https://github.com/CTFd/CTFd)[Cardinal](https://github.com/05sec/Cardinal)[GZ::CTF](https://github.com/GZTimeWalker/GZCTF),博采众长之下诞生了本项目。但最初的想法仅仅以尽可能处处简单的方式,给学校的 CTF 战队提供训练平台。

Expand Down Expand Up @@ -32,6 +32,6 @@

## 开源协议

Cloudsdale 基于 [GPLv3](https://github.com/ElaBosak233/PgsHub/blob/main/LICENSE) 协议开源,使用和二次开发需严格遵守此协议。
Cloudsdale 基于 [GPLv3](https://github.com/ElaBosak233/Cloudsdale/blob/main/LICENSE) 协议开源,使用和二次开发需严格遵守此协议。

<div style="background-image: url('/assets/img/GPLv3_Logo.svg'); width: 10rem; height: 5rem; background-repeat: no-repeat; background-position: center; background-size: cover;"></div>
54 changes: 0 additions & 54 deletions docs/pages/proxy/index.md

This file was deleted.

Loading

0 comments on commit b5a0310

Please sign in to comment.