diff --git a/dev_setup/README.md b/dev_setup/README.md new file mode 100644 index 0000000..2021676 --- /dev/null +++ b/dev_setup/README.md @@ -0,0 +1,20 @@ +# Setup Dev + + install docker + + install docker compose + + clone netbox repo + + clone netbox_topology_views repo + + create venv: `/usr/bin/python3 -m venv venv` + + activate venv: `source venv/bin/activate` + + install deps: `pip3 install -r requirements.txt` + + install build tools: `python3 -m pip install --upgrade build setuptools wheel` + +# Build + + in the root of the netbox_topology_views folder run `python3 -m build` + + install the package: `python3 -m pip install ../netbox-topology-views/dist/netbox_topology_views-X.Y.Z-py3-none-any.whl` where X,Y & Z are the version + +# Test + + copy configuration.py from dev_setup to the netbox/netbox/ folder + + run in the netbox repo: `python3 netbox/manage.py migrate` + + (first time only) run in the netbox repo: `python3 netbox/manage.py createsuperuser` + + run in the netbox repo: `python3 netbox/manage.py runserver` + + browse to http://127.0.0.1:8000 \ No newline at end of file diff --git a/dev_setup/configuration.py b/dev_setup/configuration.py new file mode 100644 index 0000000..64bc6e0 --- /dev/null +++ b/dev_setup/configuration.py @@ -0,0 +1,40 @@ +################################################################### +# This file serves as a base configuration for testing purposes # +# only. It is not intended for production use. # +################################################################### + +ALLOWED_HOSTS = ['*'] + +DATABASE = { + 'NAME': 'netbox', + 'USER': 'netbox', + 'PASSWORD': 'J5brHrAXFLQSif0K', + 'HOST': 'localhost', + 'PORT': '', + 'CONN_MAX_AGE': 300, +} + +DEBUG = True + +PLUGINS = [ + 'netbox_topology_views', +] + +REDIS = { + 'tasks': { + 'HOST': 'localhost', + 'PORT': 6379, + 'PASSWORD': 't4Ph722qJ5QHeQ1qfu36', + 'DATABASE': 0, + 'SSL': False, + }, + 'caching': { + 'HOST': 'localhost', + 'PORT': 6378, + 'PASSWORD': 'H733Kdjndks81', + 'DATABASE': 1, + 'SSL': False, + } +} + +SECRET_KEY = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789' \ No newline at end of file diff --git a/dev_setup/docker-compose.yml b/dev_setup/docker-compose.yml new file mode 100644 index 0000000..5f4a4a6 --- /dev/null +++ b/dev_setup/docker-compose.yml @@ -0,0 +1,41 @@ +version: '3.4' +services: + postgres: + image: postgres:12-alpine + environment: + POSTGRES_PASSWORD: J5brHrAXFLQSif0K #just for local dev + POSTGRES_DB: netbox + POSTGRES_USER: netbox + ports: + - "5432:5432" + volumes: + - netbox-postgres-data:/var/lib/postgresql/data + + redis: + image: redis:6-alpine + command: + - sh + - -c # this is to evaluate the $REDIS_PASSWORD from the env + - redis-server --appendonly yes --requirepass $$REDIS_PASSWORD ## $$ because of docker-compose + environment: + REDIS_PASSWORD: t4Ph722qJ5QHeQ1qfu36 #just for local dev + volumes: + - netbox-redis-data:/data + ports: + - "6379:6379" + redis-cache: + image: redis:6-alpine + command: + - sh + - -c # this is to evaluate the $REDIS_PASSWORD from the env + - redis-server --requirepass $$REDIS_PASSWORD ## $$ because of docker-compose + environment: + REDIS_PASSWORD: H733Kdjndks81 #just for local dev + ports: + - "6378:6379" + +volumes: + netbox-postgres-data: + driver: local + netbox-redis-data: + driver: local