commit 972575738d368f0c0c688efaa3b7f0cbf3ba59f1 Author: knoflook Date: Mon Nov 1 16:36:11 2021 +0100 initial commit diff --git a/.env.sample b/.env.sample new file mode 100644 index 0000000..b135a47 --- /dev/null +++ b/.env.sample @@ -0,0 +1,3 @@ +TYPE=croc + +SECRET_CROC_PASS_VERSION=v1 diff --git a/abra.sh b/abra.sh new file mode 100644 index 0000000..bca519f --- /dev/null +++ b/abra.sh @@ -0,0 +1 @@ +export CROC_ENTRYPOINT_VERSION=v1 diff --git a/compose.yml b/compose.yml new file mode 100644 index 0000000..9262063 --- /dev/null +++ b/compose.yml @@ -0,0 +1,25 @@ +version: '3.8' + +services: + app: + image: schollz/croc:master + ports: + - 9009-9013:9009-9013 + environment: + - CROC_PASS_FILE=/run/secrets/croc_pass + secrets: + - croc_pass + configs: + - source: croc_entrypoint + target: /abra-entrypoint.sh + mode: 0555 + entrypoint: /abra-entrypoint.sh + +secrets: + croc_pass: + name: ${STACK_NAME}_croc_pass_${SECRET_CROC_PASS_VERSION} + external: true +configs: + croc_entrypoint: + name: ${STACK_NAME}_croc_entrypoint_${CROC_ENTRYPOINT_VERSION} + file: entrypoint.sh diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000..1a79eb6 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,16 @@ +#!/bin/sh +set -e +if test -f "/run/secrets/croc_pass"; then + pwd=`cat /run/secrets/croc_pass` + if [ -z $pwd ]; then + echo >&2 "error: /run/secrets/croc_pass is empty" + exit 1 + fi + export "CROC_PASS"="$pwd" + unset "pwd" +else + echo >&2 "error: /run/secrets/croc_pass does not exist" + exit 1 +fi + +/croc-entrypoint.sh relay