mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2025-12-07 01:26:11 -08:00
docs
This commit is contained in:
@@ -1,32 +1,42 @@
|
||||
# Development environment set up
|
||||
# Development Environment Setup
|
||||
|
||||
>[!NOTE]
|
||||
> Replace `/development` with the path where your code files will be stored. The default container name is `netalertx` so there might be a conflict with your running containers.
|
||||
I truly appreciate all contributions! To help keep this project maintainable, this guide provides an overview of project priorities, key design considerations, and overall philosophy. It also includes instructions for setting up your environment so you can start contributing right away.
|
||||
|
||||
## Development Guidelines
|
||||
|
||||
Before starting development, please scan the below development guidelines.
|
||||
Before starting development, please review the following guidelines.
|
||||
|
||||
### Priority Order (Highest to Lowest)
|
||||
|
||||
1. 🔼 Fixing core bugs that lack workarounds.
|
||||
2. 🔵 Adding core functionality that unlocks other features (e.g., plugins).
|
||||
3. 🔵 Refactoring to enable faster development.
|
||||
4. 🔽 UI improvements (PRs welcome).
|
||||
1. 🔼 Fixing core bugs that lack workarounds
|
||||
2. 🔵 Adding core functionality that unlocks other features (e.g., plugins)
|
||||
3. 🔵 Refactoring to enable faster development
|
||||
4. 🔽 UI improvements (PRs welcome, but low priority)
|
||||
|
||||
### Design Philosophy
|
||||
|
||||
Focus on core functionality and integrate with existing tools rather than reinventing the wheel.
|
||||
Examples:
|
||||
The application architecture is designed for extensibility and maintainability. It relies heavily on configuration manifests via plugins and settings to dynamically build the UI and populate the application with data from various sources.
|
||||
|
||||
- Using **Apprise** for notifications instead of implementing multiple separate gateways.
|
||||
- Implementing **regex-based validation** instead of one-off validation for each setting.
|
||||
For details, see:
|
||||
- [Plugins Development](PLUGINS_DEV.md) (includes video)
|
||||
- [Settings System](SETTINGS_SYSTEM.md)
|
||||
|
||||
> [!NOTE]
|
||||
> UI changes have lower priority, however, PRs are welcome, but **keep them small & focused**.
|
||||
Focus on **core functionality** and integrate with existing tools rather than reinventing the wheel.
|
||||
|
||||
Examples:
|
||||
- Using **Apprise** for notifications instead of implementing multiple separate gateways
|
||||
- Implementing **regex-based validation** instead of one-off validation for each setting
|
||||
|
||||
> [!NOTE]
|
||||
> UI changes have lower priority. PRs are welcome, but please keep them **small and focused**.
|
||||
|
||||
## Development Environment Set Up
|
||||
|
||||
The following steps will guide you to set up your environment for local development and to run a custom docker build on your system. For most changes the container doesn't need to be rebuild which speeds up the development significantly.
|
||||
|
||||
>[!NOTE]
|
||||
> Replace `/development` with the path where your code files will be stored. The default container name is `netalertx` so there might be a conflict with your running containers.
|
||||
|
||||
### 1. Download the code:
|
||||
|
||||
- `mkdir /development`
|
||||
@@ -91,7 +101,7 @@ Most code changes can be tested without rebuilding the container. When working o
|
||||
- `sudo docker exec -it netalertx /bin/bash`
|
||||
- `pkill -f "python /app/server" && python /app/server & `
|
||||
|
||||
3. If none of the above work, restart the docker caontainer.
|
||||
3. If none of the above work, restart the docker container.
|
||||
|
||||
- This is usually the last resort as sometimes the Docker engine becomes unresponsive and the whole engine needs to be restarted.
|
||||
|
||||
@@ -119,3 +129,16 @@ Most code changes can be tested without rebuilding the container. When working o
|
||||
- Updating a Device
|
||||
- Plugin functionality.
|
||||
- Error log inspection.
|
||||
|
||||
### Unit Tests
|
||||
|
||||
>[!WARNING]
|
||||
> Please note these test modify data in the database.
|
||||
|
||||
1. See the `/test` directory for available test cases. These are not exhaustive but cover the main API endpoints.
|
||||
2. To run a test case, SSH into the container:
|
||||
`sudo docker exec -it netalertx /bin/bash`
|
||||
3. Inside the container, install pytest (if not already installed):
|
||||
`pip install pytest`
|
||||
4. Run a specific test case:
|
||||
`pytest /app/test/TESTFILE.py`
|
||||
|
||||
Reference in New Issue
Block a user