diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0797d3b6..23f26748 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -38,8 +38,7 @@ You can read the full documentation at https://www.conventionalcommits.org. ## Tools We maintain a collection of scripts in `./tool/`. They range from setting up a local Nextcloud server (`./tool/dev.sh`) to generating assets. -Be aware that due to limitations in Apache the dev server will crash when you resize the terminal window. - + ## Monorepo For easier development we use a monorepo structure. This means that we have multiple packages in one git repository. diff --git a/packages/nextcloud/test/helper.dart b/packages/nextcloud/test/helper.dart index 73be4edb..561494cb 100644 --- a/packages/nextcloud/test/helper.dart +++ b/packages/nextcloud/test/helper.dart @@ -156,7 +156,7 @@ Future getTestClient( return client; } -Future getDockerContainer(final DockerImage image, {final bool useApache = false}) async { +Future getDockerContainer(final DockerImage image) async { late ProcessResult result; late int port; while (true) { @@ -172,11 +172,6 @@ Future getDockerContainer(final DockerImage image, {final bool '-p', '$port:80', image, - if (!useApache) ...[ - 'php', - '-S', - '0.0.0.0:80', - ], ], ); // 125 means the docker run command itself has failed which indicated the port is already used diff --git a/packages/nextcloud/test/spreed_test.dart b/packages/nextcloud/test/spreed_test.dart index ff1ee9c1..d9559464 100644 --- a/packages/nextcloud/test/spreed_test.dart +++ b/packages/nextcloud/test/spreed_test.dart @@ -18,10 +18,7 @@ void main() { late DockerContainer container; late TestNextcloudClient client1; setUp(() async { - container = await getDockerContainer( - image, - useApache: true, - ); + container = await getDockerContainer(image); client1 = await getTestClient(container); }); tearDown(() => container.destroy()); diff --git a/tool/Dockerfile.dev b/tool/Dockerfile.dev index 602893a1..d44e6d1a 100644 --- a/tool/Dockerfile.dev +++ b/tool/Dockerfile.dev @@ -1,9 +1,7 @@ -ARG SERVER_VERSION=27.1.3@sha256:4ab3159b25310ffdb699f532d45f706d5d949100ed7ac11820d83467f29678b9 +ARG SERVER_VERSION=27.1.3-fpm-alpine@sha256:70ddd4abb804bc061a4f882a81cc62a219b262c0ed1784439e66b091ef26104b FROM nextcloud:$SERVER_VERSION WORKDIR /usr/src/nextcloud -RUN chown -R www-data:www-data . -USER www-data RUN ./occ maintenance:install --admin-pass admin --admin-email admin@example.com RUN ./occ config:system:set allow_local_remote_servers --value=true @@ -30,8 +28,11 @@ RUN install_app_version spreed https://github.com/nextcloud-releases/spreed/rele RUN ./occ talk:turn:add turn,turns staticauth.openrelay.metered.ca:443 udp,tcp --secret openrelayprojectsecret RUN ./occ app:enable password_policy -RUN (sh /entrypoint.sh php -S 0.0.0.0:8080 &) && \ - until curl -s -o /dev/null http://localhost:8080/status.php; do true; done && \ +RUN (sh /entrypoint.sh php -S 0.0.0.0:80 &) && \ + until curl -s -o /dev/null http://localhost/status.php; do true; done && \ # Do not setup the demo user here - for user in admin user1 user2; do curl -u "$user:$user" -H "ocs-apirequest: true" -s -o /dev/null http://localhost:8080/ocs/v2.php/cloud/user; done + for user in admin user1 user2; do curl -u "$user:$user" -H "ocs-apirequest: true" -s -o /dev/null http://localhost/ocs/v2.php/cloud/user; done COPY --chown=www-data:www-data overlay /usr/src/nextcloud/ + +ENV PHP_CLI_SERVER_WORKERS=10 +CMD ["php", "-S", "0.0.0.0:80"] diff --git a/tool/dev.sh b/tool/dev.sh index a08d3e79..7967c2f8 100755 --- a/tool/dev.sh +++ b/tool/dev.sh @@ -6,4 +6,13 @@ source tool/common.sh ./tool/build-dev-container.sh echo "Running development instance on http://localhost. To access it in an Android Emulator use http://10.0.2.2" -docker run --rm -v nextcloud-neon-dev:/usr/src/nextcloud -v nextcloud-neon-dev:/var/www/html -p "80:80" --add-host=host.docker.internal:host-gateway "$(image_tag "dev:latest")" + +container="$(docker run -d --rm -v nextcloud-neon-dev:/usr/src/nextcloud -v nextcloud-neon-dev:/var/www/html -p "80:80" --add-host=host.docker.internal:host-gateway "$(image_tag "dev:latest")")" +function cleanup() { + docker kill "$container" +} +trap cleanup EXIT + +docker logs -f "$container" & + +sleep infinity diff --git a/tool/dev/install_app_version b/tool/dev/install_app_version index c0d7c2cb..622d23b2 100755 --- a/tool/dev/install_app_version +++ b/tool/dev/install_app_version @@ -1,5 +1,5 @@ -#!/bin/bash -set -euxo pipefail +#!/bin/sh +set -euxo app="$1" url="$2"