The bot for the Networking Discord server
This bot is prepared to run either as a bare Python script, Heroku dyno, or Docker image. In this guide, the running configurations will be knows as 'direct', 'heroku' or docker respectively. All configuration options are therefore intended to be set via environment variables.
cryptography
package installed.)echo "from cryptography.fernet import Fernet; print(Fernet.generate_key().decode())" | python3 1 ↵
If you're using Kubernetes, Docker, or Heroku, create file in the base of the project named .env
with the contents:
Replace all values as appropriate:
BOT_DESCRIPTION='[testing] The Networking Discord Bot'
COMMAND_PREFIX=^
EGGSROLE_NAME='!eggs'
GUILD_NAME=Networking-Dev
LOGCHANNEL_NAME=cnc
MEMBERCHANNEL_NAME=general
MEMBERROLE_NAME=Members
TOKEN=<YourBotsPrivateToken>
WELCOMECHANNEL_NAME=welcome
MIRRORCHANNEL_NAME=egg-qc
SMTP_USERNAME=mysmtpusername
SMTP_PASSWORD=mysmtppassword
SMTP_SERVER=in-v3.mailjet.com
SMTP_PORT=587
SMTP_FROMEMAIL=bot@domain.com
SECRETKEY=Secret key from Step 1
DB_HOST=mongodb.hostname
DB_PORT=27017
DB_NAME=network_ranger
DB_USER=<dbuser>
#DB_PASS=<dbpass>
If you're running this directly instead of as a container, you will need to load each one of these as an environment variable. Also, DB_PASS is commented as it should be loaded from your MongoDB secret if installed with Kubernetes. If not running with Kubernetes, you'll need to populate this.
helm repo add bitmami https://hub.helm.sh/charts/bitnami
helm install -n network-ranger mongodb bitnami/mongodb
cp kube-deploy.example.yaml kube-deploy.yaml
kube-deploy.yaml
to your liking. The default should work for most users.kubectl create -f kube-deploy.yaml
kubectl create secret generic network-ranger -n network-ranger --from-env-file .env
kubectl get pods -n network-ranger
cd
into your directory containing the .env
file you created in Step 2docker run --env-file=.env netdiscord/network-ranger:latest
pwd
and running:
docker build -t network-ranger .
docker run --env-file=.env network-ranger
heroku local
cd
into your directory containing the .env
file you created in Step 2. This must also be the base
directory of the project in which the Dockerfile
resides.heroku local
.env
file by default.requirements.txt
:
pip install -r requirements.txt
python3 network_ranger