OHDSI / Broadsea

Broadsea deploys the core OHDSI technology stack (Atlas & R Hades), using cross-platform Docker container technology.
http://ohdsi.github.io/Broadsea/
Apache License 2.0
71 stars 54 forks source link

Local and Secure Deployment of Broadsea (and related Deployments) #100

Closed haydenbspence closed 11 months ago

haydenbspence commented 1 year ago

Purpose

This is a general issue to house the discussion of deploying Broadsea in local, secure, and similar environments, whether that is by adjusting Docker or modeling separate technologies after Broadsea's Docker implementation to deploy the suite.

Problem Statement

Docker is often not able to be deployed by default in some environments. IT departments may have default environment settings that do not allow for Docker. In some settings, this may involve a lengthy process of paperwork and approvals to change, which increases the barriers to using Broadsea. In other settings, the deployment may not be feasible at all due to policy.

Types of Problems

Security: The permissions provided to a user may not allow for some of the aspects of Docker or the technologies in docker-compose. However, it would be possible using different tooling that the same functionality could be possible under default user permissions.

Firewalls: The ports necessary may not be able to be opened, even locally, depending on the security settings. This may impact the Broadsea database deployment and WebAPI in particular.

Virtualization Performance/Security: The secure environment is hosted on a server, which is frequently a virtualization itself. For both security and performance reasons IT Admins may not approve of virtualization on top of virtualization.

Detailed Analysis

The following are considerations that IT offices often include in their analysis. This may be helpful when evaluating Docker alternatives. However, organization policies also factor into permissibility.

Initial Ideas

Forum Post

leeevans commented 1 year ago

Here are some additional ideas you could investigate which may enable some secure sites to run the Broadsea container images:

Podman - doesn’t run as root, and no Docker service running on server: https://podman.io/

Kubernetes - may be a good option if a site is already using it for other applications

AWS Elastic Container Service (ECS) or other cloud container service equivalent

This AWS Whitepaper - Architecting for HIPAA Security and Compliance on AWS may be a useful reference for secure cloud services approach: https://docs.aws.amazon.com/pdfs/whitepapers/latest/architecting-hipaa-security-and-compliance-on-aws/architecting-hipaa-security-and-compliance-on-aws.pdf#architecting-hipaa-security-and-compliance-on-aws

Note. A local site install of PostgreSQL or cloud database service like AWS RDS is recommended for Broadsea production use instead of the demo broadsea-atladb container image.

There is also an OHDSI-in-a-box virtual server image that doesn’t use Docker here (Windows or Linux OS): https://github.com/OHDSI/OHDSI-in-a-Box

haydenbspence commented 1 year ago

Containerd

Containerd is a container runtime that uses Open Container Initiative (OCI) standards and can be used with both Linux and Windows daemons.

Dependencies:

Pros

Cons

Vagrant

Vagrant is a tool for building and managing virtual machine environments. This can be paired with a hypervisor of choice.

Dependencies:

Pros

Cons

Nix and NixOS

Nix is a tool for package management and creating reproducible, declarative and reliable systems.

Dependencies:

Pros

Cons

alondhe commented 1 year ago

Ideally, we could just leverage the same compose setup. Do any of these work with docker compose files? I see podman can (mostly).

haydenbspence commented 1 year ago

nerdctl is a drop-in replacement for docker-compose and should run the same yml format without any reformatting.

I am currently testing it and hcsshim referencing a write-up by James Sturtevant, and another by Markus Lippert.

What's promising here is Hyper-V is not necessarily needed if the same version of windows is used as the container image. If this is possible for Linux/OSX as well it may help with any situations in which virtualization permissions is the main issue.

alondhe commented 1 year ago

I think once we select a Docker alternative (that is compose compliant), let's test it in GitHub Actions here to gain evidence that the approach can work.

haydenbspence commented 1 year ago

@alondhe Broadsea on Podman is working locally for me with a OCI translated image. I should be able to submit a pull later tonight/tomorrow as a proof of concept w/ readme.

I also suggest looking into CRI-O and Windows Containers as two other runtimes to support. If Docker, Podman, CRI-O and Windows Containers OR virtualization in general are not options -- I think only a local install would be feasible.

This is out-of-scope and non-container related but there have also been some efforts to run portable Shiny apps locally (1, 1.1, 2) using Electron and R-Portable that may fit some use-cases.

leeevans commented 1 year ago

This is great @haydenbspence - thanks for working on this!

haydenbspence commented 12 months ago

My testing with Podman really only worked when removing the following:

I also don't see a non-system specific way to fix the 80 / 443 issue with non-admin/root users.

OHDSI/Broadsea/tree/podman seems to be in-line with this.

haydenbspence commented 11 months ago

Official release notes for Podman 1.2 adds support for compose

https://podman-desktop.io/blog/podman-desktop-release-1.2

alondhe commented 11 months ago

Is it fair to say Podman is the most supported alternative? I'd want to stick to platforms that have long term viability if possible.

haydenbspence commented 11 months ago

Yes, Podman looks like a solid alternative for deployments in unique security situations that Docker doesn't cover. Here's why:

If a tech department isn't behind Docker or Podman, other choices are probably in 'shadow IT' territory, like nerdctl.

Podman does have a hitch - it needs WSL for Windows Servers and can't work with Windows Containers like Docker can. This is due to how it uses Namespaces, and might never change.

So far, I haven't found alternatives that support both Windows Containers and daemonless/rootless deployment. Though this might change (as mentioned in this article), it's too early to adopt. We're better off waiting for more support from Microsoft.

Check out Ajit's branch of Podman.

Closing the issue, reopen if Podman does not fulfill your site's needs or some magic is discovered we didn't find.