retracker

This commit is contained in:
Anatolii Zimovskii 2022-05-23 16:25:23 +03:00
parent 3be130643c
commit 16cac7b358
Signed by: stam
GPG Key ID: AA3A575AB99E8469
5 changed files with 107 additions and 0 deletions

View File

@ -6,6 +6,7 @@
* added `nodejs18` * added `nodejs18`
* updated `jira8`, `bitbucket`, `vscode` * updated `jira8`, `bitbucket`, `vscode`
* updated `apache2`, `zabbix`, `nextcloud` * updated `apache2`, `zabbix`, `nextcloud`
* added `retracker` by [vvampirius/retracker](https://github.com/vvampirius/retracker).
* `february, march` * `february, march`
* new `nextcloud` images, updated `atlassian` images. * new `nextcloud` images, updated `atlassian` images.
* new `nodejs` iamges. * new `nodejs` iamges.

View File

@ -0,0 +1,19 @@
FROM epicmorg/debian:bullseye-develop as builder
RUN go get -v github.com/vvampirius/retracker/...
RUN retracker -v
FROM epicmorg/debian:bullseye
COPY --from=builder /go/bin/retracker /bin/retracker
ENV RETRACKER_PORT=80
ENV RETRACKER_MINUTS=180
ENV RETRACKER_DEBUG=false
ENV RETRACKER_REAL_IP=true
RUN retracker -v
EXPOSE ${RETRACKER_PORT}
ENTRYPOINT ["tini", "-s", "--", "docker-entrypoint.sh"]
CMD ["docker-entrypoint.sh"]

View File

@ -0,0 +1,19 @@
all: app
app:
make build
make deploy
make clean
build:
docker-compose build --compress --parallel
deploy:
docker-compose push
clean:
docker container prune -f
docker image prune -f
docker network prune -f
docker volume prune -f
docker system prune -af

View File

@ -0,0 +1,6 @@
version: '3.9'
services:
app:
image: "epicmorg/retracker:latest"
build:
context: .

View File

@ -0,0 +1,62 @@
#!/bin/bash
set -euo pipefail
# Setup default Opts
: ${RETRACKER_PORT:=80}
: ${RETRACKER_MINUTS:=180}
: ${RETRACKER_DEBUG:=false}
: ${RETRACKER_REAL_IP:=true}
re='^[0-9]+$'
if [[ -z "${RETRACKER_REAL_IP}" ]]; then
echo "[retracker] RemoteAddr from X-Real-IP header env RETRACKER_REAL_IP is not set. Skipping..."
export RETRACKER_REAL_IP_S=""
elif [ "${RETRACKER_REAL_IP}" == "false" ]; then
echo "[retracker] RemoteAddr from X-Real-IP header env RETRACKER_REAL_IP is set to false. Skipping..."
export RETRACKER_REAL_IP_S=""
elif [ "${RETRACKER_REAL_IP}" == "true" ]; then
echo "[retracker] RemoteAddr from X-Real-IP header env RETRACKER_REAL_IP is set to true. Enabling it."
export RETRACKER_REAL_IP_S="-x"
else
echo "[retracker] RemoteAddr from X-Real-IP header env RETRACKER_REAL_IP is set to strange value. Skipping..."
export RETRACKER_REAL_IP_S=""
fi
if [[ -z "${RETRACKER_DEBUG}" ]]; then
echo "[retracker] Debug env RETRACKER_DEBUG is not set. Skipping..."
export RETRACKER_DEBUG_S=""
elif [ "${RETRACKER_DEBUG}" == "false" ]; then
echo "[retracker] Debug env RETRACKER_DEBUG is set to false. Skipping..."
export RETRACKER_DEBUG_S=""
elif [ "${RETRACKER_DEBUG}" == "true" ]; then
echo "[retracker] Debug env RETRACKER_DEBUG is set to true. Enabling it."
export RETRACKER_DEBUG_S="-d"
else
echo "[retracker] Debug env RETRACKER_DEBUG is set to strange value. Skipping..."
export RETRACKER_DEBUG_S=""
fi
if ! [[ $RETRACKER_PORT =~ $re ]] ; then
echo "[retracker] error: Port env RETRACKER_PORT not a number."
export RETRACKER_PORT_S=""
exit 1
fi
export RETRACKER_PORT_S="-l :${RETRACKER_PORT}"
if ! [[ $RETRACKER_MINUTS =~ $re ]] ; then
echo "[retracker] error: Port env RETRACKER_MINUTS not a number."
export RETRACKER_MINUTS_S=""
exit 1
fi
export RETRACKER_MINUTS_S="-a ${RETRACKER_MINUTS}"
#Building final options string
export RETRACKER_OPTS="${RETRACKER_REAL_IP_S} ${RETRACKER_DEBUG_S} ${RETRACKER_MINUTS_S} ${RETRACKER_PORT_S}"
echo "[retracker] Starting up"
retracker -v
retracker ${RETRACKER_OPTS}