/notes
{"detail":"Service unavailable"}
AUTH_SERVICE_URL
uv
.env
We have a problem, running Jarvis locally is a pain!
We don't have to!
Docker Compose is a tool that allows us to define and run multi-container applications.
compose.yml
docker-compose up
https://builder.aws.com/content/2qi9qQstGnCWguDzgLg1NgP8lBF/file-structure-of-docker-composeyml-file
YAML stands for "YAML Ain't Markup Language"
.yaml
.yml
# Key-value pairs (scalars)name: "John Doe"age: 30is_active: truesalary: 75000.50department: null# Strings (quotes optional for simple strings)simple_string: Hello Worldquoted_string: "Special chars: @#$%"multiline_string: | This is a multiline string that preserves line breaks and formatting.folded_string: > This is a folded string that will be converted to a single line with spaces replacing newlines.
# NOTE: indentation defines scope in YAML# Lists/Arrays (two styles)fruits: - apple - banana - orangecolors: [red, green, blue]random_things: [123, "123", true]# Nested objects/mapsperson: name: Alice Smith contact: email: alice@example.com phone: "555-1234" skills: - Python - JavaScript - YAML
# Lists can contain objectsemployees: - name: Bob Johnson position: Developer years_experience: 5 - name: Carol Wilson position: Designer years_experience: 3
compose.yaml
Services are the containers that make up your application. Each service runs one part of your system.
services: web: image: nginx:alpine ports: - "80:80" database: image: postgres:15 environment: POSTGRES_DB: myapp
services: api: build: ./backend # Build from a Dockerfile ports: - "3000:3000" env_file: # Inject env variables from local file - ./api/.env depends_on: # Start only after database service is ready - database restart: unless-stopped # Restart policy database: image: postgres:15 volumes: - db_data:/var/lib/postgresql/data # Use volume for persistence
default
http://api
api
services: api: ... networks: - web-tier # include api service in web-tier and db-tier networks - db-tiernetworks: web-tier: driver: bridge # The network driver to use, typically bridge db-tier: driver: bridge internal: true # Prevent external access, false by default
app/
services: database: image: postgres:15 volumes: # Mount db_data volume at /var/lib/postgresql/data - db_data:/var/lib/postgresql/data api: volumes: # Mount local folder ./api/app as /app on container - ./api/app:/appvolumes: db_data: # Managed by Docker static_files: # Shared between services
Common commands:
docker compose up
-d
docker compose down
docker compose ps
docker compose logs
There's a lot more you can do with Docker Compose, we've only just gone over the basics we need. If you're curious, check out the specification on the docker documentation.
https://docs.docker.com/reference/compose-file/