-
Clone the repository:
git clone https://github.com/quyencodes/orchid-bot.git
-
Ensure that you have Python (at least 3.11) installed on your computer. Please downgrade if needed or build the virtual enviornment in Python 3.11 to protect against compatability issues:
python --version
-
Pip should be automatically installed when you install Python, but ensure pip is installed by:
pip --version
-
Install relevant packages:
pip install -r requirements.txt
-
Copy example.env and rename to .env:
DISCORD_TOKEN = 'YOUR DISCORD TOKEN HERE'
-
Run main.py:
python3 main.py
In order to run our application with hot reload, please ensure node and npm are installed on your machine. We strongly recommend installing npm as your Node.js manager.
-
Install npm:
npm install -g npm
-
Install node:
npm install node
-
Install necessary packages:
npm install
-
Run application using hot reload:
npm run start
Please refer to the steps below to deploy your discord bot (Source):
- Go to AWS and sign up for an account. Once logged in, please hover the Apps Logo labeled Services on the top left. Navigate to All Services and find EC2.
- Select
Launch Instance
- Below is an example of what sections to change. If not stated - please leave as default
Name: something-one-word
Application and OS Images: Ubuntu (any free tier eligible)
Key pair (login):
Create new key pair ->
Key pair name: [name]-key
Type: RSA
Format: .pem
Download the key pair .pem file and save this file in the same directory as your application
Networking settings: Default is okay
- Select
Connect to instance
and click theSSH client
subtab
-
Make sure your .pem file is saved within the same directory as your application
Project/ ── orchid-bot/ ── main.py ── ... ── orchid-key.pem
-
Navigate to the directory where your .pem file is, ensure your key is not publicly viewable
chmod 400 "your-key.pem"
-
Connect to your instance using its Public DNS:
ssh -i "your-key.pem" [email protected]
-
Please run the following commands to install Node and npm on your EC2 instance:
sudo apt-get update sudo apt-get install nodejs sudo apt-get install npm
-
Install Python and pip on your EC2 instance:
sudo apt install python3 python3 --version sudo apt install python3-pip pip3 --version pip install -r requirements.txt
-
Set your env variables
export MY_VARIABLE=VALUE
-
Check if you've set your env variables correctly
env
-
Clone your repo onto your EC2 instance and change directories into repo
git clone https://github.com/quyencodes/orchid-bot.git
-
Run your bot (make sure to cd into the project on your EC2 instance)
python3 main.py
-
The bot will ONLY run while you have your terminal open. In order for it to be run after you've logged out of your EC2 instance, please
-
Please run the following commands:
sudo npm install -g pm2
-
Set your env variables and run the following command, please replace values accordingly
pm2 start your_app.py --name "your_app_name" --env '{"DISCORD_TOKEN": ASDFGHJKL123456789}
-
Run the following commands to check on your instance and read pm2 terminal
pm2 list pm2 logs