{"componentChunkName":"component---smooth-doc-smooth-doc-src-templates-doc-js","path":"/docs/on-premise/maintenance/","result":{"data":{"mdx":{"fields":{"pageType":"doc","title":"Maintenance and Backups","editLink":""},"body":"var _excluded = [\"components\"];\nfunction _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }\nfunction _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var s = Object.getOwnPropertySymbols(e); for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }\nfunction _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } return t; }\n/* @jsxRuntime classic */\n/* @jsx mdx */\n\nvar _frontmatter = {\n  \"title\": \"Maintenance and Backups\",\n  \"description\": \"maintenance and backups\",\n  \"order\": 90,\n  \"section\": \"On-Premise\"\n};\nvar layoutProps = {\n  _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n  var components = _ref.components,\n    props = _objectWithoutProperties(_ref, _excluded);\n  return mdx(MDXLayout, _extends({}, layoutProps, props, {\n    components: components,\n    mdxType: \"MDXLayout\"\n  }), mdx(\"h1\", {\n    \"id\": \"maintenance-and-backups\"\n  }, mdx(\"a\", {\n    parentName: \"h1\",\n    \"href\": \"#maintenance-and-backups\",\n    \"aria-label\": \"maintenance and backups permalink\",\n    \"className\": \"anchor\"\n  }, mdx(\"svg\", {\n    parentName: \"a\",\n    \"aria-hidden\": \"true\",\n    \"focusable\": \"false\",\n    \"height\": \"16\",\n    \"version\": \"1.1\",\n    \"viewBox\": \"0 0 16 16\",\n    \"width\": \"16\"\n  }, mdx(\"path\", {\n    parentName: \"svg\",\n    \"fillRule\": \"evenodd\",\n    \"d\": \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"Maintenance and Backups\"), mdx(\"br\", null), mdx(\"p\", null, \"When PathcoreFlow is deployed to an on-premise server or virtual machine (VM), there is the option to use the \", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"https://systemd.io/\"\n  }, \"systemd\"), \" service manager to schedule a daily maintenance script. This script performs several tasks, including managing backups.\"), mdx(\"p\", null, \"The systemd timer unit is named \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"pathcoreflow-maintenance.timer\"), \", and defaults to running the maintenance script daily at 04:00 am (server or VM time). Your server administrator can add another timer if you wish to run the maintenance tasks more or less frequently, though creating a systemd timer is beyond the scope of this document.\"), mdx(\"h2\", {\n    \"id\": \"backup-tasks\"\n  }, mdx(\"a\", {\n    parentName: \"h2\",\n    \"href\": \"#backup-tasks\",\n    \"aria-label\": \"backup tasks permalink\",\n    \"className\": \"anchor\"\n  }, mdx(\"svg\", {\n    parentName: \"a\",\n    \"aria-hidden\": \"true\",\n    \"focusable\": \"false\",\n    \"height\": \"16\",\n    \"version\": \"1.1\",\n    \"viewBox\": \"0 0 16 16\",\n    \"width\": \"16\"\n  }, mdx(\"path\", {\n    parentName: \"svg\",\n    \"fillRule\": \"evenodd\",\n    \"d\": \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"Backup Tasks\"), mdx(\"p\", null, \"The maintenance script manages daily backups automatically, according to the configuration settings set in the \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \".env\"), \" file. For example, \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"PCW_BACKUP_DIR\"), \" defines where backups are stored. For more details about environment variables, see \", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"/flow/manual/latest/docs/on-premise/configuration/\"\n  }, \"Configuration\"), \".\"), mdx(\"p\", null, \"The following items are backed up:\"), mdx(\"ul\", null, mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"p\", {\n    parentName: \"li\"\n  }, \"PathcoreFlow database - this holds all of PathcoreFlow's hierarchical data, metadata, and user information. This does not include image data\")), mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"p\", {\n    parentName: \"li\"\n  }, \"Docker Compose configuration - the configuration files describing how to retrieve and run the container images for PathcoreFlow components. This includes any customizations you may have added\")), mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"p\", {\n    parentName: \"li\"\n  }, \"Image Indexing Service database - this is used by \", mdx(\"abbr\", {\n    parentName: \"p\",\n    \"title\": \"Image Indexing Service\"\n  }, \"IIS\"), \" for managing which items it has already detected and processed. This is only relevant if you have the Image Indexing Service add-on\"))), mdx(\"h3\", {\n    \"id\": \"backup-rotation\"\n  }, mdx(\"a\", {\n    parentName: \"h3\",\n    \"href\": \"#backup-rotation\",\n    \"aria-label\": \"backup rotation permalink\",\n    \"className\": \"anchor\"\n  }, mdx(\"svg\", {\n    parentName: \"a\",\n    \"aria-hidden\": \"true\",\n    \"focusable\": \"false\",\n    \"height\": \"16\",\n    \"version\": \"1.1\",\n    \"viewBox\": \"0 0 16 16\",\n    \"width\": \"16\"\n  }, mdx(\"path\", {\n    parentName: \"svg\",\n    \"fillRule\": \"evenodd\",\n    \"d\": \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"Backup Rotation\"), mdx(\"p\", null, \"One of the maintenance tasks is to clean up old backups, to free up disk space. This task removes backups older than \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"PCW_BACKUP_DAYS\"), \" days old. By default this will keep 30 days of backups.\"), mdx(\"h3\", {\n    \"id\": \"running-a-manual-backup\"\n  }, mdx(\"a\", {\n    parentName: \"h3\",\n    \"href\": \"#running-a-manual-backup\",\n    \"aria-label\": \"running a manual backup permalink\",\n    \"className\": \"anchor\"\n  }, mdx(\"svg\", {\n    parentName: \"a\",\n    \"aria-hidden\": \"true\",\n    \"focusable\": \"false\",\n    \"height\": \"16\",\n    \"version\": \"1.1\",\n    \"viewBox\": \"0 0 16 16\",\n    \"width\": \"16\"\n  }, mdx(\"path\", {\n    parentName: \"svg\",\n    \"fillRule\": \"evenodd\",\n    \"d\": \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"Running a Manual Backup\"), mdx(\"p\", null, \"Sometimes it is desirable to run a backup outside of its regular schedule, for example before installing an \", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"/flow/manual/latest/docs/on-premise/update/\"\n  }, \"update\"), \".\"), mdx(\"details\", null, mdx(\"summary\", null, \" To backup PathcoreFlow \"), mdx(\"ol\", null, mdx(\"li\", {\n    parentName: \"ol\"\n  }, mdx(\"p\", {\n    parentName: \"li\"\n  }, \"Log in to the server or VM hosting PathcoreFlow\")), mdx(\"li\", {\n    parentName: \"ol\"\n  }, mdx(\"p\", {\n    parentName: \"li\"\n  }, \"Run the maintenance script as root (administrator) to perform all backup steps:\"), mdx(\"pre\", {\n    parentName: \"li\"\n  }, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-bash\"\n  }, \"sudo /opt/pathcore/compose/scripts/maintenance.sh\\n\")))), mdx(\"div\", {\n    className: \"info\"\n  }, mdx(\"div\", null, \"This example assumes you have installed PathcoreFlow in the default directory: \", mdx(\"code\", null, \"/opt/pathcore\"), \".\"))), mdx(\"h3\", {\n    \"id\": \"restoring-from-a-backup\"\n  }, mdx(\"a\", {\n    parentName: \"h3\",\n    \"href\": \"#restoring-from-a-backup\",\n    \"aria-label\": \"restoring from a backup permalink\",\n    \"className\": \"anchor\"\n  }, mdx(\"svg\", {\n    parentName: \"a\",\n    \"aria-hidden\": \"true\",\n    \"focusable\": \"false\",\n    \"height\": \"16\",\n    \"version\": \"1.1\",\n    \"viewBox\": \"0 0 16 16\",\n    \"width\": \"16\"\n  }, mdx(\"path\", {\n    parentName: \"svg\",\n    \"fillRule\": \"evenodd\",\n    \"d\": \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"Restoring from a Backup\"), mdx(\"p\", null, \"At times, it may be necessary to restore your PathcoreFlow service to an earlier time.\"), mdx(\"div\", {\n    className: \"warning\"\n  }, \"After you restore, any work done or changes made since the time of the backup will be lost.\"), mdx(\"details\", null, mdx(\"summary\", null, \" To restore the PathcoreFlow database from a backup \"), mdx(\"div\", {\n    className: \"info\"\n  }, mdx(\"div\", null, \"If you encounter a problem while restoring, or don't feel confident performing these tasks on your own, please contact \", mdx(\"a\", {\n    href: \"mailto:support@pathcore.com\"\n  }, \"Pathcore Support\"), \" for options.\")), mdx(\"ol\", null, mdx(\"li\", {\n    parentName: \"ol\"\n  }, mdx(\"p\", {\n    parentName: \"li\"\n  }, \"Log in to the server or VM hosting PathcoreFlow\")), mdx(\"li\", {\n    parentName: \"ol\"\n  }, mdx(\"p\", {\n    parentName: \"li\"\n  }, \"Change to the directory containing the PathcoreFlow Docker Compose configuration and stop the PathcoreFlow services. e.g., for the default install location of \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"/opt/pathcore/compose\"), \":\"), mdx(\"pre\", {\n    parentName: \"li\"\n  }, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-bash\"\n  }, \"cd /opt/pathcore/compose\\nsudo docker compose down\\n\"))), mdx(\"li\", {\n    parentName: \"ol\"\n  }, mdx(\"p\", {\n    parentName: \"li\"\n  }, \"Move the directory pointed to by \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"PCW_DB_DIR\"), \" (to preserve it in case a problem occurs when restoring) and create a new, empty directory to replace it with the same owner and permissions.\")), mdx(\"li\", {\n    parentName: \"ol\"\n  }, mdx(\"p\", {\n    parentName: \"li\"\n  }, \"Start the \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"postgres\"), \" container on its own:\"), mdx(\"pre\", {\n    parentName: \"li\"\n  }, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-bash\"\n  }, \"cd /opt/pathcore/compose\\nsudo docker compose up -d postgres\\n\"))), mdx(\"li\", {\n    parentName: \"ol\"\n  }, mdx(\"p\", {\n    parentName: \"li\"\n  }, \"Import the data from the backup, replacing the path to the backup file as appropriate:\"), mdx(\"pre\", {\n    parentName: \"li\"\n  }, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-bash\"\n  }, \"cd /opt/pathcore/compose\\nsudo gunzip -c /path/to/database-backup.sql.gz \\\\\\n     | sudo docker compose exec -T postgres sh -c \\\\\\n     'PGPASSWORD=\\\"${POSTGRES_PASSWORD}\\\" psql -n -U \\\"${POSTGRES_USER}\\\" \\\"${POSTGRES_DB}\\\"'\\n\"))), mdx(\"li\", {\n    parentName: \"ol\"\n  }, mdx(\"p\", {\n    parentName: \"li\"\n  }, \"When complete, start the rest of the PathcoreFlow services:\"), mdx(\"pre\", {\n    parentName: \"li\"\n  }, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-bash\"\n  }, \"cd /opt/pathcore/compose\\nsudo docker compose up -d\\n\"))))), mdx(\"h2\", {\n    \"id\": \"certbot\"\n  }, mdx(\"a\", {\n    parentName: \"h2\",\n    \"href\": \"#certbot\",\n    \"aria-label\": \"certbot permalink\",\n    \"className\": \"anchor\"\n  }, mdx(\"svg\", {\n    parentName: \"a\",\n    \"aria-hidden\": \"true\",\n    \"focusable\": \"false\",\n    \"height\": \"16\",\n    \"version\": \"1.1\",\n    \"viewBox\": \"0 0 16 16\",\n    \"width\": \"16\"\n  }, mdx(\"path\", {\n    parentName: \"svg\",\n    \"fillRule\": \"evenodd\",\n    \"d\": \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"Certbot\"), mdx(\"p\", null, \"If you have configured \", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"/flow/manual/latest/docs/on-premise/https/#lets-encrypt\"\n  }, \"\", mdx(\"abbr\", {\n    parentName: \"a\",\n    \"title\": \"Hypertext Transfer Protocol Secure\"\n  }, \"HTTPS\"), \" via Let's Encrypt\"), \", then this task will ensure your certificate is renewed automatically before it expires.\"));\n}\n;\nMDXContent.isMDXComponent = true;","tableOfContents":{"items":[{"url":"#maintenance-and-backups","title":"Maintenance and Backups","items":[{"url":"#backup-tasks","title":"Backup Tasks","items":[{"url":"#backup-rotation","title":"Backup Rotation"},{"url":"#running-a-manual-backup","title":"Running a Manual Backup"},{"url":"#restoring-from-a-backup","title":"Restoring from a Backup"}]},{"url":"#certbot","title":"Certbot"}]}]}}},"pageContext":{"id":"fc3220ed-0c5e-55d4-98cb-8b5b5f02c9e0"}},"staticQueryHashes":["1086510573","1106176283","1122327541","2140385554","2719290676","3597609067","4027383558"]}