From 0f4de56086f54401ce6a6b441a68c04a22ebdcba Mon Sep 17 00:00:00 2001 From: Martin Date: Mon, 24 Apr 2023 11:02:19 +0200 Subject: [PATCH 1/7] Let users configure Hour for backups / btrfs sync (#1762) Signed-off-by: Martin --- bin/ncp/BACKUPS/nc-backup-auto.sh | 2 +- bin/ncp/BACKUPS/nc-rsync-auto.sh | 2 +- bin/ncp/BACKUPS/nc-snapshot-sync.sh | 2 +- etc/ncp-config.d/nc-backup-auto.cfg | 6 ++++++ etc/ncp-config.d/nc-rsync-auto.cfg | 6 ++++++ etc/ncp-config.d/nc-snapshot-sync.cfg | 6 ++++++ 6 files changed, 21 insertions(+), 3 deletions(-) diff --git a/bin/ncp/BACKUPS/nc-backup-auto.sh b/bin/ncp/BACKUPS/nc-backup-auto.sh index 11837ad82..c754aadec 100644 --- a/bin/ncp/BACKUPS/nc-backup-auto.sh +++ b/bin/ncp/BACKUPS/nc-backup-auto.sh @@ -47,7 +47,7 @@ fi EOF chmod +x /usr/local/bin/ncp-backup-auto - echo "0 3 */${BACKUPDAYS} * * root /usr/local/bin/ncp-backup-auto >> /var/log/ncp.log 2>&1" > /etc/cron.d/ncp-backup-auto + echo "0 ${BACKUPHOUR} */${BACKUPDAYS} * * root /usr/local/bin/ncp-backup-auto >> /var/log/ncp.log 2>&1" > /etc/cron.d/ncp-backup-auto chmod 644 /etc/cron.d/ncp-backup-auto service cron restart diff --git a/bin/ncp/BACKUPS/nc-rsync-auto.sh b/bin/ncp/BACKUPS/nc-rsync-auto.sh index c9d5ae5fd..fb03ee555 100644 --- a/bin/ncp/BACKUPS/nc-rsync-auto.sh +++ b/bin/ncp/BACKUPS/nc-rsync-auto.sh @@ -36,7 +36,7 @@ configure() ${SSH[@]} echo || { echo "SSH non-interactive not properly configured"; return 1; } } - echo "0 5 */${SYNCDAYS} * * root /usr/bin/rsync -ax -e \"ssh -p $PORTNUMBER\" --delete \"$DATADIR\" \"$DESTINATION\"" > /etc/cron.d/ncp-rsync-auto + echo "0 ${SYNCHOUR} */${SYNCDAYS} * * root /usr/bin/rsync -ax -e \"ssh -p $PORTNUMBER\" --delete \"$DATADIR\" \"$DESTINATION\"" > /etc/cron.d/ncp-rsync-auto chmod 644 /etc/cron.d/ncp-rsync-auto service cron restart diff --git a/bin/ncp/BACKUPS/nc-snapshot-sync.sh b/bin/ncp/BACKUPS/nc-snapshot-sync.sh index 0c4c905e2..66d740874 100644 --- a/bin/ncp/BACKUPS/nc-snapshot-sync.sh +++ b/bin/ncp/BACKUPS/nc-snapshot-sync.sh @@ -62,7 +62,7 @@ configure() [[ "$COMPRESSION" == "yes" ]] && ZIP="-z" - echo "30 4 */${SYNCDAYS} * * root /usr/local/bin/btrfs-sync -qd $ZIP \"$SNAPDIR\" \"$DESTINATION\"" > /etc/cron.d/ncp-snapsync-auto + echo "30 ${SYNCHOUR} */${SYNCDAYS} * * root /usr/local/bin/btrfs-sync -qd $ZIP \"$SNAPDIR\" \"$DESTINATION\"" > /etc/cron.d/ncp-snapsync-auto chmod 644 /etc/cron.d/ncp-snapsync-auto service cron restart diff --git a/etc/ncp-config.d/nc-backup-auto.cfg b/etc/ncp-config.d/nc-backup-auto.cfg index 42d0ce262..6bc360b19 100644 --- a/etc/ncp-config.d/nc-backup-auto.cfg +++ b/etc/ncp-config.d/nc-backup-auto.cfg @@ -37,6 +37,12 @@ "suggest": "7", "value": "7" }, + { + "id": "BACKUPHOUR", + "name": "Hour of Day to run the Backup", + "suggest": "3", + "value": "3" + }, { "id": "BACKUPLIMIT", "name": "Number of backups to keep", diff --git a/etc/ncp-config.d/nc-rsync-auto.cfg b/etc/ncp-config.d/nc-rsync-auto.cfg index 490f7a7bb..331475cd3 100644 --- a/etc/ncp-config.d/nc-rsync-auto.cfg +++ b/etc/ncp-config.d/nc-rsync-auto.cfg @@ -29,6 +29,12 @@ "name": "Sync periodicity (in days)", "value": "3", "suggest": "3" + }, + { + "id": "SYNCHOUR", + "name": "Hour of Day when syncing", + "value": "5", + "suggest": "5" } ] } diff --git a/etc/ncp-config.d/nc-snapshot-sync.cfg b/etc/ncp-config.d/nc-snapshot-sync.cfg index 961c12e49..0780c5220 100644 --- a/etc/ncp-config.d/nc-snapshot-sync.cfg +++ b/etc/ncp-config.d/nc-snapshot-sync.cfg @@ -36,6 +36,12 @@ "name": "Sync periodicity (in days)", "value": "1", "suggest": "1" + }, + { + "id": "SYNCHOUR", + "name": "Hour of Day when syncing", + "value": "4", + "suggest": "4" } ] } From 4d6236345b1b686b678bc597134df8d381d908c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20Kn=C3=B6ppler?= <6317548+theCalcaholic@users.noreply.github.com> Date: Mon, 24 Apr 2023 11:13:18 +0200 Subject: [PATCH 2/7] nc-backup-auto, nc-rsync-auto, nc-snapshot-sync: Add input validation for cron configuration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Tobias Knöppler <6317548+theCalcaholic@users.noreply.github.com> --- bin/ncp/BACKUPS/nc-backup-auto.sh | 10 ++++++++++ bin/ncp/BACKUPS/nc-rsync-auto.sh | 10 ++++++++++ bin/ncp/BACKUPS/nc-snapshot-sync.sh | 11 +++++++++++ 3 files changed, 31 insertions(+) diff --git a/bin/ncp/BACKUPS/nc-backup-auto.sh b/bin/ncp/BACKUPS/nc-backup-auto.sh index c754aadec..d9d642487 100644 --- a/bin/ncp/BACKUPS/nc-backup-auto.sh +++ b/bin/ncp/BACKUPS/nc-backup-auto.sh @@ -47,6 +47,16 @@ fi EOF chmod +x /usr/local/bin/ncp-backup-auto + [[ "$BACKUPHOUR" =~ ^([0-1]?[0-9]|2[0-4])$ ]] || { + echo "ERROR: 'BACKUPHOUR' must be a number between 0 and 24, was: '$BACKUPHOUR'" + return 1 + } + + [[ "$BACKUPDAYS" =~ ^[0-9]+$ ]] || { + echo "ERROR: 'BACKUPDAYS' must be a number, was: '$BACKUPDAYS'" + return 1 + } + echo "0 ${BACKUPHOUR} */${BACKUPDAYS} * * root /usr/local/bin/ncp-backup-auto >> /var/log/ncp.log 2>&1" > /etc/cron.d/ncp-backup-auto chmod 644 /etc/cron.d/ncp-backup-auto service cron restart diff --git a/bin/ncp/BACKUPS/nc-rsync-auto.sh b/bin/ncp/BACKUPS/nc-rsync-auto.sh index fb03ee555..f44863b5d 100644 --- a/bin/ncp/BACKUPS/nc-rsync-auto.sh +++ b/bin/ncp/BACKUPS/nc-rsync-auto.sh @@ -22,6 +22,16 @@ configure() return 0 } + [[ "$SYNCHOUR" =~ ^([0-1]?[0-9]|2[0-4])$ ]] || { + echo "ERROR: 'BACKUPHOUR' must be a number between 0 and 24, was: '$SYNCHOUR'" + return 1 + } + + [[ "$SYNCDAYS" =~ ^[0-9]+$ ]] || { + echo "ERROR: 'BACKUPDAYS' must be a number, was: '$SYNCDAYS'" + return 1 + } + local DATADIR DATADIR=$( get_nc_config_value datadirectory ) || { echo -e "Error reading data directory. Is NextCloud running and configured?"; diff --git a/bin/ncp/BACKUPS/nc-snapshot-sync.sh b/bin/ncp/BACKUPS/nc-snapshot-sync.sh index 66d740874..25253bd21 100644 --- a/bin/ncp/BACKUPS/nc-snapshot-sync.sh +++ b/bin/ncp/BACKUPS/nc-snapshot-sync.sh @@ -46,6 +46,17 @@ configure() } # checks + + [[ "$SYNCHOUR" =~ ^([0-1]?[0-9]|2[0-4])$ ]] || { + echo "ERROR: 'BACKUPHOUR' must be a number between 0 and 24, was: '$SYNCHOUR'" + return 1 + } + + [[ "$SYNCDAYS" =~ ^[0-9]+$ ]] || { + echo "ERROR: 'BACKUPDAYS' must be a number, was: '$SYNCDAYS'" + return 1 + } + [[ -d "$SNAPDIR" ]] || { echo "$SNAPDIR does not exist"; return 1; } if ! [[ -f /root/.ssh/id_rsa ]]; then ssh-keygen -N "" -f /root/.ssh/id_rsa; fi From 6750497924970a0f71e835138519c016fb258cfb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen?= <55851807+schoetju@users.noreply.github.com> Date: Mon, 24 Apr 2023 11:15:23 +0200 Subject: [PATCH 3/7] Improved default for php max children (#1738) Fixes #1624 --- bin/ncp/CONFIG/nc-limits.sh | 9 ++++++--- etc/ncp-config.d/nc-limits.cfg | 2 +- etc/ncp-templates/php/pool.d.www.conf.sh | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/bin/ncp/CONFIG/nc-limits.sh b/bin/ncp/CONFIG/nc-limits.sh index 3ce229b46..fb374d578 100644 --- a/bin/ncp/CONFIG/nc-limits.sh +++ b/bin/ncp/CONFIG/nc-limits.sh @@ -42,10 +42,13 @@ tmpl_php_max_filesize() { } tmpl_php_threads() { + local TOTAL_MEM="$( get_total_mem )" local PHPTHREADS="$(find_app_param nc-limits PHPTHREADS)" - [[ $PHPTHREADS -eq 0 ]] && PHPTHREADS=$(nproc) - [[ $PHPTHREADS -lt 6 ]] && PHPTHREADS=6 - echo -n "$PHPTHREADS" + # By default restricted by memory / 100MB + [[ $PHPTHREADS -eq 0 ]] && PHPTHREADS=$(( TOTAL_MEM / ( 100 * 1024 * 1024 ) )) + # Minimum 16 + [[ $PHPTHREADS -lt 16 ]] && PHPTHREADS=16 + echo -n "$PHPTHREADS" } configure() diff --git a/etc/ncp-config.d/nc-limits.cfg b/etc/ncp-config.d/nc-limits.cfg index eb31282bb..705d143b1 100644 --- a/etc/ncp-config.d/nc-limits.cfg +++ b/etc/ncp-config.d/nc-limits.cfg @@ -2,7 +2,7 @@ "id": "nc-limits", "name": "Nc-limits", "title": "nc-limits", - "description": "Configure system limits for NextCloudPi", + "description": "Configure system limits for NextcloudPi", "info": "Examples: 200M or 2G. Write 0 for autoconfig", "infotitle": "", "params": [ diff --git a/etc/ncp-templates/php/pool.d.www.conf.sh b/etc/ncp-templates/php/pool.d.www.conf.sh index c4f8f3f59..c36173528 100644 --- a/etc/ncp-templates/php/pool.d.www.conf.sh +++ b/etc/ncp-templates/php/pool.d.www.conf.sh @@ -9,7 +9,7 @@ if [[ "$1" == "--defaults" ]] || ! [[ -f "${BINDIR}/CONFIG/nc-limits.sh" ]] then echo "INFO: Restoring template to default settings" >&2 - PHPTHREADS=6 + PHPTHREADS=16 else PHPTHREADS="$(source "${BINDIR}/CONFIG/nc-limits.sh"; tmpl_php_threads)" fi From c75f83b46753b35348b3153e45e0097649cc18d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20Kn=C3=B6ppler?= <6317548+theCalcaholic@users.noreply.github.com> Date: Mon, 24 Apr 2023 11:16:52 +0200 Subject: [PATCH 4/7] Add support for Nextcloud 25.0.6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Tobias Knöppler <6317548+theCalcaholic@users.noreply.github.com> --- changelog.md | 6 ++++++ etc/ncp-config.d/nc-nextcloud.cfg | 2 +- etc/ncp.cfg | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/changelog.md b/changelog.md index 1f10773ab..a6429be58 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,11 @@ # NextcloudPi Changelog +## [v1.51.3](https://github.com/nextcloud/nextcloudpi/tree/v1.51.3) (2023-04-24) Add support for Nextcloud 25.0.6 + +### Changes + +- Add support for NC 25.0.6 + ## [v1.51.2](https://github.com/nextcloud/nextcloudpi/tree/v1.51.2) (2023-04-16) Restore support for LXC images ### Changes diff --git a/etc/ncp-config.d/nc-nextcloud.cfg b/etc/ncp-config.d/nc-nextcloud.cfg index 15d301fe6..720f90c9e 100644 --- a/etc/ncp-config.d/nc-nextcloud.cfg +++ b/etc/ncp-config.d/nc-nextcloud.cfg @@ -9,7 +9,7 @@ { "id": "VER", "name": "Version", - "value": "25.0.5" + "value": "25.0.6" }, { "id": "MAXFILESIZE", diff --git a/etc/ncp.cfg b/etc/ncp.cfg index 93a6b0406..38937b122 100644 --- a/etc/ncp.cfg +++ b/etc/ncp.cfg @@ -1,5 +1,5 @@ { - "nextcloud_version": "25.0.5", + "nextcloud_version": "25.0.6", "php_version": "8.1", "release": "bullseye" } From 1e21b929e68f4a4aea76bcf8b3c3b7ec8e7f0fc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20Kn=C3=B6ppler?= <6317548+theCalcaholic@users.noreply.github.com> Date: Mon, 24 Apr 2023 11:53:17 +0200 Subject: [PATCH 5/7] .github/workflows: Only trigger docker CI for docker-* tags and branches MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Tobias Knöppler <6317548+theCalcaholic@users.noreply.github.com> --- .github/workflows/build-docker.yml | 10 +++++----- .github/workflows/release.yml | 11 +++++++---- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml index 003f6e21d..5f545788f 100644 --- a/.github/workflows/build-docker.yml +++ b/.github/workflows/build-docker.yml @@ -16,13 +16,13 @@ on: default: 'x86' push: branches: - - master - - devel + - docker-stable + - docker-devel pull_request: branches: - - master - - devel - - release/* + - docker-stable + - docker-devel + - release/docker/* jobs: build: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9874c7e03..68a037842 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -32,9 +32,12 @@ on: required: false default: false push: - tags: ["v*"] + tags: + - "v*" + - "docker-v*" branches: - master + - docker-stable permissions: contents: write @@ -56,7 +59,7 @@ jobs: secrets: inherit docker-x86: - if: ${{ inputs.docker || github.event_name != 'workflow_dispatch' }} + if: ${{ inputs.docker || ( github.event_name != 'workflow_dispatch' && startsWith(github.ref_name, 'docker-') ) }} uses: ./.github/workflows/build-docker.yml with: git_ref: "${{ inputs.git_ref || github.head_ref || github.ref_name }}" @@ -64,7 +67,7 @@ jobs: secrets: inherit docker-armhf: - if: ${{ inputs.docker || github.event_name != 'workflow_dispatch' }} + if: ${{ inputs.docker || ( github.event_name != 'workflow_dispatch' && startsWith(github.ref_name, 'docker-') ) }} uses: ./.github/workflows/build-docker.yml with: git_ref: "${{ inputs.git_ref || github.head_ref || github.ref_name }}" @@ -72,7 +75,7 @@ jobs: secrets: inherit docker-arm64: - if: ${{ inputs.docker || github.event_name != 'workflow_dispatch' }} + if: ${{ inputs.docker || ( github.event_name != 'workflow_dispatch' && startsWith(github.ref_name, 'docker-') ) }} uses: ./.github/workflows/build-docker.yml with: git_ref: "${{ inputs.git_ref || github.head_ref || github.ref_name }}" From f867b16014e0e30fd083073ae462d32bb061c1c3 Mon Sep 17 00:00:00 2001 From: Tobias K <6317548+theCalcaholic@users.noreply.github.com> Date: Wed, 26 Apr 2023 12:41:18 +0200 Subject: [PATCH 6/7] release.yml: Don't test non-docker images on docker-* branches and tags Signed-off-by: Tobias K <6317548+theCalcaholic@users.noreply.github.com> --- .github/workflows/release.yml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 68a037842..5c496b151 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -44,14 +44,14 @@ permissions: jobs: lxd-x86: - if: ${{ inputs.lxd || github.event_name != 'workflow_dispatch' }} + if: ${{ inputs.lxd || ( github.event_name != 'workflow_dispatch' && !startsWith(github.ref_name, 'docker-') ) }} uses: ./.github/workflows/build-lxd.yml with: git_ref: "${{ inputs.git_ref || github.head_ref || github.ref_name }}" arch: 'x86' secrets: inherit lxd-arm64: - if: ${{ inputs.lxd || github.event_name != 'workflow_dispatch' }} + if: ${{ inputs.lxd || ( github.event_name != 'workflow_dispatch' && !startsWith(github.ref_name, 'docker-') ) }} uses: ./.github/workflows/build-lxd.yml with: git_ref: "${{ inputs.git_ref || github.head_ref || github.ref_name }}" @@ -83,14 +83,14 @@ jobs: secrets: inherit test-curl-installer: - if: ${{ inputs.installer || github.event_name != 'workflow_dispatch' }} + if: ${{ inputs.installer || ( github.event_name != 'workflow_dispatch' && !startsWith(github.ref_name, 'docker-') ) }} uses: ./.github/workflows/vm-tests.yml with: git_ref: "${{ inputs.git_ref || github.head_ref || github.ref_name }}" secrets: inherit raspberrypi: - if: ${{ inputs.sd-images || github.event_name != 'workflow_dispatch' }} + if: ${{ inputs.sd-images || ( github.event_name != 'workflow_dispatch' && !startsWith(github.ref_name, 'docker-') ) }} uses: ./.github/workflows/build-sd-images.yml with: git_ref: "${{ inputs.git_ref || github.head_ref || github.ref_name }}" @@ -109,7 +109,7 @@ jobs: board_name: OdroidHC2 secrets: inherit rockpro64: - if: ${{ inputs.sd-images || github.event_name != 'workflow_dispatch' }} + if: ${{ inputs.sd-images || ( github.event_name != 'workflow_dispatch' && !startsWith(github.ref_name, 'docker-') ) }} uses: ./.github/workflows/build-sd-images.yml with: git_ref: "${{ inputs.git_ref || github.head_ref || github.ref_name }}" @@ -117,7 +117,7 @@ jobs: board_name: RockPro64 secrets: inherit rock64: - if: ${{ inputs.sd-images || github.event_name != 'workflow_dispatch' }} + if: ${{ inputs.sd-images || ( github.event_name != 'workflow_dispatch' && !startsWith(github.ref_name, 'docker-') ) }} uses: ./.github/workflows/build-sd-images.yml with: git_ref: "${{ inputs.git_ref || github.head_ref || github.ref_name }}" @@ -135,7 +135,7 @@ jobs: board_name: BananaPi secrets: inherit odroidhc4: - if: ${{ inputs.sd-images || github.event_name != 'workflow_dispatch' }} + if: ${{ inputs.sd-images || ( github.event_name != 'workflow_dispatch' && !startsWith(github.ref_name, 'docker-') ) }} uses: ./.github/workflows/build-sd-images.yml with: git_ref: "${{ inputs.git_ref || github.head_ref || github.ref_name }}" @@ -143,7 +143,7 @@ jobs: board_name: OdroidHC4 secrets: inherit odroidc4: - if: ${{ inputs.sd-images || github.event_name != 'workflow_dispatch' }} + if: ${{ inputs.sd-images || ( github.event_name != 'workflow_dispatch' && !startsWith(github.ref_name, 'docker-') ) }} uses: ./.github/workflows/build-sd-images.yml with: git_ref: "${{ inputs.git_ref || github.head_ref || github.ref_name }}" @@ -151,7 +151,7 @@ jobs: board_name: OdroidC4 secrets: inherit odroidc2: - if: ${{ inputs.sd-images || github.event_name != 'workflow_dispatch' }} + if: ${{ inputs.sd-images || ( github.event_name != 'workflow_dispatch' && !startsWith(github.ref_name, 'docker-') ) }} uses: ./.github/workflows/build-sd-images.yml with: git_ref: "${{ inputs.git_ref || github.head_ref || github.ref_name }}" @@ -310,8 +310,7 @@ jobs: - docker-x86 - docker-armhf - docker-arm64 - - test-curl-installer - if: ${{ (inputs.release || github.event_name != 'workflow_dispatch') && github.ref_type == 'tag' && (github.ref_protected || startsWith(github.ref, 'refs/tags/v')) }} + if: ${{ (inputs.release || github.event_name != 'workflow_dispatch') && github.ref_type == 'tag' && (github.ref_protected || startsWith(github.ref, 'refs/tags/docker-v')) }} runs-on: ubuntu-latest steps: - name: Login to DockerHub @@ -355,6 +354,7 @@ jobs: docker manifest push ownyourbits/nextcloudpi:latest github-release: + if: ${{ github.event_name == 'workflow_dispatch' || !startsWith(github.ref_name, 'docker-') }} needs: - test-curl-installer runs-on: ubuntu-latest From 7ae218d75ddef74901d6a6d56fc5c44930bd4e1d Mon Sep 17 00:00:00 2001 From: Tobias K <6317548+theCalcaholic@users.noreply.github.com> Date: Wed, 26 Apr 2023 23:51:23 +0200 Subject: [PATCH 7/7] changelog.md: Fix date for v1.51.3 Signed-off-by: Tobias K <6317548+theCalcaholic@users.noreply.github.com> --- changelog.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index a6429be58..bc540eb27 100644 --- a/changelog.md +++ b/changelog.md @@ -1,6 +1,6 @@ # NextcloudPi Changelog -## [v1.51.3](https://github.com/nextcloud/nextcloudpi/tree/v1.51.3) (2023-04-24) Add support for Nextcloud 25.0.6 +## [v1.51.3](https://github.com/nextcloud/nextcloudpi/tree/v1.51.3) (2023-04-26) Add support for Nextcloud 25.0.6 ### Changes