For Laszlo!
-
Clone Repository
git clone git@github.com:PizzaDAO/pizza-discord-bots.git && cd pizza-discord-bots
-
Run Docker Container
docker-compose up --build
If you're new to docker, don't fret; check out this guide
We are using Azure Services to host our web app for containers. We have also integrated Azure DevOps to set up a minimal viable CI/CD pipeline.
Currently, you can trigger a container build pipeline by creating a PR with the main
branch. If the build is successful, the image is pushed to our Azure container registry. Subsequently, the PR will update with the build status. Once a PR is approved, the production release pipeline is triggered. This simply takes the image from our container registry and deploys it to our Azure App Service.
You can monitor the status of the web app and discord bot here: https://super-pizza-trainer.azurewebsites.net/
Because we have no intermediary stages (i.e. dev, staging, qa, etc.) you need to ensure the image you build locally works. I suggest creating a separate discord server (it's free) and spinning up a new bot that you can use to test your changes. Please refer to the Testing section below.
pip freeze > requirements.txt
Using pip freeze
installs all packages, even those from other projects
Instead, you can update requirements by using pipreqs
pip install pipreqs
then
pipreqs path/to/project
If you're running it within the repo (i.e. cd pizza-discord-bots
), you can use the following command
pipreqs . --force
--force
is used to overwrite existing file
TODO
Simply do the following once you have a new discord server:
-
Create a new bot here
-
Apply the same permissions as the bot you are modifying
-
Create a
.env
file -
Add the following env variables
TOKEN=<your-new-test-bot-token-hurr>
WEBSITES_PORT=8080
-
Create and start all the services by running the following command:
docker-compose up --build
-
Manually test away!
If you're new to contributing to open source projects and/or projects with many different contributors, being familiar with Git is basically a must. There are several version control systems but Git is probably the most common.
Checkout this article to familiarize yourself with Git.
Here is the tl;dr for getting started with this repo:
Initial setup:
- Create a folder where you want all your pizzaDAO repos to live in
mkdir pizzaDAO
- Change into that directory
cd pizzaDAO
- Clone the repo
git clone https://github.com/PizzaDAO/pizza-discord-bots.git
You should now have the latest and greatest version of the code on your local machine. The following steps/commands will be used frequently so really try to familiarize yourself with them. This is what streamlines collaboration between many people across the world!
git switch main
makes sure you are on the main branch! This is set to track themain
branch you see on the website.git pull
this grabs any updates to themain
branch on the website that others might have made. you always want to have the latest changes to avoid any unnecessary conflicts. Conflicts happen when two or more people make changes to the same code in a file. These usually are resolved on their own but sometimes, if the changes are complex, a human has to manually resolve the conflicts.git checkout -b <new_feature>
make sure you work on a new branch which you will push to the website.git add -A
once you have made all the changes and tested, add all the files that you want to commit. You can also add specific files by listing them in place of-A
i.e.git add file_1.py file_2.py
etc.git commit -m"enter a message here about the changes you made"
commits the files; add a nice short message that summarizes the changes you made.This helps devs understand the history of the code. To view past commits usegit log
and tap the space bar to scroll down; type q to exit that view. I usually do the followinggit log | head -n 15
where -n is the # of lines you want to view starting from the top. 15 is usually enough to view the last 2-3 commits.git push -u origin <new_feature_branch>
wherenew_feature_branch
is whatever you named your branch instep 3
above.- Finally, go to the website and create a Pull Request (PR) request from
new_feature_branch
intomain
. Enter a short descriptive title and fill out the description with any relevant details/questions/concerns you have regarding the PR. Tag someone for a review and let them give you feedback; if it's good to go, they will approve and merge.
If changes are requested, simply make the changes on the same branch and start from step 4 above to push the updates! It will update the same PR so ignore step 7. Please don't create a new PR since we want to maintain all of the feedback in one location so that if many people are reviewing it, they are aware of why certain changes have been made.
For a deeper dive into Git, checkout thier website: https://git-scm.com/