mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2025-12-07 01:26:11 -08:00
Loading plugins v 0.31 🔌
This commit is contained in:
@@ -3,10 +3,25 @@
|
||||
> [!WARNING]
|
||||
> Follow this guide only after you you downloaded and started NetAlert X at least once after previously using the PiAlert image.
|
||||
|
||||
> [!TIP]
|
||||
> In short: The application will auto-migrate the database, config, and all device information. A ticker message on top will be displayed until you update your docker mount points. Even so, it's always good to have a [backup strategy](https://github.com/jokob-sk/NetAlertX/blob/main/docs/BACKUPS.md) in place.
|
||||
## STEPS:
|
||||
|
||||
The migration should be pretty straightforward. The application installation folder in the docker container has changed from `/home/pi/pialert` to `/app`. That means the new mount points are:
|
||||
> [!TIP]
|
||||
> In short: The application will auto-migrate the database, config, and all device information. A ticker message on top will be displayed until you update your docker mount points. It's always good to have a [backup strategy](https://github.com/jokob-sk/NetAlertX/blob/main/docs/BACKUPS.md) in place.
|
||||
|
||||
1. Backup your current config and database (optional `devices.csv` to have a backup) (See bellow tip if facing issues)
|
||||
2. Stop the container
|
||||
2. Update the Docker file mount locations in your `docker-compose.yml` or docker run command (See bellow **New Docker mount locations**).
|
||||
3. Rename the DB and conf files to `app.db` and `app.conf` and place them in the appropriate location.
|
||||
4. Start the Container
|
||||
|
||||
|
||||
> [!TIP]
|
||||
> If you have troubles accessing past backups, config or database files you can copy them into the newly mapped directories, for example by running this command in the container: `cp -r /app/config /home/pi/pialert/config/old_backup_files`. This should create a folder in the `config` directory called `old_backup_files` conatining all the files in that location. Another approach is to map the old location and the new one at the same time to copy things over.
|
||||
|
||||
|
||||
### New Docker mount locations
|
||||
|
||||
The application installation folder in the docker container has changed from `/home/pi/pialert` to `/app`. That means the new mount points are:
|
||||
|
||||
| Old mount point | New mount point |
|
||||
|----------------------|---------------|
|
||||
@@ -25,20 +40,10 @@ The migration should be pretty straightforward. The application installation fol
|
||||
> [!NOTE]
|
||||
> The application uses symlinks linking the old db and config locations to the new ones, so data loss should not occur. [Backup strategies](https://github.com/jokob-sk/NetAlertX/blob/main/docs/BACKUPS.md) are still recommended to backup your setup.
|
||||
|
||||
In summary:
|
||||
|
||||
1. Docker file mount locations in your `docker-compose.yml` or docker run command have changed.
|
||||
2. Backup your current config and database (optional `devices.csv` to have a backup)
|
||||
3. Rename them to `app.db` `app.conf`
|
||||
4. Update the volume mappings in your `docker-compose.yaml`
|
||||
5. Place the renamed files into the above locations.
|
||||
|
||||
|
||||
> [!TIP]
|
||||
> If you have troubles accessing past backups, config or database files you can copy them into the newly mapped directories, for example by running this command in the container: `cp -r /app/config /home/pi/pialert/config/old_backup_files`. This should create a folder in the `config` directory called `old_backup_files` conatining all the files in that location. Another approach is to map the old location and the new one at the same time to copy things over.
|
||||
|
||||
Examples follow.
|
||||
# Examples
|
||||
|
||||
Exmaples of docker files with the new mount points.
|
||||
|
||||
## Example 1: Mapping folders
|
||||
|
||||
|
||||
@@ -100,6 +100,7 @@ def importConfigs (db, all_plugins):
|
||||
# ----------------------------------------
|
||||
# ccd(key, default, config_dir, name, inputtype, options, group, events=[], desc = "", regex = "", setJsonMetadata = {}, overrideTemplate = {})
|
||||
|
||||
conf.LOADED_PLUGINS = ccd('LOADED_PLUGINS', [] , c_d, 'Loaded plugins', 'list', '', 'General')
|
||||
conf.SCAN_SUBNETS = ccd('SCAN_SUBNETS', ['192.168.1.0/24 --interface=eth1', '192.168.1.0/24 --interface=eth0'] , c_d, 'Subnets to scan', 'subnets', '', 'General')
|
||||
conf.LOG_LEVEL = ccd('LOG_LEVEL', 'verbose' , c_d, 'Log verboseness', 'text.select', "['none', 'minimal', 'verbose', 'debug']", 'General')
|
||||
conf.TIMEZONE = ccd('TIMEZONE', 'Europe/Berlin' , c_d, 'Time zone', 'text', '', 'General')
|
||||
@@ -116,9 +117,7 @@ def importConfigs (db, all_plugins):
|
||||
conf.HRS_TO_KEEP_NEWDEV = ccd('HRS_TO_KEEP_NEWDEV', 0 , c_d, 'Keep new devices for', 'integer', "0", 'General')
|
||||
conf.API_CUSTOM_SQL = ccd('API_CUSTOM_SQL', 'SELECT * FROM Devices WHERE dev_PresentLastScan = 0' , c_d, 'Custom endpoint', 'text', '', 'General')
|
||||
conf.NETWORK_DEVICE_TYPES = ccd('NETWORK_DEVICE_TYPES', ['AP', 'Gateway', 'Firewall', 'Hypervisor', 'Powerline', 'Switch', 'WLAN', 'PLC', 'Router','USB LAN Adapter', 'USB WIFI Adapter', 'Internet'] , c_d, 'Network device types', 'list', '', 'General')
|
||||
conf.LOADED_PLUGINS = ccd('LOADED_PLUGINS', [] , c_d, 'Loaded plugins', 'list', '', 'General')
|
||||
|
||||
|
||||
|
||||
|
||||
# Init timezone in case it changed
|
||||
conf.tz = timezone(conf.TIMEZONE)
|
||||
@@ -169,10 +168,21 @@ def importConfigs (db, all_plugins):
|
||||
# get default plugin run value
|
||||
plugin_run = get_plugin_setting(plugin, "RUN")
|
||||
|
||||
if plugin_run is None:
|
||||
mylog('none', ['[Config] DEBUG1 plugin_run: None'])
|
||||
else:
|
||||
mylog('none', ['[Config] DEBUG2 plugin_run: ', plugin_run])
|
||||
|
||||
# get user-defined run value if available
|
||||
if pref + "_RUN" in c_d:
|
||||
plugin_run = c_d[pref + "_RUN" ]
|
||||
|
||||
if plugin_run is None:
|
||||
mylog('none', ['[Config] DEBUG3 plugin_run: None'])
|
||||
else:
|
||||
mylog('none', ['[Config] DEBUG4 plugin_run: ', plugin_run])
|
||||
|
||||
|
||||
|
||||
# only include loaded plugins, and the ones that are enabled
|
||||
# 🔺 update also in settings.php if you update below list/array
|
||||
|
||||
Reference in New Issue
Block a user