Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/cronjob #83

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
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
14 changes: 13 additions & 1 deletion back/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,16 @@ RUN poetry config virtualenvs.create false \
&& poetry install --no-interaction --no-ansi
COPY . /app/

CMD python manage.py migrate && gunicorn --bind 0.0.0.0:$PORT config.wsgi
RUN apt-get update && apt-get install -y cron

# Copy cron file to the cron.d directory on container
COPY cron /etc/cron.d/cron
# Give execution access
RUN chmod 0755 /etc/cron.d/cron
# Run cron job on cron file
RUN crontab /etc/cron.d/cron
# Create the log file
RUN touch /var/log/cron.log
RUN cron

CMD python manage.py migrate && gunicorn --bind 0.0.0.0:$PORT config.wsgi
1 change: 1 addition & 0 deletions back/cron
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*/1 * * * * python manage.py fcm >> /var/log/cron.log 2>&1
Empty file.
Empty file.
7 changes: 7 additions & 0 deletions back/graphql_app/management/commands/_private.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from django.db.models import QuerySet

from graphql_app.models import Persona


def get_targets() -> QuerySet[Persona]:
return Persona.objects.all()
11 changes: 11 additions & 0 deletions back/graphql_app/management/commands/fcm.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from django.core.management.base import BaseCommand


class Command(BaseCommand):
help = 'hihi'

def add_arguments(self, parser):
pass

def handle(self, *args, **options):
self.stdout.write("HELLO!")
2 changes: 1 addition & 1 deletion back/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.