Some log information and error treatment
This commit is contained in:
parent
9ba269845d
commit
4b85b98412
9 changed files with 69 additions and 1 deletions
2
.github/workflows/build.yml
vendored
2
.github/workflows/build.yml
vendored
|
|
@ -69,6 +69,8 @@ jobs:
|
|||
with:
|
||||
context: .
|
||||
file: Dockerfile
|
||||
build-args: |
|
||||
RELEASE_VERSION_ARG="${{ join(steps.meta.outputs.tags, ',') }} - ${{ env.GITHUB_SHA }}"
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: ${{ github.event_name != 'pull_request' || github.event.inputs.push == 'true' }}
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,9 @@
|
|||
FROM alpine:3.16
|
||||
|
||||
ARG RELEASE_VERSION_ARG
|
||||
|
||||
ENV RELEASE_VERSION=$RELEASE_VERSION_ARG
|
||||
|
||||
WORKDIR /scripts
|
||||
|
||||
COPY requirements.txt /scripts
|
||||
|
|
|
|||
4
Makefile
4
Makefile
|
|
@ -1,6 +1,8 @@
|
|||
VERSION := $(shell git rev-parse --short HEAD)
|
||||
|
||||
.PHONY: 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
|
||||
test:
|
||||
|
|
|
|||
|
|
@ -85,6 +85,12 @@ docker run --network easyhaproxy byjg/easyhaproxy
|
|||
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
|
||||
|
||||
This method requires a functional Docker Swarm Cluster. The system will search for the labels in all containers on all
|
||||
|
|
|
|||
5
assets/scripts/banner.txt
Normal file
5
assets/scripts/banner.txt
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
_
|
||||
___ __ _ ____ _ ___| |_ __ _ _ __ _ _ _____ ___ _
|
||||
/ -_) _` (_-< || |___| ' \/ _` | '_ \ '_/ _ \ \ / || |
|
||||
\___\__,_/__/\_, | |_||_\__,_| .__/_| \___/_\_\\_, |
|
||||
|__/ |_| |__/
|
||||
|
|
@ -1,5 +1,9 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
if [ ! -f /scripts/letsencrypt_hosts.txt ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Semaphore
|
||||
if [ -f /tmp/certbot-lock ]; then
|
||||
echo "[CERTBOT_JOB] $(date +"$EASYHAPROXY_DATEFORMAT") Another process is running"
|
||||
|
|
|
|||
|
|
@ -4,6 +4,11 @@ cd /scripts
|
|||
|
||||
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
|
||||
CONTROL_FILE="/etc/haproxy/haproxy.cfg"
|
||||
touch ${CONTROL_FILE}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,14 @@ if [ -z "$EASYHAPROXY_REFRESH_CONF" ]; then
|
|||
export EASYHAPROXY_REFRESH_CONF=10
|
||||
fi
|
||||
|
||||
|
||||
cat banner.txt
|
||||
echo Release: $RELEASE_VERSION
|
||||
echo
|
||||
echo "Environment"
|
||||
env | sort | grep 'HAPROXY' | xargs -I{} echo " - {} "
|
||||
echo
|
||||
|
||||
/scripts/haproxy-reload.sh initial
|
||||
|
||||
while true; do
|
||||
|
|
|
|||
32
docker-compose.yml
Normal file
32
docker-compose.yml
Normal 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue