Skip to content
Open
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
12 changes: 6 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ help:
@echo " > Next commands are only for the dev environment with nextcloud-docker-dev!"
@echo " > They must be run from the host you are developing on, not in a Nextcloud container!"
@echo " "
@echo " run31 installs $(APP_NAME) for Nextcloud 31"
@echo " run33 installs $(APP_NAME) for Nextcloud 31"
@echo " run installs $(APP_NAME) for Nextcloud Latest"
@echo " "
@echo " run31-latest installs $(APP_NAME) with 'latest' tag for Nextcloud 31"
@echo " run33-latest installs $(APP_NAME) with 'latest' tag for Nextcloud 31"
@echo " run-latest installs $(APP_NAME) with 'latest' tag for Nextcloud Latest"

.PHONY: build-push
Expand All @@ -44,8 +44,8 @@ build-podman-latest:
podman build --format=docker --platform linux/amd64 --tag ghcr.io/nextcloud/$(APP_ID):latest-cuda --build-arg BUILD_TYPE=cuda .
podman build --format=docker --platform linux/amd64 --tag ghcr.io/nextcloud/$(APP_ID):latest-rocm --build-arg BUILD_TYPE=rocm .

.PHONY: run31
run31:
.PHONY: run33
run33:
docker exec master-stable31-1 sudo -u www-data php occ app_api:app:register $(APP_ID) --test-deploy-mode \
--info-xml https://raw.githubusercontent.com/nextcloud/$(APP_ID)/main/appinfo/info.xml

Expand All @@ -54,8 +54,8 @@ run:
docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:register $(APP_ID) --test-deploy-mode \
--info-xml https://raw.githubusercontent.com/nextcloud/$(APP_ID)/main/appinfo/info.xml

.PHONY: run31-latest
run31-latest:
.PHONY: run33-latest
run33-latest:
docker exec master-stable31-1 sudo -u www-data php occ app_api:app:register $(APP_ID) --test-deploy-mode \
--info-xml https://raw.githubusercontent.com/nextcloud/$(APP_ID)/main/appinfo/info-latest.xml

Expand Down
14 changes: 14 additions & 0 deletions appinfo/info-latest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,19 @@
<image>nextcloud/test-deploy</image>
<image-tag>latest</image-tag>
</docker-install>
<k8s-service-roles>
<role>
<name>rp</name>
<display-name>Request Processing</display-name>
<env>APP_ROLE=rp</env>
<expose>true</expose>
</role>
<role>
<name>worker</name>
<display-name>Background Worker</display-name>
<env>APP_ROLE=worker</env>
<expose>false</expose>
</role>
</k8s-service-roles>
</external-app>
</info>
14 changes: 14 additions & 0 deletions appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,19 @@
<image>nextcloud/test-deploy</image>
<image-tag>release</image-tag>
</docker-install>
<k8s-service-roles>
<role>
<name>rp</name>
<display-name>Request Processing</display-name>
<env>APP_ROLE=rp</env>
<expose>true</expose>
</role>
<role>
<name>worker</name>
<display-name>Background Worker</display-name>
<env>APP_ROLE=worker</env>
<expose>false</expose>
</role>
</k8s-service-roles>
</external-app>
</info>
19 changes: 18 additions & 1 deletion ex_app/lib/main.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
"""Modified basic example for testing problems with deployment"""

import os
import socket
import time
from contextlib import asynccontextmanager

import httpx
Expand All @@ -13,6 +16,8 @@
set_handlers,
)

APP_ROLE = os.environ.get("APP_ROLE", "")


@asynccontextmanager
async def lifespan(app: FastAPI):
Expand Down Expand Up @@ -119,6 +124,18 @@ def enabled_handler(enabled: bool, _nc: NextcloudApp) -> str:
return r


def run_worker() -> None:
"""Entry point for the worker role (no HTTP server)."""
hostname = socket.gethostname()
print(f"[worker] Starting on {hostname}, APP_ROLE={APP_ROLE}", flush=True)
while True:
print(f"[worker] {hostname} is alive", flush=True)
time.sleep(300)


if __name__ == "__main__":
print("Started", flush=True)
run_app("main:APP", log_level="trace")
if APP_ROLE == "worker":
run_worker()
else:
run_app("main:APP", log_level="trace")