Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: README #1850

Closed
wants to merge 26 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
9e993e4
build-sd-images.yml: Fix selenium setup
theCalcaholic Oct 3, 2023
ee90cad
Update Nextcloud to 27.1.2
theCalcaholic Oct 10, 2023
5dc0aba
changelog.md: Document v1.52.5
theCalcaholic Oct 10, 2023
2ecebe1
build-SD-armbian.sh: Don't checkout git history
theCalcaholic Oct 10, 2023
4b0cff6
build-SD-armbian.sh: Disable armbian's FAST_CREATE_IMAGE
theCalcaholic Oct 10, 2023
b8367e0
build-SD-armbian.sh: Patch rootfs size determination in armbian build…
theCalcaholic Oct 10, 2023
36c15f9
build-SD-armbian.sh: Use armbian-next to build NCP images
theCalcaholic Jul 21, 2023
12cfcb3
Rename TMPDIR environment variables to TEMPDIR to avoid overriding ph…
theCalcaholic Oct 17, 2023
10bf970
Add build-SD-armbian-vagrant.sh
theCalcaholic Oct 17, 2023
726bcdb
build-sd-images.yml: Fix armbian build
theCalcaholic Oct 17, 2023
fb6200f
Add ncp-community.sh and admin section to ncp-app
theCalcaholic Oct 19, 2023
1f76e6d
Add integration test for nc admin section
theCalcaholic Oct 19, 2023
183c666
release.yml: Migrate from hub to gh cli
theCalcaholic Oct 20, 2023
fc6120d
nextcloud_tests.py: Increase timeout for NCP settings toggle test
theCalcaholic Oct 21, 2023
cde03be
ncp-check-version: Temporarily override canary setting
theCalcaholic Oct 23, 2023
19b5771
tests: Remove deprecated syntax for headless option
theCalcaholic Oct 23, 2023
61cbadd
.github/*: Use latest version of selenium
theCalcaholic Oct 23, 2023
407f5f9
nextcloud_tests.py: Increase wait timeout
theCalcaholic Oct 24, 2023
660d8eb
.github/publish-image.yml: Migrate from hub to gh
theCalcaholic Oct 25, 2023
d72df8a
system_tests.py: Add auto update test
theCalcaholic Oct 25, 2023
3e130fc
install.sh: Fix ncp-provisioning not being executed on baremetal install
theCalcaholic Oct 26, 2023
d49906a
vm-tests.yml: Skip update tests for vms (for now)
theCalcaholic Oct 31, 2023
6390db5
Add support for NC 27.1.3
theCalcaholic Oct 31, 2023
deee687
system_tests.py: Add debug output
theCalcaholic Oct 31, 2023
23b12ea
Document v1.53.0
theCalcaholic Nov 14, 2023
7d4f5f1
࿓❯ fix: Removed Docker information from README
victor-rays Nov 20, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ jobs:
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Selenium
run: pip install selenium==4.10.0
run: pip install selenium

- name: Wait for container startup
run: |
Expand Down Expand Up @@ -421,7 +421,7 @@ jobs:
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Selenium
run: pip install selenium==4.10.0
run: pip install selenium
- name: Wait for container startup
run: |
set -e
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build-lxd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ jobs:
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Selenium
run: pip install selenium==4.10.0
run: pip install selenium
- name: download LXD image from artifact store
uses: actions/download-artifact@v3
with:
Expand Down Expand Up @@ -331,7 +331,7 @@ jobs:
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Selenium
run: pip install selenium==4.10.0
run: pip install selenium
- name: download LXD image from artifact store
uses: actions/download-artifact@v3
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build-sd-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ jobs:
continue-on-error: true
run: |
set -ex
export LIB_TAG=master
export IMG="NextCloudPi_${{ inputs.board_name }}_${VERSION//\//_}.img"
[[ "${{ github.ref_protected }}" == true ]] || export DBG=x

Expand All @@ -83,7 +82,6 @@ jobs:
echo -e "${LOG_CICD} Cleanup armbian build leftovers..."
sudo rm -rf armbian/ tmp/ output/

export LIB_TAG=master
export IMG="NextCloudPi_${{ inputs.board_name }}_${VERSION//\//_}.img"
[[ "${{ github.ref_protected }}" == true ]] || export DBG=x

Expand Down Expand Up @@ -179,6 +177,8 @@ jobs:
sudo rm -rf raspbian_root
. ./build/buildlib.sh
mount_raspbian "ncp.img"
sudo cat raspbian_root/etc/machine-id
sudo systemd-id128 new | sudo tee ./raspbian_root/etc/machine-id
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
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:
success=false
for i in {1..5}
do
body="$(hub release show -f "%b" "${VERSION}")"
body="$(gh release view --json body "${VERSION}" | jq -r '.body')"
if ! [[ "$body" =~ .*'**Checksums:**'.* ]]
then

Expand All @@ -80,7 +80,7 @@ jobs:
\`\`\`"

gh release edit "${VERSION?}" -n "$body"
if hub release show -f "%b" "${VERSION}" | grep "$checksum"
if gh release view --json body "${VERSION}" | jq -r '.body' | grep "$checksum"
then
success=true
break
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ jobs:

# TODO: Fix 32bit armbian images
odroidxu4:
# if: ${{ inputs.sd-images || github.event_name != 'workflow_dispatch' }}
# if: ${{ inputs.sd-images || ( github.event_name != 'workflow_dispatch' && !startsWith(github.ref_name, 'docker-') ) }}
if: ${{ false }}
uses: ./.github/workflows/build-sd-images.yml
with:
Expand All @@ -126,7 +126,7 @@ jobs:
secrets: inherit
# TODO: Fix 32bit armbian images
bananapi:
#if: ${{ inputs.sd-images || github.event_name != 'workflow_dispatch' }}
# if: ${{ inputs.sd-images || ( github.event_name != 'workflow_dispatch' && !startsWith(github.ref_name, 'docker-') ) }}
if: ${{ false }}
uses: ./.github/workflows/build-sd-images.yml
with:
Expand Down Expand Up @@ -391,7 +391,7 @@ jobs:

"

hub release create --draft -F - "${{ env.VERSION }}" <<EOF
gh release create --draft -F - "${{ env.VERSION }}" <<EOF
${subject:-No message found}

${body:+${body}${separator}}
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/vm-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ jobs:
setup-ssh-port-forwarding "$SERVER_ADDRESS"

echo "Run integration tests"
test-ncp-instance -a -f "$SNAPSHOT_ID" -b "${VERSION}" "root@${SERVER_ADDRESS}" "localhost" "8443" "9443" || {
ssh -o "StrictHostKeyChecking=no" -o "UserKnownHostsFile=/dev/null" "root@${SERVER_ADDRESS}" cat /usr/local/etc/instance.cfg
test-ncp-instance -a -f "$SNAPSHOT_ID" -b "${VERSION}" --systemtest-args "--skip-update-test" "root@${SERVER_ADDRESS}" "localhost" "8443" "9443" || {

echo "Integration tests failed"
echo "Here are the last lines of ncp-install.log:"
Expand Down Expand Up @@ -217,7 +218,7 @@ jobs:
echo "Run integration tests"
setup-ssh-port-forwarding "$SERVER_ADDRESS"

test-ncp-instance -a -f "$SNAPSHOT_ID" -b "${VERSION}" "root@${SERVER_ADDRESS}" "localhost" "8443" "9443" || {
test-ncp-instance -a -f "$SNAPSHOT_ID" -b "${VERSION}" --systemtest-args "--skip-update-test" "root@${SERVER_ADDRESS}" "localhost" "8443" "9443" || {

echo "Integration tests failed"
echo "Here are the last lines of ncp-install.log:"
Expand Down
50 changes: 3 additions & 47 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ _(The translated README pages are not updated at this time)_

# NextcloudPi

[![Telegram icon][telegram-badge]][chat-telegram] [![Matrix icon][matrix-badge]][chat-matrix] [![Docker icon][docker-badge]][ncp-docker-hub] [![Nextcloud icon][nc-badge]][nc-github]
[![Telegram icon][telegram-badge]][chat-telegram] [![Matrix icon][matrix-badge]][chat-matrix] [![Nextcloud icon][nc-badge]][nc-github]

[![Forum icon][forum-badge]][nc-forum-support]

Expand All @@ -19,7 +19,7 @@ This is the build code for the [NextcloudPi][ncp-website] open-source community

NextcloudPi is a ready to use image for Virtual Machines, Raspberry Pi, Odroid HC1, Rock64 and other boards. ([⇒ Downloads][ncp-releases])

This code also generates the NextcloudPi [Docker image][ncp-docker-hub], LXD container & VM, there is an install script for the latest stable Debian based system as well.
<!-- This code also generates the NextcloudPi [Docker image][ncp-docker-hub], LXD container & VM, there is an install script for the latest stable Debian based system as well. -->

Find the documentation at [docs.nextcloudpi.com][ncp-docs-website], the documentation is all written by volunteers.

Expand Down Expand Up @@ -108,36 +108,6 @@ sudo ncp-config

![NCP-config][ncp-config-image]


## Run in docker

```
docker run --detach \
--publish 4443:4443 \
--publish 443:443 \
--publish 80:80 \
--volume ncdata:/data \
--name nextcloudpi \
ownyourbits/nextcloudpi $DOMAIN
```

`$DOMAIN` can also be the IP-address of the host device if you're accessing it via IP-address in your local home network.

Can also be run with the `--init` flag for zombie process reaping

```
docker run --detach \
--init \
--publish 4443:4443 \
--publish 443:443 \
--publish 80:80 \
--volume ncdata:/data \
--name nextcloudpi \
ownyourbits/nextcloudpi $DOMAIN
```

It takes a moment to start completely, you can check this with `docker logs nextcloudpi` until it says `Init done`.

## Run in LXD

```
Expand Down Expand Up @@ -191,8 +161,6 @@ Packages
- `whiptail`
- `qemu`
- `qemu-user-static`
- `docker` _(If you're building a Docker image)_
- `lxd` _(If you're building an LXD/LXC container image)_

### Raspberry Pi IMG

Expand All @@ -208,16 +176,6 @@ cd nextcloudpi
./build-SD-armbian.sh odroidxu4 # supported board code name
```

In order to build & push the Docker image to your repository, you'll also need to change the username, repo and tags in the script to match your credentials at Docker Hub.

```
git clone https://github.com/nextcloud/nextcloudpi.git
cd nextcloudpi
build/build-docker.sh x86
build/build-docker.sh armhf
build/build-docker.sh arm64
```

### LXD

```
Expand Down Expand Up @@ -248,7 +206,7 @@ curl -sSL https://raw.githubusercontent.com/nextcloud/nextcloudpi/master/install

[Downloads][ncp-releases]

[Docker Hub][ncp-docker-hub]
<!-- [Docker Hub][ncp-docker-hub] -->

[Nextcloud Forum][nc-forum]

Expand Down Expand Up @@ -310,8 +268,6 @@ You can find us on the [Forum][nc-forum], [Telegram][chat-telegram] or [Matrix][

[docker-tests-badge]: https://github.com/nextcloud/nextcloudpi/actions/workflows/build-docker.yml/badge.svg

[docker-badge]: https://img.shields.io/badge/Docker-2CA5E0?style=for-the-badge&logo=docker&logoColor=white

[telegram-badge]: https://img.shields.io/badge/Telegram-2CA5E0?style=for-the-badge&logo=telegram&logoColor=white

[matrix-badge]: https://img.shields.io/badge/matrix-000000?style=for-the-badge&logo=Matrix&logoColor=white
Expand Down
14 changes: 9 additions & 5 deletions bin/ncp-check-version
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,25 @@

# update latest available version in /var/run/.ncp-latest-version

TMPDIR="$( mktemp -d /tmp/ncp-check.XXXXXX || ( echo "Failed to create temp dir. Exiting" >&2; exit 1 ) )"
trap "rm -rf \"${TMPDIR}\"; exit 0" 0 1 2 3 15
TEMPDIR="$( mktemp -d /tmp/ncp-check.XXXXXX || ( echo "Failed to create temp dir. Exiting" >&2; exit 1 ) )"
trap "rm -rf \"${TEMPDIR}\"; exit 0" 0 1 2 3 15

BRANCH="master"
{ [[ -f /.dockerenv ]] || [[ -f /.docker-image ]] || [[ "$DOCKERBUILD" == 1 ]]; } && BRANCH="docker-stable"

git clone -b "$BRANCH" --depth 20 -q --bare https://github.com/nextcloud/nextcloudpi.git "$TMPDIR" || {
git clone -b "$BRANCH" --depth 20 -q --bare https://github.com/nextcloud/nextcloudpi.git "$TEMPDIR" || {
echo "The git clone command failed: No connectivity to https://github.com ?" >&2
exit 1
}

cd "$TMPDIR" || exit 1
cd "$TEMPDIR" || exit 1
VER=$( git describe --always --tags | grep -oP "v\d+\.\d+\.\d+" )

[[ -f "/usr/local/etc/instance.cfg" ]] && {
canary="$(. /usr/local/etc/library.sh; find_app_param ncp-community.sh CANARY)"
# TODO: Remove temporary canary override after staged rollouts test
canary="no"

[[ "$canary" != "yes" ]] && [[ -f "/usr/local/etc/instance.cfg" ]] && {
cohorte_id="$(jq .cohorteId /usr/local/etc/instance.cfg)"
[[ -f "./staged_rollouts/${VER}.txt" ]] && {
grep "^${cohorte_id}$" "./staged_rollouts/${VER}.txt" || {
Expand Down
8 changes: 4 additions & 4 deletions bin/ncp-provisioning.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# this script runs at startup to provide an unique random passwords for each instance

source /usr/local/etc/library.sh

set -x
## redis provisioning

CFG=/var/www/nextcloud/config/config.php
Expand Down Expand Up @@ -73,13 +73,13 @@ if needs_decrypt; then
fi

[[ -f /usr/local/etc/instance.cfg ]] || {
cohorte_id=$((1 + RANDOM % 100))
cohorte_id=$((RANDOM % 100))
cat > /usr/local/etc/instance.cfg <<EOF
{
"cohorteId": ${cohorte_id},
"canary": false
"cohorteId": ${cohorte_id}
}
EOF
cat /usr/local/etc/instance.cfg
}


Expand Down
28 changes: 14 additions & 14 deletions bin/ncp-restore
Original file line number Diff line number Diff line change
Expand Up @@ -16,32 +16,32 @@ DIR="$( cd "$( dirname "$BACKUPFILE" )" &>/dev/null && pwd )" #abspath
[[ -f "$BACKUPFILE" ]] || { echo "$BACKUPFILE not found" ; exit 1; }
[[ "$DIR" =~ "$NCDIR".* ]] && { echo "Refusing to restore from $NCDIR"; exit 1; }

TMPDIR="$( mktemp -d "$( dirname "$BACKUPFILE" )"/ncp-restore.XXXXXX )" || { echo "Failed to create temp dir" >&2; exit 1; }
[[ "$(stat -fc%T "${TMPDIR}")" =~ ext|btrfs|zfs ]] || { echo "Can only restore from ext/btrfs/zfs filesystems (found '$(stat -fc%T "${TMPDIR}")" >&2; exit 1; }
TEMPDIR="$( mktemp -d "$( dirname "$BACKUPFILE" )"/ncp-restore.XXXXXX )" || { echo "Failed to create temp dir" >&2; exit 1; }
[[ "$(stat -fc%T "${TEMPDIR}")" =~ ext|btrfs|zfs ]] || { echo "Can only restore from ext/btrfs/zfs filesystems (found '$(stat -fc%T "${TEMPDIR}")" >&2; exit 1; }

TMPDIR="$( cd "$TMPDIR" &>/dev/null && pwd )" || { echo "$TMPDIR not found"; exit 1; } #abspath
cleanup(){ local RET=$?; echo "Cleanup..."; rm -rf "${TMPDIR}"; trap "" EXIT; exit $RET; }
TEMPDIR="$( cd "$TEMPDIR" &>/dev/null && pwd )" || { echo "$TEMPDIR not found"; exit 1; } #abspath
cleanup(){ local RET=$?; echo "Cleanup..."; rm -rf "${TEMPDIR}"; trap "" EXIT; exit $RET; }
trap cleanup INT TERM HUP ERR EXIT
rm -rf "$TMPDIR" && mkdir -p "$TMPDIR"
rm -rf "$TEMPDIR" && mkdir -p "$TEMPDIR"

[[ "$BACKUPFILE" =~ .*".tar.gz" ]] && compress_arg="-I pigz"

# CHECK FREE SPACE IN $TMPDIR
# CHECK FREE SPACE IN $TEMPDIR
echo "check free space..." # allow at least ~100 extra MiB
extractedsize=$(tar $compress_arg -tvf "$BACKUPFILE" | awk '{s+=$3} END{printf "%.0f", (s/1024)}') # Size of extracted files in "KB"
size=$(($extractedsize + 100*1024))
free=$( df "$TMPDIR" | tail -1 | awk '{ print $4 }' )
free=$( df "$TEMPDIR" | tail -1 | awk '{ print $4 }' )
[ $size -ge $free ] && {
echo "free space check failed. Need $size KB in $TMPDIR";
echo "free space check failed. Need $size KB in $TEMPDIR";
exit 1;
}

# EXTRACT FILES
echo "extracting backup file $BACKUPFILE..."
tar $compress_arg -xf "$BACKUPFILE" -C "$TMPDIR" || exit 1
tar $compress_arg -xf "$BACKUPFILE" -C "$TEMPDIR" || exit 1

## SANITY CHECKS
[[ -d "$TMPDIR"/nextcloud ]] && [[ -f "$( ls "$TMPDIR"/nextcloud-sqlbkp_*.bak 2>/dev/null )" ]] || {
[[ -d "$TEMPDIR"/nextcloud ]] && [[ -f "$( ls "$TEMPDIR"/nextcloud-sqlbkp_*.bak 2>/dev/null )" ]] || {
echo "invalid backup file. Abort"
exit 1
}
Expand All @@ -54,7 +54,7 @@ echo "restore files..."
mv -T "$NCDIR/data" "$DATA_BKP_DIR/"
}
rm -rf "$NCDIR"
mv -T "$TMPDIR"/nextcloud "$NCDIR" || { echo "Error restoring base files"; exit 1; }
mv -T "$TEMPDIR"/nextcloud "$NCDIR" || { echo "Error restoring base files"; exit 1; }

if [[ -n "$DATA_BKP_DIR" ]]
then
Expand Down Expand Up @@ -91,7 +91,7 @@ EOFMYSQL
# shellcheck disable=SC2181
[ $? -ne 0 ] && { echo "Error configuring nextcloud database"; exit 1; }

mysql -u root nextcloud < "$TMPDIR"/nextcloud-sqlbkp_*.bak || { echo "Error restoring nextcloud database"; exit 1; }
mysql -u root nextcloud < "$TEMPDIR"/nextcloud-sqlbkp_*.bak || { echo "Error restoring nextcloud database"; exit 1; }

## RESTORE DATADIR

Expand All @@ -105,7 +105,7 @@ cd "$NCDIR"

### INCLUDEDATA=yes situation
NUMFILES=2
if [[ $( ls "$TMPDIR" | wc -l ) -eq $NUMFILES ]]; then
if [[ $( ls "$TEMPDIR" | wc -l ) -eq $NUMFILES ]]; then

[[ -e "$DATADIR" ]] && {
bk_target="$DATADIR-$( date '+%FT%s' )"
Expand All @@ -121,7 +121,7 @@ if [[ $( ls "$TMPDIR" | wc -l ) -eq $NUMFILES ]]; then
btrfs subvolume create "$DATADIR" || exit 1
}
chown www-data: "$DATADIR"
TMPDATA="$TMPDIR/$( basename "$DATADIR" )"
TMPDATA="$TEMPDIR/$( basename "$DATADIR" )"
mv "$TMPDATA"/* "$TMPDATA"/.[!.]* "$DATADIR" || exit 1
rmdir "$TMPDATA" || exit 1

Expand Down
10 changes: 5 additions & 5 deletions bin/ncp-update
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,18 @@ fi
BRANCH="${1:-master}"
[[ "$BRANCH" != "master" ]] && echo "INFO: updating to development branch '$BRANCH'"

TMPDIR="$( mktemp -d /tmp/ncp-update.XXXXXX || ( echo "Failed to create temp dir. Exiting" >&2; exit 1 ) )"
trap 'cd /; rm -rf "${TMPDIR}"' EXIT
TEMPDIR="$( mktemp -d /tmp/ncp-update.XXXXXX || ( echo "Failed to create temp dir. Exiting" >&2; exit 1 ) )"
trap 'cd /; rm -rf "${TEMPDIR}"' EXIT

echo -e "Downloading updates"
git clone --depth 20 -b "$BRANCH" -q https://github.com/nextcloud/nextcloudpi.git "$TMPDIR" || {
git clone --depth 20 -b "$BRANCH" -q https://github.com/nextcloud/nextcloudpi.git "$TEMPDIR" || {
echo "No internet connectivity"
exit 1
}

# shellcheck disable=SC2164
[[ -f /.ncp-image ]] || {
cd "$TMPDIR" # update locally during build
cd "$TEMPDIR" # update locally during build

[[ -z "$2" ]] || {
git fetch origin "$2" || {
Expand All @@ -44,7 +44,7 @@ fi
echo -e "Performing updates"
./update.sh || exit $?

cd "$TMPDIR" || exit 1
cd "$TEMPDIR" || exit 1
git describe --always --tags --abbrev=0 2>/dev/null | grep -qoP "v\d+\.\d+\.\d+" || git fetch --unshallow --tags -q
VER=$( git describe --always --tags --abbrev=0 | grep -oP "v\d+\.\d+\.\d+" )

Expand Down
7 changes: 7 additions & 0 deletions bin/ncp/CONFIG/ncp-community.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

# Configure various settings for community participation

install() { :; }

configure() { :; }
Loading