-
Notifications
You must be signed in to change notification settings - Fork 18
2. Getting involved with Development
While you do not need to be a member of Practical Python, or our GitHub Org in order to contribute to Zorak. Joining the organization is certainly the recommended way of doing things. It's free, there is no commitment, and you get the perks of a shiny badge on your profile, so why not?
To clone Zorak onto your local machine, use the command:
git clone https://github.com/practical-python-org/ZorakBot.git
A folder called ZorakBot will be added to the directory you are currently in, and all the project files will be added in it.
The bot is deployed using docker. Create an .env file from '.env.example', which is in the ZorakBot folder.
DISCORD_TOKEN=xxxxx # secret token found here https://discord.com/developers/applications
SERVER_SETTINGS=Resources/ServerConfig/PracticalPython # Path to the settings file that contains all Guild info
TAG=latest
ENVIRONMENT=dev # Lets us use just the one docker-compose for both dev and prod
LOGGING_LEVEL=20
STREAM_LOGS=FALSE
Docker will use these env variables to spin up your instance of Zorak.
Quick Note: Logging levels The logging level can be set in the .env file. Below is an overview of the name / integer value of the level.
- NOTSET=0
- DEBUG=10
- INFO=20
- WARN=30
- ERROR=40
- CRITICAL=50
You might want to run Zorak without using the database, if your feature does not require it. To do so simply use the following command:
python .\src\zorak\__main__.py -dt <DISCORD_TOKEN_HERE> -ssp Resources/ServerConfig/Zorak-Dev -dd True -cl True
-ssp: Variable that sets the location to the server settings to use. -dd: Flag that allows you to drop the database. -cl: Flag that enables streaming logs to console.
The easiest way to get started is to run Zorak locally and in our test server (Contact a repo admin for an invite!). After cloning the repo, simply run:
docker-compose up -d
Be warned, on the first run you have to download all the dependencies which can take a few minutes.
After making a change, rebuild only the Zorak container, and run the container using a token.
docker build -t zorak .
and then
docker run --env-file ./.env zorak -dd True -dt <DISCORD_TOKEN_HERE>
It's important that when you are finished using docker, you bring down all of your containers so the bot doesn't run on your machine forever. You can do that simply by using
docker-compose down
this command will stop all Zorak containers, remove them, and clean up the images.