root: fix permission denied error for backups

This commit is contained in:
Jens Langhammer 2020-10-26 19:07:08 +01:00
parent 6a8000ea0d
commit 6b3411f63b
5 changed files with 18 additions and 4 deletions

View File

@ -32,7 +32,9 @@ RUN apt-get update && \
groupadd -g 999 docker_999 && \
adduser --system --no-create-home --uid 1000 --group --home /passbook passbook && \
usermod -a -G docker_998 passbook && \
usermod -a -G docker_999 passbook
usermod -a -G docker_999 passbook && \
mkdir /backups && \
chown passbook:passbook /backups
COPY ./passbook/ /passbook
COPY ./manage.py /

View File

@ -12,7 +12,7 @@ lint-fix:
lint:
pyright passbook e2e lifecycle
bandit -r passbook e2e lifecycle
bandit -r passbook e2e lifecycle -x node_modules
pylint passbook e2e lifecycle
prospector

View File

@ -34,7 +34,8 @@ server {
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Forwarded-Port 443;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
# This needs to be set inside the location block, very important.
proxy_set_header Host $host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}

View File

@ -4,6 +4,7 @@ from io import StringIO
from boto3.exceptions import Boto3Error
from botocore.exceptions import BotoCoreError, ClientError
from dbbackup.db.exceptions import CommandConnectorError
from django.contrib.humanize.templatetags.humanize import naturaltime
from django.core import management
from django.utils.timezone import now
@ -50,5 +51,12 @@ def backup_database(self: MonitoredTask): # pragma: no cover
)
)
LOGGER.info("Successfully backed up database.")
except (IOError, BotoCoreError, ClientError, Boto3Error) as exc:
except (
IOError,
BotoCoreError,
ClientError,
Boto3Error,
PermissionError,
CommandConnectorError,
) as exc:
self.set_status(TaskResult(TaskResultStatus.ERROR).with_error(exc))

3
pyproject.toml Normal file
View File

@ -0,0 +1,3 @@
[tool.black]
target-version = ['py38']
exclude = 'node_modules'