Skip to content

Commit

Permalink
Merge pull request #1920 from bunkerity/dev
Browse files Browse the repository at this point in the history
Fix multiple issues regarding migration
  • Loading branch information
TheophileDiot authored Jan 21, 2025
2 parents a7be3c5 + cfdd4ed commit fcbd388
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 9 deletions.
5 changes: 4 additions & 1 deletion src/common/core/backup/jobs/backup-data.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
else:
db = Database(LOGGER, sqlalchemy_string=getenv("DATABASE_URI"))

backed_up = False
if force_backup or not already_done:
if not force_backup:
db_metadata = db.get_metadata()
Expand All @@ -75,6 +76,7 @@
sys_exit(0)

backup_database(current_time, db, backup_dir)
backed_up = True

if not force_backup:
# Get all backup files in the directory
Expand All @@ -94,7 +96,8 @@
LOGGER.warning(f"Removing old backup file: {file}, as the rotation limit has been reached ...")
file.unlink()

update_cache_file(db, backup_dir)
if backed_up:
update_cache_file(db, backup_dir)
except SystemExit as e:
status = e.code
except BaseException as e:
Expand Down
2 changes: 1 addition & 1 deletion src/linux/Dockerfile-debian
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ RUN install -m 755 helpers/bwcli /usr/bin/bwcli && \
find . -path ./deps -prune -o -type d -print0 | xargs -0 chmod 0750 && \
chmod 755 /var/log/bunkerweb && \
touch /var/log/bunkerweb/error.log /var/log/bunkerweb/access.log /var/log/bunkerweb/modsec_audit.log && \
chmod 770 /var/cache/bunkerweb/ /var/tmp/bunkerweb/ /var/run/bunkerweb/ && \
chmod 770 /var/cache/bunkerweb/ /var/tmp/bunkerweb/ /var/run/bunkerweb/ db/alembic db/alembic/alembic.ini db/alembic/env.py && \
chmod 750 gen/*.py scheduler/*.py cli/*.py ui/*.sh helpers/*.sh /var/www/ && \
find core/ -type f -name "*.sh" ! -path "core/modsecurity/files/*" -print0 | xargs -0 chmod 750 && \
find core/ ui/ -type f -name "*.py" ! -path "core/modsecurity/files/*" -print0 | xargs -0 chmod 750 && \
Expand Down
2 changes: 1 addition & 1 deletion src/linux/Dockerfile-fedora
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ RUN install -m 755 helpers/bwcli /usr/bin/bwcli && \
find . -path ./deps -prune -o -type d -print0 | xargs -0 chmod 0750 && \
chmod 755 /var/log/bunkerweb && \
touch /var/log/bunkerweb/error.log /var/log/bunkerweb/access.log /var/log/bunkerweb/modsec_audit.log && \
chmod 770 /var/cache/bunkerweb/ /var/tmp/bunkerweb/ /var/run/bunkerweb/ && \
chmod 770 /var/cache/bunkerweb/ /var/tmp/bunkerweb/ /var/run/bunkerweb/ db/alembic db/alembic/alembic.ini db/alembic/env.py && \
chmod 750 gen/*.py scheduler/*.py cli/*.py ui/*.sh helpers/*.sh /var/www/ && \
find core/ -type f -name "*.sh" ! -path "core/modsecurity/files/*" -print0 | xargs -0 chmod 750 && \
find core/ ui/ -type f -name "*.py" ! -path "core/modsecurity/files/*" -print0 | xargs -0 chmod 750 && \
Expand Down
2 changes: 1 addition & 1 deletion src/linux/Dockerfile-rhel
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ RUN install -m 755 helpers/bwcli /usr/bin/bwcli && \
find . -path ./deps -prune -o -type d -print0 | xargs -0 chmod 0750 && \
chmod 755 /var/log/bunkerweb && \
touch /var/log/bunkerweb/error.log /var/log/bunkerweb/access.log /var/log/bunkerweb/modsec_audit.log && \
chmod 770 /var/cache/bunkerweb/ /var/tmp/bunkerweb/ /var/run/bunkerweb/ && \
chmod 770 /var/cache/bunkerweb/ /var/tmp/bunkerweb/ /var/run/bunkerweb/ db/alembic db/alembic/alembic.ini db/alembic/env.py && \
chmod 750 gen/*.py scheduler/*.py cli/*.py ui/*.sh helpers/*.sh /var/www/ && \
find core/ -type f -name "*.sh" ! -path "core/modsecurity/files/*" -print0 | xargs -0 chmod 750 && \
find core/ ui/ -type f -name "*.py" ! -path "core/modsecurity/files/*" -print0 | xargs -0 chmod 750 && \
Expand Down
2 changes: 1 addition & 1 deletion src/linux/Dockerfile-rhel9
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ RUN install -m 755 helpers/bwcli /usr/bin/bwcli && \
find . -path ./deps -prune -o -type d -print0 | xargs -0 chmod 0750 && \
chmod 755 /var/log/bunkerweb && \
touch /var/log/bunkerweb/error.log /var/log/bunkerweb/access.log /var/log/bunkerweb/modsec_audit.log && \
chmod 770 /var/cache/bunkerweb/ /var/tmp/bunkerweb/ /var/run/bunkerweb/ && \
chmod 770 /var/cache/bunkerweb/ /var/tmp/bunkerweb/ /var/run/bunkerweb/ db/alembic db/alembic/alembic.ini db/alembic/env.py && \
chmod 750 gen/*.py scheduler/*.py cli/*.py ui/*.sh helpers/*.sh /var/www/ && \
find core/ -type f -name "*.sh" ! -path "core/modsecurity/files/*" -print0 | xargs -0 chmod 750 && \
find core/ ui/ -type f -name "*.py" ! -path "core/modsecurity/files/*" -print0 | xargs -0 chmod 750 && \
Expand Down
2 changes: 1 addition & 1 deletion src/linux/Dockerfile-ubuntu
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ RUN install -m 755 helpers/bwcli /usr/bin/bwcli && \
find . -path ./deps -prune -o -type d -print0 | xargs -0 chmod 0750 && \
chmod 755 /var/log/bunkerweb && \
touch /var/log/bunkerweb/error.log /var/log/bunkerweb/access.log /var/log/bunkerweb/modsec_audit.log && \
chmod 770 /var/cache/bunkerweb/ /var/tmp/bunkerweb/ /var/run/bunkerweb/ && \
chmod 770 /var/cache/bunkerweb/ /var/tmp/bunkerweb/ /var/run/bunkerweb/ db/alembic db/alembic/alembic.ini db/alembic/env.py && \
chmod 750 gen/*.py scheduler/*.py cli/*.py ui/*.sh helpers/*.sh /var/www/ && \
find core/ -type f -name "*.sh" ! -path "core/modsecurity/files/*" -print0 | xargs -0 chmod 750 && \
find core/ ui/ -type f -name "*.py" ! -path "core/modsecurity/files/*" -print0 | xargs -0 chmod 750 && \
Expand Down
2 changes: 1 addition & 1 deletion src/linux/Dockerfile-ubuntu-jammy
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ RUN install -m 755 helpers/bwcli /usr/bin/bwcli && \
find . -path ./deps -prune -o -type d -print0 | xargs -0 chmod 0750 && \
chmod 755 /var/log/bunkerweb && \
touch /var/log/bunkerweb/error.log /var/log/bunkerweb/access.log /var/log/bunkerweb/modsec_audit.log && \
chmod 770 /var/cache/bunkerweb/ /var/tmp/bunkerweb/ /var/run/bunkerweb/ && \
chmod 770 /var/cache/bunkerweb/ /var/tmp/bunkerweb/ /var/run/bunkerweb/ db/alembic db/alembic/alembic.ini db/alembic/env.py && \
chmod 750 gen/*.py scheduler/*.py cli/*.py ui/*.sh helpers/*.sh /var/www/ && \
find core/ -type f -name "*.sh" ! -path "core/modsecurity/files/*" -print0 | xargs -0 chmod 750 && \
find core/ ui/ -type f -name "*.py" ! -path "core/modsecurity/files/*" -print0 | xargs -0 chmod 750 && \
Expand Down
3 changes: 1 addition & 2 deletions src/scheduler/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,7 @@ RUN cp helpers/bwcli /usr/bin/ && \
find core/ -type f -name "*.sh" ! -path "core/modsecurity/files/*" -print0 | xargs -0 chmod 750 && \
find core/ -type f -name "*.py" ! -path "core/modsecurity/files/*" -print0 | xargs -0 chmod 750 && \
chmod 750 cli/main.py gen/*.py scheduler/main.py scheduler/entrypoint.sh helpers/*.sh deps/python/bin/* /usr/bin/bwcli && \
chmod 770 db/alembic/alembic.ini db/alembic/env.py && \
chmod u+w db/alembic && \
chmod 770 db/alembic db/alembic/alembic.ini db/alembic/env.py && \
chmod 660 INTEGRATION


Expand Down

0 comments on commit fcbd388

Please sign in to comment.