diff --git a/Others/haproxy/README.md b/Others/haproxy/README.md new file mode 100644 index 0000000000000000000000000000000000000000..f44dd9b211771160a8e0b0159d22b1dfe9528d57 --- /dev/null +++ b/Others/haproxy/README.md @@ -0,0 +1,87 @@ +# Quick reference + +- The official HAProxy docker image. + +- Maintained by: [openEuler CloudNative SIG](https://gitee.com/openeuler/cloudnative). + +- Where to get help: [openEuler CloudNative SIG](https://gitee.com/openeuler/cloudnative), [openEuler](https://gitee.com/openeuler/community). + +# HAProxy | openEuler +Current HAProxy docker images are built on the [openEuler](https://repo.openeuler.org/). This repository is free to use and exempted from per-user rate limits. + +HAProxy is a free, very fast and reliable reverse-proxy offering high availability, load balancing, and proxying for TCP and HTTP-based applications. + +Read more on [HAProxy Docs](http://docs.haproxy.org/). + +# Supported tags and respective Dockerfile links +The tag of each `haproxy` docker image is consist of the version of `haproxy` and the version of basic image. The details are as follows + +| Tag | Currently | Architectures | +|----------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------|------------------| +| [3.1.7-oe2403sp1](https://gitee.com/openeuler/openeuler-docker-images/blob/master/Others/haproxy/3.1.7/24.03-lts-sp1/Dockerfile) | HAProxy 3.1.7 on openEuler 24.03-LTS-SP1 | amd64, arm64 | + +# Usage +In this usage, users can select the corresponding `{Tag}` based on their requirements. + +- Pull the `openeuler/haproxy` image from docker + + ```bash + docker pull openeuler/haproxy:{Tag} + ``` + +- Run with an interactive shell + + You can start the container with an interactive shell to use haproxy. + ``` + docker run -it --rm openeuler/haproxy:{Tag} bash + ``` + +- Create haproxy configuration file + + Create a file named `haproxy.cfg` in your working directory with the following contents: + ``` + global + daemon + maxconn 256 + + aults + mode http + timeout connect 5000ms + timeout client 50000ms + timeout server 50000ms + + frontend http_in + bind *:8080 + default_backend servers + + backend servers + server local_srv 127.0.0.1:8000 maxconn 32 + ``` + * `frontend` listens on port `8080`. + * `backend` forwards traffic to `127.0.0.1:8080` inside the container. + +- Start a simple backend HTTP server + + Run a basic HTTP server using Python3 on port 8080: + ``` + nohup python3 -m http.server 8080 & + ``` + This starts a minimal HTTP server that serves the current working directory on port `8080`. + +- Start haproxy in the background + + ``` + haproxy -f haproxy.cfg + ``` + HAProxy will listen on port `8080` and forward incoming requests to the local HTTP server on `127.0.0.1:8080`. + +- Test haproxy HTTP service + + Access your service from your host machine: + ``` + curl http://localhost:8080 + ``` + You should see the reponse from the local HTTP server through HAProxy. + +# Question and answering +If you have any questions or want to use some special features, please submit an issue or a pull request on [openeuler-docker-images](https://gitee.com/openeuler/openeuler-docker-images). \ No newline at end of file diff --git a/Others/haproxy/doc/image-info.yml b/Others/haproxy/doc/image-info.yml new file mode 100644 index 0000000000000000000000000000000000000000..f5c492626cec2938425dbc41b956cbcabec969b6 --- /dev/null +++ b/Others/haproxy/doc/image-info.yml @@ -0,0 +1,85 @@ +name: haproxy +category: others +description: HAProxy(High Availability Proxy)是一个开源的、高性能的 负载均衡器 和 代理服务器,主要用于 TCP(第4层)和 HTTP(第7层)应用。 +environment: | + 本应用在Docker环境中运行,安装Docker执行如下命令 + ``` + yum install -y docker + ``` +tags: | + haproxy镜像的Tag由其版本信息和基础镜像版本信息组成,详细内容如下 + + | Tag | Currently | Architectures | + |----------|-------------|------------------| + |[3.1.7-oe2403sp1](https://gitee.com/openeuler/openeuler-docker-images/blob/master/Others/haproxy/3.1.7/24.03-lts-sp1/Dockerfile)| HAProxy 3.1.7 on openEuler 24.03-LTS-SP1 | amd64, arm64 | + +download: | + 拉取镜像到本地 + ``` + docker pull openeuler/haproxy:{Tag} + ``` + +usage: | + - 以交互式Shell运行容器: + + 通过交互式 Shell 启动容器,使用haproxy: + ``` + docker run -it --rm openeuler/haproxy:{Tag} bash + ``` + + - 创建haproxy配置文件 + + 创建的配置文件`haproxy.cfg`内容如下: + ``` + global + daemon + maxconn 256 + + aults + mode http + timeout connect 5000ms + timeout client 50000ms + timeout server 50000ms + + frontend http_in + bind *:8080 + default_backend servers + + backend servers + server local_srv 127.0.0.1:8000 maxconn 32 + ``` + * `frontend`: 监听端口 `8080`。 + * `backend`: 将流量转发到 `127.0.0.1:8080`。 + + - 启动一个简单的后端 HTTP 服务 + + 使用 Python3 启动一个基础的 HTTP 服务,监听在 `8080` 端口: + ``` + nohup python3 -m http.server 8080 & + ``` + 在后台启动一个最小的 HTTP 服务,默认会把当前工作目录暴露出来,监听在 `8080` 端口。 + + - 在后台启动 HAProxy + + ``` + nohup haproxy -f haproxy.cfg & + ``` + HAProxy 会监听 `8080` 端口,把收到的请求转发到本地的 `127.0.0.1:8080`。 + + - 测试 HAProxy HTTP 服务 + + Access your service from your host machine: + ``` + curl http://localhost:8080 + ``` + 通过 HAProxy 转发后,后端 HTTP 服务返回的内容。 + +license: GPL v2 +similar_packages: + - Nginx: 支持 HTTP 缓存和负载均衡,广泛用于加速网站和应用。 +dependency: + - systemd + - pcre + - zlib + - lua + - openssl diff --git a/Others/haproxy/doc/picture/logo.png b/Others/haproxy/doc/picture/logo.png new file mode 100644 index 0000000000000000000000000000000000000000..96ebcd7901b09ed2b7eef1f30c9cada88925244b Binary files /dev/null and b/Others/haproxy/doc/picture/logo.png differ