From 2abda9b71e157a088c56c611ffaeb0c578d9a58d Mon Sep 17 00:00:00 2001 From: ShareVB Date: Sun, 19 Jul 2026 21:19:26 +0200 Subject: [PATCH] doc: add a docker compose sample with all related services --- README.md | 42 ++++++++++++++----- docker-with-services/docker-compose.yml | 52 ++++++++++++++++++++++++ docker-with-services/tools-settings.json | 37 +++++++++++++++++ 3 files changed, 120 insertions(+), 11 deletions(-) create mode 100644 docker-with-services/docker-compose.yml create mode 100644 docker-with-services/tools-settings.json diff --git a/README.md b/README.md index ed5073c3..f9d2c7e8 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ## BREAKING CHANGE for Container Image -Since the *base image* is now `nginx-unpriviledged` the container will now listen to port **8080** and not 80. So you need to update your port mapping, i.e. from `8080:80` to `8080:8080`. +Since the _base image_ is now `nginx-unpriviledged` the container will now listen to port **8080** and not 80. So you need to update your port mapping, i.e. from `8080:80` to `8080:8080`. You can override listening port using environment variable `PORT` (docker option `-e PORT=8888`). @@ -23,6 +23,7 @@ Some tools like PGP encryption rely on WebCrypto API that is only available in H So even on internal installations, you should enable HTTPS using Let's Encrypt using DNS Challenge Some docs about DNS Challenge: + - https://medium.com/@life-is-short-so-enjoy-it/homelab-nginx-proxy-manager-setup-ssl-certificate-with-domain-name-in-cloudflare-dns-732af64ddc0b - https://doc.traefik.io/traefik/user-guides/docker-compose/acme-dns/ - https://medium.com/@svenvanginkel/traefik-letsencrypt-dns01-challenge-with-ovhcloud-52f2a2c6d08a @@ -101,12 +102,18 @@ WantedBy=multi-user.target default.target Restart=always ``` +## Use with companion Self Hosted docker services + +Some tools requires additional docker services: HTTPS/DNS tools/Ping, HTML to PDF, Docker Image Download, Multi Links Download, Short Url Expander and TCP/UDP Port tester. + +See complete example here: [docker-with-services](https://github.com/sharevb/it-tools/tree/chore/all-my-stuffs/docker-with-services) ## Filter tools and add home custom content You can add custom content in Home page by mounting a `home.custom.md` in `/usr/share/nginx/html`. You can filter available tools by mounting `tools-filter.json` in `/usr/share/nginx/html`. It can contains the following filtering regex: + ```json { "excludeCategoryFilterRegex": "", @@ -115,9 +122,10 @@ You can filter available tools by mounting `tools-filter.json` in `/usr/share/ng "includeToolsFilterRegex": "" } ``` + Category matches on category (English) names ; Tools matches on tools path/url. -See [docker-tools-filter-and-home-content](https://github.com/sharevb/it-tools) +See [docker-tools-filter-and-home-content](https://github.com/sharevb/it-tools/tree/chore/all-my-stuffs/docker-tools-filter-and-home-content) ## Add custom external tools @@ -144,13 +152,16 @@ You can add custom external tools (href or markdownContent) by mounting a `exter ] ``` -See [docker-tools-filter-and-home-content](https://github.com/sharevb/it-tools) +See [docker-tools-filter-and-home-content](https://github.com/sharevb/it-tools/tree/chore/all-my-stuffs/docker-tools-filter-and-home-content) ## Setting default tools parameters / default UI language at runtime +For a complete sample, see [docker-with-services](https://github.com/sharevb/it-tools/tree/chore/all-my-stuffs/docker-with-services). + You can set default tool parameters by mounting a `tools-settings.json` in `/usr/share/nginx/html`. It is a two level json, with the first level being for `tool name` and the second level for `parameter name`: + ```json { "regex-tester": { @@ -162,7 +173,9 @@ It is a two level json, with the first level being for `tool name` and the secon ``` You can find `tool name` and `parameter name` in the tools source code `src/tools` subfolder : + - example pattern for `const global = useQueryParamOrStorage({ storageName: 'regex-tester:g', name: 'global', defaultValue: true });`: + ```json { "regex-tester": { @@ -170,7 +183,9 @@ You can find `tool name` and `parameter name` in the tools source code `src/tool } } ``` + - example pattern for `const value = useQueryParam({ tool: 'barcode-gen', name: 'text', defaultValue: '123456789' });`: + ```json { "barcode-gen": { @@ -178,7 +193,9 @@ You can find `tool name` and `parameter name` in the tools source code `src/tool } } ``` + - example pattern for `const width = useITStorage('ascii-text-drawer:width', 80);`: + ```json { "ascii-text-drawer": { @@ -188,6 +205,7 @@ You can find `tool name` and `parameter name` in the tools source code `src/tool ``` To define the default UI language, add a `default_locale` key to json: + ```json { "default_locale": "fr" @@ -204,6 +222,7 @@ docker run -d --name it-tools-fr --restart unless-stopped -p 8080:8080 it-tools- ## Build container image for a custom subfolder According to https://github.com/sharevb/it-tools/pull/461#issuecomment-1602506049 and https://github.com/CorentinTh/it-tools/pull/461: + ``` docker build -t it-tools --build-arg BASE_URL="/my-folder/" . docker run -d --name it-tools --restart unless-stopped -p 8080:8080 it-tools @@ -217,7 +236,7 @@ So you would need to put another server in front of it, like [Nginx Proxy Manage For `/it-tools/` subfolder, you can use `baseurl-it-tools` tag. -See [sample of docker-compose.yml and nginx.conf](https://github.com/sharevb/it-tools/tree/chore/all-my-stuffs/docker-subfolder-sample), this docker image needs to have another reverse proxy in front of it, like [Nginx Proxy Manager](https://nginxproxymanager.com/), [Traefik](https://traefik.io/traefik/), [caddy](https://caddyserver.com/) etc. +See [sample of docker-compose.yml and nginx.conf](https://github.com/sharevb/it-tools/tree/chore/all-my-stuffs/docker-subfolder-sample), this docker image needs to have another reverse proxy in front of it, like [Nginx Proxy Manager](https://nginxproxymanager.com/), [Traefik](https://traefik.io/traefik/), [caddy](https://caddyserver.com/) etc. Setup a reverse proxy pass using `/it-tools/`. And you should be able to access it-tools in `/it-tools/` of your server. @@ -247,14 +266,15 @@ Then navigate to http://localhost:8080/it-tools/ Assuming you're already hosting it-tools behind a reverse proxy, you can configure forward-auth and enforce authentication from the reverse proxy -* [Official guides](https://docs.goauthentik.io/docs/add-secure-apps/providers/proxy/server_nginx) with nginx. Guides with other reverse proxy setups are available -* [Step-by-step setup guide with nginx-proxy-manager](https://geekscircuit.com/set-up-authentik-sso-with-nginx-proxy-manager/) +- [Official guides](https://docs.goauthentik.io/docs/add-secure-apps/providers/proxy/server_nginx) with nginx. Guides with other reverse proxy setups are available +- [Step-by-step setup guide with nginx-proxy-manager](https://geekscircuit.com/set-up-authentik-sso-with-nginx-proxy-manager/) (thanks @jogerj) ## Deploy as LXC container In Proxmox VE, you can use docker image directly: + ```bash sudo lxc-create -n sharevb-it-tools -t oci -- --url docker://ghcr.io/sharevb/it-tools:latest ``` @@ -355,11 +375,11 @@ It will create a directory in `src/tools` with the correct files. You will need Local installation required installing first: `python3 make g++` -| Container Image | Local Installation | -|-----------------------------------------|-----------------------------------------------------------------------------------------------------------------------------| +| Container Image | Local Installation | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | GitHub Container Registry: `ghcr.io/sharevb/it-tools:latest`
Docker Hub: `sharevb/it-tools:latest` | `sudo apt-get install python3 make g++ && git clone -b chore/all-my-stuffs https://github.com/sharevb/it-tools.git && cd it-tools/ && pnpm i --ignore-scripts && pnpm dev` | -| replace your current image with this image | copy & paste oneliner (from github repo) | -| You may need to clear cache and hard reload to get new features loading | Installing packages for the first time may take some time; please wait until it finishes | +| replace your current image with this image | copy & paste oneliner (from github repo) | +| You may need to clear cache and hard reload to get new features loading | Installing packages for the first time may take some time; please wait until it finishes | @@ -369,4 +389,4 @@ Local installation required installing first: `python3 make g++` ## License -This project is under the [GNU GPLv3](LICENSE). \ No newline at end of file +This project is under the [GNU GPLv3](LICENSE). diff --git a/docker-with-services/docker-compose.yml b/docker-with-services/docker-compose.yml new file mode 100644 index 00000000..8a510ed1 --- /dev/null +++ b/docker-with-services/docker-compose.yml @@ -0,0 +1,52 @@ +services: + it-tools: + image: sharevb/it-tools:latest + pull_policy: always + restart: unless-stopped + environment: + - BASIC_AUTH=${BASIC_AUTH} + volumes: + - ./tools-settings.json:/usr/share/nginx/html/tools-settings.json + ports: + - 8080:8080 + docker-image-download-server: + image: sharevb/docker-image-download-server:latest + pull_policy: always + restart: unless-stopped + environment: + - BASIC_AUTH=${BASIC_AUTH} + ports: + - 8001:3000 + volumes: + - /var/run/docker.sock:/var/run/docker.sock + ws-tcp-udp-bridge: + image: sharevb/ws-tcp-udp-bridge:latest + pull_policy: always + restart: unless-stopped + ports: + - 8002:8080 + network-utils-ws: + image: sharevb/network-utils-ws:latest + pull_policy: always + restart: unless-stopped + environment: + - BASIC_AUTH=${BASIC_AUTH} + ports: + - 8003:8000 + puppeteer-htmltopdf: + image: sharevb/puppeteer-htmltopdf:latest + pull_policy: always + restart: unless-stopped + environment: + - BASIC_AUTH=${BASIC_AUTH} + ports: + - 8004:3000 + cors-anywhere: + image: sharevb/cors-anywhere:latest + pull_policy: always + restart: unless-stopped + environment: + - CORSANYWHERE_BASIC_AUTH=${BASIC_AUTH} + - CORSANYWHERE_ALLOWED_HTTP_METHODS=HEAD,GET,POST + ports: + - 8005:8080 diff --git a/docker-with-services/tools-settings.json b/docker-with-services/tools-settings.json new file mode 100644 index 00000000..d83ff1d3 --- /dev/null +++ b/docker-with-services/tools-settings.json @@ -0,0 +1,37 @@ +{ + "dns-prop": { + "url": "http://localhost:8003", + "auth": "alice:b@b" + }, + "dns-tester": { + "url": "http://localhost:8003", + "auth": "alice:b@b" + }, + "docker-dl": { + "url": "http://localhost:8001", + "auth": "alice:b@b" + }, + "html-to-pdf": { + "url": "http://localhost:8004", + "auth": "alice:b@b" + }, + "https-tester": { + "url": "http://localhost:8003", + "auth": "alice:b@b" + }, + "multi-links-dl": { + "url": "http://localhost:8005", + "auth": "alice:b@b" + }, + "ping": { + "url": "http://localhost:8003", + "auth": "alice:b@b" + }, + "short-urls-expander": { + "cors-anywhere-url": "http://localhost:8005", + "auth": "alice:b@b" + }, + "tcp-udp-port-tester": { + "ws": "ws://localhost:8002" + } +}