Sprocket is a platform primarily used to manage and automate organized Esports leagues, one such example being Minor League Esports.
The platform uses a Microservice pattern, and this repository contains everything needed to quickly start a new microservice.
Sprocket comes with a Docker Compose file that can be used to easily run the platform locally.
You will need
- A Discord OAuth Application
- Make sure that you have set up an OAuth Redirect URL of
http://api.l.ocket.cloud:8080/oauth/callback/discord
- If you are using a base url other than localhost; adjust the redirect url accordingly
- Make sure that you have set up an OAuth Redirect URL of
- Docker (compose) Installed
- The Bun Javascript Runtime
- If you're on Windows, you'll need to install WSL and Node.js/NPM
- That's it!
You may want
- A Steam API Key This is used to link Steam Accounts
- An Azure OAuth Application This is used for Microsoft / Xbox account linking
- Other platform OAuth applications as they become available
- A database client such as datagrip or dbeaver
- Make sure to not have a version of Postgres installed, as it could cause conflicting issues when you attempt to access the database using your client
- Once you have cloned the repository, copy
.env.example
to.env
- The root
config.yaml
is shared between all microservices, and can reference environment variables with sensible defaults. Some will be populated automatically (e.g. Postgres configuration), others will need to be set yourself - You will need to configure:
AUTH_DISCORD_CLIENT_ID
,AUTH_DISCORD_SECRET
andAUTH_DISCORD_BOT_TOKEN
- Bot token is only required if running the discord microservice
- Your Discord application will also need to be configured with the
redirect URL which this app uses:
http://api.l.ocket.cloud:8080/oauth/callback/discord
- The root
- Install dependencies by running
bun i
from the root of the project.- Sprocket uses Bun workspaces, which means that all dependencies are installed from the root of the project.
- When adding a new service or package, ensure that the root package.json is updated to include it
- Note for MacOS Users: Bun needs to be run within a linux container to
properly install dependencies, as we're running the whole project within
linux containers. To do this, run
docker run -v .:/app -w /app oven/bun bun i
instead of justbun i
above. Make sure yournode_modules/
folder is deleted before doing this!
- Once you have configured the environment to your liking,
docker compose up
, and navigate to l.ocket.cloud:8080. - Add your discord username under the "initial admins" in the
./config.yaml
file - Run the
./migrate-up
and./seed
scripts to initialize the database and populate it with some basic data
- Update all relevant containers in docker-compose.yaml
- Update the base image in Dockerfile