Installing Nytrio using Docker

Installing Nytrio using Docker is the simplest way. The following procedure is the same for all Linux distributions that support Docker.


Installing Docker

First, you'll need to install Docker components. You can find Docker installation procedure here according to your host system distribution. You may need to install Docker-compose also if you wish to use docker-compose solution (Install docker-compose).


Running Nytrio using Docker-compose

Pick up the following template and save it to a docker-compose.yml file.

copy
version: '3.3'

services:
  database:
    image: mariadb
    restart: always
    networks:
      - nytrio-net
    environment:
      - MYSQL_RANDOM_ROOT_PASSWORD=1
      - MYSQL_DATABASE=nytrio
      - MYSQL_USER=nytrio
      - MYSQL_PASSWORD=password
  nytrio:
    image: nytrio/nytrio
    restart: always
    hostname: nytrio
    networks:
      - nytrio-net
    environment:
      - WAIT_HOSTS=database:3306
      - NYTRIO_INSTALL_DB_HOST=database
      - NYTRIO_INSTALL_DB_PORT=3306
      - NYTRIO_INSTALL_DB_USER=nytrio
      - NYTRIO_INSTALL_DB_PWD=password
      - NYTRIO_INSTALL_DB_NAME=nytrio
      - NYTRIO_INSTALL_ROOT_PW=password
      - NYTRIO_INSTALL_ORGANIZATION=Nytrio solutions
      - NYTRIO_INSTALL_PUBLIC_ADDR=localhost
      - NYTRIO_INSTALL_PUBLIC_URL=http://localhost:8888/
    volumes:
      - nytrio-data-volume:/var/nytrio_vol
      - nytrio-backup-volume:/var/lib/backuppc
    depends_on:
      - database
    ports:
      - 8888:80
      - 69:69/udp

networks:
    nytrio-net:
volumes:
    db-volume:
    nytrio-data-volume:
    nytrio-backup-volume:
  • You can the use docker-compose up command to start your Nytrio instance. By default, the HTTP interface is accessible thru http://localhost:8888
  • If you wish to use imaging features, you will need to use nytrio/nytrio-imaging instead. You will need also to setup a NFS server exports on the host machine and NYTRIO_INSTALL_NFS_MASTERS_SHARE , NYTRIO_INSTALL_NFS_PACKAGES_SHARE environnement variables (more details below).
  • Feel free to customize exported HTTP port, default passwords ...



Starting container manually

MySQL / MariaDB database

You will need a MySQL / MariaDB database in order to store GLPI/Nytrio tables. For that purpose, you can use either a local / remote MySQL / MariaDB database or use a MariaDB database container.


In both cases, you will need a running MySQL / MariaDB server reachable from within the Nytrio container. And then, you will need to :

  • Create a database to host Nytrio data
  • Create a corresponding user with full privileges on this database


Setting the container up

First, pull docker Nytrio image :

copy
docker pull nytrio/nytrio


Note
The Nytrio Docker image is based on the latest Debian distribution.


Creating volumes

Docker containers do not keep internal data. You will need to create docker volumes to assure data persistence. The following command will create a volume named nytrio_main.

copy
docker volume create nytrio_main

The volume name is not important. You need just to use the same in the further steps. If you intend to use Backup feature, you need to create a separate volume for backup data :

copy
docker volume create nytrio_backup


Prepare installation environnement file


The installation environnement file contains all necessary information to set your Nytrio installation up. Create a file named nytrio.env in your working directory with the following content :

copy
 NYTRIO_INSTALL_DB_HOST=mydbserver
 NYTRIO_INSTALL_DB_PORT=3306
 NYTRIO_INSTALL_DB_USER=user
 NYTRIO_INSTALL_DB_PWD=pwd
 NYTRIO_INSTALL_DB_NAME=dbname
 NYTRIO_INSTALL_ROOT_PW=root_password
 NYTRIO_INSTALL_ORGANIZATION=Organization name
 NYTRIO_INSTALL_PUBLIC_ADDR=nytrio.local
 NYTRIO_INSTALL_PUBLIC_URL=http://nytrio.local/
  • Set NYTRIO_INSTALL_DB_* according to your database server information
  • NYTRIO_INSTALL_ROOT_PWis the default Nytrio root account password
  • NYTRIO_INSTALL_ORGANIZATION: Organization name, will be used to create Root Entity and Root location for inventory features.
  • NYTRIO_INSTALL_PUBLIC_ADDR : The public address for the Nytrio webserver and webservices. It's important to set it correctly since it's used by direct remote control features.
  • NYTRIO_INSTALL_PUBLIC_URL : The public URL for the Nytrio webserver and webservices. It's important to set it correctly since it's used by direct remote control features.


Running the container

Use the following command to run the container in your working directory :

copy
docker run -it \
    -p 80:80 \
    -p 69:69/udp \
    --name nytrio \
    --env-file ./nytrio.env \
    -v nytrio_main:/var/nytrio_vol/:rw \
    -v nytrio_backup:/var/lib/backuppc/:rw  \
    nytrio
  • The 80 HTTP port is exposed on the host machine. To access Nytrio frontend, you could use http://localhost or http://PUBLIC_ADDR as specified in the environnment file.
  • The 69 port is exposed to handle incoming TFTP requests. Avoid exposing this port if you don't intend to use disk imaging feature.
  • Avoid mounting nytrio_backup volume if you don't use backup feature.


Useful commands

Once the container running, here is some useful commands to debug your Nytrio instance.

Command Action
docker logs -f nytrio Main container log, contains basic info about all running and failling services
docker exec -it nytrio /bin/bash Get a Shell inside Nytrio container for debug purposes


Imaging configuration

DHCP

You need to configure your DHCP server to handle PXE requests (Network boot) and redirect them to Nytrio. To do so, follow the procedure according to your DHCP server.


Windows Server DHCP

Set the following options in your DHCP configuration :

  • Option #66 Boot Server Host Name: Public_address_of_your_server
  • Option #67 BootFile Name: /grub/pxe_boot


ISC DHCP Server

Here is a sample subnet configuration for ISC DHCP Server :

copy
subnet 10.0.2.0 netmask 255.255.255.0 {
  range 10.0.2.100 10.0.2.200;
  option routers 10.0.2.2;
  next-server [SERVER_PUBLIC_ADDR];
  if option arch = 00:07 {
    filename "/grub/pxe_boot_efi" ;
  } else {
    filename "grub/pxe_boot" ;
  }
}

This configuration handles both UEFI and classic BIOS architectures.


NFS exports

Diskless Disk Image deployment use NFS share to access disk images. You will need to set up a NFS server on your host system.

  • Install a NFS server :

Debian based distros : apt-get install nfs-kernel-server
RHEL/CentOS : yum install nfs-utils

  • Find your nytrio_main volume mountpoint, using :
    copy
    docker inspect nytrio_main
    

Example output :

copy
    [
        {
            "Driver": "local",
            "Labels": {},
            "Mountpoint": "/var/lib/docker/volumes/nytrio_main/_data",
            "Name": "nytrio_main",
            "Options": {},
            "Scope": "local"
        }
    ]

Edit /etc/exports on the host system, and add the following lines :

copy
/var/lib/docker/volumes/nytrio_main/_data/nytrio/imaging/masters     *(async,rw,no_root_squash,no_subtree_check)
/var/lib/docker/volumes/nytrio_main/_data/nytrio/packages            *(async,rw,no_root_squash,no_subtree_check)

You may need to adapt these paths according to the nytrio_mainmountpoint .

  • Configure these shares in Nytrio local relay configuration. Edit [[nytrio_main_vol]]/etc/nytrio/relay.conf and insert nfs_shareskey below components.imaging.davos with the following :
    copy
      "nfs_shares": {
          "/imaging_server/masters/": "/var/lib/docker/volumes/nytrio_main/_data/nytrio/imaging/masters/",
          "/packages/": "/var/lib/docker/volumes/nytrio_main/_data/nytrio/packages/"
      }
    


Note
- You may need to adapt directory paths according to your volume mountpoint
- Nytrio configuration files use JSON format. After edition, make sure the configuration files respect JSON specifications.