- Notifications
You must be signed in to change notification settings - Fork10
Backend code forhttps://avrae.io
License
avrae/avrae-service
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Avrae is a bot to facilitate running Dungeons & Dragons 5e online over Discord. This project is the backend to serveavrae.io.
You can join the Avrae Development Discordhere!
- Python 3.10+
- MongoDB server
- Redis server
See the README in avrae/avrae for additional instructions and links to dependencies.
The development config defaults to the MongoDB/Redis servers run byAvrae DockerCompose.
- Copy
docker/config-development.py
toconfig.py
. - The dev config should point to the services exposed by the Avrae docker-compose file. If necessary, set theenvironment variables
MONGO_URL
andREDIS_URL
to override connection strings. - Set the
DISCORD_CLIENT_ID
,DISCORD_CLIENT_SECRET
, andDISCORD_BOT_TOKEN
environment variables to the values foryour application, found in theDiscord Developer Portal. - Set the
JWT_SECRET
env var to any value of your choice.
Env Var Overview
MONGO_URL
- Override connection string to MongoDB, defaults to exposed instance from avrae/avrae docker composeREDIS_URL
- Override connection string to Redis, defaults to exposed instance from avrae/avrae docker composeDISCORD_CLIENT_ID
- Discord application Client ID (Dev Portal -> Application -> OAuth2)DISCORD_CLIENT_SECRET
- Discord application Client Secret (Dev Portal -> Application -> OAuth2)DISCORD_BOT_TOKEN
- Discord application Bot User Token (Dev Portal -> Application -> Bot)JWT_SECRET
- Used to sign JWTs issued by the serviceELASTICSEARCH_ENDPOINT
(optional) - Used to specify URL of an ElasticSearch instance for Alias Workshop
The Avrae service requires ElasticSearch for some features (e.g. searching alias workshop collections). You shouldeither set up a dev ElasticSearch instance on AWS, or run an openElasticSearch distro.
Whichever you choose, set theELASTICSEARCH_ENDPOINT
env var. The service will work without this set, but AliasWorkshop endpoints might have undefined behaviour.
- Create avirtual environment:
python3 -m venv venv
. - Activate the venv:
source venv/bin/activate
on Unix (bash/zsh),venv\Scripts\activate.bat
on Windows. - Install the required Python packages:
pip install -r requirements.txt
. - Run the app:
python -m flask run
.
The service should now be accessible athttp://localhost:5000.
Should you have authentication errors and DB not loading locally, you can update line 38 in app.py to the below.
app.mdb = mdb = PyMongo(app, config.MONGO_URL).cx["avrae"]
- Build the Docker image:
docker build -t avrae-service:latest --build-arg ENVIRONMENT=development .
. - Run the Docker image:
docker run -p 58000:8000 avrae-service:latest
.
The service should now be accessible athttp://localhost:58000.
- Build the Docker image:
docker build -t avrae-service:latest
. - Deploy it in whatever fashion your production environment requires.
The service should now be accessible athttp://IP.ADDRESS:8000.
Avrae usesBlack to format and lint its Python code.Black is automatically run on every commit via pre-commit hook, and takes its configuration options from thepyproject.toml
file.
The pre-commit hook is installed by by runningpre-commit install
from the repo root.The hook's configuration is governed by the.pre-commit-config.yaml
file.
In order to runpre-commit
orblack
, they must be installed.These dependencies are contained within therequirements.txt
file, and can be installed like so:
(venv) $ pip install -r requirements.txt
About
Backend code forhttps://avrae.io
Topics
Resources
License
Code of conduct
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Uh oh!
There was an error while loading.Please reload this page.
Contributors10
Uh oh!
There was an error while loading.Please reload this page.