diff --git a/README.md b/README.md index eb02906..90d6226 100644 --- a/README.md +++ b/README.md @@ -28,3 +28,69 @@ The main use case is for [Medkit](https://github.com/kayteh/medkit2) bot to have - There is deliberately no persistence. - Redis "Tender" - Cleans up Redis every 5 mins. + +# Developing + +This app is built with Rust. You can set up a build environment via https://rustup.rs/ + +To run, + +```sh +# Start Redis/backing services +docker compose up -d + +# Start Websocket for PC +env \ + WS_ADDR="wss://push.planetside2.com/streaming?environment=ps2&service-id=s:$SERVICE_ID" \ + PAIR=pc \ + ROLE=primary \ + WORLDS=1,10,13,17,19,40 \ + cargo run --bin websocket + +# (Optional:) Start redundant websocket for PC +env \ + WS_ADDR="wss://push.planetside2.com/streaming?environment=ps2&service-id=s:$SERVICE_ID" \ + PAIR=pc \ + ROLE=backup \ + WORLDS=1,10,13,17,19,40 \ + cargo run --bin websocket + +# (Optional:) Start PS4US websocket +env \ + WS_ADDR="wss://push.planetside2.com/streaming?environment=ps2ps4us&service-id=s:$SERVICE_ID" \ + PAIR=ps4us \ + WORLDS=1000 \ + cargo run --bin websocket + +# (Optional:) Start PS4EU websocket +env \ + WS_ADDR="wss://push.planetside2.com/streaming?environment=ps2ps4eu&service-id=s:$SERVICE_ID" \ + PAIR=ps4eu \ + WORLDS=2000 \ + cargo run --bin websocket + +# Start API +cargo run --bin api + +# Run prune tool +cargo run --bin tools prune + +# Build containers +docker build . --build-arg SERVICE=api -t saerro:api +docker build . --build-arg SERVICE=tools -t saerro:tools +docker build . --build-arg SERVICE=websocket -t saerro:websocket +``` + +## Code Generation + +Some aspects of this code are based on "moving parts" within PlanetSide 2. If these change, you can run `cargo run --bin codegen` to regenerate these from API. PRs are accepted for this :) + +# Deploying + +Currently, the entire stack runs on Docker. You may deploy it to any server via: + +```sh +docker compose up -d -f docker-compose.live.yaml +``` + +It listens on port 80, it's up to you from here.