Skip to content

Commit

Permalink
feat: fix mongodump
Browse files Browse the repository at this point in the history
  • Loading branch information
henilp105 committed Dec 26, 2023
1 parent 7216833 commit 88a99d4
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions backend/generate_tarball.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,14 @@

def generate_latest_tarball():
# Execute the mongodump command
archive_date = datetime.now().strftime("%Y-%m-%d")
command = f"mongodump --uri={mongo_uri} --archive=static/registry-{archive_date}.tar.gz --db={database_name} --gzip --excludeCollection=users"
subprocess.call(command, shell=True)
archive_date = datetime.now().strftime("%d-%m-%Y")
archive_path = os.path.abspath(f"static/registry-{archive_date}.tar.gz")
command = f"mongodump --uri={mongo_uri} --archive={archive_path} --db={database_name} --gzi p --excludeCollection=users".split()
try:
subprocess.call(command, text=True)
except subprocess.CalledProcessError as e:
print(f"Failed: {e}")
exit(1)
print("Database backup created successfully")

generate_latest_tarball()

1 comment on commit 88a99d4

@vercel
Copy link

@vercel vercel bot commented on 88a99d4 Dec 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.