commit dbe443afb59d0a5395a1d1ce34f13cdb6f1efeb8 Author: Zezik Date: Thu Jul 9 21:41:32 2026 +0200 first commit diff --git a/zezidock.py b/zezidock.py new file mode 100644 index 0000000..99b155d --- /dev/null +++ b/zezidock.py @@ -0,0 +1,80 @@ +import os, subprocess, sys + +USERNAME = os.environ.get('USER') +ZEZIDIR = os.getcwd() +DOCKERDIR = f'/home/{USERNAME}/docker' + +def root_check(): + if USERNAME == 'root': + print('Do NOT run this script as root! Run it as a user with sudo privileges.') + sys.exit() + +def first_run(): + print('This script will automatically install Dockhand on your system. Make sure you:') + print('1) Have Debian 11+ installed') + print('2) Are running this script as a user with sudo privileges.') + print('') + uinput = input('Continue? [Y/N]: ') + if uinput.lower() != "y": + sys.exit() + docker_install() + +def docker_install(): + os.system('sudo apt update') + os.system('sudo apt install ca-certificates curl -y') + os.system('sudo install -m 0755 -d /etc/apt/keyrings') + os.system('sudo curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc') + os.system('sudo chmod a+r /etc/apt/keyrings/docker.asc') + os.system(f'sudo cp {ZEZIDIR}/zezidock/docker/docker.sources /etc/apt/sources.list.d/docker.sources') + codename = subprocess.check_output('. /etc/os-release && echo "$VERSION_CODENAME"', shell=True, text=True).strip() + arch = subprocess.check_output('dpkg --print-architecture', shell=True, text=True).strip() + os.system(f"sudo sed -i 's/\\[CODENAME\\]/{codename}/g' /etc/apt/sources.list.d/docker.sources") + os.system(f"sudo sed -i 's/\\[ARCH\\]/{arch}/g' /etc/apt/sources.list.d/docker.sources") + os.system('sudo apt update') + os.system('sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -y') + os.system(f'mkdir {DOCKERDIR}') + +def service_install(service): + os.system(f'cp -r {ZEZIDIR}/zezidock/{service} {DOCKERDIR}') + os.system(f"sudo sed -i \"s|\\[DOCKERDIR\\]|{DOCKERDIR}|g\" {DOCKERDIR}/{service}/docker-compose.yml") + + if service == 'caddy': + http = input(f"[{service.upper()}] Choose port for HTTP: ") + https = input(f"[{service.upper()}] Choose port for HTTPS: ") + os.system(f"sudo sed -i \"s|\\[HTTP\\]|{http}|g\" {DOCKERDIR}/{service}/docker-compose.yml") + os.system(f"sudo sed -i \"s|\\[HTTPS\\]|{https}|g\" {DOCKERDIR}/{service}/docker-compose.yml") + + if service == 'dockhand' or service == 'gitea' or service == 'nextcloud': + webui = input(f'[{service.upper()}] Choose port for Web UI: ') + os.system(f"sudo sed -i \"s|\\[WEBUI\\]|{webui}|g\" {DOCKERDIR}/{service}/docker-compose.yml") + +def service_run(service): + os.chdir(f'{DOCKERDIR}/{service}') + os.system('sudo docker compose up -d') + os.chdir(f'{ZEZIDIR}') + print(f'Success! {service} is running!') + +def main(): + root_check() + + if not os.path.exists(DOCKERDIR): + first_run() + + if not os.path.exists(f'{DOCKERDIR}/dockhand/docker-compose.yml'): + service_install('dockhand') + + if not os.path.exists(f'{DOCKERDIR}/caddy/docker-compose.yml'): + service_install('caddy') + + if not os.path.exists(f'{DOCKERDIR}/gitea/docker-compose.yml'): + service_install('gitea') + + if not os.path.exists(f'{DOCKERDIR}/nextcloud/docker-compose.yml'): + service_install('nextcloud') + + service_run('dockhand') + service_run('caddy') + service_run('gitea') + service_run('nextcloud') + +main() diff --git a/zezidock/caddy/caddy/config/Caddyfile b/zezidock/caddy/caddy/config/Caddyfile new file mode 100644 index 0000000..d4d12db --- /dev/null +++ b/zezidock/caddy/caddy/config/Caddyfile @@ -0,0 +1,26 @@ +# The Caddyfile is an easy way to configure your Caddy web server. +# +# Unless the file starts with a global options block, the first +# uncommented line is always the address of your site. +# +# To use your own domain name (with automatic HTTPS), first make +# sure your domain's A/AAAA DNS records are properly pointed to +# this machine's public IP, then replace ":80" below with your +# domain name. + +:80 { + # Set this path to your site's directory. + root * /usr/share/caddy + + # Enable the static file server. + file_server + + # Another common task is to set up a reverse proxy: + # reverse_proxy localhost:8080 + + # Or serve a PHP site through php-fpm: + # php_fastcgi localhost:9000 +} + +# Refer to the Caddy docs for more information: +# https://caddyserver.com/docs/caddyfile diff --git a/zezidock/caddy/caddy/www/index.html b/zezidock/caddy/caddy/www/index.html new file mode 100644 index 0000000..4db41ef --- /dev/null +++ b/zezidock/caddy/caddy/www/index.html @@ -0,0 +1,396 @@ + + + + Caddy works! + + + + + + + +
+
+
+
+ + + + + + + + + + +

+ Congratulations! + おめでとう! + ¡Felicidades! + 恭喜! + बधाई हो! + Поздравляю! + Вітаю! + Gefeliciteerd! + Glückwunsch! + 🎊 +

+ +

+ Your web server is working. Now make it work for you. 💪 +

+

+ Caddy is ready to serve your site over HTTPS: +

+
    +
  1. Point your domain's A/AAAA DNS records at this machine.
  2. +
  3. Upload your site's files to /var/www/html. +
  4. + Edit your Caddyfile at /etc/caddy/Caddyfile: +
      +
    1. Replace :80 with your domain name
    2. +
    3. Change the site root to /var/www/html
    4. +
    +
  5. +
  6. Reload the configuration: systemctl reload caddy
  7. +
  8. Visit your site!
  9. +
+

If that worked 🥳

+

+ Awesome! You won't have to look at this slanted page anymore. +

+

+ Remember, Caddy can do a lot more than serve static files. It's also a powerful reverse proxy and + application platform. You can use the Caddyfile to enable any other features you need. Or you could use + Caddy's API to configure it programmatically. +

+

+ Everything you need to know is either in the 📖 Caddy + documentation or the manual for your OS/platform. Have fun! +

+ +

If that didn't work 😶

+

+ It's okay, you can fix it! First check the following things: +

+
    +
  • Service status: systemctl status caddy
  • +
  • Logs: journalctl --no-pager -u caddy
  • +
  • Are your site's files readable by the caddy user and group? ls -la /var/www/html
  • +
  • Is the caddy home directory writeable? ls -la /var/lib/caddy
  • +
  • Ensure your domain's A and/or AAAA records point to your machine's public IP address: + dig example.com
  • +
  • Are your ports 80 and 443 externally reachable, and is Caddy able to bind to them? Check your + firewalls, port forwarding, and other network configuration.
  • +
+

+ WAIT! Before trying again, switch to Let's Encrypt's staging environment to + avoid being accidentally rate limited. Once you + get everything else working, it's safe to switch back. +

+

+ Depending on your DNS provider, it may take a while for the DNS records to propagate. Even when + everything is configured properly, automated challenges to obtain TLS certificates usually take several + seconds, but may take up to several minutes or hours. +

+ If you still need help, we have a great community! First try a search, and if your question is original, go ahead + and ask it! Remember to pay it forward and help others too. 😁 +

+

+ Visit Caddy on: + GitHub + or + Twitter + or + Our Forum +

+
+
+ + + + + + diff --git a/zezidock/caddy/docker-compose.yml b/zezidock/caddy/docker-compose.yml new file mode 100644 index 0000000..be7b397 --- /dev/null +++ b/zezidock/caddy/docker-compose.yml @@ -0,0 +1,11 @@ +services: + caddy: + image: caddy:latest + container_name: caddy + restart: unless-stopped + ports: + - "[HTTP]:80/tcp" + - "[HTTPS]:443/tcp" + volumes: + - [DOCKERDIR]/caddy/caddy/www:/usr/share/caddy + - [DOCKERDIR]/caddy/caddy/config:/etc/caddy diff --git a/zezidock/docker/docker.sources b/zezidock/docker/docker.sources new file mode 100644 index 0000000..6797033 --- /dev/null +++ b/zezidock/docker/docker.sources @@ -0,0 +1,6 @@ +Types: deb +URIs: https://download.docker.com/linux/debian +Suites: [CODENAME] +Components: stable +Architectures: [ARCH] +Signed-By: /etc/apt/keyrings/docker.asc diff --git a/zezidock/dockhand/docker-compose.yml b/zezidock/dockhand/docker-compose.yml new file mode 100644 index 0000000..09842dc --- /dev/null +++ b/zezidock/dockhand/docker-compose.yml @@ -0,0 +1,10 @@ +services: + dockhand: + image: fnsys/dockhand:latest + container_name: dockhand + restart: unless-stopped + ports: + - [WEBUI]:3000 + volumes: + - /var/run/docker.sock:/var/run/docker.sock + - [DOCKERDIR]/dockhand/dockhand:/app/data diff --git a/zezidock/gitea/docker-compose.yml b/zezidock/gitea/docker-compose.yml new file mode 100644 index 0000000..c86e46f --- /dev/null +++ b/zezidock/gitea/docker-compose.yml @@ -0,0 +1,9 @@ +services: + gitea: + image: gitea/gitea:latest + container_name: gitea + restart: unless-stopped + ports: + - "[WEBUI]:3000/tcp" + volumes: + - [DOCKERDIR]/gitea/gitea:/data diff --git a/zezidock/nextcloud/docker-compose.yml b/zezidock/nextcloud/docker-compose.yml new file mode 100644 index 0000000..e15fa42 --- /dev/null +++ b/zezidock/nextcloud/docker-compose.yml @@ -0,0 +1,14 @@ +services: + nextcloud: + image: linuxserver/nextcloud:latest + container_name: nextcloud + restart: unless-stopped + ports: + - "[WEBUI]:443/tcp" + volumes: + - [DOCKERDIR]/nextcloud/nextcloud/config:/config + - [DOCKERDIR]/nextcloud/nextcloud/data:/data + environment: + - PUID=1000 + - PGID=1000 + - TZ=Europe/Prague