Skip to content

Commit

Permalink
docs: 📝 Replace text with bash for CLI snippets
Browse files Browse the repository at this point in the history
  • Loading branch information
jdrew82 committed Feb 1, 2024
1 parent c1b268c commit b426e56
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 28 deletions.
28 changes: 14 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ Each command can be executed with a simple `invoke <command>`. Each command also

## Manage Nautobot environment

```text
```bash
build Build all docker images.
debug Start Nautobot and its dependencies in debug mode.
destroy Destroy all containers and volumes.
Expand All @@ -89,7 +89,7 @@ Each command can be executed with a simple `invoke <command>`. Each command also

## Utility

```text
```bash
cli Launch a bash shell inside the running Nautobot container.
migrate Run database migrations in Django.
nbshell Launch a nbshell session.
Expand All @@ -99,7 +99,7 @@ Each command can be executed with a simple `invoke <command>`. Each command also

If you want to use MySQL for the database instead of PostgreSQL, perform the below step in place for step #7 below:

```text
```bash
cp invoke.mysql.yml invoke.yml
invoke build start
```
Expand All @@ -111,45 +111,45 @@ invoke build start
1. Have [Docker](https://docs.docker.com/get-docker/) installed on the host.
2. Clone this repository to your Nautobot host into the current user directory.

```text
```bash
git clone https://github.com/nautobot/nautobot-docker-compose.git
```

3. Navigate to the new directory from the git clone.

```text
```bash
cd nautobot-docker-compose
```

4. Copy the `local.env.example` file to `local.env` and `creds.example.env` file to `creds.env` in the environments folder.

```text
```bash
cp environments/local.example.env environments/local.env
cp environments/creds.example.example environments/creds.env
```

5. Update the `.env` files for your environment. **THESE SHOULD BE CHANGED** for proper security and the `creds.env` file should never be synchronized to git as it should contain all secrets for the environment!

```text
```bash
vi environments/local.env
vi environments/creds.env
```

6. Update the `local.env` and `creds.env` files to be only available for the current user.

```text
```bash
chmod 0600 environments/local.env environments/creds.env
```

7. Copy the `invoke.example.yml` file to `invoke.yml`:

```text
```bash
cp invoke.example.yml invoke.yml
```

7. Run `invoke build start` to build the containers and start the environment.

```text
```bash
invoke build start
```

Expand All @@ -173,13 +173,13 @@ After the containers have started:

1. Verify the containers are running:

```text
```bash
docker container ls
```

Example Output:

```text
```bash
❯ docker container ls
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
143f10daa229 networktocode/nautobot:latest "nautobot-server rqw…" 2 minutes ago Up 2 minutes (healthy) nautobot-docker-compose_celery_worker_1
Expand All @@ -190,13 +190,13 @@ ad57ac1749b3 redis:alpine "docker-entrypoint.s…" 2 minu

2. Execute Create Super User Command and follow the prompts

```text
```bash
invoke createsuperuser
```

Example Prompts:

```text
```bash
nautobot@bb29124d7acb:~$ invoke createsuperuser
Username: administrator
Email address:
Expand Down
12 changes: 8 additions & 4 deletions docs/create_ssl_cert.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ If you do not have your own self signed certificate, you may generate them by us
OpenSSL is included with many UNIX operating systems, but may need to be installed on your system first.
Check to see if OpenSSL is installed on your system
```
```bash
user@ntc# openssl version
LibreSSL 2.8.3
```
Expand All @@ -37,12 +38,14 @@ If you do not have OpenSSL installed, please follow the [installation guidelines
#### Example Self Sign Cert

Once OpenSSL is installed, run the following command to generate the certificates.
```

```bash
sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout ./environments/nautobot.key -out ./environments/nautobot.crt
```

You will be prompted with information to fill out for your certificate.
```

```bash
Country Name (2 letter code) [AU]:US
State or Province Name (full name) [Some-State]:New York
Locality Name (eg, city) []:New York City
Expand All @@ -53,7 +56,8 @@ Email Address []:admin@your_domain.com
```

Finally, ensure your newly generated certificates are in the correct location.
```

```bash
user@ntc# ls ./environments/
nautobot.crt nautobot.key
```
10 changes: 5 additions & 5 deletions docs/ldap.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ The LDAP container image has a different base image than the primary Docker file

2. Copy the LDAP configuration file from `config/nautobot_config.py.ldap` to `config/nautobot_config.py`

```text
```bash
cp config/nautobot_config.py.ldap config/nautobot_config.py
```

3. Update settings in the LDAP configuration to match your environment, based on the documentation from [Nautobot docs](https://nautobot.readthedocs.io)

```text
```bash
vi config/nautobot_config.py
```

Expand All @@ -24,18 +24,18 @@ vi config/nautobot_config.py
* NAUTOBOT_AUTH_LDAP_BIND_DN
* NAUTOBOT_AUTH_LDAP_BIND_PASSWORD

```text
```bash
vi local.env
```

5. Build your containers and ensure that the LDAP packages are installed:

```text
```bash
invoke build --no-cache
```

6. Assuming that your containers are not already running, you'll want to start them:

```text
```bash
invoke start
```
10 changes: 5 additions & 5 deletions docs/plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,33 @@ To add plugins you will need to build a custom container with the plugin(s) inst
1. Follow the steps in the README to create your Poetry environment and ensure you can build a container.
2. To add a specific plugin to your environment with Poetry, you simply need to use the `poetry add` command. For example, to add the Golden Configuration plugin you would do the following:

```text
```bash
poetry add nautobot-device-onboarding
```

3. This command should automatically trigger Poetry to see the versions you've specified for Nautobot and your other dependencies in the `pyproject.toml` file and find the most compatible version that is within the limits of the versions defined in your `pyproject.toml`. If you wish to use a specific version you can append that to the command like so:

```text
```bash
poetry add nautobot-device-onboarding==3.0.1
```

If for some reason this version doesn't conform to the limits set in your `pyproject.toml` you will need to modify the versions specified by your other dependencies. Poetry should provide some feedback at the command prompt once you've issued the add command if there are limits that restrict you from using that version. Poetry should also update your `poetry.lock` file with the specific pinned version of that plugin.

4. Once your `poetry.lock` file is updated by Poetry you will need to update the file `config/nautobot_config.py` settings of `PLUGINS` and `PLUGINS_CONFIG` to match your configuration updates for the plugins (PLUGINS_CONFIG is optional, if not adjusting from the default settings). See the [example PLUGIN configuration](#nautobot-configuration).

```text
```bash
vi config/nautobot_config.py
```

5. Finally, you should simply need to rebuild your containers with an `invoke build --no-cache` to build the new custom container.

```text
```bash
invoke build --no-cache
```

6. Once your new containers are built you should simply need to start them if not already started, or restart them with the following:

```text
```bash
invoke stop start
```

Expand Down

0 comments on commit b426e56

Please sign in to comment.