โก๏ธ 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.
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.
The repository contains:
- the HTTP API server written in Go
- the web frontend app written in ReactJS, as the ui Git submodule
-
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
-
You can update the image with
docker pull qmcgaw/caddy-ui
or use one of tags available
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 |
-
Setup your environment
Using VSCode and Docker (easier)
- 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
- With Visual Studio Code, install the remote containers extension
- In Visual Studio Code, press on
F1
and selectRemote-Containers: Open Folder in Container...
- Your dev environment is ready to go!... and it's running in a container ๐ So you can discard it and update it easily!
Locally
-
Install Go dependencies with
go mod download
-
Install golangci-lint
-
You might want to use an editor such as Visual Studio Code with the Go extension. Working settings are already in .vscode/settings.json.
- Install Docker
-
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
-
See Contributing for more information on how to contribute to this repository.
- Unit tests
- Integration tests
This repository is under an MIT license unless otherwise indicated