Compare commits

..

17 Commits

Author SHA1 Message Date
Jeremy Stretch
7f353e88c9 Merge pull request #153 from digitalocean/develop
Release v1.0.7
2016-06-30 18:20:32 -04:00
Jeremy Stretch
2829303c74 Issue #140: Fixed Unicode bug in message (ObjectEditView) 2016-06-30 18:04:14 -04:00
Jeremy Stretch
c9bf10421b Fixes #136: Trigger error on prefix w/host bits set instead of silently converting it 2016-06-30 17:13:55 -04:00
Jeremy Stretch
d2bcd71b32 Fixes #143: Noted that the lowest occupied U is used for mounting multi-U devices 2016-06-30 16:19:48 -04:00
Jeremy Stretch
3ea12c646a Fixes #109: Hide navbar for anonymous users when LOGIN_REQUIRED = True 2016-06-30 16:02:18 -04:00
Jeremy Stretch
381639d4a7 Wrapped pip updates inside sudo 2016-06-30 14:59:52 -04:00
Jeremy Stretch
cf17088b0a Merge pull request #145 from ryanmerolle/patch-1
standardized app installation commands
2016-06-30 14:38:31 -04:00
ryanmerolle
a165445808 Update getting-started.md 2016-06-30 13:11:43 -04:00
ryanmerolle
66d8c27b1e standardized app installation commands
* Standardized all install commands to use sudo & -y to avoid new user confusion.
* Added required missing installation (apache2 missing in Web Server and gunicorn section)
* Consolidated installs for a section to follow same format (Web Server and gunicorn section nginx)
* Added missing install argument when installing the arbitrary precision calculator language.
2016-06-30 13:02:06 -04:00
Jeremy Stretch
85f3324d97 Fixes #141: Removed invalid character 2016-06-30 11:39:25 -04:00
Jeremy Stretch
a010a6dde5 Corrected instruction for cloning the repo 2016-06-29 23:49:59 -04:00
Jeremy Stretch
1c49909e2c Fixed typo 2016-06-29 23:16:16 -04:00
Jeremy Stretch
019daf5524 Fixes #135: Add button to toggle navbar on small screens 2016-06-29 22:51:10 -04:00
Jeremy Stretch
519ab21ba0 Version bump for next release 2016-06-29 17:48:11 -04:00
Jeremy Stretch
26286b6e36 Merge pull request #125 from digitalocean/develop
Release v1.0.6
2016-06-29 17:43:40 -04:00
Jeremy Stretch
c93bc40479 Merge pull request #106 from digitalocean/develop
Release v1.0.5
2016-06-29 10:00:46 -04:00
Jeremy Stretch
2ddb4b90c5 Merge pull request #85 from digitalocean/develop
Release v1.0.4
2016-06-28 12:17:12 -04:00
9 changed files with 47 additions and 27 deletions

View File

@@ -59,12 +59,12 @@ Note that assignment of components from templates occurs only at the time of dev
# Devices
Every piece of hardware which is installed within a rack exists in NetBox as a device. Devices are measured in rack units (U) and whether they are full depth. 0U devices which can be installed in a rack but don't consume vertical rack space (such as a vertically-mounted power distribution unit) can also be defined.
Every piece of hardware which is installed within a rack exists in NetBox as a device. Devices are measured in rack units (U) and depth. 0U devices which can be installed in a rack but don't consume vertical rack space (such as a vertically-mounted power distribution unit) can also be defined.
When assigning a multi-U device to a rack, it is considered to be mounted in the lowest-numbered rack unit which it occupies. For example, a 3U device which occupies U8 through U10 shows as being mounted in U8.
A device is said to be "full depth" if its installation on one rack face prevents the installation of any other device on the opposite face within the same rack unit(s). This could be either because the device is physically too deep to allow a device behind it, or because the installation of an opposing device would impede air flow.
Each device has a physical device type (make and model), which is discussed below.
### Roles
NetBox allows for the definition of arbitrary device roles by which devices can be organized. For example, you might create roles for core switches, distribution switches, and access switches. In the interest of simplicity, device can only belong to one device role.

View File

@@ -15,7 +15,7 @@ The following packages are needed to install PostgreSQL:
* python-psycopg2
```
# apt-get install postgresql libpq-dev python-psycopg2
# sudo apt-get install -y postgresql libpq-dev python-psycopg2
```
## Configuration
@@ -61,7 +61,7 @@ NetBox requires following dependencies:
* graphviz
```
# apt-get install python2.7 python-dev git python-pip libxml2-dev libxslt1-dev libffi-dev graphviz
# sudo apt-get install -y python2.7 python-dev git python-pip libxml2-dev libxslt1-dev libffi-dev graphviz
```
You may opt to install NetBox either from a numbered release or by cloning the master branch of its repository on GitHub.
@@ -90,13 +90,13 @@ Create the base directory for the NetBox installation. For this guide, we'll use
If `git` is not already installed, install it:
```
# sudo apt-get install git
# sudo apt-get install -y git
```
Next, clone the NetBox git repository into the current directory:
Next, clone the **master** branch of the NetBox GitHub repository into the current directory:
```
# git clone https://github.com/digitalocean/netbox.git .
# git clone -b master https://github.com/digitalocean/netbox.git .
Cloning into '.'...
remote: Counting objects: 1994, done.
remote: Compressing objects: 100% (150/150), done.
@@ -111,7 +111,7 @@ Checking connectivity... done.
Install the necessary Python packages using pip. (If you encounter any compilation errors during this step, ensure that you've installed all of the required dependencies.)
```
# pip install -r requirements.txt
# sudo pip install -r requirements.txt
```
## Configuration
@@ -166,6 +166,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):
```
# cd /opt/netbox/netbox/
# ./manage.py migrate
Operations to perform:
Apply all migrations: dcim, sessions, admin, ipam, utilities, auth, circuits, contenttypes, extras, secrets, users
@@ -234,7 +235,7 @@ If the test service does not run, or you cannot reach the NetBox home page, some
We'll set up a simple HTTP front end using [gunicorn](http://gunicorn.org/) for the purposes of this guide. For web servers, we provide example configurations for both [nginx](https://www.nginx.com/resources/wiki/) and [Apache](http://httpd.apache.org/docs/2.4). (You are of course free to use whichever combination of HTTP and WSGI services you'd like.) We'll also use [supervisord](http://supervisord.org/) for service persistence.
```
# apt-get install gunicorn supervisor
# sudo apt-get install -y gunicorn supervisor
```
## nginx Configuration
@@ -242,7 +243,7 @@ We'll set up a simple HTTP 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.
```
# apt-get install nginx
# sudo apt-get install -y nginx
```
Once nginx is installed, proceed with the following configuration:
@@ -285,7 +286,11 @@ Restart the nginx service to use the new configuration.
```
## Apache Configuration
The following configuration should work for Apache. Be sure to modify the `ServerName` appropriately.
```
# sudo apt-get install -y apache2
```
Once Apache is installed, proceed with the following configuration (Be sure to modify the `ServerName` appropriately):
```
<VirtualHost *:80>
@@ -321,7 +326,7 @@ Save the contents of the above example in `/etc/apache2/sites-available/netbox.c
## gunicorn Configuration
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.
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.
```
command = '/usr/bin/gunicorn'
@@ -357,10 +362,10 @@ Please keep in mind that the configurations provided here are bare minimums requ
To add SSL support to the installation we'll start by installing the arbitrary precision calculator language.
```
# sudo apt-get -y bc
# sudo apt-get install -y bc
```
Next we'll clone Lets Encrypt in to /opt
Next we'll clone Let's Encrypt into /opt/:
```
# sudo git clone https://github.com/letsencrypt/letsencrypt /opt/letsencrypt

View File

@@ -326,10 +326,10 @@ class DeviceForm(forms.ModelForm, BootstrapMixin):
display_field='display_name',
attrs={'filter-for': 'position'}
))
position = forms.TypedChoiceField(required=False, empty_value=None, widget=APISelect(
api_url='/api/dcim/racks/{{rack}}/rack-units/?face={{face}}',
disabled_indicator='device',
))
position = forms.TypedChoiceField(required=False, empty_value=None,
help_text="For multi-U devices, this is the lowest occupied rack unit.",
widget=APISelect(api_url='/api/dcim/racks/{{rack}}/rack-units/?face={{face}}',
disabled_indicator='device'))
manufacturer = forms.ModelChoiceField(queryset=Manufacturer.objects.all(),
widget=forms.Select(attrs={'filter-for': 'device_type'}))
device_type = forms.ModelChoiceField(queryset=DeviceType.objects.all(), label='Model', widget=APISelect(

View File

@@ -10,7 +10,13 @@ from .lookups import (
)
def prefix_validator(prefix):
if prefix.ip != prefix.cidr.ip:
raise ValidationError("{} is not a valid prefix. Did you mean {}?".format(prefix, prefix.cidr))
class BaseIPField(models.Field):
default_validators = [prefix_validator]
def python_type(self):
return IPNetwork

View File

@@ -11,7 +11,7 @@ except ImportError:
"the documentation.")
VERSION = '1.0.6'
VERSION = '1.0.7'
# Import local configuration
for setting in ['ALLOWED_HOSTS', 'DATABASE', 'SECRET_KEY']:

View File

@@ -13,9 +13,16 @@
<nav class="navbar navbar-default navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/">NetBox</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
{% if request.user.is_authenticated or not settings.LOGIN_REQUIRED %}
<ul class="nav navbar-nav">
<li class="dropdown{% if request.path|startswith:'/dcim/sites/' %} active{% endif %}">
{% if perms.dcim.add_site %}
@@ -201,11 +208,12 @@
</li>
{% endif %}
</ul>
{% endif %}
<ul class="nav navbar-nav navbar-right">
{% if request.user.is_staff %}
<li><a href="{% url 'admin:index' %}"><i class="glyphicon glyphicon-cog" aria-hidden="true"></i> Admin</a></li>
{% endif %}
{% if request.user.is_authenticated %}
{% if request.user.is_staff %}
<li><a href="{% url 'admin:index' %}"><i class="glyphicon glyphicon-cog" aria-hidden="true"></i> Admin</a></li>
{% endif %}
<li><a href="{% url 'users:profile' %}"><i class="glyphicon glyphicon-user" aria-hidden="true"></i> Profile</a></li>
<li><a href="{% url 'logout' %}"><i class="glyphicon glyphicon-log-out" aria-hidden="true"></i> Log out</a></li>
{% else %}

View File

@@ -68,7 +68,7 @@
</tr>
<tr>
<td>Position (U)</td>
<td>Numeric rack position (optional)</td>
<td>Lowest rack unit occupied by the device (optional)</td>
<td>21</td>
</tr>
<tr>

View File

@@ -137,9 +137,9 @@ class ObjectEditView(View):
msg = 'Created ' if obj_created else 'Modified '
msg += self.model._meta.verbose_name
if hasattr(obj, 'get_absolute_url'):
msg += ' <a href="{}">{}</a>'.format(obj.get_absolute_url(), obj)
msg = '{} <a href="{}">{}</a>'.format(msg, obj.get_absolute_url(), obj)
else:
msg += ' {}'.format(obj)
msg = '{} {}'.format(msg, obj)
messages.success(request, msg)
if obj_created:
UserAction.objects.log_create(request.user, obj, msg)

View File

@@ -6,7 +6,8 @@
# gunicorn or uWSGI).
# Install any new Python packages
pip install -r requirements.txt --upgrade
echo "Updating required Python packages (pip install -r requirements.txt --upgrade)..."
sudo pip install -r requirements.txt --upgrade
# Apply any database migrations
./netbox/manage.py migrate