# Service Architecture

## <i class="fa-diagram-project">:diagram-project:</i> Networks

The application uses two Docker networks:

* **`internal_net`**: Bridge network for internal communication
* **`external_net`**: Bridge network for external communication

## <i class="fa-hard-drive">:hard-drive:</i> Volumes

The system uses several named volumes for data persistence:

* **`DataSpace_data`**: Main application data (bind mount to `./volume/DataSpace_data`)
* **`DataSpace_db_data`**: PostgreSQL database data (bind mount to `./volume/DataSpace_db_data`)
* **`DataSpace_db_backup`**: Database backups (bind mount to `./volume/DataSpace_db_backup`)
* **`DataSpace_ollama_data`**: Ollama AI model data
* **`DataSpace_caddy_data`**: Caddy web server data

## <i class="fa-server">:server:</i> Services

### Database Service

* Image: `postgres:15`
* Container: `DataSpace_database`
* Purpose: PostgreSQL database for application data

### Database Backup Service

* Image: `prodrigestivill/postgres-backup-local`
* Container: `DataSpace_pgbackups`
* Purpose: Automated database backups

### Docker Socket Proxy

* Image: `tecnativa/docker-socket-proxy`
* Container: `DataSpace_docker_socket_proxy`
* Purpose: Secure Docker API access for the application

### DataSpace API Service

* Image: `ghcr.io/dataspaceswiss/api:${API_VERSION:-latest}`
* Container: `DataSpace_api`
* Purpose: Main application API

### Ollama Service

* Image: `ghcr.io/dataspaceswiss/ollama:${OLLAMA_VERSION:-latest}`
* Container: `DataSpace_ollama`
* Purpose: AI model server

### DataSpace Frontend Service

* Image: `ghcr.io/dataspaceswiss/frontend:${FRONTEND_VERSION:-latest}`
* Container: `DataSpace_frontend`
* Purpose: Web user interface

### Caddy Service

* Image: `caddy:latest`
* Container: `DataSpace_caddy`
* Purpose: Reverse proxy and SSL termination
* Ports: 80, 443 (exposed to host)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.dataspace.ch/infrastructure/service-architecture.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
