bomonike

prod-macos-backend.png AI prompt to generate code and docs to stand up and run a production enviornment of enterprise-worthy servers that run macos locally.

Overview

NOTE: Content here are my personal opinions, and not intended to represent any employer (past or present). “PROTIP:” here highlight information I haven’t seen elsewhere on the internet because it is hard-won, little-know but significant facts based on my personal research and experience.

Why this?

https://www.youtube.com/watch?v=OL9ckcSkwtg sovereignty

https://www.youtube.com/watch?v=xBIowQ0WaR8 Build your own cloud by NetworkChuck $6/mo Filecloud CE or NextCloud GmbH FOSS https://www.youtube.com/watch?v=lsuj1blTRoo https://www.youtube.com/watch?v=6gyOBE-n2UY can’t recommend

Below is a prompt for AI:

Create a new project called “backend” containing all that is needed to stand up and run a production enviornment of enterprise-worthy servers that run macos locally on a macos M3 machine (which runs systemd).

External:

  1. Email server (instead of Gmail or MS Exchange)
  2. Cloudflare.DDNS for stable external IP address to internet provider’s IP address.
  3. CDN edge locations to reduce latency
  4. 3G Network router from T-Mobile
  5. Firewall to

Self-hosted servers installed locally:

  1. Time server
  2. Ad blocker
  3. DNS to resolve host names to IP addresses
  4. Reverse proxy server to compress SSL & cache same static responses (NGINX, Envoy, Caddy, HAproxy)
  5. Load balancer to distribute load among workers with least connections with session affinity
  6. Tailscale VPN
  7. API gateway auth, rate limiting (Kong)

  8. VaultWarden password manager. See https://www.youtube.com/watch?v=EtHpkMlyMHE
  9. Portainer GUI (instead of Docker Compose or Kubernetes, Unrail, or TruNAS SCALE)
  10. Gitea (GitHub clone) install using brew
  11. HomeBrew server
  12. PyPi package mirror

  13. Nextcloud (linuxserver.io) store of Google Drive, Contacts https://www.youtube.com/watch?v=yxfyvxwfLqw&t=33s https://www.youtube.com/watch?v=3HukNx5k3x4 (Alt: OwnCloud)
  14. Nextcloud Talk (instead of Zoom & Slack)
  15. Immach $100 photo storage. https://immich.app/ VIDEO
  16. Papra (https://papra.app/en/) for photo tagging
  17. Jellyfin https://jellyfin.org/ FOSS media streaming server to store and serve video (mp4) files. See https://www.youtube.com/watch?v=Z1qxr2b0-VA&pp=ugUEEgJlbg%3D%3D
  18. Music

  19. HomeAssistant FOSS IOT server
  20. PostgreSQL database to index of my movie DVD collection
  21. Redis server for caching
  22. Ollama to use downloaded LLMs.
  23. Firewall to dynamically block outgoing traffic when running batch jobs.
  24. Prometheus observability server to serve a dashboard and alerts about request counts, latency, business metrics over time.
  25. Test coverage tracking

Apps are written in Python with centralized config and secretes out of code.

  1. Use Modular Monolith: Scale Without Microservices
  2. Custom apps contain structured logging with structlog, Typer, dependency injection, and tests.
  3. Calls to APIs have retry, exponential backoff, timeout, and circuit-breaker policies.
  4. Service interfaces can replace real HTTP calls with a fake in tests.
  5. EuroOffice compitible

Build it to be scalable, reliant, and secure.

  1. Dockerfile for each service to work in Kubernetes to use more storage classes and for future scaling on clouds
  2. Local Kubernetes uses Weave CNI (don’t use docker-compose)
  3. ci.yml GitHub workflow CI/CD build CLI has linting, type checking, and security scanning.
  4. Full test suite with unit, integration, and contract tests.
  5. Release automation for wheel publishing.
  6. Backup services on a separate cloud with write-only (no delete) access.

Files generated include:

  1. README with detailed instructions for newbie SREs describe the manual actions needed to setup, operate,and troubleshoot all aspects.
  2. .gitignore containing all temporary folders and files created by the system
  3. pyproject.toml define current versions of all dependencies
  4. ClI scripts to create chaos and break-in conditions (to test organizational response)

Observability metrics and alerts include:

  1. P95/P99 latency (not just average)
  2. Error rate spikes
  3. Database connection exhaustion
  4. CPU/memory saturation

References:

  1. https://www.youtube.com/watch?v=DlzkIjhJ18o&pp=ugUEEgJlbg%3D%3D

MacOS client software:

  1. MakeMKV to extract DVD to .mkv container. This preserves all audio/subtitle tracks; open format
  2. In HandBrake transcode .mkv to .mpr. This optimizes file size; universal compatibility; has macOS preset “Fast 720p30” or “Fast 480p30” preset (DVDs are 480p max, don’t upscale) → Export as .mp4
  3. Jellyfin for Netflix-like UI. It auto-fetches metadata (posters, ratings, descriptions) from TheMovieDB if files follow this convention:
    Movies/
    └── The Devil Wears Prada (2006)/
     └── The Devil Wears Prada (2006) 1. 720p.mp4
    
  4. $22.99 Movie Explorer Pro ($50/year) server catalogs mp4 video files and physical DVD library. https://apps.apple.com/us/app/movie-explorer/id802224528?mt=12

https://www.youtube.com/watch?v=DlzkIjhJ18o 12 Self-Hosted Apps to Finally Quit Big Tech.