Skip to content

Commit

Permalink
FIX: try cron job
Browse files Browse the repository at this point in the history
  • Loading branch information
skysea04 committed Aug 16, 2024
1 parent 764d1c3 commit e704c2c
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy-docker-gce.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Deploy to Google Compute Engine
on:
push:
branches:
- master
- dev

jobs:
build-and-push:
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ RUN mkdir -p logs/ && \
apt install -y libpq5 procps cron && \
pip install -r /requirements/live.txt && \
chmod -R 755 /src/jobs/ && \
echo "30 */8 * * * /src/jobs/health_check.sh" >> /var/spool/cron/crontabs/root && \
echo "0 18 * * * /src/jobs/remind_snap_up.sh" >> /var/spool/cron/crontabs/root && \
printenv > /etc/environment
echo "30 */8 * * * su root /src/jobs/health_check.sh" >> /var/spool/cron/crontabs/root && \
echo "0 18 * * * su root /src/jobs/remind_snap_up.sh" >> /var/spool/cron/crontabs/root && \
set > /etc/environment

CMD nohup python manage.py continue_snap_up & cron && gunicorn --bind=0.0.0.0:8000 --timeout=300 --keep-alive=60 src.wsgi:application
4 changes: 2 additions & 2 deletions requirements/live.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ gunicorn==23.0.0
humanfriendly==10.0
idna==3.7
mpmath==1.3.0
numpy==1.26.4
onnxruntime==1.18.1
numpy==2.0.1
onnxruntime==1.19.0
opencv-python-headless==4.10.0.84
packaging==24.1
phonenumbers==8.13.43
Expand Down
6 changes: 2 additions & 4 deletions src/jobs/health_check.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#!/bin/bash
export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
source /etc/environment

source /etc/environment >> /src/logs/cron.log 2>&1
cd /src
python manage.py snap_up_health_check >> /src/logs/cron.log 2>&1
python manage.py snap_up_health_check
6 changes: 2 additions & 4 deletions src/jobs/remind_snap_up.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#!/bin/bash
export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
source /etc/environment

source /etc/environment >> /src/logs/cron.log 2>&1
cd /src
python manage.py remind_snap_up >> /src/logs/cron.log 2>&1
python manage.py remind_snap_up

0 comments on commit e704c2c

Please sign in to comment.