Installation
Precompiled binaries
Precompiled chproxy
binaries are available here.
Just download the latest stable binary, unpack and run it with the desired config:
./chproxy -config=/path/to/config.yml
Building from source
Chproxy is written in Go. The easiest way to install it from sources is:
go get -u github.com/contentsquare/chproxy
If you don’t have Go installed on your system - follow this guide.
Docker
Chproxy is also available as a Docker image in a public repository on DockerHub.
Download the image and run the container:
docker run -d -v <LOCAL CONFIG>:/config.yml contentsquareplatform/chproxy:<VERSION TAG> -config /config.yml
Example:
docker run -d -v $(pwd)/config/examples/simple.yml:/config.yml contentsquareplatform/chproxy:v1.20.0 -config /config.yml
Build a local image.
To build an image, as a prerequisite, the chproxy
binary should exist in the same context as Dockerfile.
You can download the prebuilt version or run the following command:
GOOS=linux GOARCH=amd64 go build -v
Then run docker build command:
docker build -t <LOCAL_IMAGE_NAME> .
Finally, run container:
docker run -d -v <LOCAL_VOLUME>:<DEST_PATH> -p <SOURCE_PORT>:<DEST_PORT> <LOCAL_IMAGE_NAME> <APPLICATION_ARGS>
Flags
-d Run container in background and print container ID-v Bind mount a volume (local directory or file to host path)-p Publish a container's port(s) to the host (default 9090)
Example:
docker run -d -v $(PWD)/config.yml:/opt/config.yml -p 9090:9090 chproxy-test -config /opt/config.yml
systemd service
Example systemd service configuration:
[Unit]Description=ChproxyDocumentation=https://www.chproxy.org/Requires=network.targetAfter=network.target
[Service]Type=notifyUser=chproxyGroup=chproxyExecStart=/usr/bin/chproxy -config /etc/chproxy/chproxy.ymlTimeoutSec=30Restart=on-failure
# quick response on bad configTimeoutStartSec=5
# avoid resource intensive cyclesRestartSec=30
[Install]WantedBy=default.target