Fork me on GitHub

Herr Knedel/Kapsayıcılarla harika şeyler: Synology üzerinde Netbox - Diskstation

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

330 Words

NetBox, bilgisayar ağı yönetimi için kullanılan ücretsiz bir yazılımdır. Bugün Synology DiskStation üzerinde bir Netbox hizmetinin nasıl kurulacağını gösteriyorum.

Adım 1: Synology’yi Hazırlayın

İlk olarak, DiskStation üzerinde SSH oturum açma etkinleştirilmelidir. Bunu yapmak için, “Denetim Masası” > “Terminal

Ardından “SSH”, belirtilen bağlantı noktası ve yönetici parolası ile oturum açabilirsiniz (Windows kullanıcıları Putty veya WinSCP kullanır). Terminal, winSCP veya Putty ile oturum açıyorum ve bu konsolu daha sonra kullanmak üzere açık bırakıyorum.

Adım 2: NETBOX klasörü oluşturun

Docker dizininde “netbox” adında yeni bir dizin oluşturuyorum.

Şimdi aşağıdaki dosya indirilmeli ve dizinde açılmalıdır: https://github.com/netbox-community/netbox-docker/archive/refs/heads/release.zip. Bunun için konsolu kullanıyorum:
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

Ardından “docker/docker-compose.yml” dosyasını düzenliyorum ve Synology adreslerimi “netbox-media-files”, “netbox-postgres-data” ve “netbox-redis-data “ya giriyorum:

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


Mirasın “« olması çok önemlidir: *netbox” değiştirilir ve “netbox” için bir port girilir. Bundan sonra Compose dosyasını başlatabilirim:

x
+
Terminal

$ sudo docker-compose up

Veritabanını oluşturmak biraz zaman alabilir. Davranış, konteyner detayları aracılığıyla gözlemlenebilir. Synology IP adresi ve konteyner portum ile netbox sunucusunu çağırıyorum.