Skip to content

Deploying a Squid App

Introduction

Squid is a high-performance caching proxy supporting HTTP, HTTPS (CONNECT), and FTP. Deploying Squid with a Dockerfile on Klutch.sh provides reproducible builds, managed secrets, and persistent storage for cache and logs—all configured from klutch.sh/app. This guide covers installation, Dockerfile setup, environment variables, storage, Nixpacks overrides, and sample connectivity checks.


Prerequisites

  • A Klutch.sh account (sign up)
  • A GitHub repository containing your Squid Dockerfile and optional squid.conf (GitHub is the only supported git source)
  • Clients that can point to a TCP proxy endpoint

For onboarding, see the Quick Start.


Architecture and ports

  • Klutch.sh supports one port per app. Squid listens on TCP port 3128 by default; choose TCP traffic and set the internal port to 3128.
  • External clients connect to example-app.klutch.sh:8000 (Klutch TCP external) mapped to internal 3128.

Repository layout

squid/
├── Dockerfile # Must be at repo root for auto-detection
└── squid.conf # Optional custom configuration

Keep secrets out of Git; store them in Klutch.sh environment variables.


Installation (local) and starter commands

Build and run locally:

Terminal window
docker build -t squid-local .
docker run -p 3128:3128 squid-local

Test with a proxy-aware client:

Terminal window
curl -x http://localhost:3128 https://example.com

Dockerfile for Squid (production-ready)

Place this at the repo root; Klutch.sh auto-detects Dockerfiles.

FROM squid:latest
COPY squid.conf /etc/squid/squid.conf
EXPOSE 3128
CMD ["squid", "-N", "-d", "1"]

Notes:

  • Pin to a specific tag (e.g., squid:6.5) for stability.
  • If you use the default config, remove the COPY squid.conf line.

Environment variables (Klutch.sh)

Squid primarily uses config files. If you rely on Nixpacks without the Dockerfile:

  • NIXPACKS_START_CMD=squid -N -d 1

Attach persistent volumes

Add storage in Klutch.sh (path and size only):

  • /var/spool/squid — cache storage.
  • /var/log/squid — logs.

Ensure the paths are writable inside the container.


Deploy Squid on Klutch.sh (Dockerfile workflow)

  1. Push your repository—with the Dockerfile (and optional squid.conf) at the root—to GitHub.
  2. Open klutch.sh/app, create a project, and add an app.
  3. Select TCP traffic and set the internal port to 3128.
  4. Add any required environment variables (if used) and confirm your config is baked into the image.
  5. Attach volumes at /var/spool/squid and /var/log/squid sized for your cache and logs.
  6. Deploy. Point clients to example-app.klutch.sh on external port 8000.

Sample checks

Verify the proxy responds:

Terminal window
curl -x http://example-app.klutch.sh:8000 https://www.google.com -I

Check access logs (if volumes attached and accessible):

Terminal window
kubectl exec <pod> -- tail -n 20 /var/log/squid/access.log

Health checks and production tips

  • Use a TCP readiness probe against port 3128 to confirm Squid accepts connections.
  • Tune cache size and ACLs in squid.conf; keep sensitive ACL details in private repos or secrets.
  • Pin image versions and test config changes in staging before production rollout.
  • Monitor cache and log volume usage; resize proactively.

Squid on Klutch.sh delivers a reproducible Docker proxy with managed storage—without extra YAML or CI steps. Configure ports, attach cache/log volumes, and direct clients to your TCP endpoint.