Skip to content

Commit 9a04499

Browse files
committed
Add detailed installation instructions
1 parent cf22833 commit 9a04499

File tree

3 files changed

+70
-5
lines changed

3 files changed

+70
-5
lines changed

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ This [NetBox](http://netboxlabs.com/oss/netbox/) plugin introduces branching fun
99

1010
## Installation
1111

12-
1. Activate the NetBox virtual environment
12+
Brief installation instructions are provided below. For a complete installation guide, please refer to the included documentation.
13+
14+
1. Activate the NetBox virtual environment:
1315

1416
```
1517
$ source /opt/netbox/venv/bin/activate
@@ -21,7 +23,7 @@ $ source /opt/netbox/venv/bin/activate
2123
$ pip install netboxlabs-netbox-branching
2224
```
2325

24-
3. Add `netbox_branching` to `PLUGINS` in `configuration.py`
26+
3. Add `netbox_branching` to `PLUGINS` in `configuration.py`:
2527

2628
```python
2729
PLUGINS = [

docs/index.md

Lines changed: 64 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,70 @@ sequenceDiagram
7474

7575
## Getting Started
7676

77-
TODO
77+
### Plugin Installation
78+
79+
#### 1. Virtual Environment
80+
81+
The plugin can be installed from [PyPI](https://pypi.org/project/netboxlabs-netbox-branching/). First, activate the Python virtual environment used by NetBox (which is typically located at `/opt/netbox/venv/`):
82+
83+
```
84+
source /opt/netbox/venv/bin/activate
85+
```
86+
87+
!!! note
88+
You may need to modify the `source` command above if your virtual environment has been installed in a different location.
89+
90+
#### 2. Python Package
91+
92+
Use `pip` to install the Python package:
93+
94+
```
95+
pip install netboxlabs-netbox-branching
96+
```
97+
98+
#### 3. Enable Plugin
99+
100+
Add `netbox_branching` to the list `PLUGINS` list in `configuration.py`.
101+
102+
```python
103+
PLUGINS = [
104+
# ...
105+
'netbox_branching',
106+
]
107+
```
108+
109+
!!! note
110+
If there are no plugins already installed, you might need to create this parameter. If so, be sure to define `PLUGINS` as a list _containing_ the plugin name as above, rather than just the name.
111+
112+
#### 4. Configuration
113+
114+
This plugin employs dynamic schema resolution, which requires that we override two low-level Django settings. First, we'll wrap NetBox's configured `DATABASE` parameter with `DynamicSchemaDict` to support dynamic schemas. Second, we'll employ the plugin's custom database router.
115+
116+
Create a new file named `local_settings.py` in the same directory as `configuration.py`, and add the content below.
117+
118+
```python
119+
from netbox_branching.utilities import DynamicSchemaDict
120+
from .configuration import DATABASE
121+
122+
# Wrap DATABASES with DynamicSchemaDict for dynamic schema support
123+
DATABASES = DynamicSchemaDict({
124+
'default': DATABASE,
125+
})
126+
127+
# Employ our custom database router
128+
DATABASE_ROUTERS = [
129+
'netbox_branching.database.BranchAwareRouter',
130+
]
131+
```
132+
133+
#### 5. Database Migrations
134+
135+
Run the included database migrations:
136+
137+
```
138+
cd /opt/netbox/netbox
139+
./manage.py migrate
140+
```
78141

79142
## Known Limitations
80143

docs/using-branches/creating-a-branch.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@ When a branch is active, any changes you make in NetBox (aside from system resou
2525
Within the branch view, you'll notice several tabs. Each of these pertains to a set of changes related to the branch.
2626

2727
* **Diff** - This tab provides a summary of all the objects that have been created, updated, or deleted within the branch.
28-
* **Changes Behind** - This tab lists all changes that have been made in main since the branch was last synchronized. [Synchronizing the branch](./syncing-changes.md) will update it to include these changes.
29-
* **Changes Ahead** - This tab lists all changes made within your branch. [Merging the branch](./merging-a-branch.md) will replicate these changes into main.
28+
* **Changes Behind** - This tab lists all changes that have been made in main since the branch was last synchronized. [Synchronizing the branch](./syncing-merging.md#syncing-a-branch) will update it to include these changes.
29+
* **Changes Ahead** - This tab lists all changes made within your branch. [Merging the branch](./syncing-merging.md#merging-a-branch) will replicate these changes into main.
3030
* **Merged Changes** - Once a branch has been merged, this tab lists all changes that have been applied from the branch. (This tab appears only for merged branches.)

0 commit comments

Comments
 (0)