Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add podman support and fix containers.run kwargs. #3

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

Minkiu
Copy link

@Minkiu Minkiu commented May 30, 2023

This PR adds support to allow the person to run AYON services as either Docker or Podman. This does not affect what the actual ASH is run as tho.

  • New containers module A module to handle the containers connection, based on the desired runtime.
  • Add rootless podman support This commit will allow the person to set AYON_USE_PODMAN in order to use podman instead of docker. This approach relies in a podman daemon being run which we then pass to ash by mapping it such as: /run/user/1000/podman/podman.sock:/run/user/1000/podman/podman.sock to get a user service running it can be created and enabled with: systemctl --user enable --now io.podman.socket so the above socket is available.
  • ServiceLogger Improve output of services logs. A better formatting, so they slightly match ASH's logs.

Example of the logs:
image

Testing Notes

  1. Install podman
  2. Run the podman service and socket:
    systemctl start --user podman
    systemctl start --user podman.socket
  3. Set the env var AYON_USE_PODMAN to anything.
  4. Run ash, it should now be able to spin rootless containers.

@Minkiu Minkiu requested a review from martastain May 30, 2023 15:17
@Minkiu Minkiu force-pushed the feature/podman_support branch from 5aa9db0 to 4575f9e Compare October 30, 2023 12:19
@Minkiu Minkiu marked this pull request as draft October 30, 2023 12:22
@Minkiu Minkiu force-pushed the feature/podman_support branch 2 times, most recently from 474f2e1 to 25905af Compare October 30, 2023 17:05
A module to handle the containers connection, based on the desired
runtime.
This commit will allow the person to set `AYON_USE_PODMAN` in order to
use `podman` instead of `docker`. This approach relies in a `podman`
daemon being run which we then pass to `ash` by mapping it such as:
`/run/user/1000/podman/podman.sock:/run/user/1000/podman/podman.sock`
to get a user service running it can be created and enabled with:
`systemctl --user enable --now io.podman.socket` so the above socket is
available.
A better formatting, so they slightly match ASH's logs.
@Minkiu Minkiu force-pushed the feature/podman_support branch from 25905af to ff7aeee Compare October 30, 2023 17:07
@Minkiu Minkiu marked this pull request as ready for review October 30, 2023 17:12
Copy link
Member

@martastain martastain left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've pushed small changes (one typo and typing related things to keep mypy happy), but please keep the main loop silent when it doesn't do anything :)

ash/services.py Outdated
@@ -22,10 +23,13 @@ def get_running_services(cls) -> list[str]:
if cls.client is None:
return result

logging.debug("Checking for Running services.")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove log statements, which are executed in every iteration as they flood the logs

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

particularly lines 26, 32, 95, 113

@martastain
Copy link
Member

Otherwise everything works with Docker. I am not sure about parsing nxtools specific logs, but apparantly it doesn't hurt when a different format is used.

@martastain
Copy link
Member

Yep... logging sometimes breaks with "bare" log messages from ayon python api:
image

@Minkiu
Copy link
Author

Minkiu commented Oct 31, 2023

Ok, I'll drop the ServiceLogger commit and remove the extra loggings in the loop

@Minkiu Minkiu requested a review from martastain October 31, 2023 14:40
@Minkiu Minkiu force-pushed the feature/podman_support branch from b47ac1b to 0739d4e Compare October 31, 2023 14:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants