1
0
Fork 0

Some log information and error treatment

This commit is contained in:
Joao M 2022-08-20 15:50:11 +00:00
parent 9ba269845d
commit 4b85b98412
9 changed files with 69 additions and 1 deletions

View file

@ -69,6 +69,8 @@ jobs:
with: with:
context: . context: .
file: Dockerfile file: Dockerfile
build-args: |
RELEASE_VERSION_ARG="${{ join(steps.meta.outputs.tags, ',') }} - ${{ env.GITHUB_SHA }}"
platforms: linux/amd64,linux/arm64 platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' || github.event.inputs.push == 'true' }} push: ${{ github.event_name != 'pull_request' || github.event.inputs.push == 'true' }}
tags: ${{ steps.meta.outputs.tags }} tags: ${{ steps.meta.outputs.tags }}

View file

@ -1,5 +1,9 @@
FROM alpine:3.16 FROM alpine:3.16
ARG RELEASE_VERSION_ARG
ENV RELEASE_VERSION=$RELEASE_VERSION_ARG
WORKDIR /scripts WORKDIR /scripts
COPY requirements.txt /scripts COPY requirements.txt /scripts

View file

@ -1,6 +1,8 @@
VERSION := $(shell git rev-parse --short HEAD)
.PHONY: build .PHONY: build
build: build:
docker build -t byjg/easy-haproxy -t byjg/easy-haproxy:local . docker build -t byjg/easy-haproxy --build-arg RELEASE_VERSION_ARG="$(VERSION)" -t byjg/easy-haproxy:local .
.PHONY: test .PHONY: test
test: test:

View file

@ -85,6 +85,12 @@ docker run --network easyhaproxy byjg/easyhaproxy
docker run --network easyhaproxy myimage docker run --network easyhaproxy myimage
``` ```
or, if the container is already created you can join it using the command:
```
docker network connect easyhaproxy mycontainer
```
### EASYHAPROXY_DISCOVER: swarm ### EASYHAPROXY_DISCOVER: swarm
This method requires a functional Docker Swarm Cluster. The system will search for the labels in all containers on all This method requires a functional Docker Swarm Cluster. The system will search for the labels in all containers on all

View file

@ -0,0 +1,5 @@
_
___ __ _ ____ _ ___| |_ __ _ _ __ _ _ _____ ___ _
/ -_) _` (_-< || |___| ' \/ _` | '_ \ '_/ _ \ \ / || |
\___\__,_/__/\_, | |_||_\__,_| .__/_| \___/_\_\\_, |
|__/ |_| |__/

View file

@ -1,5 +1,9 @@
#!/usr/bin/env bash #!/usr/bin/env bash
if [ ! -f /scripts/letsencrypt_hosts.txt ]; then
exit 0
fi
# Semaphore # Semaphore
if [ -f /tmp/certbot-lock ]; then if [ -f /tmp/certbot-lock ]; then
echo "[CERTBOT_JOB] $(date +"$EASYHAPROXY_DATEFORMAT") Another process is running" echo "[CERTBOT_JOB] $(date +"$EASYHAPROXY_DATEFORMAT") Another process is running"

View file

@ -4,6 +4,11 @@ cd /scripts
RELOAD="true" RELOAD="true"
if [[ "static|docker|swarm" != *"$EASYHAPROXY_DISCOVER"* ]];then
echo "[CONF_CHECK] $(date +"$EASYHAPROXY_DATEFORMAT") ERROR: EASYHAPROXY_DISCOVER should be 'static', 'docker', or 'swarm'. I got '$EASYHAPROXY_DISCOVER' instead."
exit 1
fi
if [[ "$EASYHAPROXY_DISCOVER" == "static" ]]; then if [[ "$EASYHAPROXY_DISCOVER" == "static" ]]; then
CONTROL_FILE="/etc/haproxy/haproxy.cfg" CONTROL_FILE="/etc/haproxy/haproxy.cfg"
touch ${CONTROL_FILE} touch ${CONTROL_FILE}

View file

@ -10,6 +10,14 @@ if [ -z "$EASYHAPROXY_REFRESH_CONF" ]; then
export EASYHAPROXY_REFRESH_CONF=10 export EASYHAPROXY_REFRESH_CONF=10
fi fi
cat banner.txt
echo Release: $RELEASE_VERSION
echo
echo "Environment"
env | sort | grep 'HAPROXY' | xargs -I{} echo " - {} "
echo
/scripts/haproxy-reload.sh initial /scripts/haproxy-reload.sh initial
while true; do while true; do

32
docker-compose.yml Normal file
View file

@ -0,0 +1,32 @@
version: "3"
services:
easyhaproxy:
image: byjg/easy-haproxy:4.1.0
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- certs_letsencrypt:/certs/letsencrypt
- certs_haproxy:/certs/haproxy
environment:
EASYHAPROXY_DISCOVER: docker
EASYHAPROXY_LABEL_PREFIX: easyhaproxy
EASYHAPROXY_LETSENCRYPT_EMAIL: changeme@example.org
EASYHAPROXY_SSL_MODE: "default"
HAPROXY_CUSTOMERRORS: "true"
HAPROXY_USERNAME: admin
HAPROXY_PASSWORD: password
HAPROXY_STATS_PORT: 1936
ports:
- "80:80/tcp"
- "443:443/tcp"
- "1936:1936/tcp"
volumes:
certs_letsencrypt:
certs_haproxy:
networks:
easyhaproxy:
driver: bridge