diff --git a/Others/varnish/README.md b/Others/varnish/README.md new file mode 100644 index 0000000000000000000000000000000000000000..ed796d40ee10a193faa80174686ad0b530c65b4a --- /dev/null +++ b/Others/varnish/README.md @@ -0,0 +1,79 @@ +# Quick reference + +- The official Varnish Cache 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). + +# Varnish Cache | openEuler +Current Varnish Cache docker images are built on the [openEuler](https://repo.openeuler.org/). This repository is free to use and exempted from per-user rate limits. + +Varnish Cache is a web application accelerator also known as a caching HTTP reverse proxy. You install it in front of any server that speaks HTTP and configure it to cache the contents. Varnish Cache is really, really fast. It typically speeds up delivery with a factor of 300 - 1000x, depending on your architecture. + +Read more on [Varnish Docs](https://varnish-cache.org/docs/index.html). + +# Supported tags and respective Dockerfile links +The tag of each `varnish` docker image is consist of the version of `varnish` and the version of basic image. The details are as follows + +| Tag | Currently | Architectures | +|----------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------|------------------| +| [7.7.1-oe2403sp1](https://gitee.com/openeuler/openeuler-docker-images/blob/master/Others/varnish/7.7.1/24.03-lts-sp1/Dockerfile) | Varnish Cache 7.7.1 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/varnish` image from docker + + ```bash + docker pull openeuler/varnish:{Tag} + ``` + +- Run with an interactive shell + + You can start the container with an interactive shell to use varnish. + ``` + docker run -it --rm openeuler/varnish:{Tag} bash + ``` + +- Create Varnish configuration file + + Create the directory to store Varnish configuration files: + ``` + mkdir -p /etc/varnish + ``` + + Create the VCL file `/etc/varnish/default.vcl`, example content could be: + ``` + vcl 4.0; + + backend default { + .host = "127.0.0.1"; + .port = "8080"; + } + ``` + +- Start a simple backend HTTP server + + Run a basic HTTP server using Python3 on port 8080: + ``` + nohup python3 -m http.server 8080 & + ``` + The python HTTP server acts as the backend that Varnish caches. + +- Start Varnish in the background + + ``` + nohup varnishd -F -f /etc/varnish/default.vcl -a :6081 & + ``` + Varnish listens on port 6081 and forwards requests to the backend on port 8080. + +- Test Varnish HTTP service + + Use `curl` to send a HEAD request and check if Varnish is responding: + ``` + curl -I http://localhost:6081 + ``` + +# 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/varnish/doc/image-info.yml b/Others/varnish/doc/image-info.yml new file mode 100644 index 0000000000000000000000000000000000000000..14e235d2136fd9e8a790074aaef0fd8171e3e306 --- /dev/null +++ b/Others/varnish/doc/image-info.yml @@ -0,0 +1,78 @@ +name: varnish +category: others +description: Varnish Cache 是一个高性能的 HTTP 反向代理缓存服务器,专门用来加速网站和 API 的静态和动态内容分发。 +environment: | + 本应用在Docker环境中运行,安装Docker执行如下命令 + ``` + yum install -y docker + ``` +tags: | + varnish镜像的Tag由其版本信息和基础镜像版本信息组成,详细内容如下 + + | Tag | Currently | Architectures | + |----------|-------------|------------------| + |[7.7.1-oe2403sp1](https://gitee.com/openeuler/openeuler-docker-images/blob/master/Others/varnish/7.7.1/24.03-lts-sp1/Dockerfile)| varnish 7.7.1 on openEuler 24.03-LTS-SP1 | amd64, arm64 | + +download: | + 拉取镜像到本地 + ``` + docker pull openeuler/varnish:{Tag} + ``` + +usage: | + - 以交互式Shell运行容器: + + 通过交互式 Shell 启动容器,使用varnish: + ``` + docker run -it --rm openeuler/varnish:{Tag} bash + ``` + + - 创建 Varnish 配置文件 + + 创建 Varnish 配置文件的目录 + ``` + mkdir -p /etc/varnish + ``` + + 创建 VCL 文件 /etc/varnish/default.vcl,示例内容如下: + ``` + vcl 4.0; + + backend default { + .host = "127.0.0.1"; + .port = "8080"; + } + ``` + + - 启动简单的后端 HTTP 服务器 + + 使用 Python3 在 8080 端口启动基础 HTTP 服务器: + ``` + nohup python3 -m http.server 8080 & + ``` + 该 Python HTTP 服务器作为 Varnish 缓存的后端。 + + - 后台启动 Varnish + + ``` + nohup varnishd -F -f /etc/varnish/default.vcl -a :6081 & + ``` + Varnish 监听 6081 端口,并将请求转发到后端 8080 端口。 + + - 测试 Varnish HTTP 服务 + + 使用 curl 发送 HEAD 请求,检查 Varnish 是否响应: + ``` + curl -I http://localhost:6081 + ``` + +license: BSD-2-Clause +similar_packages: + - Squid: 经典的代理缓存服务器,支持 HTTP 和 FTP 缓存,常用于代理和内容加速。 + - Nginx: 支持 HTTP 缓存和负载均衡,广泛用于加速网站和应用。 +dependency: + - ncurses + - pcre + - libtool + - jemalloc + - libunwind diff --git a/Others/varnish/doc/picture/logo.png b/Others/varnish/doc/picture/logo.png new file mode 100644 index 0000000000000000000000000000000000000000..ca2b7560db446c001c01555de7fc7d6c727d373e Binary files /dev/null and b/Others/varnish/doc/picture/logo.png differ