Skip to content

Commit ded67e3

Browse files
Update README.md with current standards
1 parent 3d24022 commit ded67e3

File tree

3 files changed

+78
-122
lines changed

3 files changed

+78
-122
lines changed

PAST_CONFIG.md

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Configuring plugin in the old way (<=v0.0.5)
2+
3+
## Change Netbox '**[configuration.py](https://github.com/netbox-community/netbox/blob/develop/netbox/netbox/configuration.example.py)**' to add PLUGIN parameters
4+
The plugin's configuration is also located in **/opt/netbox/netbox/netbox/configuration.py**:
5+
6+
Replace the values with your own following the [Configuration Parameters](#2-configuration-parameters) section.
7+
8+
**OBS:** You do not need to configure all the parameters, only the one's different from the default values. It means that if you have some value equal to the one below, you can skip its configuration. For netbox you should ensure the domain/port either targets gunicorn or a true http port that is not redirected to https.
9+
10+
```python
11+
PLUGINS_CONFIG = {
12+
'netbox_proxbox': {
13+
'proxmox': [
14+
{
15+
'domain': 'proxbox.example.com', # May also be IP address
16+
'http_port': 8006,
17+
'user': 'root@pam', # always required
18+
'password': 'Strong@P4ssword', # only required, if you don't want to use token based authentication
19+
'token': {
20+
'name': 'tokenID', # Only type the token name and not the 'user@pam:tokenID' format
21+
'value': '039az154-23b2-4be0-8d20-b66abc8c4686'
22+
},
23+
'ssl': False
24+
},
25+
# The following json is optional and applies only for multi-cluster use
26+
{
27+
'domain': 'proxbox2.example.com', # May also be IP address
28+
'http_port': 8006,
29+
'user': 'root@pam', # always required
30+
'password': 'Strong@P4ssword', # only required, if you don't want to use token based authentication
31+
'token': {
32+
'name': 'tokenID', # Only type the token name and not the 'user@pam:tokenID' format
33+
'value': '039az154-23b2-4be0-8d20-b66abc8c4686'
34+
},
35+
'ssl': False
36+
}
37+
],
38+
'netbox': {
39+
'domain': 'localhost', # Ensure localhost is added to ALLOWED_HOSTS
40+
'http_port': 8001, # Gunicorn port.
41+
'token': '0dd7cddfaee3b38bbffbd2937d44c4a03f9c9d38',
42+
'settings': {
43+
'virtualmachine_role_id' : 0,
44+
'node_role_id' : 0,
45+
'site_id': 0
46+
}
47+
},
48+
'fastapi': {
49+
# Uvicorn Host is (most of the time) the same as Netbox (as both servers run on the same machine)
50+
'uvicorn_host': 'localhost',
51+
'uvicorn_port': 8800, # Default Proxbox FastAPI port
52+
# Although it seems weird, the sudo-user is necessary so that Proxbox automatically starts Proxbox Backend.
53+
# It makes it more "plug-in", without the need to user input manual commands.
54+
'sudo': {
55+
'user': "sudo_enabled_user",
56+
'password': 'Strong@P4ssword',
57+
}
58+
}
59+
}
60+
}
61+
```

README.md

+17-121
Original file line numberDiff line numberDiff line change
@@ -68,23 +68,17 @@ The following table shows the Netbox and Proxmox versions compatible (tested) wi
6868
- [1.1.2. Using git (development use)](#112-using-git-development-use) - CURRENTLY WORKING
6969
- [1.2. Enable the Plugin](#12-enable-the-plugin)
7070
- [1.3. Configure Plugin](#13-configure-plugin)
71-
- [1.3.1. Change Netbox 'configuration.py' to add PLUGIN parameters](#131-change-netbox-configurationpy-to-add-plugin-parameters)
72-
- [1.3.2. Change Netbox 'settings.py' to include Proxbox Template directory](#132-change-netbox-settingspy-to-include-proxbox-template-directory)
7371
- [1.4. Run Database Migrations](#14-run-database-migrations)
7472
- [1.5. systemd Setup](#15-systemd-setup-proxbox-backend)
7573
- [1.6 Restart WSGI Service](#15-restart-wsgi-service)
7674

77-
[2. Configuration Parameters](#2-configuration-parameters)
75+
[2. Usage](#3-usage)
7876

79-
[3. Usage](#3-usage)
77+
[3. Enable Logs](#4-enable-logs)
8078

81-
[4. Enable Logs](#4-enable-logs)
79+
[4. Roadmap](#6-roadmap)
8280

83-
[5. Contributing](#5-contributing)
84-
85-
[6. Roadmap](#6-roadmap)
86-
87-
[7. Get Help from Community!](#7-get-help-from-community)
81+
[5. Get Help from Community!](#7-get-help-from-community)
8882

8983
---
9084

@@ -150,84 +144,18 @@ Enable the plugin in **/opt/netbox/netbox/netbox/configuration.py**:
150144
PLUGINS = ['netbox_proxbox']
151145
```
152146

153-
---
154147

155148
### 1.3. Configure Plugin
156149

157-
#### 1.3.1. Change Netbox '**[configuration.py](https://github.com/netbox-community/netbox/blob/develop/netbox/netbox/configuration.example.py)**' to add PLUGIN parameters
158-
The plugin's configuration is also located in **/opt/netbox/netbox/netbox/configuration.py**:
159-
160-
Replace the values with your own following the [Configuration Parameters](#2-configuration-parameters) section.
161-
162-
**OBS:** You do not need to configure all the parameters, only the one's different from the default values. It means that if you have some value equal to the one below, you can skip its configuration. For netbox you should ensure the domain/port either targets gunicorn or a true http port that is not redirected to https.
163-
164-
```python
165-
PLUGINS_CONFIG = {
166-
'netbox_proxbox': {
167-
'proxmox': [
168-
{
169-
'domain': 'proxbox.example.com', # May also be IP address
170-
'http_port': 8006,
171-
'user': 'root@pam', # always required
172-
'password': 'Strong@P4ssword', # only required, if you don't want to use token based authentication
173-
'token': {
174-
'name': 'tokenID', # Only type the token name and not the 'user@pam:tokenID' format
175-
'value': '039az154-23b2-4be0-8d20-b66abc8c4686'
176-
},
177-
'ssl': False
178-
},
179-
# The following json is optional and applies only for multi-cluster use
180-
{
181-
'domain': 'proxbox2.example.com', # May also be IP address
182-
'http_port': 8006,
183-
'user': 'root@pam', # always required
184-
'password': 'Strong@P4ssword', # only required, if you don't want to use token based authentication
185-
'token': {
186-
'name': 'tokenID', # Only type the token name and not the 'user@pam:tokenID' format
187-
'value': '039az154-23b2-4be0-8d20-b66abc8c4686'
188-
},
189-
'ssl': False
190-
}
191-
],
192-
'netbox': {
193-
'domain': 'localhost', # Ensure localhost is added to ALLOWED_HOSTS
194-
'http_port': 8001, # Gunicorn port.
195-
'token': '0dd7cddfaee3b38bbffbd2937d44c4a03f9c9d38',
196-
'settings': {
197-
'virtualmachine_role_id' : 0,
198-
'node_role_id' : 0,
199-
'site_id': 0
200-
}
201-
},
202-
'fastapi': {
203-
# Uvicorn Host is (most of the time) the same as Netbox (as both servers run on the same machine)
204-
'uvicorn_host': 'localhost',
205-
'uvicorn_port': 8800, # Default Proxbox FastAPI port
206-
# Although it seems weird, the sudo-user is necessary so that Proxbox automatically starts Proxbox Backend.
207-
# It makes it more "plug-in", without the need to user input manual commands.
208-
'sudo': {
209-
'user': "sudo_enabled_user",
210-
'password': 'Strong@P4ssword',
211-
}
212-
}
213-
}
214-
}
215-
```
216-
217-
218-
#### 1.3.2. Change Netbox '**[settings.py](https://github.com/netbox-community/netbox/blob/develop/netbox/netbox/settings.py)**' to include Proxbox Template directory
219-
220-
> Probably on the next release of Netbox, it will not be necessary to make the configuration below! As the [Pull Request #8733](https://github.com/netbox-community/netbox/pull/8734) got merged to develop branch
221-
222-
**It is no longer necessary to modify the templates section in `settings.py` and you may revert any changes.**
150+
All plugin configuration is now done using NetBox GUI or its API. You can check the old configuration way [here](./PAST_CONFIG.md).
223151

224152
---
225153

226154
### 1.4. Run Database Migrations
227155

228156
```
229157
(venv) $ cd /opt/netbox/netbox/
230-
(venv) $ python3 manage.py migrate
158+
(venv) $ python3 manage.py migrate netbox_proxbox
231159
(venv) $ python3 manage.py collectstatic --no-input
232160
```
233161

@@ -261,7 +189,7 @@ The certificates used are from Netbox, considering both applications are on the
261189
If you plan to put Proxbox Backend in another host, I recommend creating another pair of certificates and enabling NGINX in front ot it.
262190

263191
```
264-
/opt/netbox/venv/bin/uvicorn netbox-proxbox.netbox_proxbox.main:app --host 0.0.0.0 --port 8800 --app-dir /opt/netbox/netbox --ssl-keyfile=/etc/ssl/private/netbox.key --ssl-certfile=/etc/ssl/certs/netbox.crt --reload
192+
/opt/netbox/venv/bin/uvicorn netbox-proxbox.proxbox_api.main:app --host 0.0.0.0 --port 8800 --app-dir /opt/netbox/netbox --ssl-keyfile=/etc/ssl/private/netbox.key --ssl-certfile=/etc/ssl/certs/netbox.crt --reload
265193
```
266194

267195
#### (Developer Use Only) Creating self-signed certificates so Proxbox Backend (FastAPI) runs both HTTP and WS (Websocket) via TLS.
@@ -289,32 +217,7 @@ Restart the WSGI service to load the new plugin:
289217

290218
---
291219

292-
## 2. Configuration Parameters
293-
294-
The following options are available:
295-
296-
* `proxmox`: (List) Proxmox related configuration to use proxmoxer.
297-
* `proxmox.domain`: (String) Domain or IP address of Proxmox.
298-
* `proxmox.http_port`: (Integer) Proxmox HTTP port (default: 8006).
299-
* `proxmox.user`: (String) Proxmox Username.
300-
* `proxmox.password`: (String) Proxmox Password.
301-
* `proxmox.token`: (Dict) Contains Proxmox TokenID (name) and Token Value (value).
302-
* `proxmox.token.name`: (String) Proxmox TokenID.
303-
* `proxmox.token.value`: (String) Proxmox Token Value.
304-
* `proxmox.ssl`: (Bool) Defines the use of SSL (default: False).
305-
306-
* `netbox`: (Dict) Netbox related configuration to use pynetbox.
307-
* `netbox.domain`: (String) Domain or IP address of Netbox. Ensure name or ip is added to `ALLOWED_HOSTS`
308-
* `netbox.http_port`: (Integer) Netbox HTTP PORT (default: 8001). If you are not targeting gunicorn directly make sure the HTTP port is not redirected to HTTPS by your HTTP server.
309-
* `netbox.token`: (String) Netbox Token Value.
310-
* `netbox.settings`: (Dict) Default items of Netbox to be used by Proxbox.
311-
- If not configured, Proxbox will automatically create a basic configuration to make it work.
312-
- The ID of each item can be easily found on the URL of the item you want to use.
313-
* `netbox.settings.virtualmachine_role_id`: (Integer) Role ID to be used by Proxbox when creating Virtual Machines
314-
* `netbox.settings.node_role_id`: (Integer) Role ID to be used by Proxbox when creating Nodes (Devices)
315-
* `netbox.settings.site_id` (Integer) Site ID to be used by Proxbox when creating Nodes (Devices)
316-
317-
## 3. Usage
220+
## 2. Usage
318221

319222
If everything is working correctly, you should see in Netbox's navigation the **Proxmox VM/CT** button in **Plugins** dropdown list.
320223

@@ -326,7 +229,7 @@ It will redirect you to a new page and you just have to wait until the plugin ru
326229

327230
---
328231

329-
## 4. Enable Logs
232+
## 3. Enable Logs
330233

331234
So that Proxbox plugin logs what is happening to the terminal, copy the following code and paste to `configuration.py` Netbox configuration file:
332235

@@ -351,24 +254,17 @@ Although the above standard configuration should do the trick to things work.
351254

352255
---
353256

354-
## 5. Contributing
355-
Developing tools for this project based on [ntc-netbox-plugin-onboarding](https://github.com/networktocode/ntc-netbox-plugin-onboarding) repo.
356-
357-
Issues and pull requests are welcomed.
358-
359-
---
360-
361-
## 6. Roadmap
362-
- Start using custom models to optimize the use of the Plugin and stop using 'Custom Fields'
363-
- Automatically remove Nodes on Netbox when removed on Promox (as it already happens with Virtual Machines and Containers)
364-
- Add individual update of VM/CT's and Nodes (currently is only possible to update all at once)
365-
- Add periodic update of the whole environment so that the user does not need to manually click the update button.
366-
- Create virtual machines and containers directly on Netbox, having no need to access Proxmox.
367-
- Add 'Console' button to enable console access to virtual machines
257+
## 4. Roadmap
258+
- [X] Start using custom models to optimize the use of the Plugin and stop using 'Custom Fields'
259+
- [ ] Automatically remove Nodes on Netbox when removed on Promox (as it already happens with Virtual Machines and Containers)
260+
- [ ] Add individual update of VM/CT's and Nodes (currently is only possible to update all at once)
261+
- [ ] Add periodic update of the whole environment so that the user does not need to manually click the update button.
262+
- [ ] Create virtual machines and containers directly on Netbox, having no need to access Proxmox.
263+
- [ ] Add 'Console' button to enable console access to virtual machines
368264

369265
---
370266

371-
## 7. Get Help from Community!
267+
## 5. Get Help from Community!
372268
If you are struggling to get Proxbox working, feel free to contact someone from community (including me) to help you.
373269
Below some of the communities available:
374270
- **[Official - Slack Community (english)](https://netdev.chat/)**

netbox_proxbox/views/keepalive_status.py

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import requests
77

88
# Django-HTMX Imports
9-
109
from django_htmx.middleware import HtmxDetails
1110
from django_htmx.http import replace_url
1211

0 commit comments

Comments
 (0)