-
-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
182 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,16 @@ | ||
version: '3.7' | ||
services: | ||
|
||
cloudflare-companion: | ||
image: tiredofit/traefik-cloudflare-companion | ||
container_name: cloudflare-companion | ||
volumes: | ||
- /var/run/docker.sock:/var/run/docker.sock:ro | ||
- ./logs:/logs | ||
- /var/run/docker.sock:/var/run/docker.sock | ||
environment: | ||
- TIMEZONE=America/Vancouver | ||
|
||
- LOG_TYPE=BOTH | ||
- LOG_LEVEL=INFO | ||
|
||
- TRAEFIK_VERSION=2 | ||
- [email protected] | ||
- CF_TOKEN=fbSx3dk3A3mJ6UukLQ7zRbo63H5UdsGSCqQnTvbJDgyQaTp | ||
|
@@ -18,12 +22,9 @@ services: | |
#- DOCKER_CERT_PATH=/docker-certs | ||
#- DOCKER_TLS_VERIFY=1 | ||
networks: | ||
- internal | ||
- services | ||
- services | ||
restart: always | ||
|
||
networks: | ||
internal: | ||
external: false | ||
services: | ||
external: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/command/with-contenv bash | ||
|
||
DOCKER_ENTRYPOINT=${DOCKER_ENTRYPOINT:-"unix:///var/run/docker.sock"} | ||
LOG_FILE=${LOG_FILE:-"tcc.log"} | ||
LOG_PATH=${LOG_PATH:-"/logs/"} | ||
LOG_TYPE=${LOG_TYPE:-"BOTH"} | ||
TCC_USER=${TCC_USER:-"root"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/command/with-contenv bash | ||
|
||
bootstrap_filesystem() { | ||
case "${LOG_TYPE,,}" in | ||
both | file ) | ||
print_debug "[bootstrap_filesystem] Logging to file at '${LOG_PATH}/${LOG_FILE}'" | ||
if [ ! -d "${LOG_PATH}" ] ; then | ||
mkdir -p "${LOG_PATH}" | ||
fi | ||
if [ $(stat -c %U "${LOG_PATH}") != "${TCC_USER}" ] ; then chown "${TCC_USER}":"${TCC_USER}" "${LOG_PATH}" ; fi | ||
if [ ! -f "${LOG_PATH}"/"${LOG_FILE}" ] ; then | ||
sudo -u "${TCC_USER}" touch "${LOG_PATH}"/"${LOG_FILE}" | ||
fi | ||
create_logrotate tcc "${LOG_PATH}"/"${LOG_FILE}" "${TCC_USER}" "${TCC_USER}" tcc | ||
if [ "$(stat -c %U "${LOG_PATH}"/"${LOG_FILE}")" != "${TCC_USER}" ] ; then chown "${TCC_USER}":"${TCC_USER}" "${LOG_PATH}"/"${LOG_FILE}" ; fi | ||
;; | ||
esac | ||
} | ||
|
||
sanity_test() { | ||
if [ -z "${DOCKER_HOST}" ] && [ "${TCC_USER}" != "root" ] ; then | ||
if [ "$(echo "${DOCKER_ENTRYPOINT}" | sed -e 's,^\(.*://\).*,\1,g')" = "unix://" ] ; then | ||
docker_socket="$(echo "${DOCKER_ENTRYPOINT}" | sed 's/^\s*.*:\/\///g'})" | ||
if [ "$(stat -c %F "${docker_socket}")" = "socket" ] && [ "$(sudo -u "${TCC_USER}" test -r "${docker_socket}")" ] ; then | ||
print_debug "[sanity_test] Can access Docker socket at '${docker_socket}' as user '${TCC_USER}'" | ||
else | ||
print_error "[sanity_test] Can't access Docker socket at '${docker_socket}' as user '${TCC_USER}'" | ||
exit 1 | ||
fi | ||
fi | ||
fi | ||
|
||
sanity_var TARGET_DOMAIN "Target Domain" | ||
sanity_var DOMAIN1 "Domain 1" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,14 @@ | ||
#!/command/with-contenv bash | ||
|
||
source /assets/functions/00-container | ||
prepare_service defaults single | ||
PROCESS_NAME="traefik-cloudflare-companion" | ||
|
||
check_container_initialized | ||
check_service_initialized init | ||
liftoff | ||
|
||
print_start "Starting Traefik Cloudflare Companion" | ||
exec python3 -u /usr/sbin/cloudflare-companion | ||
exec s6-setuidgid "${TCC_USER}" \ | ||
python3 \ | ||
-u /usr/sbin/cloudflare-companion |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters