Fork me on GitHub

Herr Knedel/Hal-hal hebat dengan kontainer: Netbox pada Synology - Diskstation

Created Sun, 25 Apr 2021 09:28:11 +0100 Modified Sat, 01 Oct 2022 10:38:36 +0000 Schwierigkeitsgrad: Es kann etwas länger dauern

349 Words

NetBox adalah perangkat lunak gratis yang digunakan untuk manajemen jaringan komputer. Hari ini saya menunjukkan cara menginstal layanan Netbox pada Synology DiskStation.

Langkah 1: Siapkan Synology

Pertama, login SSH harus diaktifkan pada DiskStation. Untuk melakukan ini, buka “Control Panel” > “Terminal

Kemudian Anda bisa log masuk melalui “SSH”, port yang ditentukan dan kata sandi administrator (pengguna Windows menggunakan Putty atau WinSCP). Saya log masuk melalui Terminal, winSCP atau Putty dan membiarkan konsol ini terbuka untuk nanti.

Langkah 2: Buat folder NETBOX

Saya membuat direktori baru yang disebut “netbox” di direktori Docker.

Sekarang file berikut ini harus diunduh dan dibongkar di direktori: https://github.com/netbox-community/netbox-docker/archive/refs/heads/release.zip. Saya menggunakan konsol untuk ini:
x
+
Terminal

$ cd /volume1/docker/netbox/
$ sudo wget https://github.com/netbox-community/netbox-docker/archive/refs/heads/release.zip
$ sudo /bin/7z x release.zip
$ cd netbox-docker-release
$ sudo mkdir netbox-media-files
$ sudo mkdir netbox-redis-data
$ sudo mkdir netbox-postgres-data

Kemudian saya mengedit file “docker/docker-compose.yml” dan memasukkan alamat Synology saya di “netbox-media-files”, “netbox-postgres-data” dan “netbox-redis-data”:

version: '3.4'
services:
  netbox: 
    image: netboxcommunity/netbox:${VERSION-v3.1-1.6.0}
    depends_on:
    - postgres
    - redis
    - redis-cache
    - netbox-worker
    env_file: env/netbox.env
    user: 'unit:root'
    volumes:
    - ./startup_scripts:/opt/netbox/startup_scripts:z,ro
    - ./initializers:/opt/netbox/initializers:z,ro
    - ./configuration:/etc/netbox/config:z,ro
    - ./reports:/etc/netbox/reports:z,ro
    - ./scripts:/etc/netbox/scripts:z,ro
    - ./netbox-media-files:/opt/netbox/netbox/media:z
    ports:
    - "8097:8080"
    
  netbox-worker:
    image: netboxcommunity/netbox:${VERSION-v3.1-1.6.0}
    env_file: env/netbox.env
    user: 'unit:root'
    depends_on:
    - redis
    - postgres
    command:
    - /opt/netbox/venv/bin/python
    - /opt/netbox/netbox/manage.py
    - rqworker

  netbox-housekeeping:
    image: netboxcommunity/netbox:${VERSION-v3.1-1.6.0}
    env_file: env/netbox.env
    user: 'unit:root'
    depends_on:
    - redis
    - postgres
    command:
    - /opt/netbox/housekeeping.sh

  # postgres
  postgres:
    image: postgres:14-alpine
    env_file: env/postgres.env
    volumes:
    - ./netbox-postgres-data:/var/lib/postgresql/data

  # redis
  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
    env_file: env/redis.env
    volumes:
    - ./netbox-redis-data:/data

  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
    env_file: env/redis-cache.env


Sangat penting bahwa pewarisan “«: *netbox” diganti dan port untuk “netbox” dimasukkan. Setelah itu saya dapat memulai file Compose:

x
+
Terminal

$ sudo docker-compose up

Mungkin perlu waktu untuk membuat database. Perilaku ini bisa diamati melalui detail container. Saya memanggil server netbox dengan alamat IP Synology dan port container saya.