Skip to content

Commit

Permalink
Merge pull request #1587 from nextcloud/devel
Browse files Browse the repository at this point in the history
v1.50.1 release
  • Loading branch information
theCalcaholic authored Sep 27, 2022
2 parents e276712 + 672731a commit 21d9894
Show file tree
Hide file tree
Showing 16 changed files with 160 additions and 91 deletions.
83 changes: 50 additions & 33 deletions .github/workflows/build-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,46 +103,63 @@ jobs:
run: |
docker logs nextcloudpi |& awk '{ print "CONTAINER::" $0 }'
echo 'CONTAINER:: =========='
docker logs -f |& awk '{ print "CONTAINER::" $0 }' &
docker logs -f nextcloudpi |& awk '{ print "CONTAINER::" $0 }' &
docker exec nextcloudpi bash -c 'tail -f /var/log/ncp.log' |& awk '{ print "NCP::" $0 }' &
cmd=(python activation_tests.py --no-gui localhost 8443 4443)
[[ "${{ matrix.arch }}" == "x86" ]] || cmd+=(--timeout 300)
"${cmd[@]}" || {
tail -n 20 geckodriver.log >&2 || true
echo "======================="
echo "Activation test failed!"
echo "Container logs:"
echo "==========================================="
docker logs nextcloudpi
echo "Last lines of ncp.log:"
echo "==========================================="
docker exec nextcloudpi tail /var/log/ncp.log;
success=false
for attempt in {1..3}
do
echo ":: Activation Tests (attempt $attempt/3) ::"
"${cmd[@]}" || {
tail -n 20 geckodriver.log >&2 || true
echo "CI:: Activation test (attempt $attempt/3) failed!"
docker exec nextcloudpi bash /usr/local/bin/ncp-diag
sleep 12
continue
}
success=true
break
done
[[ "$success" == "true" ]] || {
echo "CI:: Activation test failed in all attempts!"
exit 1
}
echo "Activation test successful"
python system_tests.py --no-ping --non-interactive || {
echo "System test failed!"
echo "Container logs:"
echo "==========================================="
docker logs nextcloudpi
echo "Last lines of ncp.log:"
echo "==========================================="
docker exec nextcloudpi tail /var/log/ncp.log;
exit 1
echo "CI:: Activation test successful"
success=false
for attempt in {1..3}
do
echo ":: System Tests (attempt $attempt/3) ::"
python system_tests.py --no-ping --non-interactive || {
echo "CI:: System test (attempt $attempt) failed!"
continue
}
success=true
break
done
[[ "$success" == "true" ]] || {
echo "CI:: System test failed in all attempts!"
exit 1
}
echo "System test successful"
python nextcloud_tests.py --no-gui localhost 8443 4443 || {
tail -n 20 geckodriver.log >&2 || true
echo "======================="
echo "Nextcloud test failed!"
echo "Container logs:"
echo "==========================================="
docker logs nextcloudpi
echo "Last lines of ncp.log:"
echo "==========================================="
docker exec nextcloudpi tail /var/log/ncp.log;
echo "CI:: System test successful"
success=false
for attempt in {1..3}
do
echo ":: Nextcloud Tests (attempt $attempt/3) ::"
python nextcloud_tests.py --no-gui localhost 8443 4443 || {
tail -n 20 geckodriver.log >&2 || true
echo "CI:: Nextcloud test (attempt $attempt/3) failed!"
continue
}
success=true
break
done
[[ "$success" == "true" ]] || {
echo "CI:: Nextcloud test failed in all attempts!"
exit 1
}
echo "Nextcloud test successful"
echo "CI:: Nextcloud test successful"
12 changes: 11 additions & 1 deletion .github/workflows/build-lxd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,20 @@ jobs:
fi
echo "VERSION=${VERSION}" >> "$GITHUB_ENV"
echo "Running update ${{ needs.build-previous.outputs.previous_version }} -> ${VERSION}"
current_nc_version="$(lxc exec ncp -- ncc status | grep "version:" | awk '{ print $3 }')"
latest_nc_version="$(cat etc/ncp.cfg | jq -r '.nextcloud_version')"
lxc exec ncp -- bash -c "DBG=x ncp-update ${UPDATE_ARGS[*]}"
lxc exec ncp -- /usr/local/bin/ncc status
lxc exec ncp -- bash -c "DBG=x ncp-update-nc ${latest_nc_version?}"
if [[ "$current_nc_version" =~ "$latest_nc_version".* ]]
then
echo "Nextcloud is up to date - skipping NC update test."
else
lxc exec ncp -- bash -c "DBG=x ncp-update-nc ${latest_nc_version?}"
fi
lxc stop ncp
- name: Pack LXD image
id: pack-lxd
Expand Down
58 changes: 39 additions & 19 deletions .github/workflows/build-sd-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,25 @@ jobs:
artifact_name: ${{ github.run_id }}-${{ inputs.board_id }}-image
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Apply workaround for sudo bug (https://github.com/multiarch/qemu-user-static/issues/17)
uses: docker/setup-qemu-action@v2
- name: Setup qemu-user-static
run: |
apt-get -y --no-install-recommends install binfmt-support qemu-user-static
for conf in qemu-{aarch64,arm}-static.conf
do
sed 's/:F$/:OC/' /usr/lib/binfmt.d/$conf > /etc/binfmt/$conf
done
sudo apt-get update
# docker run --rm --privileged multiarch/qemu-user-static:register --reset --credential yes
# sudo mkdir -p /etc/binfmt
# for conf in qemu-{aarch64,arm}-static.conf
# do
# sed 's/:F$/:OC/' /usr/lib/binfmt.d/$conf | sudo tee /etc/binfmt/$conf
# done
- name: Checkout code
uses: actions/checkout@v3
with:
ref: "${{ env.VERSION }}"
# - name: Debug
# run: |
# which qemu-aarch64-static
# update-binfmts --display qemu-aarch64
# update-binfmts --display qemu-arm
- name: "Build Armbian"
if: ${{ inputs.board_id != 'raspberrypi' }}
id: build-armbian
Expand Down Expand Up @@ -83,7 +90,7 @@ jobs:
echo "::set-output name=artifact_file::${IMG}"
echo "ARTIFACT_FILE=${IMG}" >> $GITHUB_ENV
- name: "Upload Armbian logs"
if: ${{ inputs.board_id != 'raspberrypi' && steps.build-armbian-2nd.outcome == 'failure' }}
if: ${{ inputs.board_id != 'raspberrypi' && failure() }}
uses: actions/upload-artifact@v3
with:
name: ${{ github.run_id }}-${{ inputs.board_id }}-logs
Expand All @@ -96,6 +103,7 @@ jobs:
echo "Protected? ${{ github.ref_protected }}"
export IMG="NextCloudPi_${{ inputs.board_name }}_${VERSION//\//_}.img"
[[ "${{ github.ref_protected }}" == true ]] || export DBG=x
wget -q https://github.com/multiarch/qemu-user-static/releases/latest/download/qemu-aarch64-static -O ./qemu-aarch64-static
./build/build-SD-rpi.sh
mkdir -p output
mv "tmp/$IMG" ./output/
Expand Down Expand Up @@ -129,14 +137,21 @@ jobs:
shell: bash
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Apply workaround for sudo bug (https://github.com/multiarch/qemu-user-static/issues/17)
uses: docker/setup-qemu-action@v2
- name: Apt update
run: |
apt-get -y --no-install-recommends install binfmt-support qemu-user-static
for conf in qemu-{aarch64,arm}-static.conf
do
sed 's/:F$/:OC/' /usr/lib/binfmt.d/$conf > /etc/binfmt/$conf
done
sudo apt-get update
# sudo apt-get -y --no-install-recommends install qemu-user-static
# - name: Apply workaround for sudo bug (https://github.com/multiarch/qemu-user-static/issues/17)
# run: |
# sudo apt-get update
# sudo apt-get -y --no-install-recommends install binfmt-support qemu-user-static
# docker run --rm --privileged multiarch/qemu-user-static:register --reset --credential yes
# sudo mkdir -p /etc/binfmt
# for conf in qemu-{aarch64,arm}-static.conf
# do
# sed 's/:F$/:OC/' /usr/lib/binfmt.d/$conf | sudo tee /etc/binfmt/$conf
# done
- name: Checkout code
uses: actions/checkout@v3
with:
Expand All @@ -154,6 +169,9 @@ jobs:
sudo rm -rf raspbian_root
. ./build/buildlib.sh
mount_raspbian "ncp.img"
sudo wget -nv https://github.com/multiarch/qemu-user-static/releases/latest/download/qemu-aarch64-static -O raspbian_root/usr/bin/qemu-aarch64-static
sudo wget -nv https://github.com/multiarch/qemu-user-static/releases/latest/download/qemu-arm-static -O raspbian_root/usr/bin/qemu-arm-static
sudo chmod +x raspbian_root/usr/bin/qemu-{arm,aarch64}-static
echo 'Mutex posixsem' | sudo tee -a raspbian_root/etc/apache2/mods-available/ssl.conf
- name: Test image
id: test
Expand All @@ -163,8 +181,7 @@ jobs:
trap 'sudo machinectl terminate ncp' EXIT
sudo systemd-nspawn --boot -D ./raspbian_root/ -M ncp --hostname=nextcloudpi |& awk '{ print "CONTAINER::" $0 }' &
sudo systemd-run --machine=ncp -P --wait bash -c 'tail -f /var/log/ncp.log' |& awk '{ print "NCP::" $0 }' &
sleep 30
sleep 60
success=false
for attempt in {1..30}
Expand All @@ -175,6 +192,8 @@ jobs:
success=true
break
done
sudo systemd-run --machine=ncp -P --wait bash -c 'cat /var/log/ncp.log' |& awk '{ print "NCP::" $0 }'
sudo systemd-run --machine=ncp -P --wait bash -c 'tail -n 0 -f /var/log/ncp.log' |& awk '{ print "NCP::" $0 }' &
[[ "$success" == "true" ]] || {
echo "Could not reach container. Aborting..."
Expand All @@ -190,8 +209,9 @@ jobs:
echo "Geckodriver logs:"
tail -n 20 geckodriver.log >&2 || true
echo "================"
echo "ncp.log: "
sudo systemd-run --wait -P --machine=ncp ncp /bin/bash -c "tail -n20 /var/log/ncp.log || echo 'ncp.log not found'"
echo "mysql: "
sudo systemd-run --wait -P --machine=ncp bash /usr/local/bin/ncp-diag
sudo systemd-run --wait -P --machine=ncp systemctl status mysql
sleep 6
continue
}
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Find the full documentation at [docs.nextcloudpi.com](http://docs.nextcloudpi.co
## Features

* Debian/Raspbian 11 Bullseye
* Nextcloud 23.0.2
* Nextcloud 24.0.5
* Apache 2.4.25, with HTTP2 enabled
* PHP 7.4
* MariaDB 10
Expand Down
2 changes: 1 addition & 1 deletion bin/ncp-diag
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ GW=$( ip r | grep "default via" | awk '{ print $3 }' | head -1 )
IP="$(get_ip)"

echo "IP|$IP"
echo "Gateway|$GW"
echo "gateway|$GW"
echo "Interface|$IFACE"

# Certificates
Expand Down
2 changes: 2 additions & 0 deletions bin/ncp-dist-upgrade
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ release_new=$(jq -r '.release' < "${new_cfg}")
# the default repo in bullseye is bullseye-security - use bullseye if it is not available
grep -Eh '^deb ' /etc/apt/sources.list | grep 'bullseye-security' > /dev/null && release_new="${release_new}-security"
php_ver_new=$(jq -r '.php_version' < "${new_cfg}")
# PHP 8.1 is only supported via the
[[ "$php_ver_new" != 8.1 ]] || php_ver_new=7.4

$APTINSTALL -t ${release_new} php${php_ver_new} php${php_ver_new}-curl php${php_ver_new}-gd php${php_ver_new}-fpm php${php_ver_new}-cli php${php_ver_new}-opcache \
php${php_ver_new}-mbstring php${php_ver_new}-xml php${php_ver_new}-zip php${php_ver_new}-fileinfo php${php_ver_new}-ldap \
Expand Down
9 changes: 9 additions & 0 deletions bin/ncp-update
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@

[[ -z "$DBG" ]] || set -$DBG

if [[ -f /.dockerenv ]] || [[ -f /.docker-image ]] || [[ "$DOCKERBUILD" == 1 ]]
then
echo "WARNING: Docker images should be updated by replacing the container from the latest docker image" \
"(refer to the documentation for instructions: https://docs.nextcloudpi.com)." \
"If you are sure that you know what you are doing, you can still execute the update script by running it like this:"
echo "> ALLOW_UPDATE_SCRIPT=1 ncp-update"
[[ "$ALLOW_UPDATE_SCRIPT" == "1" ]] || exit 1
fi

{
[ "$(id -u)" -ne 0 ] && { printf "Must be run as root. Try 'sudo $0'\n"; exit 1; }

Expand Down
17 changes: 1 addition & 16 deletions bin/ncp-update-nc
Original file line number Diff line number Diff line change
Expand Up @@ -206,22 +206,7 @@ else
apachectl -k graceful
## make sure the notify_push daemon is runnnig

cat > /etc/systemd/system/notify_push.service <<EOF
[Unit]
Description = Push daemon for Nextcloud clients
After=mysql.service
After=redis.service
Requires=redis.service
[Service]
Environment=PORT=7867
Environment=NEXTCLOUD_URL=https://localhost
ExecStart="/var/www/nextcloud/apps/notify_push/bin/${ARCH}/notify_push" --allow-self-signed /var/www/nextcloud/config/config.php
User=www-data
[Install]
WantedBy = multi-user.target
EOF
install_template systemd/notify_push.service.sh /etc/systemd/system/notify_push.service
start_notify_push
nc_domain="$(ncc config:system:get overwrite.cli.url)"
set-nc-domain "${nc_domain}" || {
Expand Down
17 changes: 1 addition & 16 deletions bin/ncp/CONFIG/nc-nextcloud.sh
Original file line number Diff line number Diff line change
Expand Up @@ -226,22 +226,7 @@ EOF

arch="$(uname -m)"
[[ "${arch}" =~ "armv7" ]] && arch="armv7"
cat > /etc/systemd/system/notify_push.service <<EOF
[Unit]
Description = Push daemon for Nextcloud clients
After=mysql.service
After=redis.service
Requires=redis.service
[Service]
Environment=PORT=7867
Environment=NEXTCLOUD_URL=https://localhost
ExecStart=/var/www/nextcloud/apps/notify_push/bin/"${arch}"/notify_push --allow-self-signed /var/www/nextcloud/config/config.php
User=www-data
[Install]
WantedBy = multi-user.target
EOF
install_template systemd/notify_push.service.sh /etc/systemd/system/notify_push.service
[[ -f /.docker-image ]] || systemctl enable notify_push

# some added security
Expand Down
2 changes: 2 additions & 0 deletions build/armbian/armbian.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ run_app_unsafe post-inst.sh
# disable SSH by default, it can be enabled through ncp-web
systemctl disable ssh

basename "$IMG" | tee /usr/local/etc/ncp-baseimage

cd -


Expand Down
2 changes: 1 addition & 1 deletion build/build-SD-rpi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \
rm -rf /tmp/ncp-build
EOFCHROOT

basename "$IMG" > raspbian_root/usr/local/etc/ncp-baseimage
basename "$IMG" | sudo tee raspbian_root/usr/local/etc/ncp-baseimage

trap '' EXIT
clean_chroot_raspbian
Expand Down
23 changes: 23 additions & 0 deletions etc/ncp-templates/systemd/notify_push.service.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#! /bin/bash

set -e
source /usr/local/etc/library.sh

cat <<EOF
[Unit]
Description = Push daemon for Nextcloud clients
After=mysql.service
After=redis.service
Requires=redis.service
[Service]
Environment=PORT=7867
Environment=NEXTCLOUD_URL=https://localhost
ExecStart="/var/www/nextcloud/apps/notify_push/bin/${ARCH}/notify_push" --allow-self-signed /var/www/nextcloud/config/config.php
User=www-data
Restart=on-failure
RestartSec=20
[Install]
WantedBy = multi-user.target
EOF
6 changes: 4 additions & 2 deletions ncp.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# NextCloudPi additions to Raspbian
# NextCloudPi additions to Raspbian
#
# Copyleft 2017 by Ignacio Nunez Hernanz <nacho _a_t_ ownyourbits _d_o_t_ com>
# GPL licensed (see end of file) * Use at your own risk!
Expand Down Expand Up @@ -29,6 +29,8 @@ install()
test -f /usr/bin/raspi-config && {
sed -i '/Change User Password/i"0 NextCloudPi Configuration" "Configuration of NextCloudPi" \\' /usr/bin/raspi-config
sed -i '/1\\ \*) do_change_pass ;;/i0\\ *) ncp-config ;;' /usr/bin/raspi-config
# Disable raspberry pi default user
usermod pi -s /sbin/nologin
}

# add the ncc shortcut
Expand Down Expand Up @@ -202,7 +204,7 @@ EOF
chmod g+w /var/run/.ncp-latest-version

# Install all ncp-apps
bin/ncp-update $BRANCH || exit $?
ALLOW_UPDATE_SCRIPT=1 bin/ncp-update $BRANCH || exit $?

# LIMIT LOG SIZE
grep -q maxsize /etc/logrotate.d/apache2 || sed -i /weekly/amaxsize2M /etc/logrotate.d/apache2
Expand Down
Loading

0 comments on commit 21d9894

Please sign in to comment.