FastAPI and OpenAPI with Union type and oneOf
# .python-version # 3.12.0 # # requirements.txt # fastapi[standard]==0.114.0 # # main.py from typing import Literal, Union from pydantic import BaseModel, Field from fastapi import FastAPI app = FastAPI() class Cat(BaseModel): pet_type: Literal["c"] meows: int class Dog(BaseModel): pet_type: Literal["d"] barks: float class Pet(BaseModel): pet: Union[Cat, Dog] = Field(..., discriminator="pet_type") age: int @app.post("/cat") def post_cat(pet: Cat): return {"pet": pet} @app.post("/dog") def post_dog(pet: Dog): return {"pet": pet} @app.post("/pet") def post_pet(pet: Pet): return {"pet": pet}
Exposing homelab services publicly
Components wireguard “WireGuard® is an extremely simple yet fast and modern VPN that utilizes state-of-the-art cryptography. It aims to be faster, simpler, leaner, and more useful than IPsec, while avoiding the massive headache. " caddy " ‘The Ultimate Server’ - makes your sites more secure, more reliable, and more scalable than any other solution.” docker “Accelerate how you build, share, and run applications. Docker helps developers build, share, run, and verify applications anywhere — without tedious environment configuration or management....
fooocus ollama open-webui docker compose
Components ollama “Get up and running with large language models. Run Llama 2, Code Llama, and other models. Customize and create your own.” open-webui “Open WebUI is an extensible, feature-rich, and user-friendly self-hosted WebUI designed to operate entirely offline. It supports various LLM runners, including Ollama and OpenAI-compatible APIs.” fooocus “Fooocus is an image generating software, similar to stable diffusion with focus on ease of use” labmdalabs “On-demand & reserved cloud NVIDIA GPUs for AI training & inference....
Guacamole traefik docker compose
Guacamole Guacamole “Apache Guacamole is a clientless remote desktop gateway. It supports standard protocols like VNC, RDP, and SSH.” Set a A record for your domain pointing to the ip address where you are running this (e.g. guacamole.yourdomain.com). Add an .env file and a compose.yml Run $docker compose up -d .env DOMAIN=my-domain.com EMAIL=myemail@example-domain.com compose.yml services: traefik: image: "traefik:v2.10.5" container_name: traefik command: #- --log.level=DEBUG #- --accesslog=true #- --accesslog.filePath=/logs/access.log - --entrypoints.web.address=:80 - --entrypoints....
Technitium docker compose traefik
Technitium Technitium is a self hostable open source dns server. Self host a DNS server for privacy & security Block ads & malware at DNS level for your entire network! Set a A record for your domain pointing to the ip address where you are running this. Add an .env file and a compose.yml (docker compose picks up the .env file automatically) Run $docker compose up -d .env DOMAIN=my.example-domain.com TRAEFIK_DOMAIN=traefik.example-domain.com EMAIL=myemail@example-domain....