Nov 20, 2024 3 min read

NavWeb: The Ultimate Self-Hosting Setup

NavWeb: The Ultimate Self-Hosting Setup
Table of Contents

NavWeb is a lightweight, self-hosted web application designed to enable customizable navigation systems for managing and visualizing data workflows. Its modular design and robust APIs make it a popular choice for developers and system administrators looking for control, privacy, and adaptability. In this guide, we’ll walk you through installing, configuring, and managing NavWeb, covering everything from deployment to advanced features.

Installing NavWeb

πŸ“¦ Docker/Docker Compose Setup

Using Docker Compose is the most efficient way to deploy NavWeb. Below is a docker-compose.yml file that sets up NavWeb with persistent volumes and environment variables.


version: '3.9'

services:

navweb:

image: navweb:latest

container_name: navweb

ports:

- "8080:8080"

volumes:

- ./navweb_data:/data

- ./navweb_config:/config

environment:

- NAVWEB_ENV=production

- NAVWEB_LOG_LEVEL=info

restart: unless-stopped

Run the following commands to deploy NavWeb:


mkdir navweb && cd navweb

## Save the docker-compose.yml file

nano docker-compose.yml

## Start the service

docker-compose up -d

## Check the status

docker ps

πŸš€ Manual Installation

For direct server installation, follow these steps to install NavWeb on a Linux machine:

  1. Install dependencies:

sudo apt update

sudo apt install -y git curl unzip

  1. Download and extract NavWeb:

curl -L https://github.com/navweb/navweb/releases/latest/download/navweb-linux-amd64.zip -o navweb.zip

unzip navweb.zip -d /opt/navweb

sudo chmod +x /opt/navweb/navweb

  1. Create a systemd service:

sudo nano /etc/systemd/system/navweb.service

Add the following content:


[Unit]

Description=NavWeb Service

After=network.target

[Service]

ExecStart=/opt/navweb/navweb --config /opt/navweb/config.yaml

Restart=on-failure

[Install]

WantedBy=multi-user.target

  1. Start and enable the service:

sudo systemctl daemon-reload

sudo systemctl start navweb

sudo systemctl enable navweb

Configuring Nginx as a Reverse Proxy

🌐 Nginx Configuration

Set up Nginx to route traffic to NavWeb. Create a server block configuration:


sudo nano /etc/nginx/sites-available/navweb

Add the following content:


server {

listen 80;

server_name example.com;

location / {

proxy_pass http://localhost:8080;

proxy_http_version 1.1;

proxy_set_header Upgrade $http_upgrade;

proxy_set_header Connection 'upgrade';

proxy_set_header Host $host;

proxy_cache_bypass $http_upgrade;

}

}

Enable the configuration and restart Nginx:


sudo ln -s /etc/nginx/sites-available/navweb /etc/nginx/sites-enabled/

sudo nginx -t

sudo systemctl restart nginx

πŸ”’ SSL/TLS Setup

Use Certbot to secure NavWeb with a free Let's Encrypt certificate:


sudo apt install -y certbot python3-certbot-nginx

sudo certbot --nginx -d example.com

Automate the renewal process:


sudo systemctl enable certbot.timer

πŸ› οΈ Testing and Reloading Nginx

Verify and reload Nginx after any changes:


sudo nginx -t

sudo systemctl reload nginx

Logging and Debugging NavWeb

πŸ—ƒοΈ Enabling Debug Logs

Modify the logging level in the NavWeb configuration file:


nano /opt/navweb/config.yaml

Set the log_level to debug:


log_level: debug

Restart NavWeb to apply changes:


sudo systemctl restart navweb

πŸ“„ Viewing Logs

Access logs using the following methods:

  • For Docker:

docker logs navweb

  • For manual installation:

tail -f /opt/navweb/logs/navweb.log

πŸ› οΈ Troubleshooting Common Issues

Analyze logs for errors like port conflicts or configuration issues. For example:


grep "ERROR" /opt/navweb/logs/navweb.log

πŸ“€ Exporting Logs

Export logs to an external ELK stack using Filebeat:


sudo apt install filebeat

sudo filebeat setup -e

Edit the Filebeat configuration to include NavWeb logs:


filebeat.inputs:

- type: log

paths:

- /opt/navweb/logs/*.log

Backup and Restore

πŸ—‚οΈ File-Based Backups

Backup configuration and data directories:


tar -czvf navweb_backup.tar.gz /opt/navweb/config.yaml /opt/navweb/data

Restore the backup:


tar -xzvf navweb_backup.tar.gz -C /

πŸ”„ Database Backups

If NavWeb uses a database, back it up with:


sqlite3 /opt/navweb/data/navweb.db .dump > navweb_backup.sql

Restore it:


sqlite3 /opt/navweb/data/navweb.db < navweb_backup.sql

πŸ“… Automated Backup Scripts

Set up a cron job for periodic backups:


crontab -e

Add the following line:


0 2 * * * tar -czvf /backups/navweb_$(date +\%F).tar.gz /opt/navweb/config.yaml /opt/navweb/data

Updating and Upgrading NavWeb

⬆️ Updating Docker Images

To update NavWeb’s Docker image:


docker-compose pull

docker-compose down

docker-compose up -d

πŸ› οΈ Manual Updates

For manual installations:


curl -L https://github.com/navweb/navweb/releases/latest/download/navweb-linux-amd64.zip -o navweb.zip

unzip navweb.zip -d /opt/navweb

sudo systemctl restart navweb

πŸ” Checking for Updates

Check for updates in NavWeb’s web dashboard or GitHub repository:


curl -s https://api.github.com/repos/navweb/navweb/releases/latest | grep tag_name

Leveraging NavWeb’s Unique Features

πŸ”§ Enabling APIs

Activate NavWeb’s API by updating the configuration file:


api:

enabled: true

auth: token

Restart the app:


sudo systemctl restart navweb

Access the API with curl:


curl -H "Authorization: Bearer <TOKEN>" http://example.com/api/v1/status

🌟 Advanced Configurations

Enable advanced features like custom themes or third-party integrations:


ui:

theme: dark

integrations:

webhook: https://example.com/webhook

Wrapping Up

Self-hosting NavWeb gives you unparalleled flexibility and control over your navigation and data management workflows. By following the steps outlined in this guide, you now have the tools to deploy, configure, and manage NavWeb effectively. From securing your instance with SSL to leveraging advanced features, you're ready to unlock NavWeb’s full potential and customize it to suit your needs. Start exploring today!

Great! You’ve successfully signed up.
Welcome back! You've successfully signed in.
You've successfully subscribed to Selfhosted Ninja.
Your link has expired.
Success! Check your email for magic link to sign-in.
Success! Your billing info has been updated.
Your billing was not updated.