mirror of
https://github.com/casjaysdevdocker/tor
synced 2026-06-23 20:01:00 -04:00
🔧 Sync all project files with updated templates 🔧
Update all template-derived files to the 202605261603-git template
version. Service-specific init scripts were committed separately in
fd24da283f03; this commit covers the remaining boilerplate files.
- .env.scripts: bump version 202510220838-git → 202605261603-git, copyright 2025 → 2026
- .gitattributes: update template-generation timestamp
- .gitignore: expand with editor configs, AI tool configs, env/secret, build artifact, test/coverage, and local-override patterns
- rootfs/root/docker/setup/00-init.sh: sync to new template version
- rootfs/root/docker/setup/01-system.sh: sync to new template version
- rootfs/root/docker/setup/02-packages.sh: sync to new template version (CA cert update commands)
- rootfs/root/docker/setup/03-files.sh: sync to new template version (explicit /tmp/{bin,var,etc,data} loops)
- rootfs/root/docker/setup/04-users.sh: sync to new template version
- rootfs/root/docker/setup/05-custom.sh: sync to new template version
- rootfs/root/docker/setup/06-post.sh: sync to new template version
- rootfs/root/docker/setup/07-cleanup.sh: sync to new template version (__find_and_remove helper)
- rootfs/usr/local/bin/entrypoint.sh: sync to new template version
- rootfs/usr/local/etc/docker/functions/entrypoint.sh: sync to new template version
- rootfs/usr/local/share/template-files/config/env/default.sample: bump version stamp
- rootfs/usr/local/share/template-files/config/env/examples/zz-entrypoint.sh: bump version stamp
.env.scripts
.gitattributes
.gitignore
rootfs/root/docker/setup/00-init.sh
rootfs/root/docker/setup/01-system.sh
rootfs/root/docker/setup/02-packages.sh
rootfs/root/docker/setup/03-files.sh
rootfs/root/docker/setup/04-users.sh
rootfs/root/docker/setup/05-custom.sh
rootfs/root/docker/setup/06-post.sh
rootfs/root/docker/setup/07-cleanup.sh
rootfs/usr/local/bin/entrypoint.sh
rootfs/usr/local/etc/docker/functions/entrypoint.sh
rootfs/usr/local/share/template-files/config/env/default.sample
rootfs/usr/local/share/template-files/config/env/examples/zz-entrypoint.sh
This commit is contained in:
+2
-2
@@ -1,9 +1,9 @@
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
##@Version : 202510220838-git
|
||||
##@Version : 202605261603-git
|
||||
# @@Author : CasjaysDev
|
||||
# @@Contact : CasjaysDev <docker-admin@casjaysdev.pro>
|
||||
# @@License : MIT
|
||||
# @@Copyright : Copyright 2025 CasjaysDev
|
||||
# @@Copyright : Copyright 2026 CasjaysDev
|
||||
# @@Created : Wed Oct 22 08:38:42 AM EDT 2025
|
||||
# @@File : .env.scripts
|
||||
# @@Description : Variables for gen-dockerfile and buildx scripts
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
# Template generated on Sat Nov 29 11:57:12 AM EST 2025 from https://github.com/alexkaratarakis/gitattributes"
|
||||
# Template generated on Mon May 26 03:38:00 PM EDT 2026 from https://github.com/alexkaratarakis/gitattributes"
|
||||
# Common settings that generally should always be used with your language specific settings
|
||||
# Auto detect text files and perform LF normalization
|
||||
* text=auto
|
||||
|
||||
+155
-18
@@ -1,4 +1,4 @@
|
||||
# gitignore created on 05/05/26 at 14:38
|
||||
# gitignore created on 05/26/26 at 15:38
|
||||
# Disable reminder in prompt
|
||||
ignoredirmessage
|
||||
|
||||
@@ -6,10 +6,12 @@ ignoredirmessage
|
||||
**/.build_failed*
|
||||
|
||||
# OS generated files
|
||||
|
||||
### Linux ###
|
||||
# Backup files left by editors
|
||||
*~
|
||||
|
||||
# temporary files which can be created if a process still has a handle open of a deleted file
|
||||
# Temporary files left when a process holds an open handle to a deleted file
|
||||
.fuse_hidden*
|
||||
|
||||
# KDE directory preferences
|
||||
@@ -18,11 +20,11 @@ ignoredirmessage
|
||||
# Linux trash folder which might appear on any partition or disk
|
||||
.Trash-*
|
||||
|
||||
# .nfs files are created when an open file is removed but is still being accessed
|
||||
# NFS stale file handles
|
||||
.nfs*
|
||||
|
||||
### macOS ###
|
||||
# General
|
||||
.DS_Store
|
||||
.DS_Store?
|
||||
.AppleDouble
|
||||
.LSOverride
|
||||
@@ -46,20 +48,23 @@ Network Trash Folder
|
||||
Temporary Items
|
||||
.apdisk
|
||||
|
||||
### macOS Patch ###
|
||||
# iCloud generated files
|
||||
*.icloud
|
||||
|
||||
### Windows ###
|
||||
# Windows thumbnail cache files
|
||||
Thumbs.db
|
||||
Thumbs.db:encryptable
|
||||
ehthumbs.db
|
||||
ehthumbs_vista.db
|
||||
|
||||
# Dump file
|
||||
# Crash dump files
|
||||
*.stackdump
|
||||
|
||||
# Core dumps (Linux/macOS)
|
||||
core
|
||||
core.*
|
||||
vgcore.*
|
||||
|
||||
# Folder config file
|
||||
[Dd]esktop.ini
|
||||
|
||||
@@ -73,20 +78,146 @@ $RECYCLE.BIN/
|
||||
*.msm
|
||||
*.msp
|
||||
|
||||
# misc
|
||||
!*/README*
|
||||
!inc/main.bash
|
||||
|
||||
# Windows shortcuts
|
||||
*.lnk
|
||||
|
||||
# ignore commit message
|
||||
### Editors ###
|
||||
# Visual Studio Code
|
||||
.vscode/
|
||||
!.vscode/extensions.json
|
||||
|
||||
# JetBrains IDEs (IntelliJ, GoLand, RustRover, PyCharm, etc.)
|
||||
.idea/
|
||||
*.iml
|
||||
*.iws
|
||||
*.ipr
|
||||
|
||||
# Vim / Neovim
|
||||
*.swp
|
||||
*.swo
|
||||
.netrwhist
|
||||
Session.vim
|
||||
.vim/
|
||||
|
||||
# Sublime Text
|
||||
*.sublime-workspace
|
||||
*.sublime-project
|
||||
|
||||
# Eclipse / generic Java IDEs
|
||||
.project
|
||||
.classpath
|
||||
.factorypath
|
||||
.settings/
|
||||
|
||||
### AI tool local configs (personal settings, never commit) ###
|
||||
# Claude Code
|
||||
.claude/settings.local.json
|
||||
.claude/*.lock
|
||||
|
||||
# Cursor
|
||||
.cursor/
|
||||
.cursorignore
|
||||
.cursorindexingignore
|
||||
|
||||
# GitHub Copilot
|
||||
.copilot/
|
||||
|
||||
# Codeium
|
||||
.codeium/
|
||||
|
||||
# Tabnine
|
||||
.tabnine/
|
||||
|
||||
# Aider
|
||||
.aider/
|
||||
.aider.conf.yml
|
||||
.aider.model.settings.yml
|
||||
.aiderignore
|
||||
|
||||
# General AI assistant local state
|
||||
.ai/
|
||||
.ai.local/
|
||||
|
||||
### Environment and secrets ###
|
||||
# Local env overrides — never commit credentials
|
||||
.env
|
||||
.env.local
|
||||
.env.*.local
|
||||
|
||||
# Private keys and certificates
|
||||
*.pem
|
||||
*.key
|
||||
*.p12
|
||||
*.pfx
|
||||
|
||||
### Build artifacts ###
|
||||
build/
|
||||
dist/
|
||||
out/
|
||||
|
||||
# Rust
|
||||
target/
|
||||
|
||||
# C / C++ / compiled objects
|
||||
*.o
|
||||
*.a
|
||||
*.so
|
||||
*.dylib
|
||||
*.dll
|
||||
*.exe
|
||||
|
||||
### Dependency directories ###
|
||||
# Node
|
||||
node_modules/
|
||||
|
||||
# Go (vendored deps are sometimes committed intentionally, so gitignore only the cache)
|
||||
# vendor/
|
||||
|
||||
# Python
|
||||
__pycache__/
|
||||
*.pyc
|
||||
*.pyo
|
||||
*.pyd
|
||||
.Python
|
||||
*.egg-info/
|
||||
.eggs/
|
||||
.venv/
|
||||
venv/
|
||||
env/
|
||||
|
||||
### Logs ###
|
||||
*.log
|
||||
logs/
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
|
||||
### Temporary and cache ###
|
||||
tmp/
|
||||
.tmp/
|
||||
*.tmp
|
||||
*.cache
|
||||
.cache/
|
||||
|
||||
### Test and coverage ###
|
||||
coverage/
|
||||
.coverage
|
||||
*.cover
|
||||
*.coverprofile
|
||||
htmlcov/
|
||||
.nyc_output/
|
||||
.pytest_cache/
|
||||
.tox/
|
||||
|
||||
### Misc — always allow ###
|
||||
!*/README*
|
||||
!inc/main.bash
|
||||
|
||||
### Project-specific patterns ###
|
||||
# ignore commit message files
|
||||
**/.gitcommit
|
||||
|
||||
# ignore .build_failed files
|
||||
**/.build_failed*
|
||||
|
||||
# ignore .bak files
|
||||
# ignore backup files
|
||||
**/*.bak
|
||||
|
||||
# ignore .no_push files
|
||||
@@ -95,10 +226,16 @@ $RECYCLE.BIN/
|
||||
# ignore .no_git files
|
||||
**/.no_git
|
||||
|
||||
# ignore .installed files
|
||||
# ignore .installed marker files
|
||||
**/.installed
|
||||
|
||||
# ignore work in progress files
|
||||
# ignore work-in-progress rewrite/refactor scripts
|
||||
**/*.rewrite.sh
|
||||
**/*.refactor.sh
|
||||
|
||||
# ignore local override scripts and configs
|
||||
**/*.local.sh
|
||||
**/*.local.conf
|
||||
**/*.local.yaml
|
||||
**/*.local.yml
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
#!/usr/bin/env bash
|
||||
# shellcheck shell=bash
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
##@Version : 202511210523-git
|
||||
##@Version : 202605261538-git
|
||||
# @@Author : CasjaysDev
|
||||
# @@Contact : CasjaysDev <docker-admin@casjaysdev.pro>
|
||||
# @@License : MIT
|
||||
# @@Copyright : Copyright 2025 CasjaysDev
|
||||
# @@Created : Fri Nov 21 05:23:26 AM EST 2025
|
||||
# @@Copyright : Copyright 2026 CasjaysDev
|
||||
# @@Created : Tue May 26 03:38:50 PM EDT 2026
|
||||
# @@File : 00-init.sh
|
||||
# @@Description : script to run init
|
||||
# @@Changelog : newScript
|
||||
@@ -17,7 +17,7 @@
|
||||
# @@sudo/root : yes
|
||||
# @@Template : templates/dockerfiles/init_scripts/00-init.sh
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# shellcheck disable=SC1001,SC1003,SC2001,SC2003,SC2016,SC2031,SC2120,SC2155,SC2199,SC2317,SC2329
|
||||
# shellcheck disable=SC1001,SC1003,SC2001,SC2003,SC2016,SC2031,SC2090,SC2115,SC2120,SC2155,SC2199,SC2229,SC2317,SC2329
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Set bash options
|
||||
set -o pipefail
|
||||
@@ -36,9 +36,10 @@ if [ -d "/usr/local/share/template-files/defaults" ]; then rm -Rf "/usr/local/sh
|
||||
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Set the exit code
|
||||
#exitCode=$?
|
||||
exitCode=$?
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
exit $exitCode
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# ex: ts=2 sw=2 et filetype=sh
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
#!/usr/bin/env bash
|
||||
# shellcheck shell=bash
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
##@Version : 202511210523-git
|
||||
##@Version : 202605261538-git
|
||||
# @@Author : CasjaysDev
|
||||
# @@Contact : CasjaysDev <docker-admin@casjaysdev.pro>
|
||||
# @@License : MIT
|
||||
# @@Copyright : Copyright 2025 CasjaysDev
|
||||
# @@Created : Fri Nov 21 05:23:26 AM EST 2025
|
||||
# @@Copyright : Copyright 2026 CasjaysDev
|
||||
# @@Created : Tue May 26 03:38:50 PM EDT 2026
|
||||
# @@File : 01-system.sh
|
||||
# @@Description : script to run system
|
||||
# @@Changelog : newScript
|
||||
@@ -17,7 +17,7 @@
|
||||
# @@sudo/root : yes
|
||||
# @@Template : templates/dockerfiles/init_scripts/01-system.sh
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# shellcheck disable=SC1001,SC1003,SC2001,SC2003,SC2016,SC2031,SC2120,SC2155,SC2199,SC2317,SC2329
|
||||
# shellcheck disable=SC1001,SC1003,SC2001,SC2003,SC2016,SC2031,SC2090,SC2115,SC2120,SC2155,SC2199,SC2229,SC2317,SC2329
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Set bash options
|
||||
set -o pipefail
|
||||
@@ -34,9 +34,10 @@ exitCode=0
|
||||
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Set the exit code
|
||||
#exitCode=$?
|
||||
exitCode=$?
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
exit $exitCode
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# ex: ts=2 sw=2 et filetype=sh
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
#!/usr/bin/env bash
|
||||
# shellcheck shell=bash
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
##@Version : 202511210523-git
|
||||
##@Version : 202605261538-git
|
||||
# @@Author : CasjaysDev
|
||||
# @@Contact : CasjaysDev <docker-admin@casjaysdev.pro>
|
||||
# @@License : MIT
|
||||
# @@Copyright : Copyright 2025 CasjaysDev
|
||||
# @@Created : Fri Nov 21 05:23:26 AM EST 2025
|
||||
# @@Copyright : Copyright 2026 CasjaysDev
|
||||
# @@Created : Tue May 26 03:38:50 PM EDT 2026
|
||||
# @@File : 02-packages.sh
|
||||
# @@Description : script to run packages
|
||||
# @@Changelog : newScript
|
||||
@@ -17,7 +17,7 @@
|
||||
# @@sudo/root : yes
|
||||
# @@Template : templates/dockerfiles/init_scripts/02-packages.sh
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# shellcheck disable=SC1001,SC1003,SC2001,SC2003,SC2016,SC2031,SC2120,SC2155,SC2199,SC2317,SC2329
|
||||
# shellcheck disable=SC1001,SC1003,SC2001,SC2003,SC2016,SC2031,SC2090,SC2115,SC2120,SC2155,SC2199,SC2229,SC2317,SC2329
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Set bash options
|
||||
set -o pipefail
|
||||
@@ -31,12 +31,20 @@ exitCode=0
|
||||
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Main script
|
||||
if command -v update-ca-certificates >/dev/null 2>&1; then
|
||||
update-ca-certificates
|
||||
elif command -v update-ca-trust >/dev/null 2>&1; then
|
||||
update-ca-trust extract
|
||||
elif command -v trust >/dev/null 2>&1; then
|
||||
trust extract-compat
|
||||
fi
|
||||
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Set the exit code
|
||||
#exitCode=$?
|
||||
exitCode=$?
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
exit $exitCode
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# ex: ts=2 sw=2 et filetype=sh
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
#!/usr/bin/env bash
|
||||
# shellcheck shell=bash
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
##@Version : 202511210523-git
|
||||
##@Version : 202605261538-git
|
||||
# @@Author : CasjaysDev
|
||||
# @@Contact : CasjaysDev <docker-admin@casjaysdev.pro>
|
||||
# @@License : MIT
|
||||
# @@Copyright : Copyright 2025 CasjaysDev
|
||||
# @@Created : Fri Nov 21 05:23:26 AM EST 2025
|
||||
# @@Copyright : Copyright 2026 CasjaysDev
|
||||
# @@Created : Tue May 26 03:38:50 PM EDT 2026
|
||||
# @@File : 03-files.sh
|
||||
# @@Description : script to run files
|
||||
# @@Changelog : newScript
|
||||
@@ -17,7 +17,7 @@
|
||||
# @@sudo/root : yes
|
||||
# @@Template : templates/dockerfiles/init_scripts/03-files.sh
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# shellcheck disable=SC1001,SC1003,SC2001,SC2003,SC2016,SC2031,SC2120,SC2155,SC2199,SC2317,SC2329
|
||||
# shellcheck disable=SC1001,SC1003,SC2001,SC2003,SC2016,SC2031,SC2090,SC2115,SC2120,SC2155,SC2199,SC2229,SC2317,SC2329
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Set bash options
|
||||
set -o pipefail
|
||||
@@ -29,70 +29,70 @@ exitCode=0
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Predefined actions
|
||||
if [ -d "/tmp/bin" ]; then
|
||||
mkdir -p "/usr/local/bin"
|
||||
for bin in "/tmp/bin"/*; do
|
||||
name="$(basename -- "$bin")"
|
||||
echo "Installing $name to /usr/local/bin/$name"
|
||||
copy "$bin" "/usr/local/bin/$name"
|
||||
chmod -f +x "/usr/local/bin/$name"
|
||||
done
|
||||
mkdir -p "/usr/local/bin"
|
||||
for bin in "/tmp/bin"/*; do
|
||||
[ -e "$bin" ] || continue
|
||||
name="${bin##*/}"
|
||||
echo "Installing $name to /usr/local/bin/$name"
|
||||
cp -Rf "$bin" "/usr/local/bin/$name"
|
||||
chmod -f +x "/usr/local/bin/$name"
|
||||
done
|
||||
fi
|
||||
unset bin
|
||||
if [ -d "/tmp/var" ]; then
|
||||
for var in "/tmp/var"/*; do
|
||||
name="$(basename -- "$var")"
|
||||
echo "Installing $var to /var/$name"
|
||||
if [ -d "$var" ]; then
|
||||
mkdir -p "/var/$name"
|
||||
copy "$var/." "/var/$name/"
|
||||
else
|
||||
copy "$var" "/var/$name"
|
||||
fi
|
||||
done
|
||||
for var in "/tmp/var"/*; do
|
||||
[ -e "$var" ] || continue
|
||||
name="${var##*/}"
|
||||
echo "Installing $var to /var/$name"
|
||||
if [ -d "$var" ]; then
|
||||
mkdir -p "/var/$name"
|
||||
cp -Rf "$var/." "/var/$name/"
|
||||
else
|
||||
cp -Rf "$var" "/var/$name"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
unset var
|
||||
if [ -d "/tmp/etc" ]; then
|
||||
for config in "/tmp/etc"/*; do
|
||||
name="$(basename -- "$config")"
|
||||
echo "Installing $config to /etc/$name"
|
||||
if [ -d "$config" ]; then
|
||||
mkdir -p "/etc/$name"
|
||||
copy "$config/." "/etc/$name/"
|
||||
mkdir -p "/usr/local/share/template-files/config/$name"
|
||||
copy "$config/." "/usr/local/share/template-files/config/$name/"
|
||||
else
|
||||
copy "$config" "/etc/$name"
|
||||
copy "$config" "/usr/local/share/template-files/config/$name"
|
||||
fi
|
||||
done
|
||||
for config in "/tmp/etc"/*; do
|
||||
[ -e "$config" ] || continue
|
||||
name="${config##*/}"
|
||||
echo "Installing $config to /etc/$name"
|
||||
if [ -d "$config" ]; then
|
||||
mkdir -p "/etc/$name"
|
||||
cp -Rf "$config/." "/etc/$name/"
|
||||
mkdir -p "/usr/local/share/template-files/config/$name"
|
||||
cp -Rf "$config/." "/usr/local/share/template-files/config/$name/"
|
||||
else
|
||||
cp -Rf "$config" "/etc/$name"
|
||||
cp -Rf "$config" "/usr/local/share/template-files/config/$name"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
unset config
|
||||
if [ -d "/tmp/data" ]; then
|
||||
for data in "/tmp/data"/*; do
|
||||
name="$(basename -- "$data")"
|
||||
echo "Installing $data to /usr/local/share/template-files/data"
|
||||
if [ -d "$data" ]; then
|
||||
mkdir -p "/usr/local/share/template-files/data/$name"
|
||||
copy "$data/." "/usr/local/share/template-files/data/$name/"
|
||||
else
|
||||
copy "$data" "/usr/local/share/template-files/data/$name"
|
||||
fi
|
||||
done
|
||||
for data in "/tmp/data"/*; do
|
||||
[ -e "$data" ] || continue
|
||||
name="${data##*/}"
|
||||
echo "Installing $data to /usr/local/share/template-files/data"
|
||||
if [ -d "$data" ]; then
|
||||
mkdir -p "/usr/local/share/template-files/data/$name"
|
||||
cp -Rf "$data/." "/usr/local/share/template-files/data/$name/"
|
||||
else
|
||||
cp -Rf "$data" "/usr/local/share/template-files/data/$name"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
unset data
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Main script
|
||||
for tor_bin in server relay bridge exit; do
|
||||
if [ ! -f "/usr/local/bin/tor-$tor_bin" ]; then
|
||||
cp -Rf "$(type -P tor 2>/dev/null)" "/usr/local/bin/tor-$tor_bin"
|
||||
chmod +x "/usr/local/bin/tor-$tor_bin"
|
||||
fi
|
||||
done
|
||||
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Set the exit code
|
||||
#exitCode=$?
|
||||
exitCode=$?
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
exit $exitCode
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# ex: ts=2 sw=2 et filetype=sh
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
#!/usr/bin/env bash
|
||||
# shellcheck shell=bash
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
##@Version : 202511210523-git
|
||||
##@Version : 202605261538-git
|
||||
# @@Author : CasjaysDev
|
||||
# @@Contact : CasjaysDev <docker-admin@casjaysdev.pro>
|
||||
# @@License : MIT
|
||||
# @@Copyright : Copyright 2025 CasjaysDev
|
||||
# @@Created : Fri Nov 21 05:23:26 AM EST 2025
|
||||
# @@Copyright : Copyright 2026 CasjaysDev
|
||||
# @@Created : Tue May 26 03:38:50 PM EDT 2026
|
||||
# @@File : 04-users.sh
|
||||
# @@Description : script to run users
|
||||
# @@Changelog : newScript
|
||||
@@ -17,7 +17,7 @@
|
||||
# @@sudo/root : yes
|
||||
# @@Template : templates/dockerfiles/init_scripts/04-users.sh
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# shellcheck disable=SC1001,SC1003,SC2001,SC2003,SC2016,SC2031,SC2120,SC2155,SC2199,SC2317,SC2329
|
||||
# shellcheck disable=SC1001,SC1003,SC2001,SC2003,SC2016,SC2031,SC2090,SC2115,SC2120,SC2155,SC2199,SC2229,SC2317,SC2329
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Set bash options
|
||||
set -o pipefail
|
||||
@@ -34,9 +34,10 @@ exitCode=0
|
||||
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Set the exit code
|
||||
#exitCode=$?
|
||||
exitCode=$?
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
exit $exitCode
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# ex: ts=2 sw=2 et filetype=sh
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
#!/usr/bin/env bash
|
||||
# shellcheck shell=bash
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
##@Version : 202511210523-git
|
||||
##@Version : 202605261538-git
|
||||
# @@Author : CasjaysDev
|
||||
# @@Contact : CasjaysDev <docker-admin@casjaysdev.pro>
|
||||
# @@License : MIT
|
||||
# @@Copyright : Copyright 2025 CasjaysDev
|
||||
# @@Created : Fri Nov 21 05:23:26 AM EST 2025
|
||||
# @@Copyright : Copyright 2026 CasjaysDev
|
||||
# @@Created : Tue May 26 03:38:51 PM EDT 2026
|
||||
# @@File : 05-custom.sh
|
||||
# @@Description : script to run custom
|
||||
# @@Changelog : newScript
|
||||
@@ -17,7 +17,7 @@
|
||||
# @@sudo/root : yes
|
||||
# @@Template : templates/dockerfiles/init_scripts/05-custom.sh
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# shellcheck disable=SC1001,SC1003,SC2001,SC2003,SC2016,SC2031,SC2120,SC2155,SC2199,SC2317,SC2329
|
||||
# shellcheck disable=SC1001,SC1003,SC2001,SC2003,SC2016,SC2031,SC2090,SC2115,SC2120,SC2155,SC2199,SC2229,SC2317,SC2329
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Set bash options
|
||||
set -o pipefail
|
||||
@@ -34,9 +34,10 @@ exitCode=0
|
||||
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Set the exit code
|
||||
#exitCode=$?
|
||||
exitCode=$?
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
exit $exitCode
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# ex: ts=2 sw=2 et filetype=sh
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
#!/usr/bin/env bash
|
||||
# shellcheck shell=bash
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
##@Version : 202511210523-git
|
||||
##@Version : 202605261538-git
|
||||
# @@Author : CasjaysDev
|
||||
# @@Contact : CasjaysDev <docker-admin@casjaysdev.pro>
|
||||
# @@License : MIT
|
||||
# @@Copyright : Copyright 2025 CasjaysDev
|
||||
# @@Created : Fri Nov 21 05:23:26 AM EST 2025
|
||||
# @@Copyright : Copyright 2026 CasjaysDev
|
||||
# @@Created : Tue May 26 03:38:52 PM EDT 2026
|
||||
# @@File : 06-post.sh
|
||||
# @@Description : script to run post
|
||||
# @@Changelog : newScript
|
||||
@@ -17,7 +17,7 @@
|
||||
# @@sudo/root : yes
|
||||
# @@Template : templates/dockerfiles/init_scripts/06-post.sh
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# shellcheck disable=SC1001,SC1003,SC2001,SC2003,SC2016,SC2031,SC2120,SC2155,SC2199,SC2317,SC2329
|
||||
# shellcheck disable=SC1001,SC1003,SC2001,SC2003,SC2016,SC2031,SC2090,SC2115,SC2120,SC2155,SC2199,SC2229,SC2317,SC2329
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Set bash options
|
||||
set -o pipefail
|
||||
@@ -34,9 +34,10 @@ exitCode=0
|
||||
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Set the exit code
|
||||
#exitCode=$?
|
||||
exitCode=$?
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
exit $exitCode
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# ex: ts=2 sw=2 et filetype=sh
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
#!/usr/bin/env bash
|
||||
# shellcheck shell=bash
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
##@Version : 202511210523-git
|
||||
##@Version : 202605261538-git
|
||||
# @@Author : CasjaysDev
|
||||
# @@Contact : CasjaysDev <docker-admin@casjaysdev.pro>
|
||||
# @@License : MIT
|
||||
# @@Copyright : Copyright 2025 CasjaysDev
|
||||
# @@Created : Fri Nov 21 05:23:26 AM EST 2025
|
||||
# @@Copyright : Copyright 2026 CasjaysDev
|
||||
# @@Created : Tue May 26 03:38:52 PM EDT 2026
|
||||
# @@File : 07-cleanup.sh
|
||||
# @@Description : script to run cleanup
|
||||
# @@Changelog : newScript
|
||||
@@ -17,14 +17,14 @@
|
||||
# @@sudo/root : yes
|
||||
# @@Template : templates/dockerfiles/init_scripts/07-cleanup.sh
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# shellcheck disable=SC1001,SC1003,SC2001,SC2003,SC2016,SC2031,SC2120,SC2155,SC2199,SC2317,SC2329
|
||||
# shellcheck disable=SC1001,SC1003,SC2001,SC2003,SC2016,SC2031,SC2090,SC2115,SC2120,SC2155,SC2199,SC2229,SC2317,SC2329
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Set bash options
|
||||
set -o pipefail
|
||||
[ "$DEBUGGER" = "on" ] && echo "Enabling debugging" && set -x$DEBUGGER_OPTIONS
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Load functions
|
||||
__find_and_remove() { [ -z "$1" ] || find "${2:-/etc}" -iname "$1" -exec rm -Rf {} \; 2>/dev/null; }
|
||||
__find_and_remove() { [ -z "$1" ] || find "${2:-/etc}" -iname "$1" -exec rm -Rf {} + 2>/dev/null; }
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Set env variables
|
||||
exitCode=0
|
||||
@@ -33,16 +33,15 @@ exitCode=0
|
||||
# Predefined actions
|
||||
if [ -d "/tmp" ]; then rm -Rf "/tmp"/*; fi
|
||||
if [ -d "$HOME/.cache" ]; then rm -Rf "$HOME/.cache"; fi
|
||||
rm -Rf "/etc/privoxy"/*.new
|
||||
rm -Rf "/etc/privoxy"/*/*.new
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Main script
|
||||
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Set the exit code
|
||||
#exitCode=$?
|
||||
exitCode=$?
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
exit $exitCode
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# ex: ts=2 sw=2 et filetype=sh
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
#!/usr/bin/env bash
|
||||
# shellcheck shell=bash
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
##@Version : 202602061352-git
|
||||
##@Version : 202605241245-git
|
||||
# @@Author : Jason Hempstead
|
||||
# @@Contact : jason@casjaysdev.pro
|
||||
# @@License : WTFPL
|
||||
# @@ReadME : entrypoint.sh --help
|
||||
# @@Copyright : Copyright: (c) 2026 Jason Hempstead, Casjays Developments
|
||||
# @@Created : Tuesday, May 05, 2026 14:38 EDT
|
||||
# @@Created : Tuesday, May 26, 2026 15:38 EDT
|
||||
# @@File : entrypoint.sh
|
||||
# @@Description : Entrypoint file for tor
|
||||
# @@Description : Entrypoint file for alpine
|
||||
# @@Changelog : New script
|
||||
# @@TODO : Better documentation
|
||||
# @@Other :
|
||||
@@ -21,17 +21,25 @@
|
||||
# shellcheck disable=SC1001,SC1003,SC2001,SC2003,SC2016,SC2031,SC2090,SC2115,SC2120,SC2155,SC2199,SC2229,SC2317,SC2329
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# run trap command on exit
|
||||
trap 'retVal=$?;[ "$SERVICE_IS_RUNNING" != "yes" ] && [ -f "$SERVICE_PID_FILE" ] && rm -Rf "$SERVICE_PID_FILE";exit $retVal' INT TERM PWR
|
||||
trap 'retVal=$?;[ "$SERVICE_IS_RUNNING" != "yes" ] && [ -f "$SERVICE_PID_FILE" ] && rm -Rf "$SERVICE_PID_FILE";exit $retVal' INT TERM
|
||||
trap 'retVal=$?;[ "$SERVICE_IS_RUNNING" != "yes" ] && [ -f "$SERVICE_PID_FILE" ] && rm -Rf "$SERVICE_PID_FILE";exit $retVal' SIGPWR 2>/dev/null || true
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# setup debugging - https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html
|
||||
[ -f "/config/.debug" ] && [ -z "$DEBUGGER_OPTIONS" ] && export DEBUGGER_OPTIONS="$(<"/config/.debug")" || DEBUGGER_OPTIONS="${DEBUGGER_OPTIONS:-}"
|
||||
{ [ "$DEBUGGER" = "on" ] || [ -f "/config/.debug" ]; } && echo "Enabling debugging" && set -o pipefail -x$DEBUGGER_OPTIONS && export DEBUGGER="on" || set -o pipefail
|
||||
if [ "$DEBUGGER" = "on" ] || [ -f "/config/.debug" ]; then
|
||||
echo "Enabling debugging"
|
||||
set -o pipefail
|
||||
[ -n "$DEBUGGER_OPTIONS" ] && set -"$DEBUGGER_OPTIONS"
|
||||
export DEBUGGER="on"
|
||||
else
|
||||
set -o pipefail
|
||||
fi
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
PATH="/usr/local/etc/docker/bin:/usr/local/bin:/usr/bin:/usr/sbin:/bin:/sbin"
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Set bash options
|
||||
SCRIPT_FILE="$0"
|
||||
CONTAINER_NAME="tor"
|
||||
CONTAINER_NAME="alpine"
|
||||
SCRIPT_NAME="${SCRIPT_FILE##*/}"
|
||||
CONTAINER_NAME="${ENV_CONTAINER_NAME:-$CONTAINER_NAME}"
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
@@ -54,7 +62,7 @@ case "$1" in
|
||||
-h | --help)
|
||||
shift 1
|
||||
echo 'Docker container for '$CONTAINER_NAME''
|
||||
echo "Usage: $CONTAINER_NAME [help tail cron exec start init shell certbot ssl procs ports healthcheck backup command]"
|
||||
echo "Usage: $CONTAINER_NAME [help tail cron exec start init shell procs ports healthcheck backup command]"
|
||||
echo ""
|
||||
exit 0
|
||||
;;
|
||||
@@ -87,8 +95,8 @@ SERVICE_UID="${SERVICE_UID:-0}"
|
||||
SERVICE_GID="${SERVICE_GID:-0}"
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# User and group in which the service switches to - IE: nginx,apache,mysql,postgres
|
||||
#SERVICE_USER="${SERVICE_USER:-tor}" # execute command as another user
|
||||
#SERVICE_GROUP="${SERVICE_GROUP:-tor}" # Set the service group
|
||||
#SERVICE_USER="${SERVICE_USER:-alpine}" # execute command as another user
|
||||
#SERVICE_GROUP="${SERVICE_GROUP:-alpine}" # Set the service group
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Secondary ports
|
||||
# specifiy other ports
|
||||
@@ -143,7 +151,7 @@ export DOMAINNAME="$(hostname -d)"
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Default directories
|
||||
export SSL_DIR="${SSL_DIR:-/config/ssl}"
|
||||
export SSL_CA="${SSL_CERT:-/config/ssl/ca.crt}"
|
||||
export SSL_CA="${SSL_CA:-/config/ssl/ca.crt}"
|
||||
export SSL_KEY="${SSL_KEY:-/config/ssl/localhost.pem}"
|
||||
export SSL_CERT="${SSL_CERT:-/config/ssl/localhost.crt}"
|
||||
export LOCAL_BIN_DIR="${LOCAL_BIN_DIR:-/usr/local/bin}"
|
||||
@@ -164,7 +172,7 @@ export NGINX_CONFIG_FILE="${NGINX_CONFIG_FILE:-$(__find_nginx_conf)}"
|
||||
export MYSQL_CONFIG_FILE="${MYSQL_CONFIG_FILE:-$(__find_mysql_conf)}"
|
||||
export PGSQL_CONFIG_FILE="${PGSQL_CONFIG_FILE:-$(__find_pgsql_conf)}"
|
||||
export MONGODB_CONFIG_FILE="${MONGODB_CONFIG_FILE:-$(__find_mongodb_conf)}"
|
||||
export ENTRYPOINT_PID_FILE="${ENTRYPOINT_PID_FILE:-$ENTRYPOINT_PID_FILE}"
|
||||
export ENTRYPOINT_PID_FILE="${ENTRYPOINT_PID_FILE:-/run/.entrypoint.pid}"
|
||||
export ENTRYPOINT_INIT_FILE="${ENTRYPOINT_INIT_FILE:-/config/.entrypoint.done}"
|
||||
export ENTRYPOINT_DATA_INIT_FILE="${ENTRYPOINT_DATA_INIT_FILE:-/data/.docker_has_run}"
|
||||
export ENTRYPOINT_CONFIG_INIT_FILE="${ENTRYPOINT_CONFIG_INIT_FILE:-/config/.docker_has_run}"
|
||||
@@ -214,8 +222,6 @@ SERVER_PORTS="${SERVER_PORTS//,/ }" #
|
||||
SERVER_PORTS="${SERVER_PORTS//\/*/}" #
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# clean WEB_SERVER_PORTS variables
|
||||
WEB_SERVER_PORTS="${WEB_SERVER_PORT//\/*/}" #
|
||||
WEB_SERVER_PORTS="${WEB_SERVER_PORTS//\/*/}" #
|
||||
WEB_SERVER_PORTS="${WEB_SERVER_PORT//,/ } ${ENV_WEB_SERVER_PORTS//,/ }" #
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# rewrite and merge variables
|
||||
@@ -288,7 +294,7 @@ fi
|
||||
if [ "$ENTRYPOINT_FIRST_RUN" != "no" ]; then
|
||||
if [ "$CONFIG_DIR_INITIALIZED" = "no" ] || [ "$DATA_DIR_INITIALIZED" = "no" ]; then
|
||||
if [ "$ENTRYPOINT_MESSAGE" = "yes" ]; then
|
||||
echo "Executing entrypoint script for tor"
|
||||
echo "Executing entrypoint script for alpine"
|
||||
fi
|
||||
fi
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
@@ -357,7 +363,7 @@ if [ "$ENTRYPOINT_FIRST_RUN" != "no" ]; then
|
||||
fi
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
if [ -f "/etc/hostname" ]; then
|
||||
if [ -n "$(type -P hostname 2>/dev/null)" ]; then
|
||||
if command -v hostname &>/dev/null; then
|
||||
hostname -F "/etc/hostname" 2>/dev/null || true
|
||||
else
|
||||
HOSTNAME="$(<"/etc/hostname")" 2>/dev/null || true
|
||||
@@ -372,7 +378,7 @@ if [ "$ENTRYPOINT_FIRST_RUN" != "no" ]; then
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# import resolv.conf file into container
|
||||
if [ "$CUSTOM_DNS" != "yes" ] && [ -f "/usr/local/etc/resolv.conf" ] && [ "$UPDATE_FILE_RESOLV" = "yes" ]; then
|
||||
cat "/usr/local/etc/resolv.conf" >"/etc/resolv.conf" 2>/dev/null || true
|
||||
cp -f "/usr/local/etc/resolv.conf" "/etc/resolv.conf" 2>/dev/null || true
|
||||
fi
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
if [ -n "$HOME" ] && [ -d "/usr/local/etc/skel" ]; then
|
||||
@@ -383,12 +389,13 @@ if [ "$ENTRYPOINT_FIRST_RUN" != "no" ]; then
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
fi
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Delete any .gitkeep files
|
||||
# Delete any .gitkeep files (bash * does not match dotfiles by default,
|
||||
# so the explicit /.gitkeep path is required at each depth)
|
||||
if [ -d "/data" ]; then
|
||||
rm -Rf "/data/.gitkeep" "/data"/*/*.gitkeep 2>/dev/null || true
|
||||
rm -Rf "/data/.gitkeep" "/data"/*/.gitkeep 2>/dev/null || true
|
||||
fi
|
||||
if [ -d "/config" ]; then
|
||||
rm -Rf "/config/.gitkeep" "/config"/*/*.gitkeep 2>/dev/null || true
|
||||
rm -Rf "/config/.gitkeep" "/config"/*/.gitkeep 2>/dev/null || true
|
||||
fi
|
||||
if [ -f "/usr/local/bin/.gitkeep" ]; then
|
||||
rm -Rf "/usr/local/bin/.gitkeep" 2>/dev/null || true
|
||||
@@ -442,7 +449,7 @@ fi
|
||||
# if no pid assume container restart - clean stale files on restart
|
||||
if [ -f "$ENTRYPOINT_PID_FILE" ]; then
|
||||
# Check if the PID in the file is still running
|
||||
entrypoint_pid=$(cat "$ENTRYPOINT_PID_FILE" 2>/dev/null || echo "")
|
||||
entrypoint_pid=$(<"$ENTRYPOINT_PID_FILE") 2>/dev/null
|
||||
if [ -n "$entrypoint_pid" ] && kill -0 "$entrypoint_pid" 2>/dev/null; then
|
||||
# Process is still running, don't restart services
|
||||
START_SERVICES="no"
|
||||
@@ -451,12 +458,12 @@ if [ -f "$ENTRYPOINT_PID_FILE" ]; then
|
||||
# PID file exists but process is dead - this is a restart
|
||||
START_SERVICES="yes"
|
||||
# Clean any stale PID files on restart
|
||||
rm -f /run/__start_init_scripts.pid /run/init.d/*.pid /run/*.pid 2>/dev/null || true
|
||||
rm -f /run/.start_init_scripts.pid /run/init.d/*.pid /run/*.pid 2>/dev/null || true
|
||||
fi
|
||||
else
|
||||
START_SERVICES=yes
|
||||
# Clean any stale PID files on first run
|
||||
rm -f /run/__start_init_scripts.pid /run/init.d/*.pid /run/*.pid 2>/dev/null || true
|
||||
rm -f /run/.start_init_scripts.pid /run/init.d/*.pid /run/*.pid 2>/dev/null || true
|
||||
fi
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
[ "$ENTRYPOINT_MESSAGE" = "yes" ] && __printf_space "40" "The containers ip address is:" "$CONTAINER_IP4_ADDRESS"
|
||||
@@ -482,7 +489,7 @@ __set_user_group_id $SERVICE_USER ${SERVICE_UID:-} ${SERVICE_GID:-}
|
||||
__run_message
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Just start services
|
||||
START_SERVICES="${START_SERVICES:-SYSTEM_INIT}"
|
||||
START_SERVICES="${START_SERVICES:-yes}"
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Determine if we should start services based on command
|
||||
# Only skip service start for the 'init' command
|
||||
@@ -540,10 +547,10 @@ logs)
|
||||
tail -Fq /data/logs/*/*
|
||||
;;
|
||||
clean)
|
||||
log_files="$(find "/data/logs" -type f)"
|
||||
mapfile -t log_files < <(find "/data/logs" -type f 2>/dev/null)
|
||||
for log in "${log_files[@]}"; do
|
||||
__log_info "Clearing log file: $log"
|
||||
printf '' >$log
|
||||
printf '' >"$log"
|
||||
done
|
||||
;;
|
||||
*)
|
||||
@@ -578,16 +585,16 @@ healthcheck)
|
||||
healthPorts="${WEB_SERVER_PORTS:-}"
|
||||
healthEndPoints="${HEALTH_ENDPOINTS:-}"
|
||||
SERVICES_LIST="${arguments:-$SERVICES_LIST}"
|
||||
services="$(echo "${SERVICES_LIST//,/ }")"
|
||||
services="${SERVICES_LIST//,/ }"
|
||||
healthMessage="Everything seems to be running"
|
||||
[ "$healthEnabled" = "yes" ] || exit 0
|
||||
if [ -d "/run/healthcheck" ] && [ "$(ls -A "/run/healthcheck" | wc -l)" -ne 0 ]; then
|
||||
if [ -d "/run/healthcheck" ] && ! __is_dir_empty "/run/healthcheck"; then
|
||||
for service in /run/healthcheck/*; do
|
||||
name="${service##*/}"
|
||||
services+="$name "
|
||||
done
|
||||
fi
|
||||
services="$(echo "$services" | tr ' ' '\n' | sort -u | grep -v '^$')"
|
||||
services="$(printf '%s\n' $services | sort -u | grep -v '^$')"
|
||||
for proc in $services; do
|
||||
if [ -n "$proc" ]; then
|
||||
if ! __pgrep "$proc"; then
|
||||
@@ -596,8 +603,8 @@ healthcheck)
|
||||
fi
|
||||
fi
|
||||
done
|
||||
for port in $ports; do
|
||||
if [ -n "$(type -P netstat)" ] && [ -n "$port" ]; then
|
||||
for port in $healthPorts; do
|
||||
if command -v netstat &>/dev/null && [ -n "$port" ]; then
|
||||
if ! netstat -taupln | grep -q ":$port "; then
|
||||
echo "$port isn't open" >&2
|
||||
healthStatus=$((healthStatus + 1))
|
||||
@@ -621,38 +628,17 @@ healthcheck)
|
||||
# show open ports
|
||||
ports)
|
||||
shift 1
|
||||
ports="$(__netstat -taupln | awk -F ' ' '{print $4}' | awk -F ':' '{print $2}' | sort --unique --version-sort | grep -v '^$' | grep '^' || echo '')"
|
||||
ports="$(__netstat -taupln 2>/dev/null | awk '{ split($4, a, ":"); if (a[2] != "") print a[2] }' | sort -uV)"
|
||||
[ -n "$ports" ] && printf '%s\n%s\n' "The following are servers:" "$ports" | tr '\n' ' '
|
||||
exit $?
|
||||
;;
|
||||
# show running processes
|
||||
procs)
|
||||
shift 1
|
||||
ps="$(__ps axco command | grep -vE 'COMMAND|grep|ps' | sort -u || grep '^' || echo '')"
|
||||
ps="$(__ps axco command 2>/dev/null | grep -vE '^(COMMAND|grep|ps)$' | sort -u)"
|
||||
[ -n "$ps" ] && printf '%s\n%s\n' "Found the following processes" "$ps" | tr '\n' ' '
|
||||
exit $?
|
||||
;;
|
||||
# setup ssl
|
||||
ssl)
|
||||
shift 1
|
||||
__create_ssl_cert
|
||||
exit $?
|
||||
;;
|
||||
# manage ssl certificate
|
||||
certbot)
|
||||
shift 1
|
||||
CERT_BOT_ENABLED="yes"
|
||||
if [ "$1" = "create" ]; then
|
||||
shift 1
|
||||
__certbot "create"
|
||||
elif [ "$1" = "renew" ]; then
|
||||
shift 1
|
||||
__certbot "renew certonly --force-renew"
|
||||
else
|
||||
__exec_command "certbot" "$@"
|
||||
fi
|
||||
exit $?
|
||||
;;
|
||||
# Launch shell
|
||||
*/bin/sh | */bin/bash | bash | sh | shell)
|
||||
shift 1
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
# shellcheck shell=bash
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
##@Version : 202605241142-git
|
||||
##@Version : 202605241245-git
|
||||
# @@Author : Jason Hempstead
|
||||
# @@Contact : git-admin@casjaysdev.pro
|
||||
# @@License : LICENSE.md
|
||||
@@ -356,92 +356,6 @@ __update_ssl_certs() {
|
||||
fi
|
||||
}
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
__certbot() {
|
||||
[ -n "$(type -P 'certbot')" ] || return 1
|
||||
local options="$1"
|
||||
local statusCode=0
|
||||
local domain_list=""
|
||||
local certbot_key_opts=""
|
||||
local ADD_CERTBOT_DOMAINS=""
|
||||
local CERTBOT_DOMAINS="${CERTBOT_DOMAINS:-$HOSTNAME}"
|
||||
local CERT_BOT_MAIL="${CERT_BOT_MAIL:-ssl-admin@$CERTBOT_DOMAINS}"
|
||||
local certbot_key_opts=""
|
||||
mkdir -p "/config/letsencrypt"
|
||||
__symlink "/etc/letsencrypt" "/config/letsencrypt"
|
||||
is_renewal="$(find /etc/letsencrypt/renewal -type f 2>/dev/null || false)"
|
||||
[ -f "/config/env/ssl.sh" ] && . "/config/env/ssl.sh"
|
||||
[ -f "/config/certbot/env.sh" ] && . "/config/certbot/env.sh"
|
||||
if [ -n "$SSL_KEY" ]; then
|
||||
mkdir -p "$(dirname "$SSL_KEY")" 2>/dev/null || true
|
||||
else
|
||||
echo "The variable SSL_KEY is not set" >&2
|
||||
return 1
|
||||
fi
|
||||
if [ -n "$SSL_CERT" ]; then
|
||||
mkdir -p "$(dirname "$SSL_CERT")" 2>/dev/null || true
|
||||
else
|
||||
echo "The variable SSL_CERT is not set" >&2
|
||||
return 1
|
||||
fi
|
||||
domain_list="$CERTBOT_DOMAINS www.$CERTBOT_DOMAINS mail.$CERTBOT_DOMAINS"
|
||||
domain_list="$(echo "$domain_list" | tr ' ' '\n' | sort -u | tr '\n' ' ')"
|
||||
if [ "$CERT_BOT_ENABLED" != "true" ]; then
|
||||
export CERT_BOT_ENABLED=""
|
||||
return 10
|
||||
fi
|
||||
if [ -z "$CERT_BOT_MAIL" ]; then
|
||||
echo "The variable CERT_BOT_MAIL is not set" >&2
|
||||
return 1
|
||||
fi
|
||||
if [ -z "$CERTBOT_DOMAINS" ]; then
|
||||
echo "The variable CERTBOT_DOMAINS is not set" >&2
|
||||
return 1
|
||||
fi
|
||||
for domain in $CERTBOT_DOMAINS; do
|
||||
[ -n "$domain" ] && ADD_CERTBOT_DOMAINS+="-d $domain "
|
||||
done
|
||||
local expand_opt=""
|
||||
if [ -n "$is_renewal" ]; then
|
||||
options="renew"
|
||||
ADD_CERTBOT_DOMAINS=""
|
||||
else
|
||||
options="certonly"
|
||||
expand_opt="--expand"
|
||||
fi
|
||||
certbot_key_opts="$ADD_CERTBOT_DOMAINS"
|
||||
if [ -f "/config/certbot/setup.sh" ]; then
|
||||
\bash "/config/certbot/setup.sh"
|
||||
statusCode=$?
|
||||
elif [ -f "/etc/named/certbot.sh" ]; then
|
||||
\bash "/etc/named/certbot.sh"
|
||||
statusCode=$?
|
||||
elif [ -f "/config/certbot/dns.conf" ]; then
|
||||
if certbot $options -n --dry-run --agree-tos $expand_opt --dns-rfc2136 --dns-rfc2136-credentials /config/certbot/dns.conf $certbot_key_opts; then
|
||||
certbot $options -n --agree-tos $expand_opt --dns-rfc2136 --dns-rfc2136-credentials /config/certbot/dns.conf $certbot_key_opts
|
||||
fi
|
||||
statusCode=$?
|
||||
elif [ -f "/config/certbot/certbot.conf" ]; then
|
||||
if certbot $options -n --dry-run --agree-tos $expand_opt --dns-rfc2136 --dns-rfc2136-credentials /config/certbot/certbot.conf $certbot_key_opts; then
|
||||
certbot $options -n --agree-tos $expand_opt --dns-rfc2136 --dns-rfc2136-credentials /config/certbot/certbot.conf $certbot_key_opts
|
||||
fi
|
||||
statusCode=$?
|
||||
elif [ -f "/config/named/certbot-update.conf" ]; then
|
||||
if certbot $options -n --dry-run --agree-tos $expand_opt --dns-rfc2136 --dns-rfc2136-credentials /config/named/certbot-update.conf $certbot_key_opts; then
|
||||
certbot $options -n --agree-tos $expand_opt --dns-rfc2136 --dns-rfc2136-credentials /config/named/certbot-update.conf $certbot_key_opts
|
||||
fi
|
||||
statusCode=$?
|
||||
else
|
||||
if [ -n "$ADD_CERTBOT_DOMAINS" ]; then
|
||||
certbot $options --agree-tos -m $CERT_BOT_MAIL --webroot "${WWW_ROOT_DIR:-/usr/local/share/httpd/default}" $certbot_key_opts
|
||||
statusCode=$?
|
||||
else
|
||||
statusCode=1
|
||||
fi
|
||||
fi
|
||||
[ $statusCode -eq 0 ] && __update_ssl_certs
|
||||
return $statusCode
|
||||
}
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
__display_user_info() {
|
||||
if [ -n "$user_name" ] || [ -n "$user_pass" ] || [ -n "$root_user_name" ] || [ -n "$root_user_pass" ]; then
|
||||
__banner "User info"
|
||||
@@ -483,29 +397,26 @@ __init_config_etc() {
|
||||
}
|
||||
__create_ssl_cert() {
|
||||
local SSL_DIR="${SSL_DIR:-/etc/ssl}"
|
||||
if ! __certbot certonly; then
|
||||
[ -f "/config/env/ssl.sh" ] && . "/config/env/ssl.sh"
|
||||
if [ -z "$SSL_DIR" ]; then
|
||||
echo "SSL_DIR is unset"
|
||||
return 1
|
||||
fi
|
||||
[ -d "$SSL_DIR" ] || mkdir -p "$SSL_DIR"
|
||||
if [ -n "$FORCE_SSL" ] || [ ! -f "$SSL_CERT" ] || [ ! -f "$SSL_KEY" ]; then
|
||||
echo "Setting Country to $COUNTRY and Setting State/Province to $STATE and Setting City to $CITY"
|
||||
echo "Setting OU to $UNIT and Setting ORG to $ORG and Setting server to $CN"
|
||||
echo "All variables can be overwritten by creating a /config/.ssl.env and setting the variables there"
|
||||
echo "Creating ssl key and certificate in $SSL_DIR and will be valid for $((VALID_FOR / 365)) year[s]"
|
||||
#
|
||||
openssl req \
|
||||
-new \
|
||||
-newkey rsa:$RSA \
|
||||
-days $VALID_FOR \
|
||||
-nodes \
|
||||
-x509 \
|
||||
-subj "/C=${COUNTRY// /\\ }/ST=${STATE// /\\ }/L=${CITY// /\\ }/O=${ORG// /\\ }/OU=${UNIT// /\\ }/CN=${CN// /\\ }" \
|
||||
-keyout "$SSL_KEY" \
|
||||
-out "$SSL_CERT"
|
||||
fi
|
||||
[ -f "/config/env/ssl.sh" ] && . "/config/env/ssl.sh"
|
||||
if [ -z "$SSL_DIR" ]; then
|
||||
echo "SSL_DIR is unset" >&2
|
||||
return 1
|
||||
fi
|
||||
[ -d "$SSL_DIR" ] || mkdir -p "$SSL_DIR"
|
||||
if [ -n "$FORCE_SSL" ] || [ ! -f "$SSL_CERT" ] || [ ! -f "$SSL_KEY" ]; then
|
||||
echo "Setting Country to $COUNTRY and Setting State/Province to $STATE and Setting City to $CITY"
|
||||
echo "Setting OU to $UNIT and Setting ORG to $ORG and Setting server to $CN"
|
||||
echo "All variables can be overwritten by creating a /config/.ssl.env and setting the variables there"
|
||||
echo "Creating ssl key and certificate in $SSL_DIR and will be valid for $((VALID_FOR / 365)) year[s]"
|
||||
openssl req \
|
||||
-new \
|
||||
-newkey rsa:$RSA \
|
||||
-days $VALID_FOR \
|
||||
-nodes \
|
||||
-x509 \
|
||||
-subj "/C=${COUNTRY// /\\ }/ST=${STATE// /\\ }/L=${CITY// /\\ }/O=${ORG// /\\ }/OU=${UNIT// /\\ }/CN=${CN// /\\ }" \
|
||||
-keyout "$SSL_KEY" \
|
||||
-out "$SSL_CERT"
|
||||
fi
|
||||
if [ -f "$SSL_CERT" ] && [ -f "$SSL_KEY" ]; then
|
||||
__update_ssl_certs
|
||||
@@ -577,7 +488,6 @@ __init_couchdb() {
|
||||
# Show available init functions
|
||||
__init_help() {
|
||||
echo '
|
||||
__certbot
|
||||
__update_ssl_certs
|
||||
__create_ssl_cert
|
||||
'
|
||||
@@ -1533,27 +1443,16 @@ __is_htdocs_mounted() {
|
||||
}
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
__initialize_ssl_certs() {
|
||||
[ "$SSL_ENABLED" = "yes" ] && __certbot
|
||||
if [ -d "/config/letsencrypt" ]; then
|
||||
mkdir -p "/etc/letsencrypt"
|
||||
__file_copy "/config/letsencrypt" "/etc/letsencrypt/"
|
||||
elif [ -d "/etc/letsencrypt" ] && [ ! -d "/config/letsencrypt" ]; then
|
||||
mkdir -p "/config/letsencrypt"
|
||||
__file_copy "/etc/letsencrypt" "/config/letsencrypt/"
|
||||
else
|
||||
[ -d "$SSL_DIR" ] || mkdir -p "$SSL_DIR"
|
||||
if [ "$SSL_ENABLED" = "true" ] || [ "$SSL_ENABLED" = "yes" ]; then
|
||||
if [ -f "$SSL_CERT" ] && [ -f "$SSL_KEY" ]; then
|
||||
SSL_ENABLED="true"
|
||||
if [ -n "$SSL_CA" ] && [ -f "$SSL_CA" ]; then
|
||||
mkdir -p "$SSL_DIR/certs"
|
||||
cat "$SSL_CA" >>"/etc/ssl/certs/ca-certificates.crt"
|
||||
cp -Rf "/." "$SSL_DIR/"
|
||||
fi
|
||||
else
|
||||
[ -d "$SSL_DIR" ] || mkdir -p "$SSL_DIR"
|
||||
__create_ssl_cert
|
||||
[ -d "$SSL_DIR" ] || mkdir -p "$SSL_DIR"
|
||||
if [ "$SSL_ENABLED" = "yes" ]; then
|
||||
if [ -f "$SSL_CERT" ] && [ -f "$SSL_KEY" ]; then
|
||||
if [ -n "$SSL_CA" ] && [ -f "$SSL_CA" ]; then
|
||||
mkdir -p "$SSL_DIR/certs"
|
||||
cat "$SSL_CA" >>"/etc/ssl/certs/ca-certificates.crt"
|
||||
fi
|
||||
__update_ssl_certs
|
||||
else
|
||||
__create_ssl_cert
|
||||
fi
|
||||
fi
|
||||
type update-ca-certificates &>/dev/null && update-ca-certificates &>/dev/null
|
||||
@@ -1743,6 +1642,6 @@ export ENTRYPOINT_DATA_INIT_FILE DATA_DIR_INITIALIZED ENTRYPOINT_CONFIG_INIT_FIL
|
||||
export ENTRYPOINT_PID_FILE ENTRYPOINT_INIT_FILE ENTRYPOINT_FIRST_RUN
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# export the functions
|
||||
export -f __get_pid __start_init_scripts __is_running __certbot __update_ssl_certs __create_ssl_cert
|
||||
export -f __get_pid __start_init_scripts __is_running __update_ssl_certs __create_ssl_cert
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# end of functions
|
||||
|
||||
@@ -116,7 +116,7 @@ DATABASE_DIR_SUPABASE="${DATABASE_DIR_SUPABASE:-$DATABASE_BASE_DIR/supabase}"
|
||||
DOCKER_HOST="unix://var/run/docker.sock"
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# File locations
|
||||
ENTRYPOINT_PID_FILE="${ENTRYPOINT_PID_FILE:-/run/.entrypoint.pid}"
|
||||
ENTRYPOINT_PID_FILE="${ENTRYPOINT_PID_FILE:-/run/init.d/entrypoint.pid}"
|
||||
ENTRYPOINT_INIT_FILE="${ENTRYPOINT_INIT_FILE:-/config/.entrypoint.done}"
|
||||
ENTRYPOINT_DATA_INIT_FILE="${ENTRYPOINT_DATA_INIT_FILE:-/data/.docker_has_run}"
|
||||
ENTRYPOINT_CONFIG_INIT_FILE="${ENTRYPOINT_CONFIG_INIT_FILE:-/config/.docker_has_run}"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# File locations
|
||||
ENTRYPOINT_PID_FILE="${ENTRYPOINT_PID_FILE:-/run/.entrypoint.pid}"
|
||||
ENTRYPOINT_PID_FILE="${ENTRYPOINT_PID_FILE:-/run/init.d/entrypoint.pid}"
|
||||
ENTRYPOINT_INIT_FILE="${ENTRYPOINT_INIT_FILE:-/config/.entrypoint.done}"
|
||||
ENTRYPOINT_DATA_INIT_FILE="${ENTRYPOINT_DATA_INIT_FILE:-/data/.docker_has_run}"
|
||||
ENTRYPOINT_CONFIG_INIT_FILE="${ENTRYPOINT_CONFIG_INIT_FILE:-/config/.docker_has_run}"
|
||||
|
||||
Reference in New Issue
Block a user