Skip to content

Commit 8662be2

Browse files
authored
New script: Koillection (#2031)
1 parent f66f43d commit 8662be2

File tree

3 files changed

+241
-0
lines changed

3 files changed

+241
-0
lines changed

ct/koillection.sh

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
#!/usr/bin/env bash
2+
source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
3+
# Copyright (c) 2021-2025 community-scripts ORG
4+
# Author: bvdberg01
5+
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
6+
# Source: https://koillection.github.io/
7+
8+
# App Default Values
9+
APP="Koillection"
10+
var_tags="network"
11+
var_cpu="2"
12+
var_ram="1024"
13+
var_disk="8"
14+
var_os="debian"
15+
var_version="12"
16+
var_unprivileged="1"
17+
18+
# App Output & Base Settings
19+
header_info "$APP"
20+
base_settings
21+
22+
# Core
23+
variables
24+
color
25+
catch_errors
26+
27+
function update_script() {
28+
header_info
29+
check_container_storage
30+
check_container_resources
31+
if [[ ! -d /opt/koillection ]]; then
32+
msg_error "No ${APP} Installation Found!"
33+
exit
34+
fi
35+
RELEASE=$(curl -s https://api.github.com/repos/benjaminjonard/koillection/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
36+
if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then
37+
msg_info "Stopping Service"
38+
systemctl stop apache2
39+
msg_ok "Stopped Service"
40+
41+
msg_info "Updating ${APP} to v${RELEASE}"
42+
cd /opt
43+
mv /opt/koillection/ /opt/koillection-backup
44+
wget -q "https://github.com/benjaminjonard/koillection/archive/refs/tags/${RELEASE}.zip"
45+
unzip -q "${RELEASE}.zip"
46+
mv "/opt/koillection-${RELEASE}" /opt/koillection
47+
cd /opt/koillection
48+
cp -r /opt/koillection-backup/.env.local /opt/koillection
49+
cp -r /opt/koillection-backup/public/uploads/. /opt/koillection/public/uploads/
50+
export COMPOSER_ALLOW_SUPERUSER=1
51+
composer install --no-dev -o --no-interaction --classmap-authoritative &>/dev/null
52+
php bin/console doctrine:migrations:migrate --no-interaction &>/dev/null
53+
php bin/console app:translations:dump &>/dev/null
54+
cd assets/
55+
yarn install &>/dev/null
56+
yarn build &>/dev/null
57+
chown -R www-data:www-data /opt/koillection/public/uploads
58+
echo "${RELEASE}" >/opt/${APP}_version.txt
59+
msg_ok "Updated $APP to v${RELEASE}"
60+
61+
msg_info "Starting Service"
62+
systemctl start apache2
63+
msg_ok "Started Service"
64+
65+
msg_info "Cleaning up"
66+
rm -r "/opt/${RELEASE}.zip"
67+
rm -r /opt/koillection-backup
68+
msg_ok "Cleaned"
69+
msg_ok "Updated Successfully"
70+
else
71+
msg_ok "No update required. ${APP} is already at v${RELEASE}"
72+
fi
73+
exit
74+
}
75+
76+
start
77+
build_container
78+
description
79+
80+
msg_ok "Completed Successfully!\n"
81+
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
82+
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
83+
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}${CL}"

install/koillection-install.sh

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright (c) 2021-2025 community-scripts ORG
4+
# Author: bvdberg01
5+
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
6+
7+
source /dev/stdin <<< "$FUNCTIONS_FILE_PATH"
8+
color
9+
verb_ip6
10+
catch_errors
11+
setting_up_container
12+
network_check
13+
update_os
14+
15+
msg_info "Installing Dependencies"
16+
$STD apt-get install -y \
17+
curl \
18+
sudo \
19+
mc \
20+
gnupg2\
21+
postgresql \
22+
apache2 \
23+
lsb-release
24+
msg_ok "Installed Dependencies"
25+
26+
msg_info "Setup PHP8.4 Repository"
27+
$STD curl -sSLo /tmp/debsuryorg-archive-keyring.deb https://packages.sury.org/debsuryorg-archive-keyring.deb
28+
$STD dpkg -i /tmp/debsuryorg-archive-keyring.deb
29+
$STD sh -c 'echo "deb [signed-by=/usr/share/keyrings/deb.sury.org-php.gpg] https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list'
30+
$STD apt-get update
31+
msg_ok "Setup PHP8.4 Repository"
32+
33+
msg_info "Setup PHP"
34+
$STD apt-get install -y \
35+
php8.4 \
36+
php8.4-{apcu,ctype,curl,dom,fileinfo,gd,iconv,intl,mbstring,pgsql} \
37+
libapache2-mod-php8.4 \
38+
composer
39+
msg_info "Setup PHP"
40+
41+
msg_info "Setting up PostgreSQL"
42+
DB_NAME=koillection
43+
DB_USER=koillection
44+
DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | cut -c1-13)
45+
$STD sudo -u postgres psql -c "CREATE ROLE $DB_USER WITH LOGIN PASSWORD '$DB_PASS';"
46+
$STD sudo -u postgres psql -c "CREATE DATABASE $DB_NAME WITH OWNER $DB_USER TEMPLATE template0;"
47+
{
48+
echo "Koillection Credentials"
49+
echo "Koillection Database User: $DB_USER"
50+
echo "Koillection Database Password: $DB_PASS"
51+
echo "Koillection Database Name: $DB_NAME"
52+
} >> ~/koillection.creds
53+
msg_ok "Set up PostgreSQL"
54+
55+
msg_info "Setting up Node.js/Yarn"
56+
mkdir -p /etc/apt/keyrings
57+
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
58+
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_22.x nodistro main" >/etc/apt/sources.list.d/nodesource.list
59+
$STD apt-get update
60+
$STD apt-get install -y nodejs
61+
$STD npm install -g npm@latest
62+
$STD npm install -g yarn
63+
msg_ok "Installed Node.js/Yarn"
64+
65+
msg_info "Installing Koillection"
66+
RELEASE=$(curl -s https://api.github.com/repos/benjaminjonard/koillection/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
67+
cd /opt
68+
wget -q "https://github.com/benjaminjonard/koillection/archive/refs/tags/${RELEASE}.zip"
69+
unzip -q "${RELEASE}.zip"
70+
mv "/opt/koillection-${RELEASE}" /opt/koillection
71+
cd /opt/koillection
72+
cp /opt/koillection/.env /opt/koillection/.env.local
73+
APP_SECRET=$(openssl rand -base64 32)
74+
sed -i -e "s|^APP_ENV=.*|APP_ENV=prod|" \
75+
-e "s|^APP_DEBUG=.*|APP_DEBUG=0|" \
76+
-e "s|^APP_SECRET=.*|APP_SECRET=${APP_SECRET}|" \
77+
-e "s|^DB_NAME=.*|DB_NAME=${DB_NAME}|" \
78+
-e "s|^DB_USER=.*|DB_USER=${DB_USER}|" \
79+
-e "s|^DB_PASSWORD=.*|DB_PASSWORD=${DB_PASS}|" \
80+
/opt/koillection/.env.local
81+
export COMPOSER_ALLOW_SUPERUSER=1
82+
$STD composer install --no-dev -o --no-interaction --classmap-authoritative
83+
$STD php bin/console doctrine:migrations:migrate --no-interaction
84+
$STD php bin/console app:translations:dump
85+
cd assets/
86+
$STD yarn install
87+
$STD yarn build
88+
chown -R www-data:www-data /opt/koillection/public/uploads
89+
echo "${RELEASE}" >/opt/${APPLICATION}_version.txt
90+
msg_ok "Installed Koillection"
91+
92+
msg_info "Creating Service"
93+
cat <<EOF >/etc/apache2/sites-available/koillection.conf
94+
<VirtualHost *:80>
95+
ServerName koillection
96+
DocumentRoot /opt/koillection/public
97+
<Directory /opt/koillection/public>
98+
Options Indexes FollowSymLinks
99+
AllowOverride All
100+
Require all granted
101+
RewriteEngine On
102+
RewriteCond %{REQUEST_FILENAME} !-f
103+
RewriteCond %{REQUEST_FILENAME} !-d
104+
RewriteRule ^(.*)$ index.php/\$1 [L]
105+
</Directory>
106+
107+
ErrorLog /var/log/apache2/koillection_error.log
108+
CustomLog /var/log/apache2/koillection_access.log combined
109+
</VirtualHost>
110+
EOF
111+
$STD a2ensite koillection
112+
$STD a2enmod rewrite
113+
$STD a2dissite 000-default.conf
114+
$STD systemctl reload apache2
115+
msg_ok "Created Service"
116+
117+
motd_ssh
118+
customize
119+
120+
msg_info "Cleaning up"
121+
rm -rf "/opt/${RELEASE}.zip"
122+
$STD apt-get -y autoremove
123+
$STD apt-get -y autoclean
124+
msg_ok "Cleaned"

json/koillection.json

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"name": "Koillection",
3+
"slug": "koillection",
4+
"categories": [
5+
24
6+
],
7+
"date_created": "2025-02-04",
8+
"type": "ct",
9+
"updateable": true,
10+
"privileged": false,
11+
"interface_port": 80,
12+
"documentation": "https://github.com/benjaminjonard/koillection/wiki",
13+
"website": "https://koillection.github.io/",
14+
"logo": "https://user-images.githubusercontent.com/20560781/80213166-0e560e00-8639-11ea-944e-4f79fdbcef55.png",
15+
"description": "Koillection is a self-hosted collection manager created to keep track of physical (mostly) collections of any kind like books, DVDs, stamps, games... Koillection is meant to be used for any kind of collections and doesn't come with pre-built metadata download. But you can tailor your own HTML scraper, or you can add your own metadata freely.",
16+
"install_methods": [
17+
{
18+
"type": "default",
19+
"script": "ct/koillection.sh",
20+
"resources": {
21+
"cpu": 2,
22+
"ram": 1024,
23+
"hdd": 8,
24+
"os": "Debian",
25+
"version": "12"
26+
}
27+
}
28+
],
29+
"default_credentials": {
30+
"username": null,
31+
"password": null
32+
},
33+
"notes": []
34+
}

0 commit comments

Comments
 (0)