diff --git a/CHANGELOG.md b/CHANGELOG.md index 6ac41ab0..2d848aa8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,10 @@ major versions. - [#749](https://github.com/cytopia/devilbox/issues/749) Fix to disable PHP modules without `*.so` ext - Fixed `check-config.sh` to properly expand `~` character in path +#### Added +- [#707](https://github.com/cytopia/devilbox/issues/707) New `.env` variable: `HOST_PATH_BACKUPDIR` + + ## Release v1.8.1 (2020-11-12) diff --git a/check-config.sh b/check-config.sh index ab2322ff..32be20ca 100755 --- a/check-config.sh +++ b/check-config.sh @@ -361,7 +361,6 @@ print_head_1 "Checking directory permissions" DEVILBOX_DIRS=( "autostart" - "backups" "bash" "ca" "cfg" @@ -426,7 +425,6 @@ print_head_1 "Checking file permissions" DEVILBOX_DIRS=( "autostart" - "backups" "ca" "cfg" "compose" diff --git a/docker-compose.yml b/docker-compose.yml index 2f0a0486..a081e7cf 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -183,7 +183,7 @@ services: - devilbox-mail:/var/mail:rw${MOUNT_OPTIONS} # Mount DB Backup directory - - ${DEVILBOX_PATH}/backups:/shared/backups:rw${MOUNT_OPTIONS} + - ${HOST_PATH_BACKUPDIR:-./backups}:/shared/backups:rw${MOUNT_OPTIONS} # Mount devilbox user-defined *.ini files in order # to overwrite the default PHP.ini configuration diff --git a/docs/configuration-files/env-file.rst b/docs/configuration-files/env-file.rst index e2faa374..7d50d8a2 100644 --- a/docs/configuration-files/env-file.rst +++ b/docs/configuration-files/env-file.rst @@ -959,6 +959,22 @@ always be ``/shared/httpd/``. ``docker-compose rm``. +.. _env_host_path_backupdir: + +HOST_PATH_BACKUPDIR +------------------- + +The path on your host OS of the database backup directory to be mounted into the +PHP container into ``/shared/backups``. + + ++------------------------------+----------------+----------------+ +| Name | Allowed values | Default value | ++==============================+================+================+ +| ``HOST_PATH_BACKUPDIR`` | valid path | ``./backups`` | ++------------------------------+----------------+----------------+ + + HOST_PATH_SSH_DIR ----------------- diff --git a/docs/howto/devilbox/move-backups-to-different-directory.rst b/docs/howto/devilbox/move-backups-to-different-directory.rst new file mode 100644 index 00000000..6d3161cc --- /dev/null +++ b/docs/howto/devilbox/move-backups-to-different-directory.rst @@ -0,0 +1,40 @@ +:orphan: + +.. include:: /_includes/snippets/__ANNOUNCEMENTS__.rst + +.. _howto_move_backups_to_a_different_directory: + +************************************* +Move backups to a different directory +************************************* + +No matter if your backups are already in a different location or if you want to move them out of +the Devilbox git directory now, you can do that in a few simple steps. + +**Table of Contents** + +.. contents:: :local: + +Move backups out of the Devilbox git directory +============================================== + +All you have to to is to adjust the path of :ref:`env_host_path_backupdir` in the ``.env`` file. + +.. code-block:: bash + + # Navigate to Devilbox git directory + host> cd path/to/devilbox + + # Open the .env file with your favourite editor + host> vim .env + +Now Adjust the value of :ref:`env_host_path_backupdir` + +.. code-block:: bash + :caption: .env + :emphasize-lines: 1 + + HOST_PATH_HTTPD_DATADIR=/home/user/backups/devilbox/ + +That's it, whenever you start up the Devilbox, ``/home/user/backups/devilbox/`` will be mounted into +the PHP container into ``/shared/backups/``. diff --git a/docs/intermediate/best-practice.rst b/docs/intermediate/best-practice.rst index 6a5ba6da..1274c6e3 100644 --- a/docs/intermediate/best-practice.rst +++ b/docs/intermediate/best-practice.rst @@ -26,14 +26,26 @@ having to worry about loosing any project data. There could also be the case tha dedicated hard-disk to store your projects or you have your own idea about a directory structure where you want to store your projects. +Affected env variables to consider changing: + +* :ref:`env_httpd_datadir` +* :ref:`env_host_path_backupdir` + Projects -------- .. seealso:: - :ref:`howto_move_projects_to_a_different_directory` + * :ref:`howto_move_projects_to_a_different_directory` Follow this guide to keep your projects separated from the Devilbox git directory. +Backups +------- + +.. seealso:: + * :ref:`howto_move_backups_to_a_different_directory` + Follow this guide to keep your backups separated from the Devilbox git directory. + Version control ``.env`` file ----------------------------- diff --git a/env-example b/env-example index 59ab07aa..029a2ea8 100644 --- a/env-example +++ b/env-example @@ -465,6 +465,17 @@ MOUNT_OPTIONS= HOST_PATH_HTTPD_DATADIR=./data/www +### +### Local filesystem path to where your backups are stored +### +### Note: When changing this variable you must re-create the container. +### Simply remove it, it will be auto-created during the next start: +### +### $ docker-compose rm -f +### +HOST_PATH_BACKUPDIR=./backups + + ### ### The path on your host OS of the ssh directory to be mounted into the ### PHP container into /home/devilbox/.ssh.