@@ -1284,13 +1284,206 @@ 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+ PHP_CLI_SERVER_WORKERS=2 php -S 127.0.0.1:8080 &
1382+ ./occ app_api:daemon:register \
1383+ manual_install_harp "Harp Manual Install" "manual-install" "http" "127.0.0.1:8780" "http://127.0.0.1" \
1384+ --net host --harp --harp_frp_address "127.0.0.1:8782" --harp_shared_key "some_very_secure_password"
1385+ ./occ app_api:daemon:list
1386+
1387+ ./occ app_api:app:register app-skeleton-python manual_install_harp \
1388+ --json-info " \
1389+ { \
1390+ \"id\": \"app-skeleton-python\", \
1391+ \"name\": \"App Skeleton\", \
1392+ \"daemon_config_name\": \"manual_install_harp\", \
1393+ \"version\": \"3.0.1\", \
1394+ \"secret\": \"12345\", \
1395+ \"port\": 23000, \
1396+ \"routes\": [ \
1397+ { \
1398+ \"url\": \"^/public$\", \
1399+ \"verb\": \"GET\", \
1400+ \"access_level\": 0 \
1401+ }, \
1402+ { \
1403+ \"url\": \"^/user$\", \
1404+ \"verb\": \"GET\", \
1405+ \"access_level\": 1 \
1406+ }, \
1407+ { \
1408+ \"url\": \"^/admin$\", \
1409+ \"verb\": \"GET\", \
1410+ \"access_level\": 2 \
1411+ }, \
1412+ { \
1413+ \"url\": \"^/$\", \
1414+ \"verb\": \"GET\", \
1415+ \"access_level\": 1 \
1416+ }, \
1417+ { \
1418+ \"url\": \"^/ws$\", \
1419+ \"verb\": \"GET\", \
1420+ \"access_level\": 1 \
1421+ } \
1422+ ] \
1423+ }" \
1424+ --wait-finish
1425+
1426+ function test_req() { \
1427+ temp=$(mktemp); \
1428+ curl -i -o $temp $2 -w "%{http_code}" http://127.0.0.1/exapps/app-skeleton/$1 | grep -q "$3" || { \
1429+ echo "$1 :: $2 :: $3"; \
1430+ cat $temp; \
1431+ error; \
1432+ }; \
1433+ cat $temp | tee -a curl.log \
1434+ }
1435+
1436+ test_req -- public "--" 200
1437+ test_req -- public "-u usr:password" 200
1438+ test_req -- public "-u admin:admin" 200
1439+
1440+ test_req -- user "--" 403
1441+ test_req -- user "-u usr:password" 200
1442+ test_req -- user "-u admin:admin" 200
1443+
1444+ test_req -- admin "--" 403
1445+ test_req -- admin "-u usr:password" 403
1446+ test_req -- admin "-u admin:admin" 200
1447+
1448+ test_req -- imaginary "--" 404
1449+ test_req -- imaginary "-u usr:password" 404
1450+ test_req -- imaginary "-u admin:admin" 404
1451+
1452+ ./occ app_api:app:disable app-skeleton-python
1453+
1454+ - name : Check logs
1455+ run : |
1456+ grep -q 'Hello from app-skeleton-python :)' data/nextcloud.log || error
1457+ grep -q 'Bye bye from app-skeleton-python :(' data/nextcloud.log || error
1458+
1459+ - name : Save app and HaRP container info & logs
1460+ if : always()
1461+ run : |
1462+ docker inspect appapi-harp | json_pp > harp_host_container.json
1463+ docker logs appapi-harp > harp_host_container.log 2>&1
1464+ docker inspect nc_app_app-skeleton-python | json_pp > app_host_container.json
1465+ docker logs nc_app_app-skeleton-python > app_host_container.log 2>&1
1466+
1467+ - name : Unregister Skeleton & Daemon
1468+ run : |
1469+ ./occ app_api:app:unregister app-skeleton-python
1470+ ./occ app_api:daemon:unregister harp_proxy
1471+
1472+ - name : Test OCC commands(docker)
1473+ run : python3 apps/${{ env.APP_NAME }}/tests/test_occ_commands_docker.py
1474+
1475+ - name : Show all logs
1476+ if : always()
1477+ run : tail -v -n +1 *container.json *.log data/nextcloud.log
1478+
12871479 tests-deploy-success :
12881480 permissions :
12891481 contents : none
12901482 runs-on : ubuntu-22.04
12911483 needs : [nc-host-app-docker, nc-docker-app-docker, nc-docker-dsp-http,
12921484 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]
1485+ nc-docker-harp-bridge, nc-docker-harp-bridge-no-tls, nc-host-harp-host,
1486+ nc-host-manual-harp-host]
12941487 name : Tests-Deploy-OK
12951488 steps :
12961489 - run : echo "Tests-Deploy passed successfully"
0 commit comments