Version 3.12.1

3.8.2. Start metrics server

On-premise

To start nxs-backup in server mode on-premise just run the command:

nxs-backup server

If the server settings are specified correctly, the nxs-backup application will start and process requests until it is interrupted.

You can add a system unit for convenience.

[Unit]
Description=Nxs-backup

[Service]
ExecStart=/usr/sbin/nxs-backup server

[Install]
WantedBy=multi-user.target
Docker-compose

To start nxs-backup in server mode with docker-compose add new service with shared metrics volume.

services:
  ...
  metrics-server:
    image: nixyslab/nxs-backup:latest
    container_name: nxs-backup
    command:
      - nxs-backup
      - -c
      - /nxs-backup.conf
      - server
    volumes:
      - metrics:/tmp/metrics
    configs:
      - nxs-backup.conf

volumes:
  metrics:

Also, specify the path to the metrics file in the nxs-backup config to be in the shared volume.

server:
  metrics:
    metrics_file_path: /tmp/metrics/nxs-backup.metrics

You can find a ready-made example in our repo.

Kubernetes/OpenShift

To start nxs-backup in server mode with Kubernetes/OpenShift cluster add a deployment with nxs-backup server to your nxs-universal-chart values. Specify the path to the metrics file in the volume.

configMaps:
  config:
    data:
      nxs-backup.conf: |-
        project_name: "My Project"
        server_name: backup-in-k8s
        notifications:
          mail:
            enabled: false
        server:
          metrics:
            metrics_file_path: /var/nxs-backup/nxs-backup.metrics
        jobs:
        - job_name: backup-mysql
          type: mysql
          tmp_dir: /var/nxs-backup/dump_tmp
          sources:
          - name: mysql
            connect:
              db_host: ENV:DB_HOST
              db_port: ENV:DB_PORT
              db_user: ENV:DB_USER
              db_password: ENV:DB_PASS
            target_dbs:
            - project-db
            gzip: true
            db_extra_keys: '--opt --add-drop-database --routines --comments --create-options --quote-names --order-by-primary --hex-blob --single-transaction'
        storages_options:
        - storage_name: local
          backup_path: /var/nxs-backup/databases
          retention:
            days: 7
            weeks: 3
            months: 1

...

deployments:
  nxs-backup-metrics:
    extraSelectorLabels:
      app: nxs-backup-metrics
    containers:
    - name: metrics
      command: nxs-backup server
      envSecrets:
      - secret-envs
      volumeMounts:
      - name: config
        mountPath: /etc/nxs-backup
      - name: nxs-backup
        mountPath: /var/nxs-backup
    volumes:
    - type: configMap
      name: config
    - name: nxs-backup
      type: pvc
    restartPolicy: Never

services:
  nxs-backup-metrics:
    ports:
    - name: http
      protocol: TCP
      port: 7979
    extraSelectorLabels:
      app: nxs-backup-metrics

You can find a ready-made example in our repo.