Skip to content
This repository was archived by the owner on Oct 3, 2022. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
LOCKOUT_BOT_TOKEN=""
LOGGING_CHANNEL=""
DB_HOST="127.0.0.1"
DB_NAME=""
DB_USERNAME=""
DB_PASSWORD=""
CHALLONGE_KEY=""
CHALLONGE_KEY=""
16 changes: 16 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM python:3.8.2-buster

# Copy files to /app
ADD . ./app

# Set workdir
WORKDIR /app

# Install dependencies
RUN apt-get install -y make automake gcc g++

# Install python dependencies
RUN pip install -r requirements.txt

# Run the bot
CMD ["python", "main.py"]
3 changes: 1 addition & 2 deletions data/dbconn.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class DbConn:
def __init__(self):
load_dotenv('.env')
self.conn = psycopg2.connect(database=os.environ.get("DB_NAME"), user=os.environ.get("DB_USERNAME"),
password=os.environ.get("DB_PASSWORD"), host="127.0.0.1", port="5432")
password=os.environ.get("DB_PASSWORD"), host=os.environ.get("DB_HOST"), port="5432")
self.make_tables()

def make_tables(self):
Expand Down Expand Up @@ -914,4 +914,3 @@ def get_recent_tournaments(self, guild):
Tournament = namedtuple("Tournament", "guild name type id url winner time")
return [Tournament(x[0], x[1], x[2], x[3], x[4], x[5], x[6]) for x in data]


46 changes: 46 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
version: '3.0'

services:
postgres:
container_name: lockout_postgres
image: postgres
environment:
POSTGRES_USER: ""
POSTGRES_PASSWORD: ""
PGDATA: /data/postgres
volumes:
- postgres:/data/postgres
ports:
- "5432:5432"
networks:
- lockout
restart: unless-stopped

bot:
container_name: lockout_bot
build: .
volumes:
- lockout:/data
networks:
- lockout
depends_on:
- postgres
restart: unless-stopped
environment:
LOCKOUT_BOT_TOKEN: ""
LOGGING_CHANNEL: ""
DB_HOST: "postgres"
DB_NAME: "postgres"
DB_USERNAME: ""
DB_PASSWORD: ""
CHALLONGE_KEY: ""

volumes:
lockout:
external: false

postgres:
external: false

networks:
lockout: