mirror of
https://github.com/community-scripts/ProxmoxVE
synced 2025-03-10 07:30:28 +00:00
Add ZFS to Podman. Now it works on ZFS! (#2526)
* Allow Podman to work on ZFS containers * Fix ZFS for Podman-Create missing folder. * Added option to install Portainer or Portainer agent in Podman * Fix source for Podman Homeassistant so Portainer and other containers can be installed. * fix Podman not creating storage/volumes, until one exists.
This commit is contained in:
parent
666e170f7d
commit
10c46723fe
@ -19,11 +19,72 @@ $STD apt-get install -y sudo
|
|||||||
$STD apt-get install -y mc
|
$STD apt-get install -y mc
|
||||||
msg_ok "Installed Dependencies"
|
msg_ok "Installed Dependencies"
|
||||||
|
|
||||||
|
get_latest_release() {
|
||||||
|
curl -sL https://api.github.com/repos/$1/releases/latest | grep '"tag_name":' | cut -d'"' -f4
|
||||||
|
}
|
||||||
|
|
||||||
|
PORTAINER_LATEST_VERSION=$(get_latest_release "portainer/portainer")
|
||||||
|
PORTAINER_AGENT_LATEST_VERSION=$(get_latest_release "portainer/agent")
|
||||||
|
|
||||||
|
if $STD mount | grep 'on / type zfs' > null && echo "ZFS"; then
|
||||||
|
msg_info "Enabling ZFS support."
|
||||||
|
mkdir -p /etc/containers
|
||||||
|
cat <<'EOF' >/usr/local/bin/overlayzfsmount
|
||||||
|
#!/bin/sh
|
||||||
|
exec /bin/mount -t overlay overlay "$@"
|
||||||
|
EOF
|
||||||
|
chmod +x /usr/local/bin/overlayzfsmount
|
||||||
|
cat <<'EOF' >/etc/containers/storage.conf
|
||||||
|
[storage]
|
||||||
|
driver = "overlay"
|
||||||
|
runroot = "/run/containers/storage"
|
||||||
|
graphroot = "/var/lib/containers/storage"
|
||||||
|
|
||||||
|
[storage.options]
|
||||||
|
pull_options = {enable_partial_images = "false", use_hard_links = "false", ostree_repos=""}
|
||||||
|
mount_program = "/usr/local/bin/overlayzfsmount"
|
||||||
|
|
||||||
|
[storage.options.overlay]
|
||||||
|
mountopt = "nodev"
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
|
||||||
msg_info "Installing Podman"
|
msg_info "Installing Podman"
|
||||||
$STD apt-get -y install podman
|
$STD apt-get -y install podman
|
||||||
$STD systemctl enable --now podman.socket
|
$STD systemctl enable --now podman.socket
|
||||||
|
echo -e 'unqualified-search-registries=["docker.io"]' >> /etc/containers/registries.conf
|
||||||
msg_ok "Installed Podman"
|
msg_ok "Installed Podman"
|
||||||
|
|
||||||
|
read -r -p "Would you like to add Portainer? <y/N> " prompt
|
||||||
|
if [[ ${prompt,,} =~ ^(y|yes)$ ]]; then
|
||||||
|
msg_info "Installing Portainer $PORTAINER_LATEST_VERSION"
|
||||||
|
podman volume create portainer_data >/dev/null
|
||||||
|
$STD podman run -d \
|
||||||
|
-p 8000:8000 \
|
||||||
|
-p 9443:9443 \
|
||||||
|
--name=portainer \
|
||||||
|
--restart=always \
|
||||||
|
-v /run/podman/podman.sock:/var/run/docker.sock \
|
||||||
|
-v portainer_data:/data \
|
||||||
|
portainer/portainer-ce:latest
|
||||||
|
msg_ok "Installed Portainer $PORTAINER_LATEST_VERSION"
|
||||||
|
else
|
||||||
|
read -r -p "Would you like to add the Portainer Agent? <y/N> " prompt
|
||||||
|
if [[ ${prompt,,} =~ ^(y|yes)$ ]]; then
|
||||||
|
msg_info "Installing Portainer agent $PORTAINER_AGENT_LATEST_VERSION"
|
||||||
|
podman volume create temp >/dev/null
|
||||||
|
podman volume remove temp >/dev/null
|
||||||
|
$STD podman run -d \
|
||||||
|
-p 9001:9001 \
|
||||||
|
--name portainer_agent \
|
||||||
|
--restart=always \
|
||||||
|
-v /run/podman/podman.sock:/var/run/docker.sock \
|
||||||
|
-v /var/lib/containers/storage/volumes:/var/lib/docker/volumes \
|
||||||
|
portainer/agent
|
||||||
|
msg_ok "Installed Portainer Agent $PORTAINER_AGENT_LATEST_VERSION"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
msg_info "Pulling Home Assistant Image"
|
msg_info "Pulling Home Assistant Image"
|
||||||
$STD podman pull docker.io/homeassistant/home-assistant:stable
|
$STD podman pull docker.io/homeassistant/home-assistant:stable
|
||||||
msg_ok "Pulled Home Assistant Image"
|
msg_ok "Pulled Home Assistant Image"
|
||||||
|
@ -19,12 +19,73 @@ $STD apt-get install -y sudo
|
|||||||
$STD apt-get install -y mc
|
$STD apt-get install -y mc
|
||||||
msg_ok "Installed Dependencies"
|
msg_ok "Installed Dependencies"
|
||||||
|
|
||||||
|
get_latest_release() {
|
||||||
|
curl -sL https://api.github.com/repos/$1/releases/latest | grep '"tag_name":' | cut -d'"' -f4
|
||||||
|
}
|
||||||
|
|
||||||
|
PORTAINER_LATEST_VERSION=$(get_latest_release "portainer/portainer")
|
||||||
|
PORTAINER_AGENT_LATEST_VERSION=$(get_latest_release "portainer/agent")
|
||||||
|
|
||||||
|
if $STD mount | grep 'on / type zfs' > null && echo "ZFS"; then
|
||||||
|
msg_info "Enabling ZFS support."
|
||||||
|
mkdir -p /etc/containers
|
||||||
|
cat <<'EOF' >/usr/local/bin/overlayzfsmount
|
||||||
|
#!/bin/sh
|
||||||
|
exec /bin/mount -t overlay overlay "$@"
|
||||||
|
EOF
|
||||||
|
chmod +x /usr/local/bin/overlayzfsmount
|
||||||
|
cat <<'EOF' >/etc/containers/storage.conf
|
||||||
|
[storage]
|
||||||
|
driver = "overlay"
|
||||||
|
runroot = "/run/containers/storage"
|
||||||
|
graphroot = "/var/lib/containers/storage"
|
||||||
|
|
||||||
|
[storage.options]
|
||||||
|
pull_options = {enable_partial_images = "false", use_hard_links = "false", ostree_repos=""}
|
||||||
|
mount_program = "/usr/local/bin/overlayzfsmount"
|
||||||
|
|
||||||
|
[storage.options.overlay]
|
||||||
|
mountopt = "nodev"
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
|
||||||
msg_info "Installing Podman"
|
msg_info "Installing Podman"
|
||||||
$STD apt-get -y install podman
|
$STD apt-get -y install podman
|
||||||
$STD systemctl enable --now podman.socket
|
$STD systemctl enable --now podman.socket
|
||||||
echo -e 'unqualified-search-registries=["docker.io"]' >> /etc/containers/registries.conf
|
echo -e 'unqualified-search-registries=["docker.io"]' >> /etc/containers/registries.conf
|
||||||
msg_ok "Installed Podman"
|
msg_ok "Installed Podman"
|
||||||
|
|
||||||
|
read -r -p "Would you like to add Portainer? <y/N> " prompt
|
||||||
|
if [[ ${prompt,,} =~ ^(y|yes)$ ]]; then
|
||||||
|
msg_info "Installing Portainer $PORTAINER_LATEST_VERSION"
|
||||||
|
podman volume create portainer_data >/dev/null
|
||||||
|
$STD podman run -d \
|
||||||
|
-p 8000:8000 \
|
||||||
|
-p 9443:9443 \
|
||||||
|
--name=portainer \
|
||||||
|
--restart=always \
|
||||||
|
-v /run/podman/podman.sock:/var/run/docker.sock \
|
||||||
|
-v portainer_data:/data \
|
||||||
|
portainer/portainer-ce:latest
|
||||||
|
msg_ok "Installed Portainer $PORTAINER_LATEST_VERSION"
|
||||||
|
else
|
||||||
|
read -r -p "Would you like to add the Portainer Agent? <y/N> " prompt
|
||||||
|
if [[ ${prompt,,} =~ ^(y|yes)$ ]]; then
|
||||||
|
msg_info "Installing Portainer agent $PORTAINER_AGENT_LATEST_VERSION"
|
||||||
|
podman volume create temp >/dev/null
|
||||||
|
podman volume remove temp >/dev/null
|
||||||
|
$STD podman run -d \
|
||||||
|
-p 9001:9001 \
|
||||||
|
--name portainer_agent \
|
||||||
|
--restart=always \
|
||||||
|
-v /run/podman/podman.sock:/var/run/docker.sock \
|
||||||
|
-v /var/lib/containers/storage/volumes:/var/lib/docker/volumes \
|
||||||
|
portainer/agent
|
||||||
|
msg_ok "Installed Portainer Agent $PORTAINER_AGENT_LATEST_VERSION"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
motd_ssh
|
motd_ssh
|
||||||
customize
|
customize
|
||||||
|
|
||||||
|
@ -31,10 +31,6 @@
|
|||||||
"password": null
|
"password": null
|
||||||
},
|
},
|
||||||
"notes": [
|
"notes": [
|
||||||
{
|
|
||||||
"text": "Doesn't work with ZFS",
|
|
||||||
"type": "warning"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"text": "If the LXC is created Privileged, the script will automatically set up USB passthrough.",
|
"text": "If the LXC is created Privileged, the script will automatically set up USB passthrough.",
|
||||||
"type": "warning"
|
"type": "warning"
|
||||||
@ -42,6 +38,10 @@
|
|||||||
{
|
{
|
||||||
"text": "config path: `/var/lib/containers/storage/volumes/hass_config/_data`",
|
"text": "config path: `/var/lib/containers/storage/volumes/hass_config/_data`",
|
||||||
"type": "info"
|
"type": "info"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"text": "Options to Install Portainer or Portainer Agent",
|
||||||
|
"type": "warning"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
@ -32,7 +32,7 @@
|
|||||||
},
|
},
|
||||||
"notes": [
|
"notes": [
|
||||||
{
|
{
|
||||||
"text": "Doesn't work with ZFS",
|
"text": "Options to Install Portainer or Portainer Agent",
|
||||||
"type": "warning"
|
"type": "warning"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
Loading…
Reference in New Issue
Block a user