network_inventory/README.md

56 lines
2.3 KiB
Markdown
Raw Normal View History

2019-06-10 20:59:46 +02:00
# network_inventory
2022-02-07 21:45:48 +01:00
[![.github/workflows/publish.yml](https://github.com/Nebucatnetzer/network_inventory/actions/workflows/publish.yml/badge.svg?branch=master)](https://github.com/Nebucatnetzer/network_inventory/actions/workflows/publish.yml)
2020-01-07 18:16:29 +01:00
2019-06-10 20:59:46 +02:00
I started this project in order to have solution for keeping an
inventory over my various servers and other network equipment.
2020-07-04 11:59:51 +02:00
## Production Setup
2019-06-10 20:59:46 +02:00
1. Clone the repository
2020-07-04 11:59:51 +02:00
2. Copy the `.env-example` file to `.env` and change the `POSTGRES_PASSWORD`
2020-02-15 15:25:54 +01:00
and `DJANGO_SECRET_KEY` variables to something secure.
2020-07-04 11:59:51 +02:00
3. Run `docker-compose up` and connect to http://localhost
2019-07-13 15:25:32 +02:00
2022-11-27 16:31:16 +01:00
## Development Setup
2020-04-27 22:43:14 +02:00
2022-11-27 16:31:16 +01:00
There are two ways to work on this project.
For the first one you will need to install the Nix package manager[^1].
Afterwards you can enter the development environment with `nix develop`.
2020-04-27 22:43:14 +02:00
2022-11-27 16:31:16 +01:00
For the other way you have to install poetry[^2] and then run `poetry shell` to
enter the virtual environment.
2019-06-10 20:59:46 +02:00
2022-11-27 16:31:16 +01:00
Please note that I will only use and test the first method.
2020-04-27 22:43:14 +02:00
2022-11-27 16:31:16 +01:00
[^1]: https://nixos.org/download.html
[^2]: https://python-poetry.org
2019-06-10 20:59:46 +02:00
2022-11-27 16:31:16 +01:00
After you've entered the development environment with either method you can
2022-12-12 21:42:00 +01:00
start the server. With the nix version you can start it with `dev run`. With
poetry `./dev.sh run`. This will start a PostgreSQL database running inside a
docker container and start the Django development server. You can then access
2023-03-07 21:12:17 +01:00
it in the browser under the FQDN of your computer. E.g.
`http://mypc.domain.local:8000`. Run the `dev` command without an argument to
see all options.
2022-11-27 16:31:16 +01:00
## Environment Variables
To customise the application in the Docker container you can use environment
variables in the docker-compose.yml file. Currently the following variables are
supported.
- **DJANGO_SECRET_KEY** the secret key is mandatory, otherwise the application
doesn't run. Make sure that it is some long random string.
- **DJANGO_DEBUG** settings this variable to any value enables the Django debug
mode. Make sure that you don't set it on a production server.
- **DJANGO_SETTINGS_MODULE** the path to the settings file to use in the
container. This requires a dotet syntax. The default is
`network_inventory.settings.docker`.
2020-04-27 22:45:40 +02:00
## Documentation
Currently there isn't a lot of documentation present. I try to document my
thoughts and other related information in the [Notes
2020-04-27 22:45:40 +02:00
file](./docs/notes.org).