Article

Table of Contents
Theme:
Was this article helpful?

1  out of  1 found this helpful

Try Vultr Today with

$50 Free on Us!

Want to contribute?

You could earn up to $600 by adding new articles!

Install ArchiveBox on a One-Click Docker Application

Author: Ziyun Li

Last Updated: Wed, May 5, 2021
One-Click Apps Web Servers

Introduction

ArchiveBox is a self-hosted internet archiving solution to preserve and view sites offline. This guide explains how to self-host ArchiveBox on a Vultr One-Click Docker application, and publish it with a Caddy reverse proxy.

Prerequisites

1. Set up ArchiveBox

  1. Log in to your One Click Docker as root via SSH.

  2. Switch to the docker user.

    # su - docker
    
  3. Create a new empty directory for ArchiveBox and it's data.

    $ mkdir ~/archivebox && cd ~/archivebox
    
  4. Download the official Docker Compose file for ArchiveBox.

    $ curl -O 'https://raw.githubusercontent.com/ArchiveBox/ArchiveBox/master/docker-compose.yml'
    
  5. (Optional) You can set a restart policy for ArchiveBox.

    For example, to always restart automatically, edit docker-compose.yml and set restart: always, as shown here.

    services:
        archivebox:
            image: ${DOCKER_IMAGE:-archivebox/archivebox:latest}
            command: server --quick-init 0.0.0.0:8000
            ports:
                - 8000:8000
            restart: always
            environment:
                - ALLOWED_HOSTS=*
                - MEDIA_MAX_SIZE=750m
            volumes:
                - ./data:/data.
    
  6. Run the initial setup.

    docker-compose run archivebox init --setup
    
  7. Enter the username, email address, and password for the Web UI admin user.

  8. Start the server at localhost:8000

    docker-compose up -d
    
  9. Return to the root user account. All the following steps should be run as root.

    $ exit
    

2. Set the UFW Firewall Rules

Vultr's One Click Docker has the UFW firewall enabled and allows SSH traffic on port 22. To allow access to the web server, enable HTTP on port 80 and HTTPS on port 443.

# ufw allow 80
# ufw allow 443

Enable the firewall and verify the status.

# ufw enable
# ufw status

3. Add Server to DNS

Caddy handles SSL/TLS certificates and reverse-proxies the web traffic to ArchiveBox. You must be able to resolve your server by name for Caddy's automatic certificates to work.

  1. Point your server's DNS A record to the IP address of your Vultr One Click Docker server.
  2. Verify the DNS records are correct. Replace the name below with your server's DNS name.

    # dig archivebox.example.com
    
  3. Verify you have a valid Answer Section, and the IP address matches your server's DNS name.

    ;; ANSWER SECTION:
    archivebox.example.com.  3600  IN  A  192.0.2.123
    

4. Set up a Caddy Reverse Proxy

  1. Install Caddy.

    # apt install -y debian-keyring debian-archive-keyring apt-transport-https
    # curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo apt-key add -
    # curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | sudo tee -a /etc/apt/sources.list.d/caddy-stable.list
    # apt update
    # apt install caddy
    
  2. Edit Caddy's configuration file.

    # nano /etc/caddy/Caddyfile
    

    Replace the contents with the lines below, and substitute your server's domain name.

    archivebox.example.com
    
    reverse_proxy localhost:8000
    
  3. Reload the configuration.

    # caddy reload --config /etc/caddy/Caddyfile
    
  4. Navigate to your new site by name to verify it works. For example:

    https://archivebox.example.com
    

More Information

See these links for more information.

Want to contribute?

You could earn up to $600 by adding new articles