Skip to content
Draft
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
17 changes: 17 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# git
.git/
.gitignore

# vim
**/*.swp

# database
pgdata/

# envvars
.env
.env.example

# docker
.dockerignore
docker-compose.yml
12 changes: 12 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# docker-compose configuration for postgres
DB_PORT=5432
DB_VOLUME="/absolute/path/to/pgdata"

# postgres startup variables
POSTGRES_USER=discordoragi
POSTGRES_PASSWORD="CHANGE THIS TO A SAFE PASSWORD"
POSTGRES_DB=discordoragi

# connection info for db
DB_URL="postgresql://"
DB_HOST=db
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,12 @@ oauth.ini
#Pycharm
.idea
.vscode

# Vim
**/*.swp

# Configuration
.env

# Database
pgdata/
1 change: 0 additions & 1 deletion .python-version

This file was deleted.

11 changes: 11 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM ubuntu:latest

ENV PATH="/root/.local/bin:$PATH"

WORKDIR /app

COPY pyproject.toml .

RUN apt update && apt install -y tree vim postgresql-client build-essential libssl-dev libffi-dev python3 python3-dev python3-pip python3-venv && pip install pipx && pipx install poetry && poetry install

COPY . .
3 changes: 0 additions & 3 deletions cogs/__init__.py

This file was deleted.

Empty file added discordoragi/__init__.py
Empty file.
3 changes: 1 addition & 2 deletions bot/__init__.py → discordoragi/bot/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

from bot.discordoragi import Discordoragi
from .discordoragi import Discordoragi


__all__ = ['Discordoragi', 'SessionManager', 'HTTPStatusError']
4 changes: 2 additions & 2 deletions bot/discordoragi.py → discordoragi/bot/discordoragi.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import yaml
from time import time
from aiohttp_wrapper import SessionManager
from helpers.discord_helpers import get_name_with_discriminator
from helpers import PostgresController
from ..helpers.discord_helpers import get_name_with_discriminator
from ..helpers import PostgresController
from logging import Formatter, INFO, StreamHandler, getLogger


Expand Down
3 changes: 3 additions & 0 deletions discordoragi/cogs/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from .search import Search

__all__ = ['Search']
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions run.py → discordoragi/run.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"""
Actually runs the code
"""
from bot import Discordoragi
from cogs import Search
from .bot import Discordoragi
from .cogs import Search
from asyncio import get_event_loop


Expand Down
33 changes: 33 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
version: '3.8'
services:
db:
image: postgres:14-alpine
restart: always
volumes:
- discordoragi_pgdata:/var/lib/postgresql/data
expose:
- "${DB_PORT}"
environment:
POSTGRES_USER: "${POSTGRES_USER}"
POSTGRES_PASSWORD: "${POSTGRES_PASSWORD}"
POSTGRES_DB: "${POSTGRES_DB}"
test:
build: .
image: discordoragi_test:latest
depends_on:
- db
environment:
DB_URL: "${DB_URL}"
DB_USER: "${POSTGRES_USER}"
DB_PASSWORD: "${POSTGRES_PASSWORD}"
DB_HOST: "${DB_HOST}"
DB_PORT: "${DB_PORT}"
DB_DATABASE: "${POSTGRES_DB}"
command: ["sleep", "infinity"]
volumes:
discordoragi_pgdata:
driver: local
driver_opts:
type: none
o: bind
device: "${DB_VOLUME}"
Empty file added pgdata/.gitkeep
Empty file.
Loading