/dnscoffee

DNS Coffee Frontend Web Server

Primary LanguageJavaScriptBSD 2-Clause "Simplified" LicenseBSD-2-Clause

DNS Coffee Frontend

Building

Requires go compiler >= go1.13

$ make

Running

Database connection information is set via $DATABASE_URL environment variable

The listen address and port can be set with a flag.

To run all thats needed is the compiled dnscoffee binary and the static/ and templates/ directories. The static/ and templates/ directories should be in the cwd when calling dnscoffee.

Flags

$ ./dnscoffee -h
Usage of ./dnscoffee:
  -listen string
        ip:port to listen on (default "127.0.0.1:8080")

Example

$ export DATABASE_URL="postgresql://user:pass@host:port/db"
$ ./dnscoffee
2020/04/29 21:45:22 Server starting on 127.0.0.1:8080

Docker

The docker build used a 2-stage build. The first stage compiles the go program to a static binary, and the second stage copies the resulting binary and static files to a fresh image to run the web server.

Build

$ make docker

Run

docker-compose example:

version: '3'

services:
    web:
        container_name: dnszone_web
        image: lanrat/dnscoffee
        restart: unless-stopped
        environment:
            - TZ=America/Los_Angeles
            - DATABASE_URL="postgresql://user:pass@host:port/db"
            - HTTP_LISTEN_ADDR=0.0.0.0:8082
        healthcheck:
            test: ["CMD-SHELL", "wget --quiet --tries=1 --spider http://localhost:8082/ || exit 1"]
            interval: 30s
            timeout: 10s
            retries: 3