mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2025-02-01 14:31:50 +00:00
New script: phpIPAM (#1503)
* Added phpipam * PR feedback * fix json * Fix php version --------- Co-authored-by: CanbiZ <47820557+MickLesk@users.noreply.github.com>
This commit is contained in:
parent
959a7b4b14
commit
c45085a51d
72
ct/phpipam.sh
Normal file
72
ct/phpipam.sh
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
|
||||||
|
# Copyright (c) 2021-2025 community-scripts ORG
|
||||||
|
# Author: bvdberg01
|
||||||
|
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||||
|
# Source: https://phpipam.net/
|
||||||
|
|
||||||
|
# App Default Values
|
||||||
|
APP="phpIPAM"
|
||||||
|
var_tags="network"
|
||||||
|
var_cpu="1"
|
||||||
|
var_ram="512"
|
||||||
|
var_disk="4"
|
||||||
|
var_os="debian"
|
||||||
|
var_version="12"
|
||||||
|
var_unprivileged="1"
|
||||||
|
|
||||||
|
# App Output & Base Settings
|
||||||
|
header_info "$APP"
|
||||||
|
base_settings
|
||||||
|
|
||||||
|
# Core
|
||||||
|
variables
|
||||||
|
color
|
||||||
|
catch_errors
|
||||||
|
|
||||||
|
function update_script() {
|
||||||
|
header_info
|
||||||
|
check_container_storage
|
||||||
|
check_container_resources
|
||||||
|
if [[ ! -d /opt/phpipam ]]; then
|
||||||
|
msg_error "No ${APP} Installation Found!"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
RELEASE=$(curl -s https://api.github.com/repos/phpipam/phpipam/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
|
||||||
|
if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then
|
||||||
|
msg_info "Stopping Service"
|
||||||
|
systemctl stop apache2
|
||||||
|
msg_ok "Stopped Service"
|
||||||
|
|
||||||
|
msg_info "Updating ${APP} to v${RELEASE}"
|
||||||
|
cd /opt
|
||||||
|
mv /opt/phpipam/ /opt/phpipam-backup
|
||||||
|
wget -q "https://github.com/phpipam/phpipam/releases/download/v${RELEASE}/phpipam-v${RELEASE}.zip"
|
||||||
|
unzip -q "phpipam-v${RELEASE}.zip"
|
||||||
|
cp /opt/phpipam-backup/config.php /opt/phpipam
|
||||||
|
echo "${RELEASE}" >/opt/${APP}_version.txt
|
||||||
|
msg_ok "Updated $APP to v${RELEASE}"
|
||||||
|
|
||||||
|
msg_info "Starting Service"
|
||||||
|
systemctl start apache2
|
||||||
|
msg_ok "Started Service"
|
||||||
|
|
||||||
|
msg_info "Cleaning up"
|
||||||
|
rm -r "/opt/phpipam-v${RELEASE}.zip"
|
||||||
|
rm -r /opt/phpipam-backup
|
||||||
|
msg_ok "Cleaned"
|
||||||
|
msg_ok "Updated Successfully"
|
||||||
|
else
|
||||||
|
msg_ok "No update required. ${APP} is already at v${RELEASE}"
|
||||||
|
fi
|
||||||
|
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}"
|
84
install/phpipam-install.sh
Normal file
84
install/phpipam-install.sh
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Copyright (c) 2021-2025 community-scripts ORG
|
||||||
|
# Author: bvdberg01
|
||||||
|
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||||
|
|
||||||
|
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 \
|
||||||
|
mariadb-server \
|
||||||
|
apache2 \
|
||||||
|
php8.2-{pdo,mysql,sockets,gmp,ldap,simplexml,json,cli,mbstring,pear,gd,curl}
|
||||||
|
msg_ok "Installed Dependencies"
|
||||||
|
|
||||||
|
msg_info "Setting up MariaDB"
|
||||||
|
DB_NAME=phpipam
|
||||||
|
DB_USER=phpipam
|
||||||
|
DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13)
|
||||||
|
$STD mysql -u root -e "CREATE DATABASE $DB_NAME;"
|
||||||
|
$STD mysql -u root -e "CREATE USER '$DB_USER'@'localhost' IDENTIFIED WITH mysql_native_password AS PASSWORD('$DB_PASS');"
|
||||||
|
$STD mysql -u root -e "GRANT ALL ON $DB_NAME.* TO '$DB_USER'@'localhost'; FLUSH PRIVILEGES;"
|
||||||
|
{
|
||||||
|
echo "phpIPAM-Credentials"
|
||||||
|
echo "phpIPAM Database User: $DB_USER"
|
||||||
|
echo "phpIPAM Database Password: $DB_PASS"
|
||||||
|
echo "phpIPAM Database Name: $DB_NAME"
|
||||||
|
} >> ~/phpipam.creds
|
||||||
|
msg_ok "Set up MariaDB"
|
||||||
|
|
||||||
|
msg_info "Installing phpIPAM"
|
||||||
|
RELEASE=$(curl -s https://api.github.com/repos/phpipam/phpipam/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
|
||||||
|
cd /opt
|
||||||
|
wget -q "https://github.com/phpipam/phpipam/releases/download/v${RELEASE}/phpipam-v${RELEASE}.zip"
|
||||||
|
unzip -q "phpipam-v${RELEASE}.zip"
|
||||||
|
mysql -u root "${DB_NAME}" < /opt/phpipam/db/SCHEMA.sql
|
||||||
|
cp /opt/phpipam/config.dist.php /opt/phpipam/config.php
|
||||||
|
sed -i -e "s/\(\$disable_installer = \).*/\1true;/" \
|
||||||
|
-e "s/\(\$db\['user'\] = \).*/\1'$DB_USER';/" \
|
||||||
|
-e "s/\(\$db\['pass'\] = \).*/\1'$DB_PASS';/" \
|
||||||
|
-e "s/\(\$db\['name'\] = \).*/\1'$DB_NAME';/" \
|
||||||
|
/opt/phpipam/config.php
|
||||||
|
sed -i '/max_execution_time/s/= .*/= 600/' /etc/php/8.2/apache2/php.ini
|
||||||
|
echo "${RELEASE}" >/opt/${APPLICATION}_version.txt
|
||||||
|
msg_ok "Installed phpIPAM"
|
||||||
|
|
||||||
|
msg_info "Creating Service"
|
||||||
|
cat <<EOF >/etc/apache2/sites-available/phpipam.conf
|
||||||
|
<VirtualHost *:80>
|
||||||
|
ServerName phpipam
|
||||||
|
DocumentRoot /opt/phpipam
|
||||||
|
<Directory /opt/phpipam>
|
||||||
|
Options FollowSymLinks
|
||||||
|
AllowOverride All
|
||||||
|
Require all granted
|
||||||
|
</Directory>
|
||||||
|
|
||||||
|
ErrorLog /var/log/apache2/phpipam_error.log
|
||||||
|
CustomLog /var/log/apache2/phpipam_access.log combined
|
||||||
|
</VirtualHost>
|
||||||
|
EOF
|
||||||
|
$STD a2ensite phpipam
|
||||||
|
$STD a2enmod rewrite
|
||||||
|
$STD a2dissite 000-default.conf
|
||||||
|
$STD systemctl reload apache2
|
||||||
|
msg_ok "Created Service"
|
||||||
|
|
||||||
|
motd_ssh
|
||||||
|
customize
|
||||||
|
|
||||||
|
msg_info "Cleaning up"
|
||||||
|
rm -rf "/opt/phpipam-v${RELEASE}.zip"
|
||||||
|
$STD apt-get -y autoremove
|
||||||
|
$STD apt-get -y autoclean
|
||||||
|
msg_ok "Cleaned"
|
34
json/phpipam.json
Normal file
34
json/phpipam.json
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
{
|
||||||
|
"name": "phpIPAM",
|
||||||
|
"slug": "phpipam",
|
||||||
|
"categories": [
|
||||||
|
11
|
||||||
|
],
|
||||||
|
"date_created": "2025-01-15",
|
||||||
|
"type": "ct",
|
||||||
|
"updateable": true,
|
||||||
|
"privileged": false,
|
||||||
|
"interface_port": 80,
|
||||||
|
"documentation": "https://phpipam.net/documents/all-documents/",
|
||||||
|
"website": "https://phpipam.net/",
|
||||||
|
"logo": "https://phpipam.net/css/images/phpipam_logo_small@2x.png",
|
||||||
|
"description": "phpipam is an open-source web IP address management application (IPAM). Its goal is to provide light, modern and useful IP address management.",
|
||||||
|
"install_methods": [
|
||||||
|
{
|
||||||
|
"type": "default",
|
||||||
|
"script": "ct/phpipam.sh",
|
||||||
|
"resources": {
|
||||||
|
"cpu": 1,
|
||||||
|
"ram": 1024,
|
||||||
|
"hdd": 4,
|
||||||
|
"os": "debian",
|
||||||
|
"version": "12"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"default_credentials": {
|
||||||
|
"username": "Admin",
|
||||||
|
"password": "ipamadmin"
|
||||||
|
},
|
||||||
|
"notes": []
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user