From 1af9ea9e2d1c20738b9ab43033696a14312c00b5 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Tue, 15 Nov 2016 12:36:17 -0500 Subject: [PATCH 01/20] Post-release version bump --- netbox/netbox/settings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/netbox/netbox/settings.py b/netbox/netbox/settings.py index ccc94488b..bac839dd7 100644 --- a/netbox/netbox/settings.py +++ b/netbox/netbox/settings.py @@ -12,7 +12,7 @@ except ImportError: "the documentation.") -VERSION = '1.7.1' +VERSION = '1.7.2-dev' # Import local configuration for setting in ['ALLOWED_HOSTS', 'DATABASE', 'SECRET_KEY']: From cc79b1136b3b13ac3be351c4f52b98da17e6ffd8 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Fri, 18 Nov 2016 09:49:04 -0500 Subject: [PATCH 02/20] Fixes #696: Corrected link to VRF in prefix and IP address breadcrumbs --- netbox/templates/ipam/inc/prefix_header.html | 2 +- netbox/templates/ipam/ipaddress.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/netbox/templates/ipam/inc/prefix_header.html b/netbox/templates/ipam/inc/prefix_header.html index 7dc7a35a1..105c41a0f 100644 --- a/netbox/templates/ipam/inc/prefix_header.html +++ b/netbox/templates/ipam/inc/prefix_header.html @@ -3,7 +3,7 @@ diff --git a/netbox/templates/ipam/ipaddress.html b/netbox/templates/ipam/ipaddress.html index 2392e462b..3135b60be 100644 --- a/netbox/templates/ipam/ipaddress.html +++ b/netbox/templates/ipam/ipaddress.html @@ -9,7 +9,7 @@ From 8bff8bcbe2922a7cb6aeb7c9344c34d99563d08f Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Tue, 29 Nov 2016 13:34:22 -0500 Subject: [PATCH 03/20] Fixes #702: Improved Unicode support for custom fields --- netbox/extras/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/netbox/extras/models.py b/netbox/extras/models.py index 609e878e9..f58a3205c 100644 --- a/netbox/extras/models.py +++ b/netbox/extras/models.py @@ -130,7 +130,7 @@ class CustomField(models.Model): if self.type == CF_TYPE_SELECT: # Could be ModelChoiceField or TypedChoiceField return str(value.id) if hasattr(value, 'id') else str(value) - return str(value) + return value def deserialize_value(self, serialized_value): """ From e31fae5ec5dfa8ba9305fc6501d8158f806c1295 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Tue, 29 Nov 2016 13:45:31 -0500 Subject: [PATCH 04/20] Fixes #712: Corrected export of tenants which are not assigned to a group --- netbox/templates/tenancy/tenant.html | 10 ++++++++-- netbox/templates/tenancy/tenant_import.html | 2 +- netbox/tenancy/models.py | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/netbox/templates/tenancy/tenant.html b/netbox/templates/tenancy/tenant.html index c3e640de1..a1c9f0992 100644 --- a/netbox/templates/tenancy/tenant.html +++ b/netbox/templates/tenancy/tenant.html @@ -8,7 +8,9 @@
@@ -50,7 +52,11 @@ Group - {{ tenant.group }} + {% if tenant.group %} + {{ tenant.group }} + {% else %} + None + {% endif %} diff --git a/netbox/templates/tenancy/tenant_import.html b/netbox/templates/tenancy/tenant_import.html index ef76cacb1..eb0c62c99 100644 --- a/netbox/templates/tenancy/tenant_import.html +++ b/netbox/templates/tenancy/tenant_import.html @@ -40,7 +40,7 @@ Group - Tenant group + Tenant group (optional) Customers diff --git a/netbox/tenancy/models.py b/netbox/tenancy/models.py index 8c1bf5fa4..b80a40382 100644 --- a/netbox/tenancy/models.py +++ b/netbox/tenancy/models.py @@ -48,6 +48,6 @@ class Tenant(CreatedUpdatedModel, CustomFieldModel): return ','.join([ self.name, self.slug, - self.group.name, + self.group.name if self.group else '', self.description, ]) From 77ac79f32c24039d3d737145221204640483d94e Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Tue, 29 Nov 2016 17:29:56 -0500 Subject: [PATCH 05/20] Fixes #713: Include a label for the comments field when editing circuits, providers, or racks in bulk --- netbox/circuits/forms.py | 4 ++-- netbox/dcim/forms.py | 2 +- netbox/utilities/forms.py | 4 +++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/netbox/circuits/forms.py b/netbox/circuits/forms.py index 288f2255f..c66a8bc40 100644 --- a/netbox/circuits/forms.py +++ b/netbox/circuits/forms.py @@ -54,7 +54,7 @@ class ProviderBulkEditForm(BootstrapMixin, CustomFieldBulkEditForm): portal_url = forms.URLField(required=False, label='Portal') noc_contact = forms.CharField(required=False, widget=SmallTextarea, label='NOC contact') admin_contact = forms.CharField(required=False, widget=SmallTextarea, label='Admin contact') - comments = CommentField() + comments = CommentField(widget=SmallTextarea) class Meta: nullable_fields = ['asn', 'account', 'portal_url', 'noc_contact', 'admin_contact', 'comments'] @@ -183,7 +183,7 @@ class CircuitBulkEditForm(BootstrapMixin, CustomFieldBulkEditForm): tenant = forms.ModelChoiceField(queryset=Tenant.objects.all(), required=False) port_speed = forms.IntegerField(required=False, label='Port speed (Kbps)') commit_rate = forms.IntegerField(required=False, label='Commit rate (Kbps)') - comments = CommentField() + comments = CommentField(widget=SmallTextarea) class Meta: nullable_fields = ['tenant', 'port_speed', 'commit_rate', 'comments'] diff --git a/netbox/dcim/forms.py b/netbox/dcim/forms.py index 44e30e964..fcda14fb5 100644 --- a/netbox/dcim/forms.py +++ b/netbox/dcim/forms.py @@ -221,7 +221,7 @@ class RackBulkEditForm(BootstrapMixin, CustomFieldBulkEditForm): type = forms.ChoiceField(choices=add_blank_choice(RACK_TYPE_CHOICES), required=False, label='Type') width = forms.ChoiceField(choices=add_blank_choice(RACK_WIDTH_CHOICES), required=False, label='Width') u_height = forms.IntegerField(required=False, label='Height (U)') - comments = CommentField() + comments = CommentField(widget=SmallTextarea) class Meta: nullable_fields = ['group', 'tenant', 'role', 'comments'] diff --git a/netbox/utilities/forms.py b/netbox/utilities/forms.py index 74e0749db..7104e34c0 100644 --- a/netbox/utilities/forms.py +++ b/netbox/utilities/forms.py @@ -234,6 +234,7 @@ class CommentField(forms.CharField): A textarea with support for GitHub-Flavored Markdown. Exists mostly just to add a standard help_text. """ widget = forms.Textarea + default_label = 'Comments' # TODO: Port GFM syntax cheat sheet to internal documentation default_helptext = ' '\ ''\ @@ -241,8 +242,9 @@ class CommentField(forms.CharField): def __init__(self, *args, **kwargs): required = kwargs.pop('required', False) + label = kwargs.pop('label', self.default_label) help_text = kwargs.pop('help_text', self.default_helptext) - super(CommentField, self).__init__(required=required, help_text=help_text, *args, **kwargs) + super(CommentField, self).__init__(required=required, label=label, help_text=help_text, *args, **kwargs) class FlexibleModelChoiceField(forms.ModelChoiceField): From 9ea3383fdef0634d2e250b6d25746fe9e656d174 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Tue, 29 Nov 2016 17:33:22 -0500 Subject: [PATCH 06/20] #702: Fix lingering Unicode incompatibility --- netbox/extras/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/netbox/extras/models.py b/netbox/extras/models.py index f58a3205c..a65e90834 100644 --- a/netbox/extras/models.py +++ b/netbox/extras/models.py @@ -165,7 +165,7 @@ class CustomFieldValue(models.Model): unique_together = ['field', 'obj_type', 'obj_id'] def __unicode__(self): - return '{} {}'.format(self.obj, self.field) + return u'{} {}'.format(self.obj, self.field) @property def value(self): From 9b8bae501b29ae238754afcdcbf8116186f33264 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Wed, 30 Nov 2016 11:19:28 -0500 Subject: [PATCH 07/20] Fixes #677: Add cffi as an explicit dependency to avoid setuptools error on Debian --- requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.txt b/requirements.txt index 40b0b707f..a7fef0b9b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ +cffi>=1.8 cryptography==1.4 Django==1.10 django-debug-toolbar==1.4 From 2986840755e57f8412a1c21710c746c20e0c4512 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Wed, 30 Nov 2016 12:01:45 -0500 Subject: [PATCH 08/20] Specified syntax for code blocks --- docs/installation/docker.md | 8 ++++---- docs/installation/ldap.md | 6 +++--- docs/installation/netbox.md | 33 ++++++++++++++++----------------- docs/installation/postgresql.md | 12 ++++++------ docs/installation/upgrading.md | 12 ++++++------ docs/installation/web-server.md | 22 +++++++++++----------- 6 files changed, 46 insertions(+), 47 deletions(-) diff --git a/docs/installation/docker.md b/docs/installation/docker.md index efc9685a9..25f12fe7f 100644 --- a/docs/installation/docker.md +++ b/docs/installation/docker.md @@ -4,10 +4,10 @@ This guide demonstrates how to build and run NetBox as a Docker container. It as To get NetBox up and running: -``` -git clone -b master https://github.com/digitalocean/netbox.git -cd netbox -docker-compose up -d +```shell +# git clone -b master https://github.com/digitalocean/netbox.git +# cd netbox +# docker-compose up -d ``` The application will be available on http://localhost/ after a few minutes. diff --git a/docs/installation/ldap.md b/docs/installation/ldap.md index 5a90ec5e3..2389464e7 100644 --- a/docs/installation/ldap.md +++ b/docs/installation/ldap.md @@ -7,19 +7,19 @@ built-in Django users in the event of a failure. On Ubuntu: -``` +```shell sudo apt-get install -y python-dev libldap2-dev libsasl2-dev libssl-dev ``` On CentOS: -``` +```shell sudo yum install -y python-devel openldap-devel ``` ## Install django-auth-ldap -``` +```shell sudo pip install django-auth-ldap ``` diff --git a/docs/installation/netbox.md b/docs/installation/netbox.md index 042943cce..5040a27dc 100644 --- a/docs/installation/netbox.md +++ b/docs/installation/netbox.md @@ -8,7 +8,7 @@ **CentOS/RHEL** -``` +```shell # yum install -y epel-release # yum install -y gcc python2 python-devel python-pip libxml2-devel libxslt-devel libffi-devel graphviz openssl-devel ``` @@ -19,7 +19,7 @@ You may opt to install NetBox either from a numbered release or by cloning the m Download the [latest stable release](https://github.com/digitalocean/netbox/releases) from GitHub as a tarball or ZIP archive and extract it to your desired path. In this example, we'll use `/opt/netbox`. -``` +```shell # wget https://github.com/digitalocean/netbox/archive/vX.Y.Z.tar.gz # tar -xzf vX.Y.Z.tar.gz -C /opt # cd /opt/ @@ -31,28 +31,27 @@ Download the [latest stable release](https://github.com/digitalocean/netbox/rele Create the base directory for the NetBox installation. For this guide, we'll use `/opt/netbox`. -``` -# mkdir -p /opt/netbox/ -# cd /opt/netbox/ +```shell +# mkdir -p /opt/netbox/ && cd /opt/netbox/ ``` If `git` is not already installed, install it: **Debian/Ubuntu** -``` +```shell # apt-get install -y git ``` **CentOS/RHEL** -``` +```shell # yum install -y git ``` Next, clone the **master** branch of the NetBox GitHub repository into the current directory: -``` +```shell # git clone -b master https://github.com/digitalocean/netbox.git . Cloning into '.'... remote: Counting objects: 1994, done. @@ -67,7 +66,7 @@ Checking connectivity... done. Install the required Python packages using pip. (If you encounter any compilation errors during this step, ensure that you've installed all of the system dependencies listed above.) -``` +```shell # pip install -r requirements.txt ``` @@ -75,7 +74,7 @@ Install the required Python packages using pip. (If you encounter any compilatio Move into the NetBox configuration directory and make a copy of `configuration.example.py` named `configuration.py`. -``` +```shell # cd netbox/netbox/ # cp configuration.example.py configuration.py ``` @@ -92,7 +91,7 @@ This is a list of the valid hostnames by which this server can be reached. You m Example: -``` +```python ALLOWED_HOSTS = ['netbox.example.com', '192.0.2.123'] ``` @@ -102,7 +101,7 @@ This parameter holds the database configuration details. You must define the use Example: -``` +```python DATABASE = { 'NAME': 'netbox', # Database name 'USER': 'netbox', # PostgreSQL username @@ -125,7 +124,7 @@ You may use the script located at `netbox/generate_secret_key.py` to generate a Before NetBox can run, we need to install the database schema. This is done by running `./manage.py migrate` from the `netbox` directory (`/opt/netbox/netbox/` in our example): -``` +```shell # cd /opt/netbox/netbox/ # ./manage.py migrate Operations to perform: @@ -144,7 +143,7 @@ If this step results in a PostgreSQL authentication error, ensure that the usern NetBox does not come with any predefined user accounts. You'll need to create a super user to be able to log into NetBox: -``` +```shell # ./manage.py createsuperuser Username: admin Email address: admin@example.com @@ -155,7 +154,7 @@ Superuser created successfully. # Collect Static Files -``` +```shell # ./manage.py collectstatic You have requested to collect static files at the destination @@ -176,7 +175,7 @@ NetBox ships with some initial data to help you get started: RIR definitions, co !!! note This step is optional. It's perfectly fine to start using NetBox without using this initial data if you'd rather create everything from scratch. -``` +```shell # ./manage.py loaddata initial_data Installed 43 object(s) from 4 fixture(s) ``` @@ -185,7 +184,7 @@ Installed 43 object(s) from 4 fixture(s) At this point, NetBox should be able to run. We can verify this by starting a development instance: -``` +```shell # ./manage.py runserver 0.0.0.0:8000 --insecure Performing system checks... diff --git a/docs/installation/postgresql.md b/docs/installation/postgresql.md index a4c898bad..71b62c7cc 100644 --- a/docs/installation/postgresql.md +++ b/docs/installation/postgresql.md @@ -4,27 +4,27 @@ NetBox requires a PostgreSQL database to store data. MySQL is not supported, as **Debian/Ubuntu** -``` +```shell # apt-get install -y postgresql libpq-dev python-psycopg2 ``` **CentOS/RHEL** -``` +```shell # yum install -y postgresql postgresql-server postgresql-devel python-psycopg2 # postgresql-setup initdb ``` If using CentOS, modify the PostgreSQL configuration to accept password-based authentication by replacing `ident` with `md5` for all host entries within `/var/lib/pgsql/data/pg_hba.conf`. For example: -``` +```text host all all 127.0.0.1/32 md5 host all all ::1/128 md5 ``` Then, start the service: -``` +```shell # systemctl start postgresql ``` @@ -35,7 +35,7 @@ At a minimum, we need to create a database for NetBox and assign it a username a !!! danger DO NOT USE THE PASSWORD FROM THE EXAMPLE. -``` +```shell # sudo -u postgres psql psql (9.3.13) Type "help" for help. @@ -51,7 +51,7 @@ postgres=# \q You can verify that authentication works issuing the following command and providing the configured password: -``` +```shell # psql -U netbox -h localhost -W ``` diff --git a/docs/installation/upgrading.md b/docs/installation/upgrading.md index 303915dc7..0d28b4eb2 100644 --- a/docs/installation/upgrading.md +++ b/docs/installation/upgrading.md @@ -8,7 +8,7 @@ Download the [latest stable release](https://github.com/digitalocean/netbox/rele Download and extract the latest version: -``` +```shell # wget https://github.com/digitalocean/netbox/archive/vX.Y.Z.tar.gz # tar -xzf vX.Y.Z.tar.gz -C /opt # cd /opt/ @@ -17,13 +17,13 @@ Download and extract the latest version: Copy the 'configuration.py' you created when first installing to the new version: -``` +```shell # cp /opt/netbox-X.Y.Z/netbox/netbox/configuration.py /opt/netbox/netbox/netbox/configuration.py ``` If you followed the original installation guide to set up gunicorn, be sure to copy its configuration as well: -``` +```shell # cp /opt/netbox-X.Y.Z/gunicorn_config.py /opt/netbox/gunicorn_config.py ``` @@ -31,7 +31,7 @@ If you followed the original installation guide to set up gunicorn, be sure to c This guide assumes that NetBox is installed at `/opt/netbox`. Pull down the most recent iteration of the master branch: -``` +```shell # cd /opt/netbox # git checkout master # git pull origin master @@ -42,7 +42,7 @@ This guide assumes that NetBox is installed at `/opt/netbox`. Pull down the most Once the new code is in place, run the upgrade script (which may need to be run as root depending on how your environment is configured). -``` +```shell # ./upgrade.sh ``` @@ -56,6 +56,6 @@ This script: Finally, restart the WSGI service to run the new code. If you followed this guide for the initial installation, this is done using `supervisorctl`: -``` +```shell # sudo supervisorctl restart netbox ``` diff --git a/docs/installation/web-server.md b/docs/installation/web-server.md index 559928888..35a5e8c5d 100644 --- a/docs/installation/web-server.md +++ b/docs/installation/web-server.md @@ -5,7 +5,7 @@ We'll set up a simple WSGI front end using [gunicorn](http://gunicorn.org/) for !!! info Only Debian/Ubuntu instructions are provided here, but the installation process for CentOS/RHEL does not differ much. Please consult the documentation for those distributions for details. -``` +```shell # apt-get install -y gunicorn supervisor ``` @@ -13,13 +13,13 @@ We'll set up a simple WSGI front end using [gunicorn](http://gunicorn.org/) for The following will serve as a minimal nginx configuration. Be sure to modify your server name and installation path appropriately. -``` +```shell # apt-get install -y nginx ``` Once nginx is installed, save the following configuration to `/etc/nginx/sites-available/netbox`. Be sure to replace `netbox.example.com` with the domain name or IP address of your installation. (This should match the value configured for `ALLOWED_HOSTS` in `configuration.py`.) -``` +```nginx server { listen 80; @@ -43,7 +43,7 @@ server { Then, delete `/etc/nginx/sites-enabled/default` and create a symlink in the `sites-enabled` directory to the configuration file you just created. -``` +```shell # cd /etc/nginx/sites-enabled/ # rm default # ln -s /etc/nginx/sites-available/netbox @@ -51,7 +51,7 @@ Then, delete `/etc/nginx/sites-enabled/default` and create a symlink in the `sit Restart the nginx service to use the new configuration. -``` +```shell # service nginx restart ``` @@ -59,13 +59,13 @@ To enable SSL, consider this guide on [securing nginx with Let's Encrypt](https: ## Option B: Apache -``` +```shell # apt-get install -y apache2 ``` Once Apache is installed, proceed with the following configuration (Be sure to modify the `ServerName` appropriately): -``` +```apache ProxyPreserveHost On @@ -90,7 +90,7 @@ Once Apache is installed, proceed with the following configuration (Be sure to m Save the contents of the above example in `/etc/apache2/sites-available/netbox.conf`, enable the `proxy` and `proxy_http` modules, and reload Apache: -``` +```shell # a2enmod proxy # a2enmod proxy_http # a2ensite netbox @@ -103,7 +103,7 @@ To enable SSL, consider this guide on [securing Apache with Let's Encrypt](https Save the following configuration file in the root netbox installation path (in this example, `/opt/netbox/`) as `gunicorn_config.py`. Be sure to verify the location of the gunicorn executable (e.g. `which gunicorn`) and to update the `pythonpath` variable if needed. If using CentOS/RHEL change the username from `www-data` to `nginx` or `apache`. -``` +```text command = '/usr/bin/gunicorn' pythonpath = '/opt/netbox/netbox' bind = '127.0.0.1:8001' @@ -115,7 +115,7 @@ user = 'www-data' Save the following as `/etc/supervisor/conf.d/netbox.conf`. Update the `command` and `directory` paths as needed. -``` +```text [program:netbox] command = gunicorn -c /opt/netbox/gunicorn_config.py netbox.wsgi directory = /opt/netbox/netbox/ @@ -124,7 +124,7 @@ user = www-data Then, restart the supervisor service to detect and run the gunicorn service: -``` +```shell # service supervisor restart ``` From d960481adb5232b63122dcdcddbdb5a7b576af4d Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Wed, 30 Nov 2016 12:07:51 -0500 Subject: [PATCH 09/20] Ditched syntax highlighting for shell commands --- docs/installation/docker.md | 2 +- docs/installation/ldap.md | 6 +++--- docs/installation/netbox.md | 26 +++++++++++++------------- docs/installation/postgresql.md | 12 ++++++------ docs/installation/upgrading.md | 12 ++++++------ docs/installation/web-server.md | 18 +++++++++--------- 6 files changed, 38 insertions(+), 38 deletions(-) diff --git a/docs/installation/docker.md b/docs/installation/docker.md index 25f12fe7f..00551a096 100644 --- a/docs/installation/docker.md +++ b/docs/installation/docker.md @@ -4,7 +4,7 @@ This guide demonstrates how to build and run NetBox as a Docker container. It as To get NetBox up and running: -```shell +```no-highlight # git clone -b master https://github.com/digitalocean/netbox.git # cd netbox # docker-compose up -d diff --git a/docs/installation/ldap.md b/docs/installation/ldap.md index 2389464e7..6a4994a5c 100644 --- a/docs/installation/ldap.md +++ b/docs/installation/ldap.md @@ -7,19 +7,19 @@ built-in Django users in the event of a failure. On Ubuntu: -```shell +```no-highlight sudo apt-get install -y python-dev libldap2-dev libsasl2-dev libssl-dev ``` On CentOS: -```shell +```no-highlight sudo yum install -y python-devel openldap-devel ``` ## Install django-auth-ldap -```shell +```no-highlight sudo pip install django-auth-ldap ``` diff --git a/docs/installation/netbox.md b/docs/installation/netbox.md index 5040a27dc..bb2297d96 100644 --- a/docs/installation/netbox.md +++ b/docs/installation/netbox.md @@ -8,7 +8,7 @@ **CentOS/RHEL** -```shell +```no-highlight # yum install -y epel-release # yum install -y gcc python2 python-devel python-pip libxml2-devel libxslt-devel libffi-devel graphviz openssl-devel ``` @@ -19,7 +19,7 @@ You may opt to install NetBox either from a numbered release or by cloning the m Download the [latest stable release](https://github.com/digitalocean/netbox/releases) from GitHub as a tarball or ZIP archive and extract it to your desired path. In this example, we'll use `/opt/netbox`. -```shell +```no-highlight # wget https://github.com/digitalocean/netbox/archive/vX.Y.Z.tar.gz # tar -xzf vX.Y.Z.tar.gz -C /opt # cd /opt/ @@ -31,7 +31,7 @@ Download the [latest stable release](https://github.com/digitalocean/netbox/rele Create the base directory for the NetBox installation. For this guide, we'll use `/opt/netbox`. -```shell +```no-highlight # mkdir -p /opt/netbox/ && cd /opt/netbox/ ``` @@ -39,19 +39,19 @@ If `git` is not already installed, install it: **Debian/Ubuntu** -```shell +```no-highlight # apt-get install -y git ``` **CentOS/RHEL** -```shell +```no-highlight # yum install -y git ``` Next, clone the **master** branch of the NetBox GitHub repository into the current directory: -```shell +```no-highlight # git clone -b master https://github.com/digitalocean/netbox.git . Cloning into '.'... remote: Counting objects: 1994, done. @@ -66,7 +66,7 @@ Checking connectivity... done. Install the required Python packages using pip. (If you encounter any compilation errors during this step, ensure that you've installed all of the system dependencies listed above.) -```shell +```no-highlight # pip install -r requirements.txt ``` @@ -74,7 +74,7 @@ Install the required Python packages using pip. (If you encounter any compilatio Move into the NetBox configuration directory and make a copy of `configuration.example.py` named `configuration.py`. -```shell +```no-highlight # cd netbox/netbox/ # cp configuration.example.py configuration.py ``` @@ -124,7 +124,7 @@ You may use the script located at `netbox/generate_secret_key.py` to generate a Before NetBox can run, we need to install the database schema. This is done by running `./manage.py migrate` from the `netbox` directory (`/opt/netbox/netbox/` in our example): -```shell +```no-highlight # cd /opt/netbox/netbox/ # ./manage.py migrate Operations to perform: @@ -143,7 +143,7 @@ If this step results in a PostgreSQL authentication error, ensure that the usern NetBox does not come with any predefined user accounts. You'll need to create a super user to be able to log into NetBox: -```shell +```no-highlight # ./manage.py createsuperuser Username: admin Email address: admin@example.com @@ -154,7 +154,7 @@ Superuser created successfully. # Collect Static Files -```shell +```no-highlight # ./manage.py collectstatic You have requested to collect static files at the destination @@ -175,7 +175,7 @@ NetBox ships with some initial data to help you get started: RIR definitions, co !!! note This step is optional. It's perfectly fine to start using NetBox without using this initial data if you'd rather create everything from scratch. -```shell +```no-highlight # ./manage.py loaddata initial_data Installed 43 object(s) from 4 fixture(s) ``` @@ -184,7 +184,7 @@ Installed 43 object(s) from 4 fixture(s) At this point, NetBox should be able to run. We can verify this by starting a development instance: -```shell +```no-highlight # ./manage.py runserver 0.0.0.0:8000 --insecure Performing system checks... diff --git a/docs/installation/postgresql.md b/docs/installation/postgresql.md index 71b62c7cc..e1d9a49ea 100644 --- a/docs/installation/postgresql.md +++ b/docs/installation/postgresql.md @@ -4,27 +4,27 @@ NetBox requires a PostgreSQL database to store data. MySQL is not supported, as **Debian/Ubuntu** -```shell +```no-highlight # apt-get install -y postgresql libpq-dev python-psycopg2 ``` **CentOS/RHEL** -```shell +```no-highlight # yum install -y postgresql postgresql-server postgresql-devel python-psycopg2 # postgresql-setup initdb ``` If using CentOS, modify the PostgreSQL configuration to accept password-based authentication by replacing `ident` with `md5` for all host entries within `/var/lib/pgsql/data/pg_hba.conf`. For example: -```text +```no-highlight host all all 127.0.0.1/32 md5 host all all ::1/128 md5 ``` Then, start the service: -```shell +```no-highlight # systemctl start postgresql ``` @@ -35,7 +35,7 @@ At a minimum, we need to create a database for NetBox and assign it a username a !!! danger DO NOT USE THE PASSWORD FROM THE EXAMPLE. -```shell +```no-highlight # sudo -u postgres psql psql (9.3.13) Type "help" for help. @@ -51,7 +51,7 @@ postgres=# \q You can verify that authentication works issuing the following command and providing the configured password: -```shell +```no-highlight # psql -U netbox -h localhost -W ``` diff --git a/docs/installation/upgrading.md b/docs/installation/upgrading.md index 0d28b4eb2..afb36f464 100644 --- a/docs/installation/upgrading.md +++ b/docs/installation/upgrading.md @@ -8,7 +8,7 @@ Download the [latest stable release](https://github.com/digitalocean/netbox/rele Download and extract the latest version: -```shell +```no-highlight # wget https://github.com/digitalocean/netbox/archive/vX.Y.Z.tar.gz # tar -xzf vX.Y.Z.tar.gz -C /opt # cd /opt/ @@ -17,13 +17,13 @@ Download and extract the latest version: Copy the 'configuration.py' you created when first installing to the new version: -```shell +```no-highlight # cp /opt/netbox-X.Y.Z/netbox/netbox/configuration.py /opt/netbox/netbox/netbox/configuration.py ``` If you followed the original installation guide to set up gunicorn, be sure to copy its configuration as well: -```shell +```no-highlight # cp /opt/netbox-X.Y.Z/gunicorn_config.py /opt/netbox/gunicorn_config.py ``` @@ -31,7 +31,7 @@ If you followed the original installation guide to set up gunicorn, be sure to c This guide assumes that NetBox is installed at `/opt/netbox`. Pull down the most recent iteration of the master branch: -```shell +```no-highlight # cd /opt/netbox # git checkout master # git pull origin master @@ -42,7 +42,7 @@ This guide assumes that NetBox is installed at `/opt/netbox`. Pull down the most Once the new code is in place, run the upgrade script (which may need to be run as root depending on how your environment is configured). -```shell +```no-highlight # ./upgrade.sh ``` @@ -56,6 +56,6 @@ This script: Finally, restart the WSGI service to run the new code. If you followed this guide for the initial installation, this is done using `supervisorctl`: -```shell +```no-highlight # sudo supervisorctl restart netbox ``` diff --git a/docs/installation/web-server.md b/docs/installation/web-server.md index 35a5e8c5d..10cc4992f 100644 --- a/docs/installation/web-server.md +++ b/docs/installation/web-server.md @@ -5,7 +5,7 @@ We'll set up a simple WSGI front end using [gunicorn](http://gunicorn.org/) for !!! info Only Debian/Ubuntu instructions are provided here, but the installation process for CentOS/RHEL does not differ much. Please consult the documentation for those distributions for details. -```shell +```no-highlight # apt-get install -y gunicorn supervisor ``` @@ -13,7 +13,7 @@ We'll set up a simple WSGI front end using [gunicorn](http://gunicorn.org/) for The following will serve as a minimal nginx configuration. Be sure to modify your server name and installation path appropriately. -```shell +```no-highlight # apt-get install -y nginx ``` @@ -43,7 +43,7 @@ server { Then, delete `/etc/nginx/sites-enabled/default` and create a symlink in the `sites-enabled` directory to the configuration file you just created. -```shell +```no-highlight # cd /etc/nginx/sites-enabled/ # rm default # ln -s /etc/nginx/sites-available/netbox @@ -51,7 +51,7 @@ Then, delete `/etc/nginx/sites-enabled/default` and create a symlink in the `sit Restart the nginx service to use the new configuration. -```shell +```no-highlight # service nginx restart ``` @@ -59,7 +59,7 @@ To enable SSL, consider this guide on [securing nginx with Let's Encrypt](https: ## Option B: Apache -```shell +```no-highlight # apt-get install -y apache2 ``` @@ -90,7 +90,7 @@ Once Apache is installed, proceed with the following configuration (Be sure to m Save the contents of the above example in `/etc/apache2/sites-available/netbox.conf`, enable the `proxy` and `proxy_http` modules, and reload Apache: -```shell +```no-highlight # a2enmod proxy # a2enmod proxy_http # a2ensite netbox @@ -103,7 +103,7 @@ To enable SSL, consider this guide on [securing Apache with Let's Encrypt](https Save the following configuration file in the root netbox installation path (in this example, `/opt/netbox/`) as `gunicorn_config.py`. Be sure to verify the location of the gunicorn executable (e.g. `which gunicorn`) and to update the `pythonpath` variable if needed. If using CentOS/RHEL change the username from `www-data` to `nginx` or `apache`. -```text +```no-highlight command = '/usr/bin/gunicorn' pythonpath = '/opt/netbox/netbox' bind = '127.0.0.1:8001' @@ -115,7 +115,7 @@ user = 'www-data' Save the following as `/etc/supervisor/conf.d/netbox.conf`. Update the `command` and `directory` paths as needed. -```text +```no-highlight [program:netbox] command = gunicorn -c /opt/netbox/gunicorn_config.py netbox.wsgi directory = /opt/netbox/netbox/ @@ -124,7 +124,7 @@ user = www-data Then, restart the supervisor service to detect and run the gunicorn service: -```shell +```no-highlight # service supervisor restart ``` From b275009544be0c5b61255487f8131122b9c483d8 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Wed, 30 Nov 2016 12:10:46 -0500 Subject: [PATCH 10/20] Fixed missing on command block --- docs/installation/netbox.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/installation/netbox.md b/docs/installation/netbox.md index bb2297d96..5b673e845 100644 --- a/docs/installation/netbox.md +++ b/docs/installation/netbox.md @@ -2,7 +2,7 @@ **Debian/Ubuntu** -``` +```no-highlight # apt-get install -y python2.7 python-dev python-pip libxml2-dev libxslt1-dev libffi-dev graphviz libpq-dev libssl-dev ``` From dc88cb5ac790c9d28ec42e32e4d0bfe4c521279e Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Thu, 1 Dec 2016 14:54:20 -0500 Subject: [PATCH 11/20] Fixes #718: Restore is_primary field on IP assignment form --- netbox/templates/dcim/ipaddress_assign.html | 3 ++- netbox/templates/ipam/ipaddress_assign.html | 20 ++++++++++++++++++-- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/netbox/templates/dcim/ipaddress_assign.html b/netbox/templates/dcim/ipaddress_assign.html index 538023d08..533317baf 100644 --- a/netbox/templates/dcim/ipaddress_assign.html +++ b/netbox/templates/dcim/ipaddress_assign.html @@ -1,7 +1,7 @@ {% extends '_base.html' %} {% load form_helpers %} -{% block title %}Assign an IP Address{% endblock %} +{% block title %}Assign a New IP Address{% endblock %} {% block content %}
@@ -40,6 +40,7 @@ {% render_field form.interface %} + {% render_field form.set_as_primary %}
diff --git a/netbox/templates/ipam/ipaddress_assign.html b/netbox/templates/ipam/ipaddress_assign.html index 4143dc3ee..10a582a2f 100644 --- a/netbox/templates/ipam/ipaddress_assign.html +++ b/netbox/templates/ipam/ipaddress_assign.html @@ -2,7 +2,7 @@ {% load static from staticfiles %} {% load form_helpers %} -{% block title %}Assign IP Address{% endblock %} +{% block title %}Assign an IP Address{% endblock %} {% block content %} @@ -19,9 +19,25 @@ {% endif %}
- Assign IP Address {{ ipaddress }} ({% if ipaddress.vrf %}VRF {{ ipaddress.vrf }}{% else %}Global Table{% endif %}) + Assign an IP Address
+
+ +
+

{{ ipaddress }}

+
+ +
+

+ {% if ipaddress.vrf %} + {{ ipaddress.vrf }} ({{ ipaddress.vrf.rd }}) + {% else %} + Global + {% endif %} +

+
+