Files
ProxmoxVE/ct/koillection.sh
T

94 lines
3.5 KiB
Bash
Raw Normal View History

#!/usr/bin/env bash
_cs_boot="${COMMUNITY_SCRIPTS_CORE_DIR:-$(dirname "${BASH_SOURCE[0]}")/../../core}/core/build.func"
source "$_cs_boot" 2>/dev/null || source <(curl -fsSL "${COMMUNITY_SCRIPTS_CORE_URL:-https://raw.githubusercontent.com/community-scripts/core/main}/core/build.func")
# Copyright (c) 2021-2026 community-scripts ORG
2025-02-05 13:26:21 +01:00
# Author: bvdberg01
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://koillection.github.io/ | Github: https://github.com/benjaminjonard/koillection
2025-02-05 13:26:21 +01:00
APP="Koillection"
var_tags="${var_tags:-network}"
var_cpu="${var_cpu:-2}"
var_ram="${var_ram:-1024}"
var_disk="${var_disk:-8}"
var_os="${var_os:-debian}"
var_version="${var_version:-13}"
2026-06-12 00:16:15 +10:00
var_arm64="${var_arm64:-yes}"
var_unprivileged="${var_unprivileged:-1}"
2025-02-05 13:26:21 +01:00
header_info "$APP"
variables
color
catch_errors
function update_script() {
header_info
check_container_storage
check_container_resources
if [[ ! -d /opt/koillection ]]; then
msg_error "No ${APP} Installation Found!"
exit
fi
if check_for_gh_release "koillection" "benjaminjonard/koillection"; then
2025-02-05 13:26:21 +01:00
msg_info "Stopping Service"
systemctl stop apache2
msg_ok "Stopped Service"
2026-01-30 13:04:42 +01:00
PHP_VERSION="8.5" PHP_APACHE="YES" setup_php
setup_composer
2025-07-30 15:19:33 +02:00
msg_info "Creating a backup"
2025-02-05 13:26:21 +01:00
mv /opt/koillection/ /opt/koillection-backup
2025-07-30 15:19:33 +02:00
msg_ok "Backup created"
2026-01-07 08:49:12 +01:00
fetch_and_deploy_gh_release "koillection" "benjaminjonard/koillection" "tarball"
2025-07-30 15:19:33 +02:00
msg_info "Updating Koillection"
2025-02-05 13:26:21 +01:00
cp -r /opt/koillection-backup/.env.local /opt/koillection
cp -r /opt/koillection-backup/public/uploads/. /opt/koillection/public/uploads/
2026-06-10 23:09:31 +02:00
# Ensure APP_RUNTIME is in .env.local for CLI commands (upgrades from older versions)
if ! grep -q "APP_RUNTIME" /opt/koillection/.env.local 2>/dev/null; then
# Ensure file ends with newline before appending to avoid concatenation
[[ -s /opt/koillection/.env.local && -n "$(tail -c 1 /opt/koillection/.env.local)" ]] && echo "" >>/opt/koillection/.env.local
echo 'APP_RUNTIME="Symfony\Component\Runtime\SymfonyRuntime"' >>/opt/koillection/.env.local
fi
NODE_VERSION="26" NODE_MODULE="yarn" setup_nodejs
2026-06-10 23:09:31 +02:00
cd /opt/koillection
2025-02-05 13:26:21 +01:00
export COMPOSER_ALLOW_SUPERUSER=1
export APP_RUNTIME='Symfony\Component\Runtime\SymfonyRuntime'
$STD composer install --no-dev -o --no-interaction --classmap-authoritative
$STD php bin/console doctrine:migrations:migrate --no-interaction
$STD php bin/console app:translations:dump
2026-06-10 23:09:31 +02:00
cd assets/
$STD yarn install
$STD yarn build
2026-01-30 13:31:00 +01:00
mkdir -p /opt/koillection/public/uploads
mkdir -p /opt/koillection/var/log
chown -R www-data:www-data /opt/koillection/var/log
2025-02-05 13:26:21 +01:00
chown -R www-data:www-data /opt/koillection/public/uploads
rm -r /opt/koillection-backup
2026-06-10 23:09:31 +02:00
# Ensure APP_RUNTIME is set in Apache config (for upgrades from older versions)
if ! grep -q "APP_RUNTIME" /etc/apache2/sites-available/koillection.conf 2>/dev/null; then
sed -i '/<VirtualHost/a\ SetEnv APP_RUNTIME "Symfony\\Component\\Runtime\\SymfonyRuntime"' /etc/apache2/sites-available/koillection.conf
fi
msg_ok "Updated Koillection"
2025-02-05 13:26:21 +01:00
msg_info "Starting Service"
systemctl start apache2
msg_ok "Started Service"
2026-01-06 22:57:40 +01:00
msg_ok "Updated successfully!"
2025-02-05 13:26:21 +01:00
fi
exit
}
start
build_container
description
2026-01-06 22:57:40 +01:00
msg_ok "Completed successfully!\n"
2025-02-05 13:26:21 +01:00
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
echo -e "${INFO}${YW}Access it using the following URL:${CL}"
echo -e "${GATEWAY}${BGN}http://${IP}${CL}"