Initial trial of Podman support.

This commit is contained in:
Buster Neece 2023-02-10 14:36:57 -06:00
parent fa0803f3d3
commit 054b6e6e0d
No known key found for this signature in database
GPG Key ID: F1D2E64A0005E80E
3 changed files with 56 additions and 13 deletions

View File

@ -1,6 +1,24 @@
#!/usr/bin/env bash
# shellcheck disable=SC2145,SC2178,SC2120,SC2162
PODMAN_MODE=0
docker() {
if [[ $PODMAN_MODE -ne 0 ]]; then
podman "$@"
else
docker "$@"
fi
}
docker-compose() {
if [[ $PODMAN_MODE -ne 0 ]]; then
podman-compose "$@"
else
docker-compose "$@"
fi
}
# Functions to manage .env files
__dotenv=
__dotenv_file=
@ -399,19 +417,30 @@ run-installer() {
install() {
check-install-requirements
if [[ $(command -v docker) && $(docker --version) ]]; then
echo "Docker is already installed! Continuing..."
else
if ask "Docker does not appear to be installed. Install Docker now?" Y; then
install-docker
fi
fi
if [[ $PODMAN_MODE -ne 0 ]]; then
echo "Podman was detected and will be used instead of Docker..."
if [[ $(command -v docker-compose) ]]; then
echo "Docker Compose is already installed. Continuing..."
if [[ $(command -v podman-compose) ]]; then
echo "Podman mode is active, but podman-compose is not found."
echo "Install it by following the instructions on this page:"
echo "https://github.com/containers/podman-compose"
exit 1
fi
else
if ask "Docker Compose does not appear to be installed. Install Docker Compose now?" Y; then
install-docker-compose
if [[ $(command -v docker) && $(docker --version) ]]; then
echo "Docker is already installed! Continuing..."
else
if ask "Docker does not appear to be installed. Install Docker now?" Y; then
install-docker
fi
fi
if [[ $(command -v docker-compose) ]]; then
echo "Docker Compose is already installed. Continuing..."
else
if ask "Docker Compose does not appear to be installed. Install Docker Compose now?" Y; then
install-docker-compose
fi
fi
fi
@ -480,6 +509,10 @@ install-dev() {
.env --file .env set AZURACAST_PGID="$(id -g)"
fi
if [[ $PODMAN_MODE -ne 0 ]]; then
.env --file .env set AZURACAST_PODMAN_MODE=true
fi
chmod 777 ./frontend/ ./web/ ./vendor/ \
./web/static/ ./web/static/api/ \
./web/static/dist/ ./web/static/img/
@ -855,4 +888,9 @@ restart() {
# Ensure we're in the same directory as this script.
cd "$( dirname "${BASH_SOURCE[0]}" )" || exit
# Podman support
if [[ $(command -v podman) ]]; then
PODMAN_MODE=1
fi
"$@"

View File

@ -359,8 +359,9 @@ final class InstallCommand extends Command
unset($service);
}
// Remove web updater if disabled
if (!$azuracastEnv->getAsBool(Environment::ENABLE_WEB_UPDATER, true)) {
// Remove web updater if disabled or in Podman mode.
if (!$azuracastEnv->getAsBool(Environment::ENABLE_WEB_UPDATER, true)
|| $env->getAsBool('AZURACAST_PODMAN_MODE', false)) {
unset($yaml['services']['updater']);
}

View File

@ -80,6 +80,10 @@ final class EnvFile extends AbstractEnvFile
),
'default' => 1000,
],
'AZURACAST_PODMAN_MODE' => [
'name' => __('Use Podman instead of Docker.'),
'default' => false,
],
'AZURACAST_COMPOSE_PRIVILEGED' => [
'name' => __('Advanced: Use Privileged Docker Settings'),
'default' => true,