From 2b3a7c0e73482ee20d87c12f5214879ffb875cd8 Mon Sep 17 00:00:00 2001 From: Oleksander Piskun Date: Fri, 3 Jan 2025 14:52:08 +0200 Subject: [PATCH] (feat): Allow any docker network for HTTPS(remote) install type Signed-off-by: Oleksander Piskun --- .github/workflows/docs-check.yml | 25 - .github/workflows/lint.yml | 153 ----- .github/workflows/node-build.yml | 55 -- .github/workflows/node.yml | 105 ---- .github/workflows/reuse.yml | 24 - .github/workflows/tests-deploy.yml | 845 ++++++++++++++++------------ .github/workflows/tests-special.yml | 137 ----- .github/workflows/tests.yml | 509 ----------------- lib/DeployActions/DockerActions.php | 21 +- 9 files changed, 512 insertions(+), 1362 deletions(-) delete mode 100644 .github/workflows/docs-check.yml delete mode 100644 .github/workflows/lint.yml delete mode 100644 .github/workflows/node-build.yml delete mode 100644 .github/workflows/node.yml delete mode 100644 .github/workflows/reuse.yml delete mode 100644 .github/workflows/tests-special.yml delete mode 100644 .github/workflows/tests.yml diff --git a/.github/workflows/docs-check.yml b/.github/workflows/docs-check.yml deleted file mode 100644 index 0bb0e5a7..00000000 --- a/.github/workflows/docs-check.yml +++ /dev/null @@ -1,25 +0,0 @@ -# SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors -# SPDX-License-Identifier: MIT -name: Docs check -on: - pull_request: - -permissions: - contents: read - -jobs: - build_docs: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 - with: - python-version: '3.10' - - - name: Install Docs dependencies - run: python3 -m pip install -r docs/requirements.txt - - - name: Build and push Docs - run: | - make html SPHINXOPTS="-W" diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml deleted file mode 100644 index 5056fc5a..00000000 --- a/.github/workflows/lint.yml +++ /dev/null @@ -1,153 +0,0 @@ -# SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors -# SPDX-License-Identifier: MIT -name: Lint - -on: - pull_request: - push: - branches: [main] - workflow_dispatch: - -permissions: - contents: read - -concurrency: - group: lint-${{ github.head_ref || github.run_id }} - cancel-in-progress: true - -jobs: - xml-lint: - runs-on: ubuntu-22.04 - name: info.xml lint - - steps: - - uses: actions/checkout@v4 - - - name: Download xml appinfo schema - run: wget https://raw.githubusercontent.com/nextcloud/appstore/master/nextcloudappstore/api/v1/release/info.xsd - - - name: Lint appinfo/info.xml - uses: ChristophWurst/xmllint-action@v1.1 - with: - xml-file: ./appinfo/info.xml - xml-schema-file: ./info.xsd - - php-lint: - runs-on: ubuntu-22.04 - name: php-lint - strategy: - matrix: - php-versions: ["8.1"] - - steps: - - uses: actions/checkout@v4 - - - name: Set up php ${{ matrix.php-versions }} - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php-versions }} - coverage: none - - - name: Lint - run: composer run lint - - php-cs: - runs-on: ubuntu-22.04 - name: php-cs - strategy: - matrix: - php-versions: ["8.1"] - - steps: - - uses: actions/checkout@v4 - - - name: Set up php ${{ matrix.php-versions }} - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php-versions }} - coverage: none - - - name: Install dependencies - run: composer i - - - name: Lint - run: composer run cs:check || ( echo 'Please run `composer run cs:fix` to format your code' && exit 1 ) - - php-psalm-analysis: - runs-on: ubuntu-22.04 - strategy: - matrix: - php-versions: ["8.1"] - name: php-psalm-analysis - - steps: - - uses: actions/checkout@v4 - - name: Set up php ${{ matrix.php-versions }} - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php-versions }} - coverage: none - - - name: Install dependencies - run: composer i - - - name: Run coding standards check - run: composer run psalm - - php-security-analysis: - runs-on: ubuntu-22.04 - permissions: - contents: read - actions: read - security-events: write - name: security analysis - steps: - - uses: actions/checkout@v4 - with: - submodules: recursive - - - name: Psalm - uses: docker://vimeo/psalm-github-actions:4.30.0 - with: - security_analysis: true - composer_ignore_platform_reqs: false - report_file: results.sarif - - - name: Upload Security Analysis results to GitHub - uses: github/codeql-action/upload-sarif@v2 - with: - sarif_file: results.sarif - - js-eslint: - runs-on: ubuntu-22.04 - name: eslint - - steps: - - uses: actions/checkout@v4 - - name: Install dependencies - run: npm ci - - - name: ESLint - run: npm run lint - - stylelint: - runs-on: ubuntu-22.04 - - name: stylelint - - steps: - - uses: actions/checkout@v4 - - name: Install dependencies - run: npm ci - - - name: Lint - run: npm run stylelint - - lint-success: - permissions: - contents: none - runs-on: ubuntu-22.04 - needs: [xml-lint, php-lint, php-cs, php-psalm-analysis, php-security-analysis, js-eslint, stylelint] - name: Lint-OK - steps: - - run: echo "Lint passed successfully" diff --git a/.github/workflows/node-build.yml b/.github/workflows/node-build.yml deleted file mode 100644 index ca6dbb1d..00000000 --- a/.github/workflows/node-build.yml +++ /dev/null @@ -1,55 +0,0 @@ -# SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors -# SPDX-License-Identifier: MIT -name: Node Build - -on: - pull_request: - paths: - - src/** - - .eslintrc.js - - stylelint.config.js - - webpack.js - push: - branches: - - main - paths: - - src/** - - .eslintrc.js - - stylelint.config.js - - webpack.js - -jobs: - build: - name: node-build - runs-on: ubuntu-latest - - steps: - - name: Set app env - run: echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV - - - name: Checkout - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # - with: - path: ${{ env.APP_NAME }} - - - name: Read package.json node and npm engines version - uses: skjnldsv/read-package-engines-version-actions@0ce2ed60f6df073a62a77c0a4958dd0fc68e32e7 # v2.1 - id: versions - with: - path: ${{ env.APP_NAME }} - fallbackNode: "^20" - fallbackNpm: "^9" - - - name: Set up node ${{ steps.versions.outputs.nodeVersion }} - uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3 - with: - node-version: ${{ steps.versions.outputs.nodeVersion }} - - - name: Set up npm ${{ steps.versions.outputs.npmVersion }} - run: npm i -g npm@"${{ steps.versions.outputs.npmVersion }}" - - - name: Build ${{ env.APP_NAME }} - run: | - cd ${{ env.APP_NAME }} - npm ci - npm run build diff --git a/.github/workflows/node.yml b/.github/workflows/node.yml deleted file mode 100644 index 0b82c9eb..00000000 --- a/.github/workflows/node.yml +++ /dev/null @@ -1,105 +0,0 @@ -# This workflow is provided via the organization template repository -# -# https://github.com/nextcloud/.github -# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization -# -# SPDX-FileCopyrightText: 2021-2024 Nextcloud GmbH and Nextcloud contributors -# SPDX-License-Identifier: MIT - -name: Node - -on: pull_request - -permissions: - contents: read - -concurrency: - group: node-${{ github.head_ref || github.run_id }} - cancel-in-progress: true - -jobs: - changes: - runs-on: ubuntu-latest - permissions: - contents: read - pull-requests: read - - outputs: - src: ${{ steps.changes.outputs.src}} - - steps: - - uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 - id: changes - continue-on-error: true - with: - filters: | - src: - - '.github/workflows/**' - - 'src/**' - - 'appinfo/info.xml' - - 'package.json' - - 'package-lock.json' - - 'tsconfig.json' - - '**.js' - - '**.ts' - - '**.vue' - - build: - runs-on: ubuntu-latest - - needs: changes - if: needs.changes.outputs.src != 'false' - - name: NPM build - steps: - - name: Checkout - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - - - name: Read package.json node and npm engines version - uses: skjnldsv/read-package-engines-version-actions@06d6baf7d8f41934ab630e97d9e6c0bc9c9ac5e4 # v3 - id: versions - with: - fallbackNode: '^20' - fallbackNpm: '^10' - - - name: Set up node ${{ steps.versions.outputs.nodeVersion }} - uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3 - with: - node-version: ${{ steps.versions.outputs.nodeVersion }} - - - name: Set up npm ${{ steps.versions.outputs.npmVersion }} - run: npm i -g 'npm@${{ steps.versions.outputs.npmVersion }}' - - - name: Install dependencies & build - env: - CYPRESS_INSTALL_BINARY: 0 - PUPPETEER_SKIP_DOWNLOAD: true - run: | - npm ci - npm run build --if-present - - - name: Check webpack build changes - run: | - bash -c "[[ ! \"`git status --porcelain `\" ]] || (echo 'Please recompile and commit the assets, see the section \"Show changes on failure\" for details' && exit 1)" - - - name: Show changes on failure - if: failure() - run: | - git status - git --no-pager diff - exit 1 # make it red to grab attention - - summary: - permissions: - contents: none - runs-on: ubuntu-latest-low - needs: [changes, build] - - if: always() - - # This is the summary, we just avoid to rename it so that branch protection rules still match - name: node - - steps: - - name: Summary status - run: if ${{ needs.changes.outputs.src != 'false' && needs.build.result != 'success' }}; then exit 1; fi diff --git a/.github/workflows/reuse.yml b/.github/workflows/reuse.yml deleted file mode 100644 index b6828556..00000000 --- a/.github/workflows/reuse.yml +++ /dev/null @@ -1,24 +0,0 @@ -# This workflow is provided via the organization template repository -# -# https://github.com/nextcloud/.github -# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization - -# SPDX-FileCopyrightText: 2022 Free Software Foundation Europe e.V. -# -# SPDX-License-Identifier: CC0-1.0 - -name: REUSE Compliance Check - -on: [pull_request] - -jobs: - reuse-compliance-check: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - with: - persist-credentials: false - - - name: REUSE Compliance Check - uses: fsfe/reuse-action@bb774aa972c2a89ff34781233d275075cbddf542 # v5.0.0 diff --git a/.github/workflows/tests-deploy.yml b/.github/workflows/tests-deploy.yml index 50baf9d3..95912a5b 100644 --- a/.github/workflows/tests-deploy.yml +++ b/.github/workflows/tests-deploy.yml @@ -17,128 +17,128 @@ concurrency: cancel-in-progress: true jobs: - nc-host-app-docker: - runs-on: ubuntu-22.04 - name: NC In Host • ${{ matrix.server-version }} • 🐘${{ matrix.php-version }} - strategy: - fail-fast: false - matrix: - php-version: [ '8.3' ] - server-version: [ 'master' ] - - services: - postgres: - image: ghcr.io/nextcloud/continuous-integration-postgres-14:latest - ports: - - 4444:5432/tcp - env: - POSTGRES_USER: root - POSTGRES_PASSWORD: rootpassword - POSTGRES_DB: nextcloud - options: --health-cmd pg_isready --health-interval 5s --health-timeout 2s --health-retries 5 - - steps: - - name: Set app env - run: echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV - - - name: Checkout server - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - with: - submodules: true - repository: nextcloud/server - ref: ${{ matrix.server-version }} - - - name: Checkout AppAPI - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - with: - path: apps/${{ env.APP_NAME }} - - - name: Set up php ${{ matrix.php-version }} - uses: shivammathur/setup-php@4bd44f22a98a19e0950cbad5f31095157cc9621b # v2 - with: - php-version: ${{ matrix.php-version }} - extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, session, simplexml, xmlreader, xmlwriter, zip, zlib, pgsql, pdo_pgsql - coverage: none - ini-file: development - ini-values: - apc.enabled=on, apc.enable_cli=on, disable_functions= - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Check composer file existence - id: check_composer - uses: andstor/file-existence-action@20b4d2e596410855db8f9ca21e96fbe18e12930b # v2 - with: - files: apps/${{ env.APP_NAME }}/composer.json - - - name: Set up dependencies - if: steps.check_composer.outputs.files_exists == 'true' - working-directory: apps/${{ env.APP_NAME }} - run: composer i - - - name: Set up Nextcloud - env: - DB_PORT: 4444 - run: | - mkdir data - ./occ maintenance:install --verbose --database=pgsql --database-name=nextcloud --database-host=127.0.0.1 \ - --database-port=$DB_PORT --database-user=root --database-pass=rootpassword \ - --admin-user admin --admin-pass admin - ./occ config:system:set loglevel --value=0 --type=integer - ./occ config:system:set debug --value=true --type=boolean - ./occ app:enable --force ${{ env.APP_NAME }} - - - name: Test deploy - run: | - PHP_CLI_SERVER_WORKERS=2 php -S 127.0.0.1:8080 & - ./occ app_api:daemon:register docker_local_sock Docker docker-install http /var/run/docker.sock http://127.0.0.1:8080/index.php - ./occ app_api:app:register app-skeleton-python docker_local_sock \ - --info-xml https://raw.githubusercontent.com/nextcloud/app-skeleton-python/main/appinfo/info.xml - ./occ app_api:app:enable app-skeleton-python - ./occ app_api:app:disable app-skeleton-python - - - name: Check logs - run: | - grep -q 'Hello from app-skeleton-python :)' data/nextcloud.log || error - grep -q 'Bye bye from app-skeleton-python :(' data/nextcloud.log || error - - - name: Save container info & logs - if: always() - run: | - docker inspect nc_app_app-skeleton-python | json_pp > container.json - docker logs nc_app_app-skeleton-python > container.log 2>&1 - - - name: Unregister Skeleton & Daemon - run: | - ./occ app_api:app:unregister app-skeleton-python - ./occ app_api:daemon:unregister docker_local_sock - - - name: Test OCC commands(docker) - run: python3 apps/${{ env.APP_NAME }}/tests/test_occ_commands_docker.py - - - name: Upload Container info - if: always() - uses: actions/upload-artifact@v4 - with: - name: nc_host_app_docker_${{ matrix.server-version }}_${{ matrix.php-version }}_container.json - path: container.json - if-no-files-found: warn - - - name: Upload Container logs - if: always() - uses: actions/upload-artifact@v4 - with: - name: nc_host_app_docker_${{ matrix.server-version }}_${{ matrix.php-version }}_container.log - path: container.log - if-no-files-found: warn - - - name: Upload NC logs - if: always() - uses: actions/upload-artifact@v4 - with: - name: nc_host_app_docker_${{ matrix.server-version }}_${{ matrix.php-version }}_nextcloud.log - path: data/nextcloud.log - if-no-files-found: warn +# nc-host-app-docker: +# runs-on: ubuntu-22.04 +# name: NC In Host • ${{ matrix.server-version }} • 🐘${{ matrix.php-version }} +# strategy: +# fail-fast: false +# matrix: +# php-version: [ '8.3' ] +# server-version: [ 'master' ] +# +# services: +# postgres: +# image: ghcr.io/nextcloud/continuous-integration-postgres-14:latest +# ports: +# - 4444:5432/tcp +# env: +# POSTGRES_USER: root +# POSTGRES_PASSWORD: rootpassword +# POSTGRES_DB: nextcloud +# options: --health-cmd pg_isready --health-interval 5s --health-timeout 2s --health-retries 5 +# +# steps: +# - name: Set app env +# run: echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV +# +# - name: Checkout server +# uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 +# with: +# submodules: true +# repository: nextcloud/server +# ref: ${{ matrix.server-version }} +# +# - name: Checkout AppAPI +# uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 +# with: +# path: apps/${{ env.APP_NAME }} +# +# - name: Set up php ${{ matrix.php-version }} +# uses: shivammathur/setup-php@4bd44f22a98a19e0950cbad5f31095157cc9621b # v2 +# with: +# php-version: ${{ matrix.php-version }} +# extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, session, simplexml, xmlreader, xmlwriter, zip, zlib, pgsql, pdo_pgsql +# coverage: none +# ini-file: development +# ini-values: +# apc.enabled=on, apc.enable_cli=on, disable_functions= +# env: +# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +# +# - name: Check composer file existence +# id: check_composer +# uses: andstor/file-existence-action@20b4d2e596410855db8f9ca21e96fbe18e12930b # v2 +# with: +# files: apps/${{ env.APP_NAME }}/composer.json +# +# - name: Set up dependencies +# if: steps.check_composer.outputs.files_exists == 'true' +# working-directory: apps/${{ env.APP_NAME }} +# run: composer i +# +# - name: Set up Nextcloud +# env: +# DB_PORT: 4444 +# run: | +# mkdir data +# ./occ maintenance:install --verbose --database=pgsql --database-name=nextcloud --database-host=127.0.0.1 \ +# --database-port=$DB_PORT --database-user=root --database-pass=rootpassword \ +# --admin-user admin --admin-pass admin +# ./occ config:system:set loglevel --value=0 --type=integer +# ./occ config:system:set debug --value=true --type=boolean +# ./occ app:enable --force ${{ env.APP_NAME }} +# +# - name: Test deploy +# run: | +# PHP_CLI_SERVER_WORKERS=2 php -S 127.0.0.1:8080 & +# ./occ app_api:daemon:register docker_local_sock Docker docker-install http /var/run/docker.sock http://127.0.0.1:8080/index.php +# ./occ app_api:app:register app-skeleton-python docker_local_sock \ +# --info-xml https://raw.githubusercontent.com/nextcloud/app-skeleton-python/main/appinfo/info.xml +# ./occ app_api:app:enable app-skeleton-python +# ./occ app_api:app:disable app-skeleton-python +# +# - name: Check logs +# run: | +# grep -q 'Hello from app-skeleton-python :)' data/nextcloud.log || error +# grep -q 'Bye bye from app-skeleton-python :(' data/nextcloud.log || error +# +# - name: Save container info & logs +# if: always() +# run: | +# docker inspect nc_app_app-skeleton-python | json_pp > container.json +# docker logs nc_app_app-skeleton-python > container.log 2>&1 +# +# - name: Unregister Skeleton & Daemon +# run: | +# ./occ app_api:app:unregister app-skeleton-python +# ./occ app_api:daemon:unregister docker_local_sock +# +# - name: Test OCC commands(docker) +# run: python3 apps/${{ env.APP_NAME }}/tests/test_occ_commands_docker.py +# +# - name: Upload Container info +# if: always() +# uses: actions/upload-artifact@v4 +# with: +# name: nc_host_app_docker_${{ matrix.server-version }}_${{ matrix.php-version }}_container.json +# path: container.json +# if-no-files-found: warn +# +# - name: Upload Container logs +# if: always() +# uses: actions/upload-artifact@v4 +# with: +# name: nc_host_app_docker_${{ matrix.server-version }}_${{ matrix.php-version }}_container.log +# path: container.log +# if-no-files-found: warn +# +# - name: Upload NC logs +# if: always() +# uses: actions/upload-artifact@v4 +# with: +# name: nc_host_app_docker_${{ matrix.server-version }}_${{ matrix.php-version }}_nextcloud.log +# path: data/nextcloud.log +# if-no-files-found: warn nc-docker-app-docker: runs-on: ubuntu-22.04 @@ -159,7 +159,7 @@ jobs: - name: Install AppAPI run: | - docker exec -w /var/www/html/apps nextcloud git clone https://github.com/cloud-py-api/${{ env.APP_NAME }}.git + docker exec -w /var/www/html/apps nextcloud git clone https://github.com/nextcloud/${{ env.APP_NAME }}.git docker exec -w /var/www/html/apps/${{ env.APP_NAME }} nextcloud git fetch origin $GITHUB_REF docker exec -w /var/www/html/apps/${{ env.APP_NAME }} nextcloud git checkout FETCH_HEAD docker exec nextcloud sudo -u www-data php occ app:enable app_api @@ -238,7 +238,7 @@ jobs: - name: Install AppAPI run: | - docker exec -w /var/www/html/apps nextcloud git clone https://github.com/cloud-py-api/${{ env.APP_NAME }}.git + docker exec -w /var/www/html/apps nextcloud git clone https://github.com/nextcloud/${{ env.APP_NAME }}.git docker exec -w /var/www/html/apps/${{ env.APP_NAME }} nextcloud git fetch origin $GITHUB_REF docker exec -w /var/www/html/apps/${{ env.APP_NAME }} nextcloud git checkout FETCH_HEAD docker exec nextcloud sudo -u www-data php occ app:enable app_api @@ -249,6 +249,9 @@ jobs: docker exec nextcloud sudo -u www-data php occ app_api:app:register app-skeleton-python docker_by_port \ --info-xml https://raw.githubusercontent.com/nextcloud/app-skeleton-python/main/appinfo/info.xml docker exec nextcloud sudo -u www-data php occ app_api:app:enable app-skeleton-python + + - name: Disable ExApp + run: | docker exec nextcloud sudo -u www-data php occ app_api:app:disable app-skeleton-python - name: Copy NC log to host @@ -295,9 +298,9 @@ jobs: path: nextcloud.log if-no-files-found: warn - nc-docker-dsp-https: + nc-docker-dsp-https-bridge: runs-on: ubuntu-22.04 - name: NC In Julius Docker(DSP-HTTPS) • 🐘8.3 + name: NC In Julius Docker(DSP-HTTPS-BRIDGE) • 🐘8.3 env: docker-image: ghcr.io/juliusknorr/nextcloud-dev-php83:master @@ -313,6 +316,7 @@ jobs: - name: Create containers run: | + docker network create master_bridge docker run -v /var/run/docker.sock:/var/run/docker.sock \ -v `pwd`/certs/cert.pem:/certs/cert.pem \ -e NC_HAPROXY_PASSWORD="some_secure_password" \ @@ -320,32 +324,50 @@ jobs: -e EX_APPS_NET="ipv4@localhost" \ --net host --name nextcloud-appapi-dsp -h nextcloud-appapi-dsp \ --privileged -d ghcr.io/nextcloud/nextcloud-appapi-dsp:latest - docker run --net=bridge --name=nextcloud -p 8080:80 --rm -d ${{ env.docker-image }} + docker run --net master_bridge --name nextcloud --rm -d ${{ env.docker-image }} sleep 60s + + - name: Debug information + run: | + echo "hostname -I:" hostname -I + echo "" + echo "DSP networks:" docker exec nextcloud-appapi-dsp ip addr show | grep inet | awk '{print $2}' | cut -d/ -f1 + echo "" + echo "Open ports:" + netstat -lntu - name: Install AppAPI run: | - docker exec -w /var/www/html/apps nextcloud git clone https://github.com/cloud-py-api/${{ env.APP_NAME }}.git + docker exec -w /var/www/html/apps nextcloud git clone https://github.com/nextcloud/${{ env.APP_NAME }}.git docker exec -w /var/www/html/apps/${{ env.APP_NAME }} nextcloud git fetch origin $GITHUB_REF docker exec -w /var/www/html/apps/${{ env.APP_NAME }} nextcloud git checkout FETCH_HEAD docker exec nextcloud sudo -u www-data php occ app:enable app_api docker cp ./certs/cert.pem nextcloud:/ docker exec nextcloud sudo -u www-data php occ security:certificates:import /cert.pem docker exec nextcloud sudo -u www-data php occ app_api:daemon:register \ - docker_by_port Docker docker-install https host.docker.internal:2375 http://localhost:8080/index.php \ - --net=host --haproxy_password=some_secure_password + docker_by_port Docker docker-install https host.docker.internal:2375 http://nextcloud/index.php \ + --net=master_bridge --haproxy_password=some_secure_password docker exec nextcloud sudo -u www-data php occ app_api:daemon:list + echo "ping host:" + docker exec nextcloud ping -c 1 host.docker.internal + + - name: Registering and enabling Skeleton ExApp + run: | docker exec nextcloud sudo -u www-data php occ app_api:app:register app-skeleton-python docker_by_port \ --info-xml https://raw.githubusercontent.com/nextcloud/app-skeleton-python/main/appinfo/info.xml docker exec nextcloud sudo -u www-data php occ app_api:app:enable app-skeleton-python + - name: Docker inspect output + if: always() + run: docker inspect nc_app_app-skeleton-python + - name: Checking if ExApp container can access HTTPS DSP run: | docker exec nc_app_app-skeleton-python apt update docker exec nc_app_app-skeleton-python apt install curl -y - docker exec nc_app_app-skeleton-python curl --resolve host.docker.internal:2375:172.17.0.1 https://host.docker.internal:2375 + docker exec nc_app_app-skeleton-python curl https://host.docker.internal:2375 - name: Disable ExApp run: | @@ -379,7 +401,7 @@ jobs: if: always() uses: actions/upload-artifact@v4 with: - name: dsp_https_haproxy.log + name: dsp_https_bridge_haproxy.log path: haproxy.log if-no-files-found: warn @@ -387,7 +409,7 @@ jobs: if: always() uses: actions/upload-artifact@v4 with: - name: dsp_https_container.json + name: dsp_https_bridge_container.json path: container.json if-no-files-found: warn @@ -395,7 +417,7 @@ jobs: if: always() uses: actions/upload-artifact@v4 with: - name: dsp_https_container.log + name: dsp_https_bridge_container.log path: container.log if-no-files-found: warn @@ -403,231 +425,85 @@ jobs: if: always() uses: actions/upload-artifact@v4 with: - name: dsp_https_nextcloud.log + name: dsp_https_bridge_nextcloud.log path: nextcloud.log if-no-files-found: warn - nc-host-app-docker-redis: + nc-docker-dsp-https: runs-on: ubuntu-22.04 - name: NC In Host(Redis) • master • 🐘8.3 - - services: - postgres: - image: ghcr.io/nextcloud/continuous-integration-postgres-14:latest - ports: - - 4444:5432/tcp - env: - POSTGRES_USER: root - POSTGRES_PASSWORD: rootpassword - POSTGRES_DB: nextcloud - options: --health-cmd pg_isready --health-interval 5s --health-timeout 2s --health-retries 5 - redis: - image: redis - options: >- - --health-cmd "redis-cli ping" - --health-interval 10s - --health-timeout 5s - --health-retries 5 - --name redis - ports: - - 6379:6379 + name: NC In Julius Docker(DSP-HTTPS) • 🐘8.3 + env: + docker-image: ghcr.io/juliusknorr/nextcloud-dev-php83:master steps: - name: Set app env run: echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV - - name: Checkout server - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - with: - submodules: true - repository: nextcloud/server - ref: master - - - name: Checkout AppAPI - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - with: - path: apps/${{ env.APP_NAME }} - - - name: Set up php 8.3 - uses: shivammathur/setup-php@4bd44f22a98a19e0950cbad5f31095157cc9621b # v2 - with: - php-version: 8.3 - extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, session, simplexml, xmlreader, xmlwriter, zip, zlib, pgsql, pdo_pgsql, redis - coverage: none - ini-file: development - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Check composer file existence - id: check_composer - uses: andstor/file-existence-action@20b4d2e596410855db8f9ca21e96fbe18e12930b # v2 - with: - files: apps/${{ env.APP_NAME }}/composer.json - - - name: Set up dependencies - if: steps.check_composer.outputs.files_exists == 'true' - working-directory: apps/${{ env.APP_NAME }} - run: composer i - - - name: Set up Nextcloud - env: - DB_PORT: 4444 - REDIS_HOST: localhost - REDIS_PORT: 6379 - run: | - mkdir data - ./occ maintenance:install --verbose --database=pgsql --database-name=nextcloud --database-host=127.0.0.1 \ - --database-port=$DB_PORT --database-user=root --database-pass=rootpassword \ - --admin-user admin --admin-pass admin - ./occ config:system:set loglevel --value=0 --type=integer - ./occ config:system:set debug --value=true --type=boolean - - ./occ config:system:set memcache.local --value "\\OC\\Memcache\\Redis" - ./occ config:system:set memcache.distributed --value "\\OC\\Memcache\\Redis" - ./occ config:system:set memcache.locking --value "\\OC\\Memcache\\Redis" - ./occ config:system:set redis host --value ${{ env.REDIS_HOST }} - ./occ config:system:set redis port --value ${{ env.REDIS_PORT }} - - ./occ app:enable --force ${{ env.APP_NAME }} - - - name: Test deploy + - name: Create certificates run: | - PHP_CLI_SERVER_WORKERS=2 php -S 127.0.0.1:8080 & - ./occ app_api:daemon:register docker_local_sock Docker docker-install http /var/run/docker.sock http://127.0.0.1:8080/index.php - ./occ app_api:daemon:list - ./occ app_api:app:register app-skeleton-python docker_local_sock \ - --info-xml https://raw.githubusercontent.com/nextcloud/app-skeleton-python/main/appinfo/info.xml - ./occ app_api:app:enable app-skeleton-python - ./occ app_api:app:disable app-skeleton-python + mkdir certs + openssl req -nodes -new -x509 -subj '/CN=host.docker.internal' -sha256 -keyout certs/privkey.pem -out certs/fullchain.pem -days 365000 > /dev/null 2>&1 + cat certs/fullchain.pem certs/privkey.pem | tee certs/cert.pem > /dev/null 2>&1 - - name: Check logs + - name: Create containers run: | - grep -q 'Hello from app-skeleton-python :)' data/nextcloud.log || error - grep -q 'Bye bye from app-skeleton-python :(' data/nextcloud.log || error + docker run -v /var/run/docker.sock:/var/run/docker.sock \ + -v `pwd`/certs/cert.pem:/certs/cert.pem \ + -e NC_HAPROXY_PASSWORD="some_secure_password" \ + -e BIND_ADDRESS="172.17.0.1" \ + -e EX_APPS_NET="ipv4@localhost" \ + --net host --name nextcloud-appapi-dsp -h nextcloud-appapi-dsp \ + --privileged -d ghcr.io/nextcloud/nextcloud-appapi-dsp:latest + docker run --net=bridge --name=nextcloud -p 8080:80 --rm -d ${{ env.docker-image }} + sleep 60s - - name: Save container info & logs - if: always() + - name: Debug information run: | - docker inspect nc_app_app-skeleton-python | json_pp > container.json - docker logs nc_app_app-skeleton-python > container.log 2>&1 + echo "Hostname:" + hostname -I + echo "DSP networks:" + docker exec nextcloud-appapi-dsp ip addr show | grep inet | awk '{print $2}' | cut -d/ -f1 + echo "Open ports:" + netstat -lntu - - name: Unregister Skeleton & Daemon + - name: Install AppAPI run: | - ./occ app_api:app:unregister app-skeleton-python - ./occ app_api:daemon:unregister docker_local_sock - - - name: Test OCC commands(docker) - run: python3 apps/${{ env.APP_NAME }}/tests/test_occ_commands_docker.py + docker exec -w /var/www/html/apps nextcloud git clone https://github.com/nextcloud/${{ env.APP_NAME }}.git + docker exec -w /var/www/html/apps/${{ env.APP_NAME }} nextcloud git fetch origin $GITHUB_REF + docker exec -w /var/www/html/apps/${{ env.APP_NAME }} nextcloud git checkout FETCH_HEAD + docker exec nextcloud sudo -u www-data php occ app:enable app_api + docker cp ./certs/cert.pem nextcloud:/ + docker exec nextcloud sudo -u www-data php occ security:certificates:import /cert.pem + docker exec nextcloud sudo -u www-data php occ app_api:daemon:register \ + docker_by_port Docker docker-install https host.docker.internal:2375 http://localhost:8080/index.php \ + --net=host --haproxy_password=some_secure_password + docker exec nextcloud sudo -u www-data php occ app_api:daemon:list + docker exec nextcloud sudo -u www-data php occ app_api:app:register app-skeleton-python docker_by_port \ + --info-xml https://raw.githubusercontent.com/nextcloud/app-skeleton-python/main/appinfo/info.xml + docker exec nextcloud sudo -u www-data php occ app_api:app:enable app-skeleton-python - - name: Check redis keys + - name: Checking if ExApp container can access HTTPS DSP run: | - docker exec redis redis-cli keys '*app_api*' || error - - - name: Upload Container info - if: always() - uses: actions/upload-artifact@v4 - with: - name: nc_host_app_docker_redis_master_8.3_container.json - path: container.json - if-no-files-found: warn + docker exec nc_app_app-skeleton-python apt update + docker exec nc_app_app-skeleton-python apt install curl -y + docker exec nc_app_app-skeleton-python curl --resolve host.docker.internal:2375:172.17.0.1 https://host.docker.internal:2375 - - name: Upload Container logs - if: always() - uses: actions/upload-artifact@v4 - with: - name: nc_host_app_docker_redis_master_8.3_container.log - path: container.log - if-no-files-found: warn + - name: Disable ExApp + run: | + docker exec nextcloud sudo -u www-data php occ app_api:app:disable app-skeleton-python - - name: Upload NC logs + - name: Copy NC log to host if: always() - uses: actions/upload-artifact@v4 - with: - name: nc_host_app_docker_redis_master_8.3_nextcloud.log - path: data/nextcloud.log - if-no-files-found: warn - - nc-host-network-host: - runs-on: ubuntu-22.04 - name: NC In Host(network=host) • master • 🐘8.3 - - services: - postgres: - image: ghcr.io/nextcloud/continuous-integration-postgres-14:latest - ports: - - 4444:5432/tcp - env: - POSTGRES_USER: root - POSTGRES_PASSWORD: rootpassword - POSTGRES_DB: nextcloud - options: --health-cmd pg_isready --health-interval 5s --health-timeout 2s --health-retries 5 - - steps: - - name: Set app env - run: echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV - - - name: Checkout server - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - with: - submodules: true - repository: nextcloud/server - ref: master - - - name: Checkout AppAPI - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - with: - path: apps/${{ env.APP_NAME }} - - - name: Set up php 8.3 - uses: shivammathur/setup-php@4bd44f22a98a19e0950cbad5f31095157cc9621b # v2 - with: - php-version: 8.3 - extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, session, simplexml, xmlreader, xmlwriter, zip, zlib, pgsql, pdo_pgsql, redis - coverage: none - ini-file: development - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Check composer file existence - id: check_composer - uses: andstor/file-existence-action@20b4d2e596410855db8f9ca21e96fbe18e12930b # v2 - with: - files: apps/${{ env.APP_NAME }}/composer.json - - - name: Set up dependencies - if: steps.check_composer.outputs.files_exists == 'true' - working-directory: apps/${{ env.APP_NAME }} - run: composer i - - - name: Set up Nextcloud - env: - DB_PORT: 4444 - run: | - mkdir data - ./occ maintenance:install --verbose --database=pgsql --database-name=nextcloud --database-host=127.0.0.1 \ - --database-port=$DB_PORT --database-user=root --database-pass=rootpassword \ - --admin-user admin --admin-pass admin - ./occ config:system:set loglevel --value=0 --type=integer - ./occ config:system:set debug --value=true --type=boolean - ./occ config:system:set overwrite.cli.url --value http://127.0.0.1:8080 --type=string - ./occ app:enable --force ${{ env.APP_NAME }} - - - name: Test deploy - run: | - PHP_CLI_SERVER_WORKERS=2 php -S 127.0.0.1:8080 & - ./occ app_api:daemon:register \ - docker_socket_local Docker docker-install http /var/run/docker.sock http://127.0.0.1:8080/index.php \ - --net=host --set-default - ./occ app_api:daemon:list - ./occ app_api:app:register app-skeleton-python \ - --info-xml https://raw.githubusercontent.com/nextcloud/app-skeleton-python/main/appinfo/info.xml - ./occ app_api:app:enable app-skeleton-python - ./occ app_api:app:disable app-skeleton-python + run: docker cp nextcloud:/var/www/html/data/nextcloud.log nextcloud.log - name: Check logs run: | - grep -q 'Hello from app-skeleton-python :)' data/nextcloud.log || error - grep -q 'Bye bye from app-skeleton-python :(' data/nextcloud.log || error + grep -q 'Hello from app-skeleton-python :)' nextcloud.log || error + grep -q 'Bye bye from app-skeleton-python :(' nextcloud.log || error + + - name: Save HaProxy logs + if: always() + run: docker logs nextcloud-appapi-dsp > haproxy.log 2>&1 - name: Save container info & logs if: always() @@ -637,17 +513,22 @@ jobs: - name: Unregister Skeleton & Daemon run: | - ./occ app_api:app:unregister app-skeleton-python - ./occ app_api:daemon:unregister docker_socket_local + docker exec nextcloud sudo -u www-data php occ app_api:app:unregister app-skeleton-python + docker exec nextcloud sudo -u www-data php occ app_api:daemon:unregister docker_by_port - - name: Test OCC commands(docker) - run: python3 apps/${{ env.APP_NAME }}/tests/test_occ_commands_docker.py + - name: Upload HaProxy logs + if: always() + uses: actions/upload-artifact@v4 + with: + name: dsp_https_haproxy.log + path: haproxy.log + if-no-files-found: warn - name: Upload Container info if: always() uses: actions/upload-artifact@v4 with: - name: nc_host_network_host_master_8.2_container.json + name: dsp_https_container.json path: container.json if-no-files-found: warn @@ -655,7 +536,7 @@ jobs: if: always() uses: actions/upload-artifact@v4 with: - name: nc_host_network_host_master_8.2_container.log + name: dsp_https_container.log path: container.log if-no-files-found: warn @@ -663,16 +544,276 @@ jobs: if: always() uses: actions/upload-artifact@v4 with: - name: nc_host_network_host_master_8.2_nextcloud.log - path: data/nextcloud.log + name: dsp_https_nextcloud.log + path: nextcloud.log if-no-files-found: warn - tests-deploy-success: - permissions: - contents: none - runs-on: ubuntu-22.04 - needs: [nc-host-app-docker, nc-docker-app-docker, nc-docker-dsp-http, - nc-docker-dsp-https, nc-host-app-docker-redis, nc-host-network-host] - name: Tests-Deploy-OK - steps: - - run: echo "Tests-Deploy passed successfully" +# nc-host-app-docker-redis: +# runs-on: ubuntu-22.04 +# name: NC In Host(Redis) • master • 🐘8.3 +# +# services: +# postgres: +# image: ghcr.io/nextcloud/continuous-integration-postgres-14:latest +# ports: +# - 4444:5432/tcp +# env: +# POSTGRES_USER: root +# POSTGRES_PASSWORD: rootpassword +# POSTGRES_DB: nextcloud +# options: --health-cmd pg_isready --health-interval 5s --health-timeout 2s --health-retries 5 +# redis: +# image: redis +# options: >- +# --health-cmd "redis-cli ping" +# --health-interval 10s +# --health-timeout 5s +# --health-retries 5 +# --name redis +# ports: +# - 6379:6379 +# +# steps: +# - name: Set app env +# run: echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV +# +# - name: Checkout server +# uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 +# with: +# submodules: true +# repository: nextcloud/server +# ref: master +# +# - name: Checkout AppAPI +# uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 +# with: +# path: apps/${{ env.APP_NAME }} +# +# - name: Set up php 8.3 +# uses: shivammathur/setup-php@4bd44f22a98a19e0950cbad5f31095157cc9621b # v2 +# with: +# php-version: 8.3 +# extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, session, simplexml, xmlreader, xmlwriter, zip, zlib, pgsql, pdo_pgsql, redis +# coverage: none +# ini-file: development +# env: +# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +# +# - name: Check composer file existence +# id: check_composer +# uses: andstor/file-existence-action@20b4d2e596410855db8f9ca21e96fbe18e12930b # v2 +# with: +# files: apps/${{ env.APP_NAME }}/composer.json +# +# - name: Set up dependencies +# if: steps.check_composer.outputs.files_exists == 'true' +# working-directory: apps/${{ env.APP_NAME }} +# run: composer i +# +# - name: Set up Nextcloud +# env: +# DB_PORT: 4444 +# REDIS_HOST: localhost +# REDIS_PORT: 6379 +# run: | +# mkdir data +# ./occ maintenance:install --verbose --database=pgsql --database-name=nextcloud --database-host=127.0.0.1 \ +# --database-port=$DB_PORT --database-user=root --database-pass=rootpassword \ +# --admin-user admin --admin-pass admin +# ./occ config:system:set loglevel --value=0 --type=integer +# ./occ config:system:set debug --value=true --type=boolean +# +# ./occ config:system:set memcache.local --value "\\OC\\Memcache\\Redis" +# ./occ config:system:set memcache.distributed --value "\\OC\\Memcache\\Redis" +# ./occ config:system:set memcache.locking --value "\\OC\\Memcache\\Redis" +# ./occ config:system:set redis host --value ${{ env.REDIS_HOST }} +# ./occ config:system:set redis port --value ${{ env.REDIS_PORT }} +# +# ./occ app:enable --force ${{ env.APP_NAME }} +# +# - name: Test deploy +# run: | +# PHP_CLI_SERVER_WORKERS=2 php -S 127.0.0.1:8080 & +# ./occ app_api:daemon:register docker_local_sock Docker docker-install http /var/run/docker.sock http://127.0.0.1:8080/index.php +# ./occ app_api:daemon:list +# ./occ app_api:app:register app-skeleton-python docker_local_sock \ +# --info-xml https://raw.githubusercontent.com/nextcloud/app-skeleton-python/main/appinfo/info.xml +# ./occ app_api:app:enable app-skeleton-python +# ./occ app_api:app:disable app-skeleton-python +# +# - name: Check logs +# run: | +# grep -q 'Hello from app-skeleton-python :)' data/nextcloud.log || error +# grep -q 'Bye bye from app-skeleton-python :(' data/nextcloud.log || error +# +# - name: Save container info & logs +# if: always() +# run: | +# docker inspect nc_app_app-skeleton-python | json_pp > container.json +# docker logs nc_app_app-skeleton-python > container.log 2>&1 +# +# - name: Unregister Skeleton & Daemon +# run: | +# ./occ app_api:app:unregister app-skeleton-python +# ./occ app_api:daemon:unregister docker_local_sock +# +# - name: Test OCC commands(docker) +# run: python3 apps/${{ env.APP_NAME }}/tests/test_occ_commands_docker.py +# +# - name: Check redis keys +# run: | +# docker exec redis redis-cli keys '*app_api*' || error +# +# - name: Upload Container info +# if: always() +# uses: actions/upload-artifact@v4 +# with: +# name: nc_host_app_docker_redis_master_8.3_container.json +# path: container.json +# if-no-files-found: warn +# +# - name: Upload Container logs +# if: always() +# uses: actions/upload-artifact@v4 +# with: +# name: nc_host_app_docker_redis_master_8.3_container.log +# path: container.log +# if-no-files-found: warn +# +# - name: Upload NC logs +# if: always() +# uses: actions/upload-artifact@v4 +# with: +# name: nc_host_app_docker_redis_master_8.3_nextcloud.log +# path: data/nextcloud.log +# if-no-files-found: warn +# +# nc-host-network-host: +# runs-on: ubuntu-22.04 +# name: NC In Host(network=host) • master • 🐘8.3 +# +# services: +# postgres: +# image: ghcr.io/nextcloud/continuous-integration-postgres-14:latest +# ports: +# - 4444:5432/tcp +# env: +# POSTGRES_USER: root +# POSTGRES_PASSWORD: rootpassword +# POSTGRES_DB: nextcloud +# options: --health-cmd pg_isready --health-interval 5s --health-timeout 2s --health-retries 5 +# +# steps: +# - name: Set app env +# run: echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV +# +# - name: Checkout server +# uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 +# with: +# submodules: true +# repository: nextcloud/server +# ref: master +# +# - name: Checkout AppAPI +# uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 +# with: +# path: apps/${{ env.APP_NAME }} +# +# - name: Set up php 8.3 +# uses: shivammathur/setup-php@4bd44f22a98a19e0950cbad5f31095157cc9621b # v2 +# with: +# php-version: 8.3 +# extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, session, simplexml, xmlreader, xmlwriter, zip, zlib, pgsql, pdo_pgsql, redis +# coverage: none +# ini-file: development +# env: +# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +# +# - name: Check composer file existence +# id: check_composer +# uses: andstor/file-existence-action@20b4d2e596410855db8f9ca21e96fbe18e12930b # v2 +# with: +# files: apps/${{ env.APP_NAME }}/composer.json +# +# - name: Set up dependencies +# if: steps.check_composer.outputs.files_exists == 'true' +# working-directory: apps/${{ env.APP_NAME }} +# run: composer i +# +# - name: Set up Nextcloud +# env: +# DB_PORT: 4444 +# run: | +# mkdir data +# ./occ maintenance:install --verbose --database=pgsql --database-name=nextcloud --database-host=127.0.0.1 \ +# --database-port=$DB_PORT --database-user=root --database-pass=rootpassword \ +# --admin-user admin --admin-pass admin +# ./occ config:system:set loglevel --value=0 --type=integer +# ./occ config:system:set debug --value=true --type=boolean +# ./occ config:system:set overwrite.cli.url --value http://127.0.0.1:8080 --type=string +# ./occ app:enable --force ${{ env.APP_NAME }} +# +# - name: Test deploy +# run: | +# PHP_CLI_SERVER_WORKERS=2 php -S 127.0.0.1:8080 & +# ./occ app_api:daemon:register \ +# docker_socket_local Docker docker-install http /var/run/docker.sock http://127.0.0.1:8080/index.php \ +# --net=host --set-default +# ./occ app_api:daemon:list +# ./occ app_api:app:register app-skeleton-python \ +# --info-xml https://raw.githubusercontent.com/nextcloud/app-skeleton-python/main/appinfo/info.xml +# ./occ app_api:app:enable app-skeleton-python +# ./occ app_api:app:disable app-skeleton-python +# +# - name: Check logs +# run: | +# grep -q 'Hello from app-skeleton-python :)' data/nextcloud.log || error +# grep -q 'Bye bye from app-skeleton-python :(' data/nextcloud.log || error +# +# - name: Save container info & logs +# if: always() +# run: | +# docker inspect nc_app_app-skeleton-python | json_pp > container.json +# docker logs nc_app_app-skeleton-python > container.log 2>&1 +# +# - name: Unregister Skeleton & Daemon +# run: | +# ./occ app_api:app:unregister app-skeleton-python +# ./occ app_api:daemon:unregister docker_socket_local +# +# - name: Test OCC commands(docker) +# run: python3 apps/${{ env.APP_NAME }}/tests/test_occ_commands_docker.py +# +# - name: Upload Container info +# if: always() +# uses: actions/upload-artifact@v4 +# with: +# name: nc_host_network_host_master_8.2_container.json +# path: container.json +# if-no-files-found: warn +# +# - name: Upload Container logs +# if: always() +# uses: actions/upload-artifact@v4 +# with: +# name: nc_host_network_host_master_8.2_container.log +# path: container.log +# if-no-files-found: warn +# +# - name: Upload NC logs +# if: always() +# uses: actions/upload-artifact@v4 +# with: +# name: nc_host_network_host_master_8.2_nextcloud.log +# path: data/nextcloud.log +# if-no-files-found: warn +# +# tests-deploy-success: +# permissions: +# contents: none +# runs-on: ubuntu-22.04 +# needs: [nc-host-app-docker, nc-docker-app-docker, nc-docker-dsp-http, +# nc-docker-dsp-https, nc-host-app-docker-redis, nc-host-network-host] +# name: Tests-Deploy-OK +# steps: +# - run: echo "Tests-Deploy passed successfully" diff --git a/.github/workflows/tests-special.yml b/.github/workflows/tests-special.yml deleted file mode 100644 index 387d7c6c..00000000 --- a/.github/workflows/tests-special.yml +++ /dev/null @@ -1,137 +0,0 @@ -# SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors -# SPDX-License-Identifier: MIT -name: Tests Special - -on: - pull_request: - branches: [main] - push: - branches: [main] - workflow_dispatch: - -permissions: - contents: read - -concurrency: - group: tests-special-${{ github.head_ref || github.run_id }} - cancel-in-progress: true - -env: - NEXTCLOUD_URL: "http://localhost:8080/" - APP_ID: "nc_py_api" - APP_PORT: 9009 - APP_VERSION: "1.0.0" - APP_SECRET: "tC6vkwPhcppjMykD1r0n9NlI95uJMBYjs5blpIcA1PAdoPDmc5qoAjaBAkyocZ6E" - -jobs: - - auth-tests-no-init: - runs-on: ubuntu-22.04 - name: Auth tests (no Init endpoint) - - services: - postgres: - image: ghcr.io/nextcloud/continuous-integration-postgres-14:latest - ports: - - 4444:5432/tcp - env: - POSTGRES_USER: root - POSTGRES_PASSWORD: rootpassword - POSTGRES_DB: nextcloud - options: --health-cmd pg_isready --health-interval 5s --health-timeout 2s --health-retries 5 - - steps: - - uses: actions/setup-python@v4 - with: - python-version: '3.11' - - - name: Set app env - run: echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV - - - name: Checkout server - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - with: - submodules: true - repository: nextcloud/server - ref: 'master' - - - name: Checkout AppAPI - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - with: - path: apps/${{ env.APP_NAME }} - - - name: Set up php - uses: shivammathur/setup-php@4bd44f22a98a19e0950cbad5f31095157cc9621b # v2 - with: - php-version: '8.3' - extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, session, simplexml, xmlreader, xmlwriter, zip, zlib, pgsql, pdo_pgsql - coverage: none - ini-file: development - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Check composer file existence - id: check_composer - uses: andstor/file-existence-action@20b4d2e596410855db8f9ca21e96fbe18e12930b # v2 - with: - files: apps/${{ env.APP_NAME }}/composer.json - - - name: Set up dependencies - if: steps.check_composer.outputs.files_exists == 'true' - working-directory: apps/${{ env.APP_NAME }} - run: composer i - - - name: Set up Nextcloud - env: - DB_PORT: 4444 - run: | - mkdir data - ./occ maintenance:install --verbose --database=pgsql --database-name=nextcloud --database-host=127.0.0.1 \ - --database-port=$DB_PORT --database-user=root --database-pass=rootpassword \ - --admin-user admin --admin-pass admin - ./occ app:enable --force ${{ env.APP_NAME }} - - - name: Run Nextcloud - run: PHP_CLI_SERVER_WORKERS=2 php -S 127.0.0.1:8080 & - - - name: Checkout NcPyApi - uses: actions/checkout@v4 - with: - path: nc_py_api - repository: cloud-py-api/nc_py_api - - - name: Install NcPyApi - working-directory: nc_py_api - run: python3 -m pip -v install ".[dev]" - - - name: Register App - run: | - python3 apps/${{ env.APP_NAME }}/tests/install_no_init.py & - echo $! > /tmp/_install.pid - sleep 5s - php occ app_api:daemon:register manual_install "Manual Install" manual-install http localhost 0 - php occ app_api:app:register $APP_ID manual_install --json-info \ - "{\"appid\":\"$APP_ID\",\"name\":\"$APP_ID\",\"daemon_config_name\":\"manual_install\",\"version\":\"$APP_VERSION\",\"secret\":\"$APP_SECRET\",\"port\":$APP_PORT}" \ - --force-scopes --wait-finish - kill -15 $(cat /tmp/_install.pid) - timeout 3m tail --pid=$(cat /tmp/_install.pid) -f /dev/null - - - name: Check logs - run: grep -q 'Hello from ' data/nextcloud.log || error - - - name: Upload NC logs - if: always() - uses: actions/upload-artifact@v4 - with: - name: install_no_init.log - path: data/nextcloud.log - if-no-files-found: warn - - tests-special-success: - permissions: - contents: none - runs-on: ubuntu-22.04 - needs: [auth-tests-no-init] - name: TestsSpecial-OK - steps: - - run: echo "Tests special passed successfully" diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml deleted file mode 100644 index 9f16b0ad..00000000 --- a/.github/workflows/tests.yml +++ /dev/null @@ -1,509 +0,0 @@ -# SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors -# SPDX-License-Identifier: MIT -name: Tests - -on: - pull_request: - branches: [main] - push: - branches: [main] - workflow_dispatch: - -permissions: - contents: read - -concurrency: - group: tests-${{ github.head_ref || github.run_id }} - cancel-in-progress: true - -env: - NEXTCLOUD_URL: "http://localhost:8080/" - APP_ID: "nc_py_api" - APP_PORT: 9009 - APP_VERSION: "1.0.0" - APP_SECRET: "tC6vkwPhcppjMykD1r0n9NlI95uJMBYjs5blpIcA1PAdoPDmc5qoAjaBAkyocZ6E" - SKIP_NC_CLIENT_TESTS: 1 - -jobs: - nc-py-api-pgsql: - runs-on: ubuntu-22.04 - name: NC_Py_API • ${{ matrix.server-version }} • 🐘${{ matrix.php-version }} • PgSQL - strategy: - fail-fast: false - matrix: - php-version: [ '8.3' ] - server-version: [ 'master' ] - env: - DATABASE_PGSQL: 1 - - services: - postgres: - image: ghcr.io/nextcloud/continuous-integration-postgres-14:latest - ports: - - 4444:5432/tcp - env: - POSTGRES_USER: root - POSTGRES_PASSWORD: rootpassword - POSTGRES_DB: nextcloud - options: --health-cmd pg_isready --health-interval 5s --health-timeout 2s --health-retries 5 - - steps: - - uses: actions/setup-python@v4 - with: - python-version: '3.11' - - - name: Set app env - run: echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV - - - name: Checkout server - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - with: - submodules: true - repository: nextcloud/server - ref: ${{ matrix.server-version }} - - - name: Checkout Notifications - uses: actions/checkout@v4 - with: - repository: nextcloud/notifications - ref: ${{ matrix.server-version }} - path: apps/notifications - - - name: Checkout AppAPI - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - with: - path: apps/${{ env.APP_NAME }} - - - name: Checkout Notes - uses: actions/checkout@v4 - if: ${{ !startsWith(matrix.server-version, 'master') }} - with: - repository: nextcloud/notes - ref: "main" - path: apps/notes - - - name: Set up php ${{ matrix.php-version }} - uses: shivammathur/setup-php@4bd44f22a98a19e0950cbad5f31095157cc9621b # v2 - with: - php-version: ${{ matrix.php-version }} - extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, session, simplexml, xmlreader, xmlwriter, zip, zlib, pgsql, pdo_pgsql - coverage: none - ini-file: development - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Check composer file existence - id: check_composer - uses: andstor/file-existence-action@20b4d2e596410855db8f9ca21e96fbe18e12930b # v2 - with: - files: apps/${{ env.APP_NAME }}/composer.json - - - name: Set up dependencies - if: steps.check_composer.outputs.files_exists == 'true' - working-directory: apps/${{ env.APP_NAME }} - run: composer i - - - name: Set up Nextcloud - env: - DB_PORT: 4444 - run: | - mkdir data - ./occ maintenance:install --verbose --database=pgsql --database-name=nextcloud --database-host=127.0.0.1 \ - --database-port=$DB_PORT --database-user=root --database-pass=rootpassword \ - --admin-user admin --admin-pass admin - ./occ app:enable notifications - ./occ app:enable --force ${{ env.APP_NAME }} - - - name: Enable Notes - if: ${{ !startsWith(matrix.server-version, 'master') }} - run: ./occ app:enable notes - - - name: Run Nextcloud - run: PHP_CLI_SERVER_WORKERS=2 php -S 127.0.0.1:8080 & - - - name: Checkout NcPyApi - uses: actions/checkout@v4 - with: - path: nc_py_api - repository: cloud-py-api/nc_py_api - - - name: Install NcPyApi - working-directory: nc_py_api - run: python3 -m pip -v install ".[dev]" - - - name: Register NcPyApi - run: | - cd nc_py_api - python3 tests/_install.py & - echo $! > /tmp/_install.pid - python3 tests/_install_wait.py http://127.0.0.1:$APP_PORT/heartbeat "\"status\":\"ok\"" 15 0.5 - cd .. - sh nc_py_api/scripts/ci_register.sh "$APP_ID" "$APP_VERSION" "$APP_SECRET" "localhost" "$APP_PORT" - kill -15 $(cat /tmp/_install.pid) - timeout 3m tail --pid=$(cat /tmp/_install.pid) -f /dev/null - - - name: Run NC_Py_API tests - working-directory: nc_py_api - run: python3 -m pytest - - - name: Upload NC logs - if: always() - uses: actions/upload-artifact@v4 - with: - name: pgsql_nc_py_api_${{ matrix.server-version }}_${{ matrix.php-version }}_nextcloud.log - path: data/nextcloud.log - if-no-files-found: warn - - nc-py-api-mysql: - runs-on: ubuntu-22.04 - name: NC_Py_API • master • 8.3 • MySQL - - services: - mysql: - image: ghcr.io/nextcloud/continuous-integration-mysql-8.3:latest - ports: - - 4444:3306/tcp - env: - MYSQL_ROOT_PASSWORD: rootpassword - options: --health-cmd="mysqladmin ping" --health-interval 5s --health-timeout 2s --health-retries 5 - - steps: - - uses: actions/setup-python@v4 - with: - python-version: '3.10' - - - name: Set app env - run: echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV - - - name: Checkout server - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - with: - submodules: true - repository: nextcloud/server - ref: master - - - name: Checkout Notifications - uses: actions/checkout@v4 - with: - repository: nextcloud/notifications - ref: master - path: apps/notifications - - - name: Checkout AppAPI - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - with: - path: apps/${{ env.APP_NAME }} - - - name: Set up php 8.3 - uses: shivammathur/setup-php@4bd44f22a98a19e0950cbad5f31095157cc9621b # v2 - with: - php-version: '8.3' - extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, session, simplexml, xmlreader, xmlwriter, zip, zlib, mysql, pdo_mysql - coverage: none - ini-file: development - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Enable ONLY_FULL_GROUP_BY MySQL option - run: | - echo "SET GLOBAL sql_mode=(SELECT CONCAT(@@sql_mode,',ONLY_FULL_GROUP_BY'));" | mysql -h 127.0.0.1 -P 4444 -u root -prootpassword - echo "SELECT @@sql_mode;" | mysql -h 127.0.0.1 -P 4444 -u root -prootpassword - - - name: Check composer file existence - id: check_composer - uses: andstor/file-existence-action@20b4d2e596410855db8f9ca21e96fbe18e12930b # v2 - with: - files: apps/${{ env.APP_NAME }}/composer.json - - - name: Set up dependencies - if: steps.check_composer.outputs.files_exists == 'true' - working-directory: apps/${{ env.APP_NAME }} - run: composer i - - - name: Set up Nextcloud - env: - DB_PORT: 4444 - run: | - mkdir data - ./occ maintenance:install --verbose --database=mysql --database-name=nextcloud \ - --database-host=127.0.0.1 --database-port=$DB_PORT --database-user=root --database-pass=rootpassword \ - --admin-user admin --admin-pass admin - ./occ app:enable notifications - ./occ app:enable --force ${{ env.APP_NAME }} - - - name: Run Nextcloud - run: PHP_CLI_SERVER_WORKERS=2 php -S 127.0.0.1:8080 & - - - name: Checkout NcPyApi - uses: actions/checkout@v4 - with: - path: nc_py_api - repository: cloud-py-api/nc_py_api - - - name: Install NcPyApi - working-directory: nc_py_api - run: python3 -m pip -v install ".[dev]" - - - name: Register NcPyApi - run: | - cd nc_py_api - python3 tests/_install.py & - echo $! > /tmp/_install.pid - python3 tests/_install_wait.py http://127.0.0.1:$APP_PORT/heartbeat "\"status\":\"ok\"" 15 0.5 - cd .. - sh nc_py_api/scripts/ci_register.sh "$APP_ID" "$APP_VERSION" "$APP_SECRET" "localhost" "$APP_PORT" - kill -15 $(cat /tmp/_install.pid) - timeout 3m tail --pid=$(cat /tmp/_install.pid) -f /dev/null - - - name: Run NC_Py_API tests - working-directory: nc_py_api - run: python3 -m pytest - - - name: Upload NC logs - if: always() - uses: actions/upload-artifact@v4 - with: - name: mysql_nc_py_api_master_8.3_nextcloud.log - path: data/nextcloud.log - if-no-files-found: warn - - nc-py-api-mysql-apcu: - runs-on: ubuntu-22.04 - name: APCu • NC_Py_API • master • 8.3 • MySQL - - services: - mysql: - image: ghcr.io/nextcloud/continuous-integration-mysql-8.3:latest - ports: - - 4444:3306/tcp - env: - MYSQL_ROOT_PASSWORD: rootpassword - options: --health-cmd="mysqladmin ping" --health-interval 5s --health-timeout 2s --health-retries 5 - - steps: - - uses: actions/setup-python@v4 - with: - python-version: '3.10' - - - name: Set app env - run: echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV - - - name: Checkout server - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - with: - submodules: true - repository: nextcloud/server - ref: master - - - name: Checkout Notifications - uses: actions/checkout@v4 - with: - repository: nextcloud/notifications - ref: master - path: apps/notifications - - - name: Checkout AppAPI - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - with: - path: apps/${{ env.APP_NAME }} - - - name: Set up php 8.3 - uses: shivammathur/setup-php@4bd44f22a98a19e0950cbad5f31095157cc9621b # v2 - with: - php-version: '8.3' - extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, session, simplexml, xmlreader, xmlwriter, zip, zlib, mysql, pdo_mysql, apcu - coverage: none - ini-file: development - ini-values: - apc.enabled=on, apc.enable_cli=on - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Enable ONLY_FULL_GROUP_BY MySQL option - run: | - echo "SET GLOBAL sql_mode=(SELECT CONCAT(@@sql_mode,',ONLY_FULL_GROUP_BY'));" | mysql -h 127.0.0.1 -P 4444 -u root -prootpassword - echo "SELECT @@sql_mode;" | mysql -h 127.0.0.1 -P 4444 -u root -prootpassword - - - name: Check composer file existence - id: check_composer - uses: andstor/file-existence-action@20b4d2e596410855db8f9ca21e96fbe18e12930b # v2 - with: - files: apps/${{ env.APP_NAME }}/composer.json - - - name: Set up dependencies - if: steps.check_composer.outputs.files_exists == 'true' - working-directory: apps/${{ env.APP_NAME }} - run: composer i - - - name: Set up Nextcloud - env: - DB_PORT: 4444 - run: | - mkdir data - ./occ maintenance:install --verbose --database=mysql --database-name=nextcloud \ - --database-host=127.0.0.1 --database-port=$DB_PORT --database-user=root --database-pass=rootpassword \ - --admin-user admin --admin-pass admin - ./occ config:system:set memcache.local --value "\\OC\\Memcache\\APCu" --type string - ./occ app:enable notifications - ./occ app:enable --force ${{ env.APP_NAME }} - - - name: Run Nextcloud - run: PHP_CLI_SERVER_WORKERS=2 php -S 127.0.0.1:8080 & - - - name: Checkout NcPyApi - uses: actions/checkout@v4 - with: - path: nc_py_api - repository: cloud-py-api/nc_py_api - - - name: Install NcPyApi - working-directory: nc_py_api - run: python3 -m pip -v install ".[dev]" - - - name: Register NcPyApi - run: | - cd nc_py_api - python3 tests/_install.py & - echo $! > /tmp/_install.pid - python3 tests/_install_wait.py http://127.0.0.1:$APP_PORT/heartbeat "\"status\":\"ok\"" 15 0.5 - cd .. - sh nc_py_api/scripts/ci_register.sh "$APP_ID" "$APP_VERSION" "$APP_SECRET" "localhost" "$APP_PORT" - kill -15 $(cat /tmp/_install.pid) - timeout 3m tail --pid=$(cat /tmp/_install.pid) -f /dev/null - - - name: Run NC_Py_API tests - working-directory: nc_py_api - run: python3 -m pytest - - - name: Upload NC logs - if: always() - uses: actions/upload-artifact@v4 - with: - name: apcu_mysql_nc_py_api_master_8.3_nextcloud.log - path: data/nextcloud.log - if-no-files-found: warn - - nc-py-api-oci: - runs-on: ubuntu-22.04 - name: NC_Py_API • ${{ matrix.server-version }} • 8.3 • Oracle - strategy: - fail-fast: false - matrix: - server-version: [ 'master' ] - - services: - oracle: - image: ghcr.io/gvenzl/oracle-xe:11 - env: - ORACLE_RANDOM_PASSWORD: true - APP_USER: useroracle - APP_USER_PASSWORD: userpassword - options: >- - --health-cmd healthcheck.sh - --health-interval 10s - --health-timeout 5s - --health-retries 10 - ports: - - 1521:1521/tcp - - steps: - - uses: actions/setup-python@v4 - with: - python-version: '3.11' - - - name: Set app env - run: echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV - - - name: Checkout server - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - with: - submodules: true - repository: nextcloud/server - ref: ${{ matrix.server-version }} - - - name: Checkout Notifications - uses: actions/checkout@v4 - with: - repository: nextcloud/notifications - ref: ${{ matrix.server-version }} - path: apps/notifications - - - name: Checkout AppAPI - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - with: - path: apps/${{ env.APP_NAME }} - - - name: Set up php - uses: shivammathur/setup-php@v2 - with: - php-version: '8.3' - extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, \ - posix, session, simplexml, xmlreader, xmlwriter, zip, zlib, oci8 - - - name: Check composer file existence - id: check_composer - uses: andstor/file-existence-action@20b4d2e596410855db8f9ca21e96fbe18e12930b # v2 - with: - files: apps/${{ env.APP_NAME }}/composer.json - - - name: Set up dependencies - if: steps.check_composer.outputs.files_exists == 'true' - working-directory: apps/${{ env.APP_NAME }} - run: composer i - - - name: Set up Nextcloud - env: - DB_PORT: 4444 - run: | - mkdir data - ./occ maintenance:install --verbose --database=oci --database-name=XE \ - --database-host=127.0.0.1 --database-port=1521 --database-user=useroracle --database-pass=userpassword \ - --admin-user admin --admin-pass admin - ./occ app:enable --force ${{ env.APP_NAME }} - ./occ app:enable notifications - ./occ app:enable --force ${{ env.APP_NAME }} - - - name: Run Nextcloud - run: PHP_CLI_SERVER_WORKERS=2 php -S 127.0.0.1:8080 & - - - name: Checkout NcPyApi - uses: actions/checkout@v4 - with: - path: nc_py_api - repository: cloud-py-api/nc_py_api - - - name: Install NcPyApi - working-directory: nc_py_api - run: python3 -m pip -v install ".[dev]" - - - name: Register NcPyApi - run: | - cd nc_py_api - python3 tests/_install.py & - echo $! > /tmp/_install.pid - python3 tests/_install_wait.py http://127.0.0.1:$APP_PORT/heartbeat "\"status\":\"ok\"" 15 0.5 - cd .. - sh nc_py_api/scripts/ci_register.sh "$APP_ID" "$APP_VERSION" "$APP_SECRET" "localhost" "$APP_PORT" - kill -15 $(cat /tmp/_install.pid) - timeout 3m tail --pid=$(cat /tmp/_install.pid) -f /dev/null - - - name: Run NC_Py_API tests - working-directory: nc_py_api - run: python3 -m pytest - - - name: Upload NC logs - if: always() - uses: actions/upload-artifact@v4 - with: - name: oci_nc_py_api_${{ matrix.server-version }}_8.3_nextcloud.log - path: data/nextcloud.log - if-no-files-found: warn - - tests-success: - permissions: - contents: none - runs-on: ubuntu-22.04 - needs: [nc-py-api-pgsql, nc-py-api-mysql, nc-py-api-oci] - name: Tests-OK - steps: - - run: echo "Tests passed successfully" diff --git a/lib/DeployActions/DockerActions.php b/lib/DeployActions/DockerActions.php index 680abbf7..9b5dabac 100644 --- a/lib/DeployActions/DockerActions.php +++ b/lib/DeployActions/DockerActions.php @@ -82,7 +82,7 @@ public function deployExApp(ExApp $exApp, DaemonConfig $daemonConfig, array $par } } $this->exAppService->setAppDeployProgress($exApp, 96); - $result = $this->createContainer($dockerUrl, $imageId, $params['container_params']); + $result = $this->createContainer($dockerUrl, $imageId, $daemonConfig, $params['container_params']); if (isset($result['error'])) { return $result['error']; } @@ -282,7 +282,7 @@ private function buildExtendedImageName2(array $imageParams, DaemonConfig $daemo $imageParams['image_name'] . ':' . $imageParams['image_tag'] . '-' . $daemonConfig->getDeployConfig()['computeDevice']['id']; } - public function createContainer(string $dockerUrl, string $imageId, array $params = []): array { + public function createContainer(string $dockerUrl, string $imageId, DaemonConfig $daemonConfig, array $params = []): array { $createVolumeResult = $this->createVolume($dockerUrl, $this->buildExAppVolumeName($params['name'])); if (isset($createVolumeResult['error'])) { return $createVolumeResult; @@ -301,6 +301,23 @@ public function createContainer(string $dockerUrl, string $imageId, array $param 'Env' => $params['env'], ]; + // Exposing the ExApp's primary port when the installation type is remote and the network is not a "host" + if (($params['net'] !== 'host') && ($daemonConfig->getProtocol() === 'https')) { + $exAppMainPort = $params['port']; + $containerParams['ExposedPorts'] = [ + sprintf('%d/tcp', $exAppMainPort) => (object) [], + sprintf('%d/udp', $exAppMainPort) => (object) [], + ]; + $containerParams['HostConfig']['PortBindings'] = [ + sprintf('%d/tcp', $exAppMainPort) => [ + ['HostPort' => (string)$exAppMainPort, 'HostIp' => '127.0.0.1'] + ], + sprintf('%d/udp', $exAppMainPort) => [ + ['HostPort' => (string)$exAppMainPort, 'HostIp' => '127.0.0.1'] + ], + ]; + } + if (!in_array($params['net'], ['host', 'bridge'])) { $networkingConfig = [ 'EndpointsConfig' => [