mirror of
https://github.com/frappe/frappe_docker.git
synced 2024-12-27 19:54:56 +00:00
5254e2aad3
* ci(Test): Add `workflow_dispatch` trigger * ci(Test): Build and run on push and pr * test: Set failfast, remove ERPNext reference * test: Reveal .env file for logs * ci(Test): Rename step * ci(Test): Fix git tag * test: Add -x flag for debugging * test: Fix failing test * ci(Test): Check if built images are used * ci(Test): Configure trigger paths, don't build on schedule * test: Remove bug * ci: Build and test stable images on PR * fix(frappe-nginx): Get back to `ls` from `find` * check if test passes with erpnext images * fix(frappe-worker): Default sites in backup command * get integration test changes back * chore: Fix linting
39 lines
1.1 KiB
Python
39 lines
1.1 KiB
Python
import os
|
|
import frappe
|
|
from frappe.utils.backups import scheduled_backup
|
|
from frappe.utils import cint, get_sites, now
|
|
|
|
|
|
def backup(sites, with_files=False):
|
|
for site in sites:
|
|
frappe.init(site)
|
|
frappe.connect()
|
|
odb = scheduled_backup(
|
|
ignore_files=not with_files,
|
|
backup_path_db=None,
|
|
backup_path_files=None,
|
|
backup_path_private_files=None,
|
|
force=True
|
|
)
|
|
print("database backup taken -", odb.backup_path_db, "- on", now())
|
|
if with_files:
|
|
print("files backup taken -", odb.backup_path_files, "- on", now())
|
|
print("private files backup taken -", odb.backup_path_private_files, "- on", now())
|
|
frappe.destroy()
|
|
|
|
|
|
def main():
|
|
installed_sites = ":".join(get_sites())
|
|
sites = os.environ.get("SITES", installed_sites).split(":")
|
|
with_files = cint(os.environ.get("WITH_FILES"))
|
|
|
|
backup(sites, with_files)
|
|
|
|
if frappe.redis_server:
|
|
frappe.redis_server.connection_pool.disconnect()
|
|
|
|
exit(0)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main() |