Self-host 16/16: Netdata

In this series, you will learn how to self-host 16 services on your server. To self-host a service, you can either use a server at home or a server in the cloud.

Nginx Proxy Manager

The first thing you need to set up is a reverse proxy, so you can go to a domain or subdomain to access the service.

Install docker-compose

Update your package list

sudo apt-get update

Install dependencies

sudo apt-get install ca-certificates curl gnupg lsb-release

Add Docker’s official GPG key

sudo apt-get install ca-certificates curl gnupg lsb-release

Set up the stable repository

echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

Update your package list

sudo apt-get update

Install Docker Engine

sudo apt-get install docker-ce docker-ce-cli containerd.io

Verify that Docker Engine is installed correctly

sudo docker run hello-world

Download the current stable release of Docker Compose

sudo curl -L "https://github.com/docker/compose/releases/download/$(curl -s https://api.github.com/repos/docker/compose/releases/latest | grep tag_name | cut -d '"' -f 4)/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

Apply executable permissions to the binary

sudo chmod +x /usr/local/bin/docker-compose

Verify the installation

docker-compose --version

Create directory

Create a directory

Change “name-of-the-service” with the actual name of the container

mkdir -p ~/docker-compose/name-of-the-service

Move into the directory

Change “name-of-the-service” with the name you choose above

cd ~/docker-compose/name-of-the-service

Create a docker-compose.yml file

Create a docker-compose.yml file

nano docker-compose.yml

Past this content into the file

version: '3.8'
services:
  app:
    image: 'jc21/nginx-proxy-manager:latest'
    restart: unless-stopped
    ports:
      - '80:80'
      - '81:81'
      - '443:443'
    volumes:
      - ./data:/data
      - ./letsencrypt:/etc/letsencrypt

Press “ctrl + o” to save the file

Press “ctrl + x” to exit the file

Start the docker-compose container

Start the docker-compose container

sudo docker-compose up -d

Access the service

To access the service, open a browser and type in the following content

http://<your-server-ip>:81

Afterwards, you will be presented by a Nginx Proxy Manager website. Login with this credentials
Email: [email protected]
Password: changeme

Netdata

Create directory

Create a directory

Change “name-of-the-service” with the actual name of the container

mkdir -p ~/docker-compose/name-of-the-service

Move into the directory

Change “name-of-the-service” with the name you choose above

cd ~/docker-compose/name-of-the-service

Create a docker-compose.yml file

Create a docker-compose.yml file

nano docker-compose.yml

Past this content into the file

version: '3'
services:
  netdata:
    image: netdata/netdata
    container_name: netdata
    pid: host
    network_mode: host
    restart: unless-stopped
    cap_add:
      - SYS_PTRACE
      - SYS_ADMIN
    security_opt:
      - apparmor:unconfined
    volumes:
      - netdataconfig:/etc/netdata
      - netdatalib:/var/lib/netdata
      - netdatacache:/var/cache/netdata
      - /etc/passwd:/host/etc/passwd:ro
      - /etc/group:/host/etc/group:ro
      - /etc/localtime:/etc/localtime:ro
      - /proc:/host/proc:ro
      - /sys:/host/sys:ro
      - /etc/os-release:/host/etc/os-release:ro
      - /var/log:/host/var/log:ro
      - /var/run/docker.sock:/var/run/docker.sock:ro

volumes:
  netdataconfig:
  netdatalib:
  netdatacache:

Press “ctrl + o” to save the file

Press “ctrl + x” to exit the file

Start the docker-compose container

Start the docker-compose container

sudo docker-compose up -d

Access the service

To access the service, open a browser and type in the following content

http://<your-server-ip>:19999

Afterwards, you will be presented by the website. Now you can create an account and start using it.

Make the service available via a domain

Login into your Nginx Proxy Manager

Add a host

Click on “Proxy Hosts”

Click on “Add Proxy Host”

Fill in the details

Details

Domain Names: Enter your domain name (e.g. servicename.yourdomain.com)

Scheme: select “http”

Forward Host / IP: Enter the IP address of your server (enter “localhost” or “127.0.0.1” if its on the same machine)

Forward Port: Enter used port in the config

Cache Assets: Optional, check if needed

Block Common Exploits: Optional, check if needed (recommended)

Websockets Support: Check if your service needs Websocket support

Custom locations

Add location: Optional, check if needed

SSL

SSL Certificate: Select “Request a new SSL Certificate”

Force SSL: Optional, highly recommended automatic redirecting to HTTPS

HSTS Enabled: Optional, check if needed

Use a DNS Challenge: Optional, check if needed

HTTP/2 Support: Optional, check if needed

HSTS Subdomains: Optional, check if needed

Email Address for Let’s Encrypt: Enter your Email address

Agree to the Terms of Services

Advanced

Custom Nginx Configuration: Optional, check if needed

Click “Save”

Enjoy!

1 thought on “Self-host 16/16: Netdata”

  1. Wonderful work! That is the type of info that are supposed to be shared across the net.
    Shame on Google for now not positioning this publish
    upper! Come on over and consult with my web site . Thank you =)

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top