diff --git a/ct/headers/inventree b/ct/headers/inventree new file mode 100644 index 0000000..6057785 --- /dev/null +++ b/ct/headers/inventree @@ -0,0 +1,6 @@ + ____ ______ + / _/___ _ _____ ____/_ __/_______ ___ + / // __ \ | / / _ \/ __ \/ / / ___/ _ \/ _ \ + _/ // / / / |/ / __/ / / / / / / / __/ __/ +/___/_/ /_/|___/\___/_/ /_/_/ /_/ \___/\___/ + diff --git a/ct/inventree.sh b/ct/inventree.sh new file mode 100644 index 0000000..5bc1f9b --- /dev/null +++ b/ct/inventree.sh @@ -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}" diff --git a/install/inventree-install.sh b/install/inventree-install.sh new file mode 100644 index 0000000..a745c34 --- /dev/null +++ b/install/inventree-install.sh @@ -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" diff --git a/install/seafile-install.sh b/install/seafile-install.sh index 39a35b2..3e3776a 100644 --- a/install/seafile-install.sh +++ b/install/seafile-install.sh @@ -186,8 +186,9 @@ msg_ok "Memcached Started" 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 -echo -e "\nFILE_SERVER_ROOT = \"http://$IP:8082/seafhttp\"" >> /opt/seafile/conf/seahub_settings.py -echo -e "\nCSRF_TRUSTED_ORIGINS = ['http://$IP:8000']" >> /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 "\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_info "Setting up Seafile" @@ -253,24 +254,28 @@ mv /opt/seafile/seafile-data $STORAGE_DIR/seafile-data # Create a symlink for access ln -s $STORAGE_DIR/seafile-data /opt/seafile/seafile-data EOF +chmod +x ~/external-storage.sh msg_ok "Bash Script for External Storage created" msg_info "Creating Domain access script" cat <<'EOF' >~/domain.sh #!/bin/bash -domain=$1 +DOMAIN=$1 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 -sed -i "s|http://$IP:8000|http://$1:8000|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|CSRF_TRUSTED_ORIGINS = ['http://$IP:8000/']|CSRF_TRUSTED_ORIGINS = ['$DOMAIN']|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 +chmod +x ~/domain.sh msg_ok "Bash Script for Domain access created" + motd_ssh customize 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 autoclean msg_ok "Cleaned" \ No newline at end of file diff --git a/json/inventree.json b/json/inventree.json new file mode 100644 index 0000000..d01f8bc --- /dev/null +++ b/json/inventree.json @@ -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" + } + ] +} diff --git a/misc/api.func b/misc/api.func index 1ca98f4..15bde49 100644 --- a/misc/api.func +++ b/misc/api.func @@ -39,9 +39,6 @@ post_to_api() { 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() { @@ -87,9 +84,6 @@ post_to_api_vm() { 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 @@ -115,9 +109,6 @@ post_update_to_api() { 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 }