Skip to content

Commit

Permalink
Merge pull request #84 from kastaid/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
illvart authored Apr 9, 2024
2 parents 8a665e1 + 643bd87 commit 7c5e2e6
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 19 deletions.
5 changes: 2 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ ENV TZ=Asia/Jakarta \
PATH=/opt/venv/bin:/app/bin:$PATH \
CHROME_BIN=/usr/bin/google-chrome \
DISPLAY=:99
ARG LANG=en_US

WORKDIR /app
COPY . .

RUN set -ex \
&& apt-get -qqy update \
&& apt-get -qqy install --no-install-recommends \
tini \
gnupg \
git \
curl \
Expand All @@ -40,7 +40,7 @@ RUN set -ex \
libnss3 \
unzip \
build-essential \
&& localedef --quiet -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 \
&& localedef --quiet -i ${LANG} -c -f UTF-8 -A /usr/share/locale/locale.alias ${LANG}.UTF-8 \
&& ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone \
&& dpkg-reconfigure --force -f noninteractive tzdata >/dev/null 2>&1 \
&& install -m 0755 -d /etc/apt/keyrings \
Expand All @@ -65,5 +65,4 @@ RUN set -ex \
&& apt-get -qqy clean \
&& rm -rf -- /var/lib/apt/lists/* /var/cache/apt/archives/* /etc/apt/sources.list.d/* /usr/share/man/* /usr/share/doc/* /var/log/* /tmp/* /var/tmp/*

ENTRYPOINT ["/usr/bin/tini", "--"]
CMD ["python3", "-m", "getter"]
1 change: 0 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: "3.9"
services:
worker:
build: .
Expand Down
4 changes: 2 additions & 2 deletions getter/core/base_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,8 @@ async def reboot(
import psutil

proc = psutil.Process(os.getpid())
for _ in proc.open_files() + proc.connections():
os.close(_.fd)
for p in proc.open_files() + proc.connections():
os.close(p.fd)
except BaseException:
pass
os.execl(sys.executable, sys.executable, "-m", "getter")
Expand Down
7 changes: 5 additions & 2 deletions getter/plugins/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,14 +195,17 @@ async def heroku_logs(kst) -> None:


async def restart_app() -> None:
os.system("clear")
try:
import psutil

proc = psutil.Process(os.getpid())
for _ in proc.open_files() + proc.connections():
os.close(_.fd)
for p in proc.open_files() + proc.connections():
os.close(p.fd)
except BaseException:
pass
reqs = Root / "requirements.txt"
os.system(f"{executable} -m pip install --disable-pip-version-check --default-timeout=100 -U -r {reqs}")
os.execl(executable, executable, "-m", "getter")


Expand Down
1 change: 0 additions & 1 deletion lite-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: "3.9"
services:
getter:
build:
Expand Down
5 changes: 2 additions & 3 deletions lite.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,20 @@ ENV TZ=Asia/Jakarta \
DEBIAN_FRONTEND=noninteractive \
VIRTUAL_ENV=/opt/venv \
PATH=/opt/venv/bin:/app/bin:$PATH
ARG LANG=en_US

WORKDIR /app
COPY . .

RUN set -ex \
&& apt-get -qqy update \
&& apt-get -qqy install --no-install-recommends \
tini \
gnupg2 \
git \
locales \
tzdata \
build-essential \
&& localedef --quiet -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 \
&& localedef --quiet -i ${LANG} -c -f UTF-8 -A /usr/share/locale/locale.alias ${LANG}.UTF-8 \
&& ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone \
&& dpkg-reconfigure --force -f noninteractive tzdata >/dev/null 2>&1 \
&& python3 -m venv $VIRTUAL_ENV \
Expand All @@ -35,5 +35,4 @@ RUN set -ex \
&& apt-get -qqy clean \
&& rm -rf -- /var/lib/apt/lists/* /var/cache/apt/archives/* /etc/apt/sources.list.d/* /usr/share/man/* /usr/share/doc/* /var/log/* /tmp/* /var/tmp/*

ENTRYPOINT ["/usr/bin/tini", "--"]
CMD ["python3", "-m", "getter"]
1 change: 0 additions & 1 deletion local-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: "3.9"
services:
getter:
build: .
Expand Down
2 changes: 1 addition & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
ruff==0.3.4
ruff==0.3.5
black==24.3.0
isort==5.13.2
10 changes: 5 additions & 5 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ https://github.com/kastaid/Telethon/archive/main.tar.gz
cryptg==0.4.0
psutil==5.9.8
heroku3==5.2.1
GitPython==3.1.42
GitPython==3.1.43
SQLAlchemy==2.0.29
asyncpg==0.29.0
aiosqlite==0.20.0
Expand All @@ -17,13 +17,13 @@ aiohttp[speedups]==3.9.3
httpx==0.27.0
Markdown==3.6
beautifulsoup4==4.12.3
emoji==2.10.1
emoji==2.11.0
Unidecode==1.3.8
validators==0.24.0
validators==0.28.0
telegraph==2.2.0
requests==2.31.0
lottie==0.7.0
Pillow==10.2.0
Pillow==10.3.0
CairoSVG==2.7.1
uvloop==0.19.0
orjson==3.9.15
orjson==3.10.0

0 comments on commit 7c5e2e6

Please sign in to comment.