Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PVE Speedrun Tracking #587

Merged
merged 17 commits into from
Jan 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
* text=auto
docs/* linguist-documentation
go.sum linguist-generated merge=ours
go.mod linguist-generated
* text=auto eol=lf
docs/* linguist-documentation eol=lf
go.sum linguist-generated merge=ours eol=lf
go.mod linguist-generated eol=lf

/.github export-ignore
.gitattributes export-ignore
.gitignore export-ignore
/.github export-ignore eol=lf
.gitattributes export-ignore eol=lf
.gitignore export-ignore eol=lf

/frontend/src/icons/* binary
/frontend/src/fonts/* binary
*.js text
*.json text
*.ts text
*.md text
*.yml text
*.js text eol=lf
*.json text eol=lf
*.ts text eol=lf
*.md text eol=lf
*.yml text eol=lf

*.dem binary
*.png binary
Expand Down
32 changes: 16 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ all: frontend sourcemod buildp
fmt:
gci write . --skip-generated -s standard -s default
gofumpt -l -w .
cd frontend && pnpm prettier src/ --write
make -C frontend fmt
# cd frontend && pnpm prettier src/ --write

bump_deps:
go get -u ./...
cd frontend && pnpm update -i
make -C frontend update

buildp: frontend
goreleaser release --clean
Expand All @@ -23,13 +24,13 @@ builds: frontend
goreleaser release --clean --snapshot

watch:
cd frontend && pnpm run watch
make -C frontend watch

serve:
cd frontend && pnpm run serve
make -C frontend serve

frontend:
cd frontend && pnpm install --frozen-lockfile && pnpm run build
make -C frontend

dist: frontend build
zip -j gbans-`git describe --abbrev=0`-win64.zip build/win64/gbans.exe LICENSE README.md gbans_example.yml
Expand All @@ -56,7 +57,7 @@ sourcemod_devel: sourcemod
test: test-go test-ts

test-ts:
@cd frontend && pnpm run test
make -C frontend test

test-go:
@go test $(GO_FLAGS) -race ./...
Expand All @@ -80,19 +81,18 @@ fix: fmt
golangci-lint run --fix

lint_ts:
cd frontend && pnpm run eslint:check && pnpm prettier src/ --check
make -C frontend lint

typecheck_ts:
cd frontend && pnpm run typecheck
make -C frontend typecheck

static:
staticcheck -go 1.23 ./...

clean:
@go clean $(GO_FLAGS) -i
rm -rf ./build/
rm -rf ./frontend/dist
rm -rf ./frontend/node_modules
make -C frontend clean
rm -rf ./sourcemod/plugins/gbans.smx

docker_test:
Expand All @@ -111,16 +111,16 @@ docker_restore:

run_docker_snapshot: builds
docker build . --no-cache -t gbans:snapshot
docker run -it -v ./gbans.yml:/app/gbans.yml -p 6006:6006 gbans:snapshot
docker run -it -v ./gbans.yml:/app/gbans.yml -v ./.cache:/app/.cache -p 6006:6006 gbans:snapshot

docs_setup:
cd docs && pnpm i
docs_install:
make -C docs install

docs_start:
cd docs && pnpm start
make -C docs start

docs_deploy:
cd docs && pnpm deploy
make -C docs deploy

docs_build:
cd docs && pnpm build
make -C docs build
2 changes: 1 addition & 1 deletion docker/test-backend.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.22-alpine
FROM golang:1.23-alpine
RUN apk add make gcc g++
WORKDIR /build
COPY go.mod go.sum ./
Expand Down
18 changes: 18 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
all: build

install:
pnpm install

start:
pnpm start

deploy:
pnpm deploy

build:
pnpm build

clean:
rm -rf build
rm -rf node_modules

31 changes: 21 additions & 10 deletions docs/docs/install/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,30 @@ Gbans is lightweight and can handle a small to moderately sized community with a

Special considerations need to be made when using extended functionality:

It's recommended, but not required, to use a dedicated server for installation. The application is fairly lightweight, but some features
It's recommended, but not required, to use a dedicated server for installation. The application is fairly lightweight,
but some features
will take some computational power which can interrupt other processes. This includes things like downloading demos
over SSH/SCP and processing users stats. If you omit these features, it should be able to run alongside a game server fairly
over SSH/SCP and processing users stats. If you omit these features, it should be able to run alongside a game server
fairly
well on a VPS. Ram usage is pretty negligible, but if you have a lot of servers and a long history, you may want to
increase the ram allocated to postgres.

If you are hosting game servers and gbans on the same host, you will likely want to specify [GOMAXPROCS](https://pkg.go.dev/runtime#hdr-Environment_Variables)
when starting gbans so that you can set processor affinity/cpuset properly to ensure they are not fighting each other for resources.
If you are hosting game servers and gbans on the same host, you will likely want to
specify [GOMAXPROCS](https://pkg.go.dev/runtime#hdr-Environment_Variables)
when starting gbans so that you can set processor affinity/cpuset properly to ensure they are not fighting each other
for resources.

IP2Location updates are a fairly intensive process, so considerations should be taken as far as how and when to update the database
IP2Location updates are a fairly intensive process, so considerations should be taken as far as how and when to update
the database
to ensure it doesn't impact other things on the system.

## Runtime requirements

Running the binaries is very easy as they are statically compiled. All frontend assets are embedded into the binary
to make deployment as trivial as possible.

- Any modern-ish postgresql install with [PostGIS](https://postgis.net/) & [ip4r](https://github.com/RhodiumToad/ip4r) extensions. All non-EOL versions of postgres should work.
- Any modern-ish postgresql install with [PostGIS](https://postgis.net/) & [ip4r](https://github.com/RhodiumToad/ip4r)
extensions. All non-EOL versions of postgres should work.
- A platform that go supports. Only linux and windows amd64 are tested, but as far as I know, others should work.

## Sourcemod Plugins
Expand All @@ -40,7 +46,8 @@ instructions:
- [sm-ripext](https://github.com/ErikMinekus/sm-ripext) Provides HTTP(S) client functionality
- [sm-json](https://github.com/clugg/sm-json) `Required for development only` Provides JSON encoding/decoding.
- [Connect](https://github.com/asherkin/connect) Provides `OnClientPreConnectEx`
- [SourceTVManager](https://github.com/peace-maker/sourcetvmanager) Interface to interact with the SourceTV server from SourcePawn.
- [SourceTVManager](https://github.com/peace-maker/sourcetvmanager) Interface to interact with the SourceTV server from
SourcePawn.

## gbans Server

Expand All @@ -50,8 +57,9 @@ Precompiled binaries will be provided once the project is in a more stable state
images as they are currently the only tested usecase.

- [make](https://www.gnu.org/software/make/) Not strictly required but provides predefined build commands
- [golang 1.22+](https://golang.org/) Version >=1.22 is required.
- [PostgreSQL](https://www.postgresql.org/) Version 16 is the only version currently tested against. All non-EOL versions should be supported.
- [golang 1.23+](https://golang.org/) Version >=1.23 is required.
- [PostgreSQL](https://www.postgresql.org/) Version 16 is the only version currently tested against. All non-EOL
versions should be supported.
- [PostGIS](https://postgis.net/) Provides some basic GIS functionality.
- [ip4r](https://github.com/RhodiumToad/ip4r) Improved ip/cidr indexed and types.
- [Node.js >=18.17.1](https://nodejs.org/en/) To build frontend
Expand All @@ -72,12 +80,14 @@ Clone the gbans repository
```shell
git clone [email protected]:leighmacdonald/gbans.git && cd gbans
````

Build the projects, replace SM_ROOT with the path to your sourcemod installation directory (the folder with addons and
cfg folders inside).

```shell
SM_ROOT=~/sourcemod make
````

You should now have a binary located at `./build/$platform/gbans`

### Docker
Expand Down Expand Up @@ -139,4 +149,5 @@ SSLCertificateKeyFile /etc/cloudflare/example.com.key
</IfModule>
```

If using Cloudflare to provide user location, you can use Origin Certificates to generate a long-lasting SSL certificate.
If using Cloudflare to provide user location, you can use Origin Certificates to generate a long-lasting SSL
certificate.
13 changes: 7 additions & 6 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
"dependencies": {
"@docusaurus/core": "3.3.2",
"@docusaurus/preset-classic": "3.3.2",
"@mdx-js/react": "^3.0.0",
"clsx": "^2.0.0",
"prism-react-renderer": "^2.3.0",
"react": "^18.0.0",
"react-dom": "^18.0.0"
"@mdx-js/react": "^3.0.1",
"clsx": "^2.1.1",
"prism-react-renderer": "^2.3.1",
"react": "^18.3.1",
"react-dom": "^18.3.1"
},
"devDependencies": {
"@docusaurus/module-type-aliases": "3.3.2",
Expand All @@ -43,5 +43,6 @@
},
"engines": {
"node": ">=18.0"
}
},
"packageManager": "[email protected]+sha512.73a29afa36a0d092ece5271de5177ecbf8318d454ecd701343131b8ebc0c1a91c487da46ab77c8e596d6acf1461e3594ced4becedf8921b074fbd8653ed7051c"
}
22 changes: 11 additions & 11 deletions docs/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 37 additions & 0 deletions frontend/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
all: install build

install:
pnpm install --frozen-lockfile

build:
pnpm run build

watch:
pnpm run watch

serve:
pnpm run serve

update:
pnpm update -i

test:
pnpm run test

fmt:
pnpm run prettier:fix

typecheck:
pnpm run typecheck

lint: eslint prettier

eslint:
pnpm run eslint:check

prettier:
pnpm prettier:check

clean:
rm -rf dist
rm -rf node_modules
Loading
Loading