This commit is contained in:
CanbiZ 2025-03-06 11:15:45 +01:00
commit 4d415b0cf9
6 changed files with 149 additions and 15 deletions

6
ct/headers/inventree Normal file
View File

@ -0,0 +1,6 @@
____ ______
/ _/___ _ _____ ____/_ __/_______ ___
/ // __ \ | / / _ \/ __ \/ / / ___/ _ \/ _ \
_/ // / / / |/ / __/ / / / / / / / __/ __/
/___/_/ /_/|___/\___/_/ /_/_/ /_/ \___/\___/

47
ct/inventree.sh Normal file
View File

@ -0,0 +1,47 @@
#!/usr/bin/env bash
source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/build.func)
# Copyright (c) 2021-2025 community-scripts ORG
# Author: Slaviša Arežina (tremor021)
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://github.com/inventree/InvenTree
APP="InvenTree"
var_tags="inventory"
var_cpu="2"
var_ram="2048"
var_disk="6"
var_os="debian"
var_version="12"
var_unprivileged="1"
header_info "$APP"
variables
color
catch_errors
function update_script() {
header_info
check_container_storage
check_container_resources
if [[ ! -d "/opt/habitica" ]]; then
msg_error "No ${APP} Installation Found!"
exit
fi
msg_info "Updating $APP"
$STD apt-get update
$STD apt-get install --only-upgrade inventree -y
msg_ok "Updated $APP"
msg_ok "Update Successful"
exit
}
start
build_container
description
msg_ok "Completed Successfully!\n"
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}${CL}"

View File

@ -0,0 +1,46 @@
#!/usr/bin/env bash
# Copyright (c) 2021-2025 community-scripts ORG
# Author: Slaviša Arežina (tremor021)
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://github.com/inventree/InvenTree
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
color
verb_ip6
catch_errors
setting_up_container
network_check
update_os
msg_info "Installing Dependencies"
$STD apt-get install -y \
curl \
sudo \
mc \
gnupg \
sudo
temp_file=$(mktemp)
wget -q http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2_amd64.deb -O $temp_file
$STD dpkg -i $temp_file
msg_ok "Installed Dependencies"
msg_info "Setting up InvenTree Repository"
mkdir -p /etc/apt/keyrings
curl -fsSL https://dl.packager.io/srv/inventree/InvenTree/key | gpg --dearmor -o /etc/apt/keyrings/inventree.gpg
echo "deb [signed-by=/etc/apt/keyrings/inventree.gpg] https://dl.packager.io/srv/deb/inventree/InvenTree/stable/ubuntu 20.04 main" >/etc/apt/sources.list.d/inventree.list
msg_ok "Set up InvenTree Repository"
msg_info "Setup ${APPLICATION}"
$STD apt-get update
$STD apt-get install -y inventree
msg_ok "Setup ${APPLICATION}"
motd_ssh
customize
msg_info "Cleaning up"
rm -f $temp_file
$STD apt-get -y autoremove
$STD apt-get -y autoclean
msg_ok "Cleaned"

View File

@ -186,8 +186,9 @@ msg_ok "Memcached Started"
msg_info "Adjusting Conf files" msg_info "Adjusting Conf files"
sed -i "0,/127.0.0.1/s/127.0.0.1/0.0.0.0/" /opt/seafile/conf/gunicorn.conf.py sed -i "0,/127.0.0.1/s/127.0.0.1/0.0.0.0/" /opt/seafile/conf/gunicorn.conf.py
echo -e "\nFILE_SERVER_ROOT = \"http://$IP:8082/seafhttp\"" >> /opt/seafile/conf/seahub_settings.py sed -i "0,/SERVICE_URL = \"http:\/\/$IP\"/s/SERVICE_URL = \"http:\/\/$IP\"/SERVICE_URL = \"http:\/\/$IP:8000\"/" /opt/seafile/conf/seahub_settings.py
echo -e "\nCSRF_TRUSTED_ORIGINS = ['http://$IP:8000']" >> /opt/seafile/conf/seahub_settings.py echo -e "\nFILE_SERVER_ROOT = \"http://$IP:8082\"" >> /opt/seafile/conf/seahub_settings.py
echo -e "CSRF_TRUSTED_ORIGINS = ['http://$IP/']" >> /opt/seafile/conf/seahub_settings.py
msg_ok "Conf files adjusted" msg_ok "Conf files adjusted"
msg_info "Setting up Seafile" msg_info "Setting up Seafile"
@ -253,24 +254,28 @@ mv /opt/seafile/seafile-data $STORAGE_DIR/seafile-data
# Create a symlink for access # Create a symlink for access
ln -s $STORAGE_DIR/seafile-data /opt/seafile/seafile-data ln -s $STORAGE_DIR/seafile-data /opt/seafile/seafile-data
EOF EOF
chmod +x ~/external-storage.sh
msg_ok "Bash Script for External Storage created" msg_ok "Bash Script for External Storage created"
msg_info "Creating Domain access script" msg_info "Creating Domain access script"
cat <<'EOF' >~/domain.sh cat <<'EOF' >~/domain.sh
#!/bin/bash #!/bin/bash
domain=$1 DOMAIN=$1
IP=$(ip a s dev eth0 | awk '/inet / {print $2}' | cut -d/ -f1) IP=$(ip a s dev eth0 | awk '/inet / {print $2}' | cut -d/ -f1)
DOMAIN_NOSCHEME=$(echo $DOMAIN | sed 's|^https://||')
#Change the CORS to provided domain #Change the CORS to provided domain
sed -i "s|http://$IP:8000|http://$1:8000|g" /opt/seafile/conf/seahub_settings.py sed -i "s|CSRF_TRUSTED_ORIGINS = ['http://$IP:8000/']|CSRF_TRUSTED_ORIGINS = ['$DOMAIN']|g" /opt/seafile/conf/seahub_settings.py
sed -i "s|http://$IP:8082|http://$1:8082|g" /opt/seafile/conf/seahub_settings.py sed -i "s|FILE_SERVER_ROOT = \"http://$IP:8082\"|FILE_SERVER_ROOT = \"$DOMAIN/seafhttp\"|g" /opt/seafile/conf/seahub_settings.py
EOF EOF
chmod +x ~/domain.sh
msg_ok "Bash Script for Domain access created" msg_ok "Bash Script for Domain access created"
motd_ssh motd_ssh
customize customize
msg_info "Cleaning up" msg_info "Cleaning up"
su - seafile -c "rm -rf seafile*.tar.gz" rm -rf /home/seafile/seafile*.tar.gz
$STD apt-get -y autoremove $STD apt-get -y autoremove
$STD apt-get -y autoclean $STD apt-get -y autoclean
msg_ok "Cleaned" msg_ok "Cleaned"

39
json/inventree.json Normal file
View File

@ -0,0 +1,39 @@
{
"name": "InvenTree",
"slug": "inventree",
"categories": [
25
],
"date_created": "2025-03-05",
"type": "ct",
"updateable": true,
"privileged": false,
"interface_port": 80,
"documentation": "https://docs.inventree.org/en/latest/",
"website": "https://inventree.org",
"logo": "https://docs.inventree.org/en/latest/assets/logo.png",
"description": "InvenTree is an open-source inventory management system which provides intuitive parts management and stock control. It is designed to be lightweight and easy to use for SME or hobbyist applications.",
"install_methods": [
{
"type": "default",
"script": "ct/inventree.sh",
"resources": {
"cpu": 2,
"ram": 2048,
"hdd": 6,
"os": "debian",
"version": "12"
}
}
],
"default_credentials": {
"username": "admin",
"password": "`cat /etc/inventree/admin_password`"
},
"notes": [
{
"text": "Please read the documentation for your configuration needs.",
"type": "info"
}
]
}

View File

@ -39,9 +39,6 @@ post_to_api() {
EOF EOF
) )
RESPONSE=$(curl -s -w "%{http_code}" -L -X POST "$API_URL" --post301 --post302 \
-H "Content-Type: application/json" \
-d "$JSON_PAYLOAD") || true
} }
post_to_api_vm() { post_to_api_vm() {
@ -87,9 +84,6 @@ post_to_api_vm() {
EOF EOF
) )
RESPONSE=$(curl -s -w "%{http_code}" -L -X POST "$API_URL" --post301 --post302 \
-H "Content-Type: application/json" \
-d "$JSON_PAYLOAD") || true
} }
POST_UPDATE_DONE=false POST_UPDATE_DONE=false
@ -115,9 +109,6 @@ post_update_to_api() {
EOF EOF
) )
RESPONSE=$(curl -s -w "%{http_code}" -L -X POST "$API_URL" --post301 --post302 \
-H "Content-Type: application/json" \
-d "$JSON_PAYLOAD") || true
POST_UPDATE_DONE=true POST_UPDATE_DONE=true
} }