Skip to content

Commit

Permalink
feat(deployment): add launch for all deployments
Browse files Browse the repository at this point in the history
  • Loading branch information
emptybutton committed Jan 13, 2025
1 parent 20570e5 commit 082eb7d
Show file tree
Hide file tree
Showing 8 changed files with 115 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/pixel_battle/deployment/chunk_reading_service/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import uvicorn

from pixel_battle.deployment.chunk_reading_service.asgi import app


def main() -> None:
uvicorn.run(app)


if __name__ == "__main__":
main()
12 changes: 12 additions & 0 deletions src/pixel_battle/deployment/chunk_reading_service/asgi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from pixel_battle.deployment.chunk_reading_service.di import (
chunk_reading_service_container,
)
from pixel_battle.deployment.common.asgi import ASGIApp, LazyASGIApp
from pixel_battle.presentation.web.app import app_from


async def app_factory() -> ASGIApp:
return await app_from(chunk_reading_service_container)


app = LazyASGIApp(factory=app_factory)
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import asyncio

from pixel_battle.deployment.chunk_stream_compression_coordination_service.di import ( # noqa: E501
chunk_stream_compression_coordination_service_container,
)
from pixel_battle.presentation.distributed_tasks.update_chunk_view import (
UpdateChunkViewTask,
)


async def main() -> None:
task = await chunk_stream_compression_coordination_service_container.get(
UpdateChunkViewTask
)

try:
await task.start_pushing()
finally:
await chunk_stream_compression_coordination_service_container.close()


if __name__ == "__main__":
asyncio.run(main())
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import asyncio

from pixel_battle.deployment.chunk_stream_compression_service.di import (
chunk_stream_compression_service_container,
)
from pixel_battle.presentation.distributed_tasks.update_chunk_view import (
UpdateChunkViewTask,
)


async def main() -> None:
task = await chunk_stream_compression_service_container.get(
UpdateChunkViewTask
)

try:
await task.start_pulling()
finally:
await chunk_stream_compression_service_container.close()


if __name__ == "__main__":
asyncio.run(main())
11 changes: 11 additions & 0 deletions src/pixel_battle/deployment/chunk_streaming_service/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import uvicorn

from pixel_battle.deployment.chunk_streaming_service.asgi import app


def main() -> None:
uvicorn.run(app)


if __name__ == "__main__":
main()
12 changes: 12 additions & 0 deletions src/pixel_battle/deployment/chunk_streaming_service/asgi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from pixel_battle.deployment.chunk_streaming_service.di import (
chunk_streaming_service_container,
)
from pixel_battle.deployment.common.asgi import ASGIApp, LazyASGIApp
from pixel_battle.presentation.web.app import app_from


async def app_factory() -> ASGIApp:
return await app_from(chunk_streaming_service_container)


app = LazyASGIApp(factory=app_factory)
11 changes: 11 additions & 0 deletions src/pixel_battle/deployment/chunk_writing_service/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import uvicorn

from pixel_battle.deployment.chunk_writing_service.asgi import app


def main() -> None:
uvicorn.run(app)


if __name__ == "__main__":
main()
12 changes: 12 additions & 0 deletions src/pixel_battle/deployment/chunk_writing_service/asgi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from pixel_battle.deployment.chunk_writing_service.di import (
chunk_writing_service_container,
)
from pixel_battle.deployment.common.asgi import ASGIApp, LazyASGIApp
from pixel_battle.presentation.web.app import app_from


async def app_factory() -> ASGIApp:
return await app_from(chunk_writing_service_container)


app = LazyASGIApp(factory=app_factory)

0 comments on commit 082eb7d

Please sign in to comment.