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

Fileaccess text #57

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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 ci/ocm-test-suite.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ function waitForPort () {
[ ! -d "${ENV_ROOT}/temp" ] && mkdir --parents "${ENV_ROOT}/temp"

# copy init files.
cp --force ./docker/scripts/init-owncloud-sciencemesh.sh ./temp/owncloud.sh
cp --force ./docker/scripts/init-nextcloud-sciencemesh.sh ./temp/nextcloud.sh
cp -f ./docker/scripts/init-owncloud-sciencemesh.sh ./temp/owncloud.sh
cp -f ./docker/scripts/init-nextcloud-sciencemesh.sh ./temp/nextcloud.sh

docker run --detach --network=testnet \
--name=meshdir.docker \
Expand Down
33 changes: 33 additions & 0 deletions docker/build/fileaccess-text.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/env bash

# CACHEBUST forces docker to clone fresh source codes from git.
# example: docker build -t your-image --build-arg CACHEBUST="default" .

set -e

# @michielbdejong avoid docker buildkit
export DOCKER_BUILDKIT=0

# find this scripts location.
SOURCE=${BASH_SOURCE[0]}
while [ -L "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR=$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )
SOURCE=$(readlink "$SOURCE")
# if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
[[ $SOURCE != /* ]] && SOURCE=$DIR/$SOURCE
done
DIR=$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )

cd "$DIR/.."

# echo Building pondersource/dev-stock-php-base
# docker build --build-arg CACHEBUST="default" --file ./dockerfiles/php-base.Dockerfile --tag pondersource/dev-stock-php-base .

# echo Building pondersource/dev-stock-nextcloud
# docker build --build-arg CACHEBUST="default" --file ./dockerfiles/nextcloud.Dockerfile --tag pondersource/dev-stock-nextcloud .

echo Building pondersource/dev-stock-nextcloud-sunet
docker build --build-arg CACHEBUST="default" --file ./dockerfiles/nextcloud-sunet.Dockerfile --tag pondersource/dev-stock-nextcloud-sunet .

echo Building pondersource/dev-stock-nextcloud-fileaccess-text
docker build --build-arg CACHEBUST="default" --file ./dockerfiles/nextcloud-fileaccess-text.Dockerfile --tag pondersource/dev-stock-nextcloud-fileaccess-text .
5 changes: 5 additions & 0 deletions docker/dockerfiles/nextcloud-fileaccess-text.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM pondersource/dev-stock-nextcloud-sunet

# ARG files_accesscontrol_version=1.16.2
# RUN wget -q https://github.com/nextcloud-releases/files_accesscontrol/releases/download/v${files_accesscontrol_version}/files_accesscontrol-v${files_accesscontrol_version}.tar.gz -O /tmp/files_accesscontrol.tar.gz \
# && cd /tmp && tar xf /tmp/files_accesscontrol.tar.gz && mv /tmp/files_accesscontrol /var/www/html/custom_apps/
15 changes: 15 additions & 0 deletions docker/scripts/init-nextcloud-fileaccess-text.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash

# @michielbdejong halt on error in docker init scripts
set -e

php console.php maintenance:install --admin-user "$USER" --admin-pass "$PASS" --database "mysql" \
--database-name "efss" --database-user "root" --database-host "$DBHOST" \
--database-pass "eilohtho9oTahsuongeeTh7reedahPo1Ohwi3aek"
php console.php app:disable firstrunwizard
php console.php app:enable files_accesscontrol
# php console.php app:enable text

sed -i "8 i\ 1 => 'nc1.docker'," /var/www/html/config/config.php
sed -i "9 i\ 2 => 'nc2.docker'," /var/www/html/config/config.php
sed -i "3 i\ 'allow_local_remote_servers' => true," config/config.php
2 changes: 1 addition & 1 deletion release/federatedgroups-owncloud.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ BRANCH_OWNCLOUD_APP=release
[ ! -d "${REPO_ROOT}/temp" ] && mkdir -p "${REPO_ROOT}/temp"

# copy init files.
cp --force "${REPO_ROOT}/docker/scripts/init-owncloud-rd-sram.sh" "${REPO_ROOT}/temp/oc-rd-sram.sh"
cp -f "${REPO_ROOT}/docker/scripts/init-owncloud-rd-sram.sh" "${REPO_ROOT}/temp/oc-rd-sram.sh"

# ownCloud federatedgroups source code.
[ ! -d "rd-sram-release" ] && \
Expand Down
2 changes: 1 addition & 1 deletion release/ocm-owncloud.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ BRANCH_OWNCLOUD_APP=release
[ ! -d "${REPO_ROOT}/temp" ] && mkdir -p "${REPO_ROOT}/temp"

# copy init files.
cp --force "${REPO_ROOT}/docker/scripts/init-owncloud-opencloudmesh.sh" "${REPO_ROOT}/temp/oc-opencloudmesh.sh"
cp -f "${REPO_ROOT}/docker/scripts/init-owncloud-opencloudmesh.sh" "${REPO_ROOT}/temp/oc-opencloudmesh.sh"

# ownCloud opencloudmesh source code.
[ ! -d "oc-ocm-release" ] && \
Expand Down
2 changes: 1 addition & 1 deletion release/sciencemesh-nextcloud.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ BRANCH_OWNCLOUD_APP=nextcloud
[ ! -d "temp" ] && mkdir -p temp

# copy init file.
cp --force ./docker/scripts/init-nextcloud-sciencemesh.sh ./temp/nc.sh
cp -f ./docker/scripts/init-nextcloud-sciencemesh.sh ./temp/nc.sh

# add additional tagging for docker images.
docker tag pondersource/dev-stock-nextcloud-sciencemesh pondersource/dev-stock-nc1-sciencemesh
Expand Down
2 changes: 1 addition & 1 deletion release/sciencemesh-owncloud.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ BRANCH_OWNCLOUD_APP=owncloud
[ ! -d "temp" ] && mkdir -p temp

# copy init file.
cp --force ./docker/scripts/init-owncloud-sciencemesh.sh ./temp/oc.sh
cp -f ./docker/scripts/init-owncloud-sciencemesh.sh ./temp/oc.sh

# add additional tagging for docker images.
docker tag pondersource/dev-stock-owncloud-sciencemesh pondersource/dev-stock-oc1-sciencemesh
Expand Down
8 changes: 5 additions & 3 deletions tests/base-nextcloud.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function waitForPort () {
[ ! -d "${ENV_ROOT}/temp" ] && mkdir -p "${ENV_ROOT}/temp"

# copy init files.
cp --force "${ENV_ROOT}/docker/scripts/init-nextcloud.sh" "${ENV_ROOT}/temp/nc-base.sh"
cp -f "${ENV_ROOT}/docker/scripts/init-nextcloud.sh" "${ENV_ROOT}/temp/nc-base.sh"

# echo "starting firefox tester"
docker run --detach --name=firefox --network=testnet -p 5800:5800 --shm-size 2g jlesage/firefox:latest
Expand All @@ -60,7 +60,8 @@ docker run --detach --network=testnet
-e DBHOST="maria1.docker" \
-e USER="einstein" \
-e PASS="relativity" \
-v "${ENV_ROOT}/temp/nc-base.sh:/init.sh" \
-v "${ENV_ROOT}/temp/nc-base.sh:/init.sh" \
-v "${ENV_ROOT}/docker/tls:/tls-host" \
pondersource/dev-stock-nextcloud

echo "starting maria2.docker"
Expand All @@ -82,7 +83,8 @@ docker run --detach --network=testnet
-e DBHOST="maria2.docker" \
-e USER="marie" \
-e PASS="radioactivity" \
-v "${ENV_ROOT}/temp/nc-base.sh:/init.sh" \
-v "${ENV_ROOT}/temp/nc-base.sh:/init.sh" \
-v "${ENV_ROOT}/docker/tls:/tls-host" \
pondersource/dev-stock-nextcloud

waitForPort maria1.docker 3306
Expand Down
10 changes: 7 additions & 3 deletions tests/base-owncloud.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function waitForPort () {
[ ! -d "${ENV_ROOT}/temp" ] && mkdir -p "${ENV_ROOT}/temp"

# copy init files.
cp --force "${ENV_ROOT}/docker/scripts/init-owncloud.sh" "${ENV_ROOT}/temp/oc-base.sh"
cp -f "${ENV_ROOT}/docker/scripts/init-owncloud.sh" "${ENV_ROOT}/temp/oc-base.sh"

echo "starting firefox tester"
docker run --detach --name=firefox --network=testnet -p 5800:5800 --shm-size 2g jlesage/firefox:latest
Expand All @@ -60,7 +60,9 @@ docker run --detach --network=testnet
-e DBHOST="maria1.docker" \
-e USER="einstein" \
-e PASS="relativity" \
-v "${ENV_ROOT}/temp/oc-base.sh:/init.sh" \
-v "${ENV_ROOT}/temp/oc-base.sh:/init.sh" \
-v "${ENV_ROOT}/docker/tls:/tls-host" \

pondersource/dev-stock-owncloud

echo "starting maria2.docker"
Expand All @@ -82,7 +84,9 @@ docker run --detach --network=testnet
-e DBHOST="maria2.docker" \
-e USER="marie" \
-e PASS="radioactivity" \
-v "${ENV_ROOT}/temp/oc-base.sh:/init.sh" \
-v "${ENV_ROOT}/temp/oc-base.sh:/init.sh" \
-v "${ENV_ROOT}/docker/tls:/tls-host" \

pondersource/dev-stock-owncloud

waitForPort maria1.docker 3306
Expand Down
110 changes: 110 additions & 0 deletions tests/nextcloud-fileaccess-text.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
#!/usr/bin/env bash

# @michielbdejong halt on error in docker init scripts
set -e

# find this scripts location.
SOURCE=${BASH_SOURCE[0]}
while [ -L "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR=$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )
SOURCE=$(readlink "$SOURCE")
# if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
[[ $SOURCE != /* ]] && SOURCE=$DIR/$SOURCE
done
DIR=$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )

cd "$DIR/.." || exit

ENV_ROOT=$(pwd)
export ENV_ROOT=${ENV_ROOT}

function waitForPort () {
echo waitForPort ${1} ${2}
# the "| cat" after the "| grep" is to prevent the command from exiting with 1 if no match is found by grep.
x=$(docker exec -it "${1}" ss -tulpn | grep -c "${2}" | cat)
until [ "${x}" -ne 0 ]
do
echo Waiting for "${1}" to open port "${2}", this usually takes about 10 seconds ... "${x}"
sleep 1
x=$(docker exec -it "${1}" ss -tulpn | grep -c "${2}" | cat)
done
echo "${1}" port "${2}" is open
}

# create temp dirctory if it doesn't exist.
[ ! -d "${ENV_ROOT}/temp" ] && mkdir -p "${ENV_ROOT}/temp"

# copy init files.
cp -f "${ENV_ROOT}/docker/scripts/init-nextcloud.sh" "${ENV_ROOT}/temp/nc-base.sh"

# echo "starting firefox tester"
# docker run --detach --name=firefox --network=testnet -p 5800:5800 --shm-size 2g jlesage/firefox:latest
# docker run --detach --name=firefox-legacy --network=testnet -p 5900:5800 --shm-size 2g jlesage/firefox:v1.18.0

echo "starting maria1.docker"
docker run --detach --network=testnet \
--name=maria1.docker \
-e MARIADB_ROOT_PASSWORD=eilohtho9oTahsuongeeTh7reedahPo1Ohwi3aek \
mariadb \
--transaction-isolation=READ-COMMITTED \
--binlog-format=ROW \
--innodb-file-per-table=1 \
--skip-innodb-read-only-compressed

echo "starting nc1.docker"
docker run --detach --network=testnet \
--name=nc1.docker \
--publish 8080:80 \
--add-host "host.docker.internal:host-gateway" \
-e HOST="nc1" \
-e DBHOST="maria1.docker" \
-e USER="einstein" \
-e PASS="relativity" \
-v "${ENV_ROOT}/temp/nc-base.sh:/init.sh" \
-v "${ENV_ROOT}/docker/tls:/tls-host" \
pondersource/dev-stock-nextcloud-fileaccess-text

echo "starting maria2.docker"
docker run --detach --network=testnet \
--name=maria2.docker \
-e MARIADB_ROOT_PASSWORD=eilohtho9oTahsuongeeTh7reedahPo1Ohwi3aek \
mariadb \
--transaction-isolation=READ-COMMITTED \
--binlog-format=ROW \
--innodb-file-per-table=1 \
--skip-innodb-read-only-compressed

echo "starting nc2.docker"
docker run --detach --network=testnet \
--name=nc2.docker \
--publish 9080:80 \
--add-host "host.docker.internal:host-gateway" \
-e HOST="nc2" \
-e DBHOST="maria2.docker" \
-e USER="marie" \
-e PASS="radioactivity" \
-v "${ENV_ROOT}/temp/nc-base.sh:/init.sh" \
-v "${ENV_ROOT}/docker/tls:/tls-host" \
pondersource/dev-stock-nextcloud-fileaccess-text

waitForPort maria1.docker 3306
waitForPort nc1.docker 443

docker exec "nc1.docker" bash -c "cp /tls/*.crt /usr/local/share/ca-certificates/"
docker exec "nc1.docker" bash -c "cp /tls-host/*.crt /usr/local/share/ca-certificates/"
docker exec "nc1.docker" update-ca-certificates
docker exec "nc1.docker" bash -c "cat /etc/ssl/certs/ca-certificates.crt >> /var/www/html/resources/config/ca-bundle.crt"

echo "executing init.sh on nc1.docker"
docker exec -u www-data nc1.docker bash /init.sh

waitForPort maria2.docker 3306
waitForPort nc2.docker 443

docker exec "nc2.docker" bash -c "cp /tls/*.crt /usr/local/share/ca-certificates/"
docker exec "nc2.docker" bash -c "cp /tls-host/*.crt /usr/local/share/ca-certificates/"
docker exec "nc2.docker" update-ca-certificates
docker exec "nc2.docker" bash -c "cat /etc/ssl/certs/ca-certificates.crt >> /var/www/html/resources/config/ca-bundle.crt"

echo "executing init.sh on nc2.docker"
docker exec -u www-data nc2.docker bash /init.sh
6 changes: 3 additions & 3 deletions tests/ocm-test-suite.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ function waitForCollabora {
[ ! -d "${ENV_ROOT}/temp" ] && mkdir --parents "${ENV_ROOT}/temp"

# copy init files.
cp --force ./docker/scripts/init-owncloud-sciencemesh.sh ./temp/owncloud.sh
cp --force ./docker/scripts/init-nextcloud-sciencemesh.sh ./temp/nextcloud.sh
sudo rm --force --recursive "${ENV_ROOT}/temp/.X11-unix"
cp -f ./docker/scripts/init-owncloud-sciencemesh.sh ./temp/owncloud.sh
cp -f ./docker/scripts/init-nextcloud-sciencemesh.sh ./temp/nextcloud.sh
sudo rm -rf "${ENV_ROOT}/temp/.X11-unix"

docker run --detach --name=meshdir.docker --network=testnet -v "${ENV_ROOT}/docker/scripts/stub.js:/ocm-stub/stub.js" pondersource/dev-stock-ocmstub
docker run --detach --name=firefox --network=testnet -p 5800:5800 --shm-size 2g jlesage/firefox:latest
Expand Down
2 changes: 1 addition & 1 deletion tests/rd-sram.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function waitForPort () {
[ ! -d "${ENV_ROOT}/temp" ] && mkdir -p "${ENV_ROOT}/temp"

# copy init files.
cp --force "${ENV_ROOT}/docker/scripts/init-owncloud-rd-sram.sh" "${ENV_ROOT}/temp/oc-rd-sram.sh"
cp -f "${ENV_ROOT}/docker/scripts/init-owncloud-rd-sram.sh" "${ENV_ROOT}/temp/oc-rd-sram.sh"

docker run --detach --name=firefox --network=testnet -p 5800:5800 --shm-size 2g jlesage/firefox:latest
docker run --detach --name=firefox-legacy --network=testnet -p 5900:5800 --shm-size 2g jlesage/firefox:v1.18.0
Expand Down
4 changes: 2 additions & 2 deletions tests/sciencemesh.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ function waitForCollabora {
[ ! -d "${ENV_ROOT}/temp" ] && mkdir --parents "${ENV_ROOT}/temp"

# copy init files.
cp --force ./docker/scripts/init-owncloud-sciencemesh.sh ./temp/owncloud.sh
cp --force ./docker/scripts/init-nextcloud-sciencemesh.sh ./temp/nextcloud.sh
cp -f ./docker/scripts/init-owncloud-sciencemesh.sh ./temp/owncloud.sh
cp -f ./docker/scripts/init-nextcloud-sciencemesh.sh ./temp/nextcloud.sh

docker run --detach --name=meshdir.docker --network=testnet -v "${ENV_ROOT}/docker/scripts/stub.js:/ocm-stub/stub.js" pondersource/dev-stock-ocmstub
docker run --detach --name=firefox --network=testnet -p 5800:5800 --shm-size 2g jlesage/firefox:latest
Expand Down
2 changes: 1 addition & 1 deletion tests/sm-sram-ocm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function waitForCollabora {
[ ! -d "${ENV_ROOT}/temp" ] && mkdir --parents "${ENV_ROOT}/temp"

# copy init files.
cp --force ./docker/scripts/init-owncloud-sm-sram-ocm.sh ./temp/owncloud.sh
cp -f ./docker/scripts/init-owncloud-sm-sram-ocm.sh ./temp/owncloud.sh

docker run --detach --name=meshdir.docker --network=testnet -v "${ENV_ROOT}/docker/scripts/stub.js:/ocm-stub/stub.js" pondersource/dev-stock-ocmstub
docker run --detach --name=firefox --network=testnet -p 5800:5800 --shm-size 2g jlesage/firefox:latest
Expand Down
2 changes: 1 addition & 1 deletion tests/surf-trashbin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function waitForPort () {
[ ! -d "${ENV_ROOT}/temp" ] && mkdir -p "${ENV_ROOT}/temp"

# copy init files.
cp --force "${ENV_ROOT}/docker/scripts/init-owncloud-surf-trashbin.sh" "${ENV_ROOT}/temp/oc-surf-trashbin.sh"
cp -f "${ENV_ROOT}/docker/scripts/init-owncloud-surf-trashbin.sh" "${ENV_ROOT}/temp/oc-surf-trashbin.sh"

echo "starting firefox tester"
docker run --detach --name=firefox --network=testnet -p 5800:5800 --shm-size 2g jlesage/firefox:latest
Expand Down
4 changes: 2 additions & 2 deletions tests/testing-ocm-nc-oc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ function waitForPort {
[ ! -d "${REPO_ROOT}/temp" ] && mkdir -p "${REPO_ROOT}/temp"

# copy init files.
cp --force "${REPO_ROOT}/docker/scripts/init-nextcloud.sh" "${REPO_ROOT}/temp/nc-base.sh"
cp --force "${REPO_ROOT}/docker/scripts/init-owncloud-opencloudmesh.sh" "${REPO_ROOT}/temp/oc-opencloudmesh.sh"
cp -f "${REPO_ROOT}/docker/scripts/init-nextcloud.sh" "${REPO_ROOT}/temp/nc-base.sh"
cp -f "${REPO_ROOT}/docker/scripts/init-owncloud-opencloudmesh.sh" "${REPO_ROOT}/temp/oc-opencloudmesh.sh"

echo "starting firefox tester"
docker run --detach --name=firefox --network=testnet -p 5800:5800 --shm-size 2g jlesage/firefox:latest
Expand Down
2 changes: 1 addition & 1 deletion tests/testing-ocm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function waitForPort {
[ ! -d "${REPO_ROOT}/temp" ] && mkdir -p "${REPO_ROOT}/temp"

# copy init files.
cp --force "${REPO_ROOT}/docker/scripts/init-owncloud-opencloudmesh.sh" "${REPO_ROOT}/temp/oc-opencloudmesh.sh"
cp -f "${REPO_ROOT}/docker/scripts/init-owncloud-opencloudmesh.sh" "${REPO_ROOT}/temp/oc-opencloudmesh.sh"

echo "starting firefox tester"
docker run --detach --name=firefox --network=testnet -p 5800:5800 --shm-size 2g jlesage/firefox:latest
Expand Down