Skip to content

Commit

Permalink
v2.1.2
Browse files Browse the repository at this point in the history
Minor cosmetic changes
  • Loading branch information
mlebreuil committed Jun 8, 2024
1 parent aef7c37 commit 8a7ef47
Show file tree
Hide file tree
Showing 2 changed files with 115 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

## Version 2

### Version 2.1.1
### Version 2.1.2

* [127](https://github.com/mlebreuil/netbox-contract/issues/135) Fix service provider creation issue
* Fix contract assignement issue
Expand Down
114 changes: 114 additions & 0 deletions UTILS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
# Utils

## Generating the distribution archives

Note: This part is now automated with Github Actions.
Each time a release is created, a new package is created.

Make sure the package version is incremented in the following files.
- pyproject.toml
- src/netbox_contract/__init__.py

```bash
source netbox/venv/bin/activate
cd netbox-contract
python3 -m pip install --upgrade build
python3 -m build
```

## Update the package in the test pypi repository


```bash
source netbox/venv/bin/activate
python3 -m pip install --upgrade pip
python3 -m pip install --upgrade twine
python3 -m twine upload --repository testpypi dist/*
```

## Update the package in the pypi repository

Note: This part is now automated with Github Actions.
Each time a release is created, a new package is created and uploaded to PyPI.

```bash
source netbox/venv/bin/activate
python3 -m pip install --upgrade pip
python3 -m pip install --upgrade twine
python3 -m twine upload dist/*
```

## install the pluggin

For development install from local file system with the "editable" option:

git clone

```bash
source netbox/venv/bin/activate
python3 -m pip uninstall netbox-contract
git clone https://github.com/mlebreuil/netbox-contract.git
python3 -m pip install -e netbox-contract
```

from the test respository:

```bash
source netbox/venv/bin/activate
python3 -m pip uninstall netbox-contract
python3 -m pip install --index-url https://test.pypi.org/simple/ --no-deps netbox-contract
```

From the production repository:

```bash
source netbox/venv/bin/activate
python3 -m pip uninstall netbox-contract
python3 -m pip install netbox-contract
```

Update netbox configuration

```python
# configuration.py
PLUGINS = [
'netbox_contract',
]
```

update the database

```bash
source netbox/venv/bin/activate
python netbox/netbox/manage.py migrate
```

## initialisze the database

Install database package.
postgresql python adapter [psycopg](https://www.psycopg.org/docs/install.html)

```bash
pip install psycopg2
```

Run the initialization script

```bash
cd ..
python3 database_init.py
```

## Backup and restore the db

```bash
pg_dump --username netbox --password --host db netbox > netbox.sql
```

Restore:

```bash
psql --host=db --username=postgres --password -c 'drop database netbox'
psql --host=db --username=postgres --password -c 'create database netbox'
psql --host=db --username=postgres --password netbox < netbox.sql
```

0 comments on commit 8a7ef47

Please sign in to comment.