-
Notifications
You must be signed in to change notification settings - Fork 299
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
Fix SQLite permission issue #1984
Conversation
@@ -1,11 +1,8 @@ | |||
from rest_framework.response import Response | |||
from rest_framework.views import APIView | |||
|
|||
from apps.telegram.tasks import register_telegram_webhook |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moving this to on_worker_ready
so it doesn't fail with RabbitMQ connectivity error when building the docker image.
@@ -19,9 +19,12 @@ RUN pip install -r requirements.txt | |||
# https://stackoverflow.com/questions/34398632/docker-how-to-run-pip-requirements-txt-only-if-there-was-a-change/34399661#34399661 | |||
COPY ./ ./ | |||
|
|||
# Collect static files and create an SQLite database | |||
RUN mkdir -p /var/lib/oncall | |||
# Collect static files | |||
RUN DJANGO_SETTINGS_MODULE=settings.prod_without_db DATABASE_TYPE=sqlite3 DATABASE_NAME=/var/lib/oncall/oncall.db SECRET_KEY="ThEmUsTSecretKEYforBUILDstage123" SILK_PROFILER_ENABLED="True" python manage.py collectstatic --no-input |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before removing this line, running python manage.py collectstatic
was creating a DB file and everything worked as expected. After removing this line, the DB file is now created by a Celery worker which runs on a different user than uWSGI, which leads to a permission issue.
|
||
# Create SQLite database and set permissions | ||
RUN mkdir -p /var/lib/oncall | ||
RUN DATABASE_TYPE=sqlite3 DATABASE_NAME=/var/lib/oncall/oncall.db python manage.py create_sqlite_db |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding a new manage.py
command that specifically creates a DB file so it's present in the docker image before setting permissions
What this PR does
Fixes #1960.
Checklist
pr:no public docs
PR label added if not required)CHANGELOG.md
updated (orpr:no changelog
PR label added if not required)