-
-
Notifications
You must be signed in to change notification settings - Fork 366
Proxmox baremetal installer #1200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
readme.md
Addition of setting for PHP 8.4.
WalkthroughAdds a Proxmox-focused NetAlertX installer script, an Nginx site configuration serving the PHP web UI on port 20211, and a README documenting installer usage and behavior. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Admin
participant Script as Proxmox Installer
participant OS as Package Manager / System
participant Git as Git Repo
participant Nginx
participant PHPFPM as PHP-FPM
participant Systemd
Admin->>Script: Run proxmox-install-netalertx.sh
Script->>Script: Validate root, prompt/resolve PORT & SERVER_IP
Script->>OS: Add repos, install packages (nginx, php8.4-fpm, python, etc.)
Script->>OS: Create Python venv & install requirements
Script->>Git: Clone/Update NetAlertX into INSTALL_DIR
Script->>OS: Prepare webroot, tmpfs for logs/api, copy configs/DB
Script->>Nginx: Install site config, stop/start service
Script->>PHPFPM: Ensure php8.4-fpm running
alt systemd available
Script->>Systemd: Create/enable netalertx.service
else no systemd
Script->>Script: Launch background starter script
end
Script-->>Admin: Print access URL (http://SERVER_IP:PORT)
sequenceDiagram
autonumber
participant Client
participant Nginx
participant PHPFPM as PHP-FPM (php8.4)
participant App as NetAlertX (index.php)
Client->>Nginx: GET / or /netalertx/...
alt static asset
Nginx-->>Client: Serve file directly (cache headers)
else PHP route
Nginx->>PHPFPM: fastcgi_pass -> unix:/run/php/php8.4-fpm.sock (SCRIPT_FILENAME=index.php)
PHPFPM->>App: Execute index.php (receives X-Forwarded-Prefix)
App-->>PHPFPM: HTTP response
PHPFPM-->>Nginx: Response forwarded
Nginx-->>Client: 200 OK (charset=utf-8)
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used🪛 Shellcheck (0.11.0)install/proxmox/proxmox-install-netalertx.sh[warning] 21-21: BOLD appears unused. Verify use (or export if used externally). (SC2034) [warning] 21-21: WHITE appears unused. Verify use (or export if used externally). (SC2034) 🔇 Additional comments (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
🧹 Nitpick comments (2)
install/proxmox/readme.md (2)
50-63: Rename the second “Service Management” heading to avoid duplication.Markdown lint is flagging the repeated
### Service Managementheading (Line 51). Please give the second instance a distinct title so navigation and anchors stay unambiguous.As per markdownlint.
-### Service Management +### Service Commands
68-179: Add language hints to the remaining fenced code blocks.markdownlint (MD040) is still warning on Lines 68‑179 because a few fences lack language tags. Please annotate them (e.g.,
textfor URLs/file trees,bashfor shell snippets) to silence the lint and improve readability.As per markdownlint.
-``` -http://[SERVER_IP]:[PORT] -``` +```text +http://[SERVER_IP]:[PORT] +``` -``` -./start.netalertx.sh -``` +```bash +./start.netalertx.sh +``` -``` -/app/ # Main application directory +```text +/app/ # Main application directory @@ -└── start.netalertx.sh # Service startup script +└── start.netalertx.sh # Service startup script @@ -└── netalertx.service # Systemd service definition +└── netalertx.service # Systemd service definition @@ -└── netalertx.conf # NGINX configuration -``` +└── netalertx.conf # NGINX configuration +```
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
install/proxmox/netalertx.conf(1 hunks)install/proxmox/proxmox-install-netalertx.sh(1 hunks)install/proxmox/readme.md(1 hunks)
🧰 Additional context used
🪛 Shellcheck (0.11.0)
install/proxmox/proxmox-install-netalertx.sh
[warning] 21-21: BOLD appears unused. Verify use (or export if used externally).
(SC2034)
[warning] 21-21: WHITE appears unused. Verify use (or export if used externally).
(SC2034)
🪛 markdownlint-cli2 (0.18.1)
install/proxmox/readme.md
50-50: Multiple headings with the same content
(MD024, no-duplicate-heading)
68-68: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
143-143: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
164-164: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
| location ~ \.php$ { | ||
| # Use a Unix socket for better performance | ||
| fastcgi_pass unix:/var/run/php/php8.4-fpm.sock; | ||
| fastcgi_index index.php; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix the PHP-FPM socket path before shipping.
fastcgi_pass unix:/var/run/php/php8.4-fpm.sock; hard-codes the PHP minor version. On a stock Debian 13/Proxmox host today you typically get php8.2 or php8.3, so this socket never exists and every request will 502. Please make the installer write the detected PHP version into the nginx conf (or switch both nginx and the FPM pool to a version-agnostic socket path) so we don't brick the UI on fresh installs.
🤖 Prompt for AI Agents
In install/proxmox/netalertx.conf around lines 24-27, the nginx fastcgi_pass
hard-codes php8.4's socket which will 502 on hosts with php8.2/8.3; change the
installer/template to write the actual PHP-FPM socket path at install-time by
detecting the installed PHP-FPM version (e.g. probe /run/php or check php -v or
dpkg-query for php-fpm package), then render fastcgi_pass
unix:/run/php/php{MAJOR}.{MINOR}-fpm.sock; into the nginx conf; include a
fallback to a version-agnostic socket (or create a symlink /run/php/php-fpm.sock
-> the real socket) if detection fails so fresh installs won’t break the UI.
| # create symbolic link to the installer directory | ||
| ln -sfn "${INSTALL_DIR}/front" "$WEB_UI_DIR" | ||
| # create symbolic link to NGINX configuration coming with NetAlertX | ||
| ln -sfn "${INSTALLER_DIR}/${NGINX_CONF_NAME}" "${NGINX_CONFIG_FILE}" | ||
|
|
||
| # Use selected port (may be default 20211) | ||
| if [ -n "${PORT-}" ]; then | ||
| printf "%b\n" "--------------------------------------------------------------------------" | ||
| printf "%b\n" "Setting webserver to port ($PORT)" | ||
| printf "%b\n" "--------------------------------------------------------------------------" | ||
| sed -i "s/listen 20211;/listen ${PORT};/g" "${NGINX_CONFIG_FILE}" | ||
| # Also update the template file so it reflects the chosen port | ||
| sed -i "s/listen 20211;/listen ${PORT};/g" "${INSTALLER_DIR}/${NGINX_CONF_NAME}" | ||
| fi | ||
|
|
||
| # Change web interface address if set | ||
| if [ -n "${LISTEN_ADDR-}" ]; then | ||
| printf "%b\n" "--------------------------------------------------------------------------" | ||
| printf "%b\n" "Setting webserver to user-supplied address (${LISTEN_ADDR})" | ||
| printf "%b\n" "--------------------------------------------------------------------------" | ||
| sed -i "s/listen /listen ${LISTEN_ADDR}:/g" "${NGINX_CONFIG_FILE}" | ||
| sed -i "s/listen /listen ${LISTEN_ADDR}:/g" "${INSTALLER_DIR}/${NGINX_CONF_NAME}" | ||
| fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid mutating the tracked nginx template when applying runtime settings.
Because /etc/nginx/conf.d/netalertx.conf is symlinked to the repo copy (Line 265), the sed calls on Lines 272‑275 & 282‑284 rewrite install/proxmox/netalertx.conf itself. Any user who selects a custom port ends up with a dirty working tree, and later git pull (the documented update path) will abort. Copy the template before templating so the repository file stays pristine.
-# create symbolic link to NGINX configuration coming with NetAlertX
-ln -sfn "${INSTALLER_DIR}/${NGINX_CONF_NAME}" "${NGINX_CONFIG_FILE}"
+# deploy NGINX configuration from the template
+cp "${INSTALLER_DIR}/${NGINX_CONF_NAME}" "${NGINX_CONFIG_FILE}"
@@
- sed -i "s/listen 20211;/listen ${PORT};/g" "${NGINX_CONFIG_FILE}"
- # Also update the template file so it reflects the chosen port
- sed -i "s/listen 20211;/listen ${PORT};/g" "${INSTALLER_DIR}/${NGINX_CONF_NAME}"
+ sed -i "s/listen 20211;/listen ${PORT};/g" "${NGINX_CONFIG_FILE}"
@@
- sed -i "s/listen /listen ${LISTEN_ADDR}:/g" "${NGINX_CONFIG_FILE}"
- sed -i "s/listen /listen ${LISTEN_ADDR}:/g" "${INSTALLER_DIR}/${NGINX_CONF_NAME}"
+ sed -i "s/listen /listen ${LISTEN_ADDR}:/g" "${NGINX_CONFIG_FILE}"🤖 Prompt for AI Agents
In install/proxmox/proxmox-install-netalertx.sh around lines 262-284, the script
currently edits the tracked installer template via the symlinked
NGINX_CONFIG_FILE, mutating the repo; instead, break the symlink and copy the
template to the target config path before any sed changes and only perform sed
on the target copy. Concretely: if "${NGINX_CONFIG_FILE}" is a symlink or
exists, remove it (or unlink), then copy "${INSTALLER_DIR}/${NGINX_CONF_NAME}"
to "${NGINX_CONFIG_FILE}" (e.g. cp --dereference or cp -f) preserving
permissions, and change the subsequent sed calls so they only edit
"${NGINX_CONFIG_FILE}" (do not run sed on
"${INSTALLER_DIR}/${NGINX_CONF_NAME}"), ensuring the repo template remains
unchanged.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is a correct comment that git pull will fail. I noticed that, too.
Workaround is a git stash -q for example before the git pull. Could of course use more drastic git commands like reset.
Good catch Bunny.. I forgot to change those permissions after testing. Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
install/proxmox/proxmox-install-netalertx.sh(1 hunks)
🧰 Additional context used
🪛 Shellcheck (0.11.0)
install/proxmox/proxmox-install-netalertx.sh
[warning] 21-21: BOLD appears unused. Verify use (or export if used externally).
(SC2034)
[warning] 21-21: WHITE appears unused. Verify use (or export if used externally).
(SC2034)
🔇 Additional comments (1)
install/proxmox/proxmox-install-netalertx.sh (1)
263-284: Stop templating the tracked nginx config in-place.
ln -sfnkeeps/etc/nginx/conf.d/netalertx.confpointing at the repo copy, so the subsequentsed -icalls still rewriteinstall/proxmox/netalertx.conf. Any custom port leaves the working tree dirty and blocks the documentedgit pullupdate path. Break the symlink, copy the template to the live location, and only mutate the copy.-# create symbolic link to the installer directory -ln -sfn "${INSTALL_DIR}/front" "$WEB_UI_DIR" -# create symbolic link to NGINX configuration coming with NetAlertX -ln -sfn "${INSTALLER_DIR}/${NGINX_CONF_NAME}" "${NGINX_CONFIG_FILE}" +# create symbolic link to the installer directory +ln -sfn "${INSTALL_DIR}/front" "$WEB_UI_DIR" +# deploy the NGINX configuration from the template (keep repo copy pristine) +cp -f "${INSTALLER_DIR}/${NGINX_CONF_NAME}" "${NGINX_CONFIG_FILE}" @@ - sed -i "s/listen 20211;/listen ${PORT};/g" "${NGINX_CONFIG_FILE}" - # Also update the template file so it reflects the chosen port - sed -i "s/listen 20211;/listen ${PORT};/g" "${INSTALLER_DIR}/${NGINX_CONF_NAME}" + sed -i "s/listen 20211;/listen ${PORT};/g" "${NGINX_CONFIG_FILE}" @@ - sed -i "s/listen /listen ${LISTEN_ADDR}:/g" "${NGINX_CONFIG_FILE}" - sed -i "s/listen /listen ${LISTEN_ADDR}:/g" "${INSTALLER_DIR}/${NGINX_CONF_NAME}" + sed -i "s/listen /listen ${LISTEN_ADDR}:/g" "${NGINX_CONFIG_FILE}"
sure why not. lol Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
|
Thanks a lot for the PR @JVKeller - is it good to merge? |
|
Great minds think alike - as they say. I updated the Ubuntu 24 installer to use a systemd unit as well, however I have that file as an external separate file, not an inline creation. I have no preference or idea which one is better. I also develop and test on Proxmox LXC containers :-) |
|
Following the Setting up python environment statement this is what the console outputed update-alternatives: using /usr/bin/python3 to provide /usr/bin/python (python) in auto mode Update: I deleted the .sh file when it ran the script so it failed |
|
|
||
| # Copy starter $DB_FILE and $CONF_FILE if they don't exist | ||
| mkdir -p "${INSTALL_DIR}/config" "${INSTALL_DIR}/db" | ||
| cp -u "${INSTALL_DIR}/back/${CONF_FILE}" "${INSTALL_DIR}/config/${CONF_FILE}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reccomend these changes to correct app.conf in in /var/www/html/netalertx/config/
error on startup.
` # Delete content of "/config/"
rm -rf "${WEB_UI_DIR}/config/"*
# Delete content of "/db/"
rm -rf "${INSTALL_DIR}/db/"*
fi
Copy starter $DB_FILE and $CONF_FILE if they don't exist
mkdir -p "${WEB_UI_DIR}/config" "${INSTALL_DIR}/db"
cp -u "${INSTALL_DIR}/back/${CONF_FILE}" "${WEB_UI_DIR}/config/${CONF_FILE}"
`
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, you did get an error running the installer? I thought you said it was because you deleted a script file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I initially had a problem as i created the script in the location that the script deleted after i moved a different location it worked. the scrip completed all the way through
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you happen to test this on an Ubuntu image? I think it should work... |
Let's see what the testers say! |
|
I didn’t receive an error during the script however the link to the /app.conf file was not there so the web interface had an error of file didn’t exists. I don’t know how to fix it but some way to bind the /app/config folder to the location in the web ui file location Sent from my iPhoneOn Sep 28, 2025, at 14:05, rell3k ***@***.***> wrote:
@JVKeller commented on this pull request.
In install/proxmox/proxmox-install-netalertx.sh:
+ if [ "${ALWAYS_FRESH_INSTALL:-false}" = true ]; then
+ printf "%b\n" "--------------------------------------------------------------------------"
+ printf "%b\n" "${GREEN}[INSTALLING] ${RESET}❗ ALERT /db and /config folders are cleared because the"
+ printf "%b\n" " ALWAYS_FRESH_INSTALL is set to: ${ALWAYS_FRESH_INSTALL}❗"
+ printf "%b\n" "--------------------------------------------------------------------------"
+ # Delete content of "/config/"
+ rm -rf "${INSTALL_DIR}/config/"*
+
+ # Delete content of "/db/"
+ rm -rf "${INSTALL_DIR}/db/"*
+ fi
+
+
+ # Copy starter $DB_FILE and $CONF_FILE if they don't exist
+ mkdir -p "${INSTALL_DIR}/config" "${INSTALL_DIR}/db"
+ cp -u "${INSTALL_DIR}/back/${CONF_FILE}" "${INSTALL_DIR}/config/${CONF_FILE}"
So, you did get an error running the installer? I thought you said it was because you deleted a script file.
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: ***@***.***>
|
|
I'll have to take a look at it tomorrow morning. The config file should be netalertx.conf for the Web folder binding. |
I think it's good to merge. if anyone wants to tweak it after, they can do so. |
|
May I ask a fundamental question: why is a Docker-based solution not sufficient and why is a native installation under an OS necessary? Thannks! |
Not necessary at all, but with people that are not familiar with Docker, but have a Proxmox server, with a script like this they could set up a container and have the app running and ready to go in minutes. I was more familiar with this type of set up, saw the script for Deb 12, and wanted to try it out and ended up making it work on Deb 13. Figured since I got that far and saw there was a little interest in it, I might as well tweak it and see if @jokob-sk wanted to add it in. |
Maintaining this should be easy. Just updating as requirements are added really. Even updating the app would be as easy as 'git pull' and a restart. |
|
I got an idea... :) Don't merge this. |
|
In my experience, people who are familiar with Proxmox are also familiar with Docker. |
I am familiar with both. Hence I choose LXC over docker. Fundamentally, I can backup containers, change network settings and replace things as I please. And I believe I can say I know what I am talking about, having worked with all Proxmox and docker for several years. |
okay :) |


I made a thing...
This installer will make it too easy to install NetAlertX on a Proxmox or any Debian 13 server.
Should be good to get a server up quickly for testing, and for a dev server.
Hope it helps someone!
Summary by CodeRabbit
New Features
Documentation