Initial Commit
Signed-off-by: Petr "Stone" Hracek <phracek@redhat.com>
This commit is contained in:
parent
c581e1042c
commit
e34b782ed1
7 changed files with 202 additions and 0 deletions
29
Dockerfile
Normal file
29
Dockerfile
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
FROM registry.fedoraproject.org/fedora:26
|
||||
|
||||
ENV NAME=haproxy ARCH=x86_64
|
||||
LABEL MAINTAINER "Petr Hracek" <phracek@redhat.com>
|
||||
LABEL summary="HAProxy reverse proxy for high availability environments." \
|
||||
name="$FGC/$NAME" \
|
||||
version="0" \
|
||||
release="1.$DISTTAG" \
|
||||
architecture="$ARCH" \
|
||||
com.redhat.component=$NAME \
|
||||
usage="docker run -p 80:80 docker.io/modularityimages/haproxy" \
|
||||
help="Runs haproxy, which listens on port 80. No dependencies. See Help File below for more details." \
|
||||
description="HAProxy is a TCP/HTTP reverse proxy which is particularly suited for high availability environments." \
|
||||
io.k8s.description="HAProxy is a TCP/HTTP reverse proxy which is particularly suited for high availability environments." \
|
||||
io.k8s.diplay-name="HAProxy 1.6 " \
|
||||
io.openshift.expose-services="80:haproxy" \
|
||||
io.openshift.tags="haproxy"
|
||||
|
||||
RUN dnf install -y --setopt=tsflags=nodocs haproxy which bash && \
|
||||
dnf -y clean all
|
||||
|
||||
EXPOSE 80
|
||||
|
||||
ADD files /files
|
||||
ADD help.md README.md /
|
||||
|
||||
ENTRYPOINT ["/files/docker-entrypoint.sh"]
|
||||
CMD ["/usr/sbin/haproxy", "-p", "/run/haproxy.pid", "-f", "/etc/haproxy/haproxy.cfg", "-D", "s"]
|
||||
|
||||
43
README.md
Normal file
43
README.md
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
# haproxy
|
||||
|
||||
HAProxy reverse proxy for high availability environments.
|
||||
|
||||
## Summary
|
||||
|
||||
- Dockerfile - build container image with haproxy.
|
||||
- openshift-template.yml - Template for OpenShift to haproxy.
|
||||
|
||||
## How to use the container
|
||||
|
||||
* Copy ```./examples/haproxy.cfg``` to ```/etc/haproxy/haproxy.cfg```
|
||||
* Run two HTTPD servers on ```IP1```:```port1``` and ```IP2```:```port2```
|
||||
* Modify ```/etc/haproxy/haproxy.cfg``` so it uses relevant addresses and ports.
|
||||
|
||||
Command for running haproxy docker container:
|
||||
|
||||
```bash
|
||||
docker run -it n
|
||||
```
|
||||
|
||||
## How to run haproxy as standalone container
|
||||
|
||||
Copy haproxy-container.service to ```/usr/lib/systemd/system/``` directory
|
||||
```bash
|
||||
sudo cp haproxy-container.service /usr/lib/systemd/system/
|
||||
systemctl daemon-reload
|
||||
```
|
||||
|
||||
Command for running memcached as standalone container:
|
||||
```bash
|
||||
systemctl start haproxy-container
|
||||
```
|
||||
|
||||
## How to stop memcached as standalone container
|
||||
Command for stopping haproxy as standalone container:
|
||||
```bash
|
||||
systemctl stop haproxy-container
|
||||
```
|
||||
## How to test the haproxy
|
||||
|
||||
Statistic can be seen on haproxy url `http://<haproxy_url>/haproxy?stats`.
|
||||
|
||||
10
haproxy-container.service
Normal file
10
haproxy-container.service
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
[Unit]
|
||||
Description="HAProxy reverse proxy for high availability environments."
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/bin/docker run -t -i -v /etc/sysconfig/haproxy:/etc/sysconfig/haproxy:ro -v /etc/haproxy/haproxy.cfg:/etc/haproxy/haproxy.cfg:ro -p 80:80 --name haproxy-container haproxy
|
||||
ExecStop=/usr/bin/docker stop -t 2 haproxy-container
|
||||
ExecStopPost=/usr/bin/docker rm -f haproxy-container
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
31
help.md
Normal file
31
help.md
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
% HAPROXY(1) Container Image Pages
|
||||
% Petr Hracek
|
||||
% March 2, 2017
|
||||
|
||||
# NAME
|
||||
haproxy - HAProxy reverse proxy for high availability environments.
|
||||
|
||||
# DESCRIPTION
|
||||
HAProxy is a TCP/HTTP reverse proxy which is particularly suited for high availability environments.
|
||||
|
||||
The container itself consists of:
|
||||
- fedora/26 base image
|
||||
- haproxy RPM package
|
||||
|
||||
Files added to the container during docker build include: /files/haproxy.sh
|
||||
|
||||
# USAGE
|
||||
To get the memcached container image on your local system, run the following:
|
||||
|
||||
docker pull hub.docker.io/phracek/haproxy
|
||||
|
||||
# SECURITY IMPLICATIONS
|
||||
Lists of security-related attributes that are opened to the host.
|
||||
|
||||
-p 80:80
|
||||
Opens container port 80 and maps it to the same port on the host.
|
||||
|
||||
# SEE ALSO
|
||||
HAProxy page
|
||||
<https://haproxy.org/>
|
||||
<https://www.digitalocean.com/community/tutorials/how-to-use-haproxy-to-set-up-http-load-balancing-on-an-ubuntu-vps>
|
||||
44
openshift-template.yml
Normal file
44
openshift-template.yml
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
apiVersion: v1
|
||||
kind: Template
|
||||
metadata:
|
||||
annotation:
|
||||
description: HAProxy reverse proxy for high availability environments.
|
||||
tags: haproxy
|
||||
template: docker.io/phracek/haproxy
|
||||
name: haproxy
|
||||
objects:
|
||||
- apiVersion: v1
|
||||
kind: ImageStream
|
||||
metadata:
|
||||
name: haproxy
|
||||
spec:
|
||||
dockerImageRepository: docker.io/phracek/haproxy
|
||||
tags:
|
||||
- name: latest
|
||||
- apiVersion: v1
|
||||
kind: DeploymentConfig
|
||||
metadata:
|
||||
name: haproxy
|
||||
spec:
|
||||
dockerImageRepository: docker.io/phracek/haproxy
|
||||
replicas: 1
|
||||
strategy:
|
||||
type: Rolling
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
name: haproxy
|
||||
spec:
|
||||
containers:
|
||||
- env:
|
||||
image: docker.io/phracek/haproxy
|
||||
name: haproxy
|
||||
triggers:
|
||||
- imageChangeParams:
|
||||
automatic: true
|
||||
containerNames:
|
||||
- docker.io/phracek/haproxy
|
||||
from:
|
||||
kind: ImageStreamTag
|
||||
name: haproxy:latest
|
||||
type: ImageChange
|
||||
28
tests/config.yaml
Normal file
28
tests/config.yaml
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
document: modularity-testing
|
||||
version: 1
|
||||
name: haproxy
|
||||
modulemd-url: http://raw.githubusercontent.com/container-images/haproxy/master/haproxy.yaml
|
||||
service:
|
||||
port: 80
|
||||
packages:
|
||||
rpms:
|
||||
- haproxy
|
||||
module:
|
||||
docker:
|
||||
start: "docker run -it -p 80:80"
|
||||
labels:
|
||||
description: "HAProxy reverse proxy for high availability environments"
|
||||
io.k8s.description: "HAProxy reverse proxy for high availability environments"
|
||||
source: https://github.com/container-images/haproxy.git
|
||||
container: docker.io/phracek/haproxy
|
||||
rpm:
|
||||
start: systemctl start haproxy
|
||||
stop: systemctl stop haproxy
|
||||
status: systemctl status haproxy
|
||||
repos:
|
||||
- http://download.englab.brq.redhat.com/pub/fedora/releases/25/Everything/x86_64/os/
|
||||
- https://phracek.fedorapeople.org/haproxy-module-repo/
|
||||
test:
|
||||
processrunning:
|
||||
- 'ls /proc/*/exe -alh | grep haproxy'
|
||||
|
||||
17
tests/generated.py
Normal file
17
tests/generated.py
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
import socket
|
||||
from avocado import main
|
||||
import moduleframework
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
class GeneratedTestsConfig(moduleframework.AvocadoTest):
|
||||
"""
|
||||
:avocado: enable
|
||||
"""
|
||||
|
||||
def test_processrunning(self):
|
||||
self.start()
|
||||
self.run("ls /proc/*/exe -alh | grep haproxy")
|
||||
Loading…
Add table
Add a link
Reference in a new issue