@@ -1284,13 +1284,207 @@ jobs:
12841284 if : always()
12851285 run : tail -v -n +1 *container.json *.log data/nextcloud.log
12861286
1287+ nc-host-manual-harp-host :
1288+ runs-on : ubuntu-22.04
1289+ name : NC In Host (Manual HaRP-Host network)
1290+
1291+ services :
1292+ postgres :
1293+ image : ghcr.io/nextcloud/continuous-integration-postgres-14:latest
1294+ ports :
1295+ - 4444:5432/tcp
1296+ env :
1297+ POSTGRES_USER : root
1298+ POSTGRES_PASSWORD : rootpassword
1299+ POSTGRES_DB : nextcloud
1300+ options : --health-cmd pg_isready --health-interval 5s --health-timeout 2s --health-retries 5
1301+
1302+ steps :
1303+ - name : Set app env
1304+ run : echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV
1305+
1306+ - name : Checkout server
1307+ uses : actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
1308+ with :
1309+ submodules : true
1310+ repository : nextcloud/server
1311+ ref : master
1312+
1313+ - name : Checkout AppAPI
1314+ uses : actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
1315+ with :
1316+ path : apps/${{ env.APP_NAME }}
1317+
1318+ - name : Set up php 8.3
1319+ uses : shivammathur/setup-php@4bd44f22a98a19e0950cbad5f31095157cc9621b # v2
1320+ with :
1321+ php-version : 8.3
1322+ 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
1323+ coverage : none
1324+ ini-file : development
1325+ env :
1326+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
1327+
1328+ - name : Check composer file existence
1329+ id : check_composer
1330+ uses : andstor/file-existence-action@20b4d2e596410855db8f9ca21e96fbe18e12930b # v2
1331+ with :
1332+ files : apps/${{ env.APP_NAME }}/composer.json
1333+
1334+ - name : Set up dependencies
1335+ if : steps.check_composer.outputs.files_exists == 'true'
1336+ working-directory : apps/${{ env.APP_NAME }}
1337+ run : composer i
1338+
1339+ - name : Set up Nextcloud
1340+ env :
1341+ DB_PORT : 4444
1342+ OC_PASS : password
1343+ run : |
1344+ mkdir data
1345+ ./occ maintenance:install --verbose --database=pgsql --database-name=nextcloud --database-host=127.0.0.1 \
1346+ --database-port=$DB_PORT --database-user=root --database-pass=rootpassword \
1347+ --admin-user admin --admin-pass admin
1348+ ./occ config:system:set loglevel --value=0 --type=integer
1349+ ./occ config:system:set debug --value=true --type=boolean
1350+ ./occ config:system:set overwrite.cli.url --value http://127.0.0.1 --type=string
1351+ ./occ app:enable --force ${{ env.APP_NAME }}
1352+ ./occ user:add --password-from-env usr
1353+
1354+ - name : Create HaRP and app container
1355+ run : |
1356+ cat apps/${{ env.APP_NAME }}/tests/simple-nginx-NOT-FOR-PRODUCTION.conf
1357+ docker run \
1358+ -e HP_SHARED_KEY="some_very_secure_password" \
1359+ -e NC_INSTANCE_URL="http://127.0.0.1" \
1360+ -e HP_LOG_LEVEL="debug" \
1361+ -v /var/run/docker.sock:/var/run/docker.sock \
1362+ --net host --name appapi-harp \
1363+ --restart unless-stopped \
1364+ -d ghcr.io/nextcloud/nextcloud-appapi-harp:latest
1365+ docker run --net host --name nextcloud --rm \
1366+ -v $(pwd)/apps/${{ env.APP_NAME }}/tests/simple-nginx-NOT-FOR-PRODUCTION.conf:/etc/nginx/conf.d/default.conf:ro \
1367+ -d nginx
1368+ docker run --net host --name nc_app_app-skeleton-python \
1369+ -e AA_VERSION=4.0.0 \
1370+ -e APP_SECRET=12345 \
1371+ -e APP_ID=app-skeleton-python \
1372+ -e APP_DISPLAY_NAME="App Skeleton" \
1373+ -e APP_VERSION=3.0.1 \
1374+ -e APP_HOST=0.0.0.0 \
1375+ -e APP_PORT=23000 \
1376+ -e NEXTCLOUD_URL=http://127.0.0.1 \
1377+ --rm -d ghcr.io/nextcloud/app-skeleton-python:latest
1378+
1379+ - name : Test deploy
1380+ run : |
1381+ set -x
1382+ PHP_CLI_SERVER_WORKERS=2 php -S 127.0.0.1:8080 &
1383+ ./occ app_api:daemon:register \
1384+ manual_install_harp "Harp Manual Install" "manual-install" "http" "127.0.0.1:8780" "http://127.0.0.1" \
1385+ --net host --harp --harp_frp_address "127.0.0.1:8782" --harp_shared_key "some_very_secure_password"
1386+ ./occ app_api:daemon:list
1387+
1388+ ./occ app_api:app:register app-skeleton-python manual_install_harp \
1389+ --json-info " \
1390+ { \
1391+ \"id\": \"app-skeleton-python\", \
1392+ \"name\": \"App Skeleton\", \
1393+ \"daemon_config_name\": \"manual_install_harp\", \
1394+ \"version\": \"3.0.1\", \
1395+ \"secret\": \"12345\", \
1396+ \"port\": 23000, \
1397+ \"routes\": [ \
1398+ { \
1399+ \"url\": \"^/public$\", \
1400+ \"verb\": \"GET\", \
1401+ \"access_level\": 0 \
1402+ }, \
1403+ { \
1404+ \"url\": \"^/user$\", \
1405+ \"verb\": \"GET\", \
1406+ \"access_level\": 1 \
1407+ }, \
1408+ { \
1409+ \"url\": \"^/admin$\", \
1410+ \"verb\": \"GET\", \
1411+ \"access_level\": 2 \
1412+ }, \
1413+ { \
1414+ \"url\": \"^/$\", \
1415+ \"verb\": \"GET\", \
1416+ \"access_level\": 1 \
1417+ }, \
1418+ { \
1419+ \"url\": \"^/ws$\", \
1420+ \"verb\": \"GET\", \
1421+ \"access_level\": 1 \
1422+ } \
1423+ ] \
1424+ }" \
1425+ --wait-finish
1426+
1427+ function test_req() {
1428+ temp=$(mktemp)
1429+ curl -i -o $temp -w "%{http_code}" $2 http://127.0.0.1/exapps/app-skeleton-python/$1 | grep -q "$3" || {
1430+ echo "$1 :: $2 :: $3"
1431+ cat $temp
1432+ error
1433+ }
1434+ cat $temp | tee -a curl.log
1435+ }
1436+
1437+ test_req public "--" 200
1438+ test_req public "-u usr:password" 200
1439+ test_req public "-u admin:admin" 200
1440+
1441+ test_req user "--" 403
1442+ test_req user "-u usr:password" 200
1443+ test_req user "-u admin:admin" 200
1444+
1445+ test_req admin "--" 403
1446+ test_req admin "-u usr:password" 403
1447+ test_req admin "-u admin:admin" 200
1448+
1449+ test_req imaginary "--" 404
1450+ test_req imaginary "-u usr:password" 404
1451+ test_req imaginary "-u admin:admin" 404
1452+
1453+ ./occ app_api:app:disable app-skeleton-python
1454+
1455+ - name : Check logs
1456+ run : |
1457+ grep -q 'Hello from app-skeleton-python :)' data/nextcloud.log || error
1458+ grep -q 'Bye bye from app-skeleton-python :(' data/nextcloud.log || error
1459+
1460+ - name : Save app and HaRP container info & logs
1461+ if : always()
1462+ run : |
1463+ docker inspect appapi-harp | json_pp > harp_host_container.json
1464+ docker logs appapi-harp > harp_host_container.log 2>&1
1465+ docker inspect nc_app_app-skeleton-python | json_pp > app_host_container.json
1466+ docker logs nc_app_app-skeleton-python > app_host_container.log 2>&1
1467+
1468+ - name : Unregister Skeleton & Daemon
1469+ run : |
1470+ ./occ app_api:app:unregister app-skeleton-python
1471+ ./occ app_api:daemon:unregister harp_proxy
1472+
1473+ - name : Test OCC commands(docker)
1474+ run : python3 apps/${{ env.APP_NAME }}/tests/test_occ_commands_docker.py
1475+
1476+ - name : Show all logs
1477+ if : always()
1478+ run : tail -v -n +1 *container.json *.log data/nextcloud.log
1479+
12871480 tests-deploy-success :
12881481 permissions :
12891482 contents : none
12901483 runs-on : ubuntu-22.04
12911484 needs : [nc-host-app-docker, nc-docker-app-docker, nc-docker-dsp-http,
12921485 nc-docker-dsp-https, nc-host-app-docker-redis, nc-host-network-host,
1293- nc-docker-harp-bridge, nc-docker-harp-bridge-no-tls, nc-host-harp-host]
1486+ nc-docker-harp-bridge, nc-docker-harp-bridge-no-tls, nc-host-harp-host,
1487+ nc-host-manual-harp-host]
12941488 name : Tests-Deploy-OK
12951489 steps :
12961490 - run : echo "Tests-Deploy passed successfully"
0 commit comments