all debugging online.

This commit is contained in:
Adam Outler
2025-10-03 22:12:42 +00:00
parent 1e04e9f571
commit ada92715a8
11 changed files with 151 additions and 46 deletions

View File

@@ -14,7 +14,7 @@ RUN apk add --no-cache bash shadow python3 python3-dev gcc musl-dev libffi-dev o
# Enable venv
ENV PATH="/opt/venv/bin:$PATH"
RUN pip install openwrt-luci-rpc asusrouter asyncio aiohttp graphene flask flask-cors unifi-sm-api tplink-omada-client wakeonlan pycryptodome requests paho-mqtt scapy cron-converter pytz json2table dhcp-leases pyunifi speedtest-cli chardet python-nmap dnspython librouteros yattag zeroconf git+https://github.com/foreign-sub/aiofreepybox.git
RUN pip install openwrt-luci-rpc asusrouter asyncio aiohttp graphene flask flask-cors unifi-sm-api tplink-omada-client wakeonlan pycryptodome requests paho-mqtt scapy cron-converter pytz json2table dhcp-leases pyunifi speedtest-cli chardet python-nmap dnspython librouteros yattag zeroconf simplejson future six urllib3 httplib2 git+https://github.com/foreign-sub/aiofreepybox.git
RUN chmod -R u-rwx,g-rwx /opt

View File

@@ -1,27 +1,49 @@
{
"name": "NetAlertX DevContainer",
"remoteUser": "netalertx",
"workspaceFolder": "/workspaces/NetAlertX",
"build": {
"dockerfile": "./Dockerfile",
"context": "../",
"dockerfile": "./Dockerfile", // Dockerfile generated by script
"context": "../", // Context is the root of the repository
"target": "netalertx-devcontainer"
},
"workspaceFolder": "/workspaces/NetAlertX",
"runArgs": [
"--add-host=host.docker.internal:host-gateway",
"--security-opt", "apparmor=unconfined" // for alowing ramdisk mounts
],
"capAdd": [
"SYS_ADMIN", // For mounting ramdisks
"NET_ADMIN", // For network interface configuration
"NET_RAW" // For raw packet manipulation
"NET_RAW" // For raw packet manipulation
],
"runArgs": [
"--security-opt",
"apparmor=unconfined" // for allowing ramdisk mounts
// Uncomment --network=host to run full NetAlertX scanning capabilities of network scanning in
// container. This runs too slowly in a large network to be practical for development purposes.
// You can start services such as avahi on the host, in other containers within the network, or
// even within this container and connect to them as needed.
// "--network=host",
],
// ATTENTION: If running with --network=host, COMMENT `forwardPorts` OR ELSE THERE WILL BE NO WEBUI!
"forwardPorts": [20211, 20212, 9003, 9000, 5678],
"portsAttributes": { // the ports we care about
"20211": {
"label": "Frontend:Nginx+PHP"
},
"20212": {
"label": "Backend:GraphQL"
},
"9003": {
"label": "PHP Debug:Xdebug"
},
"9000": {
"label": "PHP-FPM:FastCGI"
},
"5678": {
"label": "Python Debug:debugpy"
}
},
"postStartCommand": "${containerWorkspaceFolder}/.devcontainer/scripts/setup.sh",
"customizations": {
"vscode": {
"extensions": [
@@ -43,16 +65,13 @@
"eamodio.gitlens",
"alexcvzz.vscode-sqlite",
"yzhang.markdown-all-in-one"
]
,
],
"settings": {
"terminal.integrated.cwd": "${containerWorkspaceFolder}",
// Python testing configuration
"python.testing.pytestEnabled": true,
"python.testing.unittestEnabled": false,
"python.testing.pytestArgs": [
"test"
],
"python.testing.pytestArgs": ["test"],
// Make sure we discover tests and import server correctly
"python.analysis.extraPaths": [
"/workspaces/NetAlertX",
@@ -63,26 +82,6 @@
}
}
},
"forwardPorts": [5678, 9000, 9003, 20211, 20212],
"portsAttributes": {
"20211": {
"label": "Frontend:Nginx+PHP"
},
"20212": {
"label": "Backend:GraphQL"
},
"9003": {
"label": "PHP Debug:Xdebug"
},
"9000": {
"label": "PHP-FPM:FastCGI"
},
"5678": {
"label": "Python Debug:debugpy"
}
},
// Optional: ensures compose services are stopped when you close the window
"shutdownAction": "stopContainer"
}
"shutdownAction": "stopContainer" // stop container when VSCode is closed
}

View File

@@ -5,7 +5,7 @@ extension_dir="/services/php/modules"
xdebug.mode=develop,debug
xdebug.log=/app/log/xdebug.log
xdebug.log_level=7
xdebug.client_host=host.docker.internal
xdebug.client_host=127.0.0.1
xdebug.client_port=9003
xdebug.start_with_request=yes
xdebug.discover_client_host=1

View File

@@ -2,7 +2,7 @@ zend_extension="xdebug.so"
[xdebug]
xdebug.mode=develop,debug
xdebug.log_level=0
xdebug.client_host=host.docker.internal
xdebug.client_host=127.0.0.1
xdebug.client_port=9003
xdebug.start_with_request=yes
xdebug.discover_client_host=1

View File

@@ -5,4 +5,4 @@ if [ ! -d /workspaces/NetAlertX/.devcontainer ]; then
echo "Not in a devcontainer, exiting..."
echo ---------------------------------------------------
exit 255
fi
fi