Skip to content

Commit

Permalink
Merge pull request #72 from imjoy-team/support-in-docker
Browse files Browse the repository at this point in the history
pass in-docker parameter
  • Loading branch information
oeway authored Dec 4, 2021
2 parents c2152ca + bf9b731 commit 2083685
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
2 changes: 1 addition & 1 deletion hypha/VERSION
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"version": "0.13.0"
"version": "0.13.1"
}
8 changes: 6 additions & 2 deletions hypha/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,14 @@ async def initialize(self) -> None:
self._initialize_future = asyncio.Future()
try:
# Start 2 instances of browser
brwoser_runner = BrowserAppRunner(self.core_interface)
brwoser_runner = BrowserAppRunner(
self.core_interface, in_docker=self.in_docker
)
await brwoser_runner.initialize()

brwoser_runner = BrowserAppRunner(self.core_interface)
brwoser_runner = BrowserAppRunner(
self.core_interface, in_docker=self.in_docker
)
await brwoser_runner.initialize()

self._runners = self.core_interface.list_services({"type": "plugin-runner"})
Expand Down
11 changes: 10 additions & 1 deletion hypha/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ def setup_socketio_server(
rdf_bucket: str = "hypha-rdfs",
apps_dir: str = "hypha-apps",
executable_path: str = "",
in_docker: bool = False,
**kwargs,
) -> None:
"""Set up the socketio server."""
Expand Down Expand Up @@ -282,7 +283,9 @@ async def stats():
# pylint: disable=import-outside-toplevel
from hypha.apps import ServerAppController

ServerAppController(core_interface, port=port, apps_dir=apps_dir)
ServerAppController(
core_interface, port=port, apps_dir=apps_dir, in_docker=in_docker
)

if enable_s3:
# pylint: disable=import-outside-toplevel
Expand Down Expand Up @@ -401,6 +404,12 @@ def get_argparser():
action="store_true",
help="enable S3 object storage",
)
parser.add_argument(
"--in-docker",
action="store_true",
help="Indicate whether running in docker (e.g. "
"server apps will run without sandboxing)",
)
parser.add_argument(
"--endpoint-url",
type=str,
Expand Down
3 changes: 3 additions & 0 deletions tests/testASGIWebPythonPlugin.imjoy.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,10 @@
async def setup():
# Registering fastapi app
fastapi_app = create_fastapi_app()

async def serve_fastapi(args):
await fastapi_app(args["scope"], args["receive"], args["send"])

await api.register_service({
"name": "hello-fastapi",
"type": "ASGI",
Expand All @@ -69,6 +71,7 @@
flask_app = create_flask_app()
async def serve_flask(args):
await flask_app(args["scope"], args["receive"], args["send"])

await api.register_service({
"name": "hello-flask",
"type": "ASGI",
Expand Down

0 comments on commit 2083685

Please sign in to comment.