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

Support Podman #197

Merged
merged 13 commits into from
Feb 6, 2024
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
default-image:
- '' # use the application default
- aiidalab/aiidalab-docker-stack:latest
- aiidalab/aiidalab-docker-stack:latest # This is the old stack

steps:

Expand Down
15 changes: 13 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ AiiDAlab Launch makes it easy to run AiiDAlab on your own workstation or laptop.

To use AiiDAlab launch you will have to

1. [Install Docker on your workstation or laptop.](https://docs.docker.com/get-docker/)
1. [Install Docker on your workstation or laptop.](https://docs.docker.com/get-docker/) (you can also use Podman, [see below](README.md#using-podman))
2. Install AiiDAlab launch with [pipx](https://pypa.github.io/pipx/installation/) (**recommended**):

```console
Expand Down Expand Up @@ -70,6 +70,17 @@ Please see [here](ssh-forward.md) for instructions on how to run AiiDAlab on a r

This package follows the Python compatibility and deprecation schedule specified by [NEP 29](https://numpy.org/neps/nep-0029-deprecation_policy.html).

### Using Podman instead of Docker

You should be able to use Podman as as a drop-in replacement for Docker, with just a little extra setup. The following was tested on Fedora 39 which comes with Podman pre-installed.

```console
systemctl --user enable podman.socket
systemctl --user start podman.socket
systemctl --user status podman.socket
export DOCKER_HOST=unix:///run/user/$UID/podman/podman.sock
```

## Development

### Setting up a development environment
Expand Down Expand Up @@ -162,7 +173,7 @@ SOFTWARE.
## Acknowledgements

This work is supported by the
[MARVEL National Centre for Competency in Research](<http://nccr-marvel.ch>) funded by the [Swiss National Science Foundation](<http://www.snf.ch/en>),
[MARVEL National Centre for Competency in Research](<https://nccr-marvel.ch>) funded by the [Swiss National Science Foundation](<https://www.snf.ch/en>),
Copy link
Member

Choose a reason for hiding this comment

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

Thanks!

the MARKETPLACE project funded by [Horizon 2020](https://ec.europa.eu/programmes/horizon2020/) under the H2020-NMBP-25-2017 call (Grant No. 760173),
as well as by the [MaX
European Centre of Excellence](<http://www.max-centre.eu/>) funded by the Horizon 2020 EINFRA-5 program,
Expand Down
17 changes: 11 additions & 6 deletions aiidalab_launch/profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ def _default_port() -> int: # explicit function required to enable test patchin
return DEFAULT_PORT


DEFAULT_IMAGE = "aiidalab/full-stack:latest"
DEFAULT_REGISTRY = "docker.io"
Copy link
Member

Choose a reason for hiding this comment

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

docker registry has a quite strict API rate limits. What about using ghcr.io?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well, it's currently dockerhub. The API rate limits should not really apply to users of aiidalab-launch for whom downloading a new AiiDAlab image should be a relatively rare operation.

I think it's better to keep using dockerhub for production images and ghcr.io for development. If there's a disagreement on that let's discuss separately.

DEFAULT_IMAGE_PATH = "aiidalab/full-stack:latest"
DEFAULT_IMAGE = f"{DEFAULT_REGISTRY}/{DEFAULT_IMAGE_PATH}"


def _valid_volume_name(source: str) -> None:
Expand Down Expand Up @@ -158,11 +160,14 @@ def from_container(cls, container: Container) -> Profile:

system_user = get_docker_env(container, "SYSTEM_USER")

image_tag = (
DEFAULT_IMAGE
if DEFAULT_IMAGE in container.image.tags
else container.image.tags[0]
)
if DEFAULT_IMAGE in container.image.tags:
image_tag = DEFAULT_IMAGE
# Docker seems to strip `docker.io` from the image name
# so we add it back manually.
elif DEFAULT_IMAGE_PATH in container.image.tags:
image_tag = f"{DEFAULT_REGISTRY}/{DEFAULT_IMAGE_PATH}"
else:
image_tag = container.image.tags[0]

extra_destinations: list[PurePosixPath] = [
PurePosixPath(mount["Destination"])
Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def _pull_docker_image(docker_client):
# Avoid interfering with used ports on the host system.
@pytest.fixture(scope="session", autouse=True)
def _default_port(monkeypatch_session):
monkeypatch_session.setattr(aiidalab_launch.profile, "DEFAULT_PORT", None)
monkeypatch_session.setattr(aiidalab_launch.profile, "DEFAULT_PORT", 7777)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Podman seems to autoassign random port, so the tests were failing for me locally.

yield None


Expand Down
Loading