Skip to content

Commit

Permalink
chore: some containers
Browse files Browse the repository at this point in the history
  • Loading branch information
SantiiRepair committed Oct 9, 2023
1 parent 4a191b0 commit 7502aac
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ RUN make install
RUN wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
RUN dpkg -i google-chrome-stable_current_amd64.deb; apt-get -fy install
RUN rm -rf google-chrome-stable_current_amd64.deb; apt-get update
ENTRYPOINT ["python", "-m", "bot"]
ENTRYPOINT ["make", "start"]
9 changes: 6 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
.PHONY: install

run-container:
docker-compose up -d
run-containers:
docker-compose up -d --remove-orphans

remove-containers:
docker-compose down --volumes

install:
pip install --no-deps -U pytgcalls==3.0.0.dev24 tgcalls==3.0.0.dev6
Expand All @@ -17,6 +20,6 @@ lint:
session-string:
python ./session/session.py

start: install
start:
python -m bot

2 changes: 1 addition & 1 deletion bot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# ------------------------------------------------------------------------------

_API_ID = config.API_ID
_API_HASH = config.API_ID
_API_HASH = config.API_HASH
_BOT_TOKEN = config.BOT_TOKEN
_SESSION_STRING = config.SESSION_STRING
_POSTGRES_DB = config.POSTGRES_DB
Expand Down
9 changes: 6 additions & 3 deletions bot/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@

class Config(object):
def __init__(self):
current_dir = os.path.dirname(os.path.abspath(__file__))
path = os.path.join(current_dir, "../.env")
cwd = os.path.dirname(os.path.abspath(__file__))
path = os.path.join(cwd, "../.env")
load_dotenv(path)
self.API_HASH = os.getenv("API_HASH")

self.API_ID = os.getenv("API_ID")
self.API_HASH = os.getenv("API_HASH")
self.BOT_TOKEN = os.getenv("BOT_TOKEN")
self.BOT_USERNAME = os.getenv("BOT_USERNAME")
self.CHANNEL = os.getenv("CHANNEL")
Expand All @@ -20,6 +21,8 @@ def __init__(self):
self.POSTGRES_DB = os.getenv("POSTGRES_DB")
self.POSTGRES_USER = os.getenv("POSTGRES_USER")
self.POSTGRES_PASSWORD = os.getenv("POSTGRES_PASSWORD")
self.POSTGRES_HOST = os.getenv("POSTGRES_HOST")
self.POSTGRES_PORT = os.getenv("POSTGRES_PORT")
self.REDIS_HOST = os.getenv("REDIS_HOST")
self.REDIS_PASSWORD = os.getenv("REDIS_PASSWORD")
self.REDIS_PORT = os.getenv("REDIS_PORT")
Expand Down
4 changes: 2 additions & 2 deletions bot/plugins/commands/play_song.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,8 @@ async def _(client: Client, message: Message):
)
return await msg.edit(
f"__Added to queue at {position} \n\n Title: [{name}]({url})\nDuration: {duration} Minutes\n Requested by:__ [{data['first_name']}]({data['mention']})",
reply_markup=InlineKeyboardMarkup(
[[InlineKeyboardButton("cʟᴏꜱᴇ", callback_data="cls")]]
reply_markup=InlineKeyboardMarkup(
[[InlineKeyboardButton("cʟᴏꜱᴇ", callback_data="cls")]]
),
)
if message.chat.id not in get_queues():
Expand Down
6 changes: 3 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ services:
env_file:
- ./.env
ports:
- "$($POSTGRES_PORT):$($POSTGRES_PORT)"
- "$POSTGRES_PORT:$POSTGRES_PORT"
cache:
image: redis:7.2.1-alpine3.18
restart: always
Expand All @@ -18,7 +18,7 @@ services:
- cache:/data
command: redis-server --save 20 1 --loglevel warning --requirepass $REDIS_PASSWORD
ports:
- "$($REDIS_PORT):$($REDIS_PORT)"
- "$REDIS_PORT:$REDIS_PORT"
pgadmin:
image: dpage/pgadmin4
restart: always
Expand All @@ -32,7 +32,7 @@ services:
- "5050:80"
expose:
- 5050
bot:
app:
build: .
depends_on:
- db
Expand Down

0 comments on commit 7502aac

Please sign in to comment.