Skip to content
This repository has been archived by the owner on Apr 4, 2024. It is now read-only.
/ caddy-ui-server Public archive
generated from qdm12/go-template

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

License

Notifications You must be signed in to change notification settings

qdm12/caddy-ui-server

Repository files navigation

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 variable Default Description
CADDY_API_ENDPOINT http://localhost:2019 Caddy server API endpoint address
LOG_ENCODING console Logging format, can be json or console
LOG_LEVEL info Logging level, can be debug, info, warning, error
NODE_ID -1 Node ID for logger (-1 to disable)
LISTENING_PORT 8000 Internal listening TCP port
ROOT_URL / URL path, used if behind a reverse proxy
TZ America/Montreal Timezone 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 👍 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

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published