You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**Note**: Package names may vary by Ubuntu/Debian version. Use `apt-cache search libgdal` to find the correct version for your system.
127
+
128
+
**macOS:**
129
+
```bash
130
+
brew install postgresql postgis gdal geos proj
131
+
```
132
+
133
+
**Docker users**: The official `netboxcommunity/netbox` images do **NOT** include PostGIS and GDAL libraries by default. You will need to create a custom Docker image. See the Docker-specific instructions below.
134
+
135
+
### Step 1: Enable PostGIS in PostgreSQL
136
+
137
+
Connect to your NetBox database and enable the PostGIS extension:
138
+
139
+
```sql
140
+
-- Connect to your NetBox database
141
+
\c netbox
142
+
143
+
-- Enable PostGIS extension
144
+
CREATE EXTENSION IF NOT EXISTS postgis;
145
+
146
+
-- Verify installation
147
+
SELECT PostGIS_version();
148
+
```
149
+
150
+
### Step 2: Configure NetBox Database Engine
151
+
152
+
**CRITICAL**: Update your NetBox `configuration.py` to use the PostGIS database engine:
**Note**: This is just an example. If you're using NetBox Docker, this can be configured via environment variables in your `docker-compose.yml` or similar configuration files.
172
+
173
+
### Step 3: Install the Plugin
174
+
175
+
#### Standard Installation (pip)
94
176
95
-
1. Install the plugin:
96
177
```bash
97
178
pip install cesnet_service_path_plugin
98
179
```
99
180
100
-
2. Enable the plugin in your NetBox configuration:
181
+
#### Docker Installation
182
+
183
+
The official NetBox Docker images do not include the required geographic libraries. You need to create a custom Docker image.
184
+
185
+
**Option 1: Create a Custom Dockerfile**
186
+
187
+
Create a `Dockerfile` extending the official NetBox image:
188
+
189
+
```dockerfile
190
+
FROM netboxcommunity/netbox:v4.4
191
+
192
+
# copy plugin requirements
193
+
COPY ./plugin_requirements.txt /opt/netbox/
194
+
195
+
# Install git and minimal PostGIS runtime dependencies
196
+
RUN apt-get update && apt-get install -y \
197
+
git \
198
+
gdal-bin \
199
+
libgdal34 \
200
+
libgeos-c1t64 \
201
+
libproj25 \
202
+
&& apt-get clean \
203
+
&& rm -rf /var/lib/apt/lists/*
204
+
205
+
# Install PostGIS and geospatial Python dependencies
206
+
RUN /usr/local/bin/uv pip install \
207
+
psycopg2-binary \
208
+
-r /opt/netbox/plugin_requirements.txt
209
+
```
210
+
211
+
**Note**: Library package names (like `libgdal34`) may vary depending on the base image's Ubuntu/Debian version. Check available packages if you encounter errors.
212
+
213
+
Then create a `plugin_requirements.txt` file:
214
+
```
215
+
cesnet_service_path_plugin
216
+
```
217
+
218
+
Build your custom image:
219
+
```bash
220
+
docker build -t netbox-with-gis:latest .
221
+
```
222
+
223
+
Update your `docker-compose.yml` to use the custom image:
224
+
```yaml
225
+
services:
226
+
netbox:
227
+
image: netbox-with-gis:latest
228
+
# ... rest of your configuration
229
+
```
230
+
231
+
**Option 2: Use docker-compose override**
232
+
233
+
Add a `docker-compose.override.yml` file:
234
+
235
+
```yaml
236
+
version: '3.8'
237
+
services:
238
+
netbox:
239
+
build:
240
+
context: .
241
+
dockerfile: Dockerfile.custom
242
+
```
243
+
244
+
For detailed Docker setup instructions, see [using netbox-docker with plugins](https://github.com/netbox-community/netbox-docker/wiki/Using-Netbox-Plugins).
For NetBox Docker installations, add to your `plugin_requirements.txt`:
283
+
**Docker users:**
137
284
```bash
138
-
cesnet_service_path_plugin
285
+
docker-compose restart netbox netbox-worker
139
286
```
140
287
141
-
**Docker users**: Ensure your NetBox Docker image includes PostGIS and GDAL libraries.
288
+
### Verification
142
289
143
-
For detailed Docker setup instructions, see [using netbox-docker with plugins](https://github.com/netbox-community/netbox-docker/wiki/Using-Netbox-Plugins).
290
+
To verify the installation:
144
291
145
-
## Configuration
292
+
1. Log into NetBox
293
+
2. Check that "Service Paths" appears in the navigation menu
294
+
3. Navigate to **Service Paths → Segments** to confirm the plugin is working
146
295
147
-
### Database Configuration
296
+
For geographic feature verification, you can use the diagnostic function in the Django shell:
148
297
149
-
Ensure your NetBox database has PostGIS enabled:
150
-
```sql
151
-
CREATE EXTENSION IF NOT EXISTS postgis;
298
+
```python
299
+
python manage.py nbshell
300
+
301
+
from cesnet_service_path_plugin.utils import check_gis_environment
302
+
check_gis_environment()
152
303
```
153
304
305
+
## Additional Configuration
306
+
154
307
### Custom Status Choices
155
308
156
309
Extend or override default status choices in your `configuration.py`:
**Note**: For development, you typically only need the runtime libraries. The Python packages (geopandas, fiona, shapely) use precompiled wheels that already include the necessary bindings. Development headers (`-dev` packages) are only needed if you're compiling these libraries from source.
439
+
285
440
### Testing Geographic Features
286
441
287
442
Use the built-in diagnostic function:
@@ -311,9 +466,10 @@ Automatic integration with existing NetBox models:
311
466
### Common Issues
312
467
313
468
1. **PostGIS not enabled**: Ensure PostGIS extension is installed in your database
314
-
2.**GDAL library missing**: Install system GDAL libraries before Python packages
469
+
2. **GDAL library missing**: Install system GDAL runtime libraries (`gdal-bin`, `libgdal34`) before Python packages
315
470
3. **Path upload fails**: Check file format and ensure it contains LineString geometries
316
471
4. **Map not loading**: Verify JavaScript console for tile layer errors
472
+
5. **Library version mismatch**: If you encounter errors about missing libraries, check that library package names match your OS version (e.g., `libgdal34` vs `libgdal32`)
0 commit comments