Sign inSign up

qmcgaw/caddy-ui

By qmcgaw

•Updated over 6 years ago

Image
2

10K+

qmcgaw/caddy-ui repository overview

⁠Caddy UI server

➡️ Server responsible to serve the Caddy UI and communicate with the Caddy server API

Please refer to the caddy-ui⁠ repository for end-user instructions.

Build status Join Slack channel GitHub last commit GitHub commit activity GitHub issues

⁠Architecture

This server is stateless and does the following:

  • Serve the built static files of the frontend to the user
  • Act as an intermediary proxy to communicate with your Caddy server (to work around CORS)

It is written in Go in order to have a small static binary on a Docker Scratch image.

⁠Repository

The repository contains:

  • the HTTP API server written in Go
  • the web frontend app written in ReactJS, as the ui Git submodule

⁠Setup

  1. Use the following command:

    docker run -d -p 8000:8000/tcp qmcgaw/caddy-ui
    

    You can also use docker-compose.yml⁠ with:

    docker-compose up -d
    
  2. You can update the image with docker pull qmcgaw/caddy-ui or use one of tags available⁠

⁠Environment variables
Environment variableDefaultDescription
CADDY_API_ENDPOINThttp://localhost:2019Caddy server API endpoint address
LOG_ENCODINGconsoleLogging format, can be json or console
LOG_LEVELinfoLogging level, can be debug, info, warning, error
NODE_ID-1Node ID for logger (-1 to disable)
LISTENING_PORT8000Internal listening TCP port
ROOT_URL/URL path, used if behind a reverse proxy
TZAmerica/MontrealTimezone string

⁠Development

  1. Setup your environment

    Using VSCode and Docker (easier)

    1. Install Docker⁠
      • On Windows, share a drive with Docker Desktop and have the project on that partition
      • On OSX, share your project directory with Docker Desktop
    2. With Visual Studio Code⁠, install the remote containers extension⁠
    3. In Visual Studio Code, press on F1 and select Remote-Containers: Open Folder in Container...
    4. Your dev environment is ready to go!... and it's running in a container :+1: So you can discard it and update it easily!

    Locally

    1. Install Go⁠, Docker⁠ and Git⁠

    2. Install Go dependencies with

      go mod download
      
    3. Install golangci-lint⁠

    4. You might want to use an editor such as Visual Studio Code⁠ with the Go extension⁠. Working settings are already in .vscode/settings.json⁠.

  2. Commands available:

    # Build the binary
    go build cmd/app/main.go
    # Test the code
    go test ./...
    # Lint the code
    golangci-lint run
    # Build the Docker image
    docker build -o build ui
    docker build -t qmcgaw/caddy-ui .
    # Run the container
    docker run -it --rm -p 8000:8000/tcp qmcgaw/caddy-ui
    
  3. See Contributing⁠ for more information on how to contribute to this repository.

⁠TODOs

  • Unit tests
  • Integration tests

⁠License

This repository is under an MIT license⁠ unless otherwise indicated

Tag summary

Content type

Image

Digest

Size

3.7 MB

Last updated

over 6 years ago

docker pull qmcgaw/caddy-ui