Skip to content

Commit f9e0dfb

Browse files
yry-devMickLeskhavardthom
authored
Add Komga LXC (#275)
* add komga * fix syntax error * add co-author * Make this resemble other scripts * Get ready for PR * Address PR feedback to bring more in line with other scripts * Bring json in line * Harmonize Script * Update komga.sh * Make hdd match komga.sh * Update ascii * Update install/komga-install.sh Co-authored-by: Håvard Gjøby Thom <[email protected]> * Update ct/komga.sh Co-authored-by: Håvard Gjøby Thom <[email protected]> * Update ct/komga.sh Co-authored-by: Håvard Gjøby Thom <[email protected]> * Update ct/komga.sh Co-authored-by: Håvard Gjøby Thom <[email protected]> * Update install/komga-install.sh Co-authored-by: Håvard Gjøby Thom <[email protected]> * Update install/komga-install.sh Co-authored-by: Håvard Gjøby Thom <[email protected]> * Update install/komga-install.sh Co-authored-by: Håvard Gjøby Thom <[email protected]> * Update install/komga-install.sh Co-authored-by: Håvard Gjøby Thom <[email protected]> * Update install/komga-install.sh Co-authored-by: Håvard Gjøby Thom <[email protected]> * Update install/komga-install.sh Co-authored-by: Håvard Gjøby Thom <[email protected]> * Update json/komga.json Co-authored-by: Håvard Gjøby Thom <[email protected]> * Uneeded group write permissions? --------- Co-authored-by: CanbiZ <[email protected]> Co-authored-by: Håvard Gjøby Thom <[email protected]>
1 parent d3633f9 commit f9e0dfb

File tree

3 files changed

+182
-0
lines changed

3 files changed

+182
-0
lines changed

ct/komga.sh

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
#!/usr/bin/env bash
2+
source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
3+
# Copyright (c) 2021-2024 community-scripts ORG
4+
# Author: madelyn (DysfunctionalProgramming)
5+
# License: MIT
6+
# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
7+
8+
function header_info {
9+
clear
10+
cat <<"EOF"
11+
__ __
12+
/ //_/___ ____ ___ ____ _____ _
13+
/ ,< / __ \/ __ `__ \/ __ `/ __ `/
14+
/ /| / /_/ / / / / / / /_/ / /_/ /
15+
/_/ |_\____/_/ /_/ /_/\__, /\__,_/
16+
/____/
17+
EOF
18+
}
19+
header_info
20+
echo -e "Loading..."
21+
APP="Komga"
22+
var_disk="4"
23+
var_cpu="1"
24+
var_ram="2048"
25+
var_os="debian"
26+
var_version="12"
27+
variables
28+
color
29+
catch_errors
30+
31+
function default_settings() {
32+
CT_TYPE="1"
33+
PW=""
34+
CT_ID=$NEXTID
35+
HN=$NSAPP
36+
DISK_SIZE="$var_disk"
37+
CORE_COUNT="$var_cpu"
38+
RAM_SIZE="$var_ram"
39+
BRG="vmbr0"
40+
NET="dhcp"
41+
GATE=""
42+
APT_CACHER=""
43+
APT_CACHER_IP=""
44+
DISABLEIP6="no"
45+
MTU=""
46+
SD=""
47+
NS=""
48+
MAC=""
49+
VLAN=""
50+
SSH="no"
51+
VERB="no"
52+
echo_default
53+
}
54+
55+
function update_script() {
56+
header_info
57+
check_container_storage
58+
check_container_resources
59+
if [[ ! -f /opt/komga/komga*.jar ]]; then msg_error "No ${APP} Installation Found!"; exit; fi
60+
msg_info "Updating ${APP}"
61+
RELEASE=$(curl -s https://api.github.com/repos/gotson/komga/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
62+
if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then
63+
msg_info "Stopping ${APP}"
64+
systemctl stop komga
65+
msg_ok "Stopped ${APP}"
66+
67+
msg_info "Updating ${APP} to ${RELEASE}"
68+
rm -rf /opt/komga/komga*.jar
69+
wget -q "https://github.com/gotson/komga/releases/download/v${RELEASE}/komga-${RELEASE}.jar"
70+
mv -f komga-${RELEASE}.jar /opt/komga/komga.jar
71+
echo "${RELEASE}" >/opt/${APP}_version.txt
72+
msg_ok "Updated ${APP} to ${RELEASE}"
73+
74+
msg_info "Starting ${APP}"
75+
systemctl start komga
76+
msg_ok "Started ${APP}"
77+
msg_ok "Updated Successfully"
78+
else
79+
msg_ok "No update required. ${APP} is already at ${RELEASE}."
80+
fi
81+
exit
82+
}
83+
84+
start
85+
build_container
86+
description
87+
88+
msg_ok "Completed Successfully!\n"
89+
echo -e "${APP} should be reachable by going to the following URL.
90+
${BL}http://${IP}:25600 ${CL} \n"

install/komga-install.sh

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright (c) 2021-2024 community-scripts ORG
4+
# Author: madelyn (DysfunctionalProgramming)
5+
# License: MIT
6+
# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
7+
8+
source /dev/stdin <<< "$FUNCTIONS_FILE_PATH"
9+
color
10+
verb_ip6
11+
catch_errors
12+
setting_up_container
13+
network_check
14+
update_os
15+
16+
msg_info "Installing Dependencies"
17+
$STD apt-get install -y \
18+
curl \
19+
mc \
20+
sudo \
21+
openjdk-17-jre
22+
msg_ok "Installed Dependencies"
23+
24+
msg_info "Installing Komga"
25+
RELEASE=$(curl -s https://api.github.com/repos/gotson/komga/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
26+
wget -q https://github.com/gotson/komga/releases/download/${RELEASE}/komga-${RELEASE}.jar
27+
mkdir -p /opt/komga
28+
mv -f komga-${RELEASE}.jar /opt/komga/komga.jar
29+
echo "${RELEASE}" >"/opt/${APPLICATION}_version.txt"
30+
msg_ok "Installed Komga"
31+
32+
msg_info "Creating Service"
33+
cat <<EOF >/etc/systemd/system/komga.service
34+
[Unit]
35+
Description=Komga
36+
After=syslog.target network.target
37+
38+
[Service]
39+
Type=simple
40+
WorkingDirectory=/opt/komga/
41+
ExecStart=/usr/bin/java -jar -Xmx2g komga.jar
42+
TimeoutStopSec=20
43+
KillMode=process
44+
Restart=on-failure
45+
46+
[Install]
47+
WantedBy=multi-user.target
48+
EOF
49+
systemctl enable --now -q komga
50+
msg_ok "Created Service"
51+
52+
motd_ssh
53+
customize
54+
55+
msg_info "Cleaning up"
56+
$STD apt-get -y autoremove
57+
$STD apt-get -y autoclean
58+
msg_ok "Cleaned"

json/komga.json

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"name": "Komga",
3+
"slug": "komga",
4+
"categories": [
5+
12
6+
],
7+
"date_created": "2024-11-15",
8+
"type": "ct",
9+
"updateable": true,
10+
"privileged": false,
11+
"interface_port": "25600",
12+
"documentation": "https://komga.org/docs/introduction",
13+
"website": "https://komga.org/",
14+
"logo": "https://github.com/gotson/komga/raw/master/.github/readme-images/app-icon.png",
15+
"description": "A media server for your comics, mangas, BDs, magazines and eBooks. Organize your CBZ, CBR, PDF and EPUB files in different libraries, collections or reading lists. Use the integrated Webreader, the Mihon extension, any OPDS reader, or other integrations. Edit metadata for your series and books.",
16+
"install_methods": [
17+
{
18+
"type": "default",
19+
"script": "ct/komga.sh",
20+
"resources": {
21+
"cpu": "1",
22+
"ram": "2048",
23+
"hdd": "4",
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)