跳转到内容

Installation

此内容尚不支持你的语言。

Precompiled binaries

Precompiled chproxy binaries are available here. Just download the latest stable binary, unpack and run it with the desired config:

Terminal window
./chproxy -config=/path/to/config.yml

Building from source

Chproxy is written in Go. The easiest way to install it from sources is:

Terminal window
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:

Terminal window
docker run -d -v <LOCAL CONFIG>:/config.yml contentsquareplatform/chproxy:<VERSION TAG> -config /config.yml

Example:

Terminal window
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:

Terminal window
GOOS=linux GOARCH=amd64 go build -v

Then run docker build command:

Terminal window
docker build -t <LOCAL_IMAGE_NAME> .

Finally, run container:

Terminal window
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:

Terminal window
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=Chproxy
Documentation=https://www.chproxy.org/
Requires=network.target
After=network.target
[Service]
Type=notify
User=chproxy
Group=chproxy
ExecStart=/usr/bin/chproxy -config /etc/chproxy/chproxy.yml
TimeoutSec=30
Restart=on-failure
# quick response on bad config
TimeoutStartSec=5
# avoid resource intensive cycles
RestartSec=30
[Install]
WantedBy=default.target