Files
ProxmoxVE/install/snipeit-install.sh
T

72 lines
2.0 KiB
Bash
Raw Normal View History

2024-12-02 09:05:12 +01:00
#!/usr/bin/env bash
# Copyright (c) 2021-2026 community-scripts ORG
2024-12-02 09:05:12 +01:00
# Author: Michel Roegl-Brunner (michelroegl-brunner)
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://snipeitapp.com/ | Github: https://github.com/grokability/snipe-it
2024-12-02 09:05:12 +01:00
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
color
verb_ip6
catch_errors
setting_up_container
network_check
update_os
msg_info "Installing Dependencies"
2025-10-15 22:58:08 +02:00
$STD apt install -y \
git \
2025-08-23 10:24:57 +02:00
nginx
2024-12-02 09:05:12 +01:00
msg_ok "Installed Dependencies"
PHP_VERSION="8.3" PHP_FPM="YES" PHP_MODULE="ldap,soap,xsl" setup_php
2025-08-23 10:24:57 +02:00
setup_composer
fetch_and_deploy_gh_release "snipe-it" "grokability/snipe-it" "tarball"
setup_mariadb
2025-12-11 12:08:16 +01:00
MARIADB_DB_NAME="snipeit_db" MARIADB_DB_USER="snipeit" setup_mariadb_db
2024-12-02 09:05:12 +01:00
2025-08-23 10:24:57 +02:00
msg_info "Configuring Snipe-IT"
2024-12-02 09:05:12 +01:00
cd /opt/snipe-it
cp .env.example .env
2025-12-11 12:08:16 +01:00
sed -i -e "s|^APP_URL=.*|APP_URL=http://$LOCAL_IP|" \
-e "s|^DB_DATABASE=.*|DB_DATABASE=$MARIADB_DB_NAME|" \
-e "s|^DB_USERNAME=.*|DB_USERNAME=$MARIADB_DB_USER|" \
-e "s|^DB_PASSWORD=.*|DB_PASSWORD=$MARIADB_DB_PASS|" .env
2024-12-02 09:05:12 +01:00
chown -R www-data: /opt/snipe-it
chmod -R 755 /opt/snipe-it
export COMPOSER_ALLOW_SUPERUSER=1
$STD composer install --no-dev --optimize-autoloader --no-interaction
2024-12-02 09:05:12 +01:00
$STD php artisan key:generate --force
2025-12-11 12:08:16 +01:00
msg_ok "Configured Snipe-IT"
2024-12-02 09:05:12 +01:00
msg_info "Creating Service"
PHP_SOCK=$(get_php_fpm_socket)
2024-12-02 09:05:12 +01:00
cat <<EOF >/etc/nginx/conf.d/snipeit.conf
server {
listen 80;
root /opt/snipe-it/public;
2025-12-11 12:08:16 +01:00
server_name $LOCAL_IP;
2025-09-02 22:16:48 +02:00
client_max_body_size 100M;
2024-12-02 09:05:12 +01:00
index index.php;
2024-12-02 09:05:12 +01:00
location / {
try_files \$uri \$uri/ /index.php?\$query_string;
}
2024-12-02 09:05:12 +01:00
location ~ \.php\$ {
include fastcgi.conf;
include snippets/fastcgi-php.conf;
fastcgi_pass unix:${PHP_SOCK};
2024-12-02 09:05:12 +01:00
fastcgi_split_path_info ^(.+\.php)(/.+)\$;
fastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name;
include fastcgi_params;
}
}
EOF
systemctl reload nginx
2025-08-23 10:24:57 +02:00
msg_ok "Created Service"
2024-12-02 09:05:12 +01:00
motd_ssh
customize
cleanup_lxc