Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
100 changes: 71 additions & 29 deletions docs/docker-to-iac/parser/digitalocean.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,41 @@ To use the DigitalOcean App Spec, you need a valid DigitalOcean account with acc

## Architecture

The DigitalOcean App Spec will deploy your application using two main components:
The DigitalOcean App Spec will deploy your application entirely within App Platform using containerized services:

### App Platform Services

- Each service from your Docker Compose file becomes an App Platform service
- Services are identified by their original service names
- The app auto-configures HTTPS routing:
Services in your App Platform deployment fall into two categories:

#### HTTP Services

- Web-facing containers that serve HTTP traffic
- Automatically configured with HTTPS routing:
- First service gets the root path `/`
- Additional services receive paths based on their names, e.g., `/servicename`
- Ideal for web applications, APIs, and frontend services

#### TCP Services

- Database containers (MySQL, PostgreSQL, Redis, etc.) run as internal TCP services
- Configured with appropriate health checks and internal ports
- No external HTTP routing - only accessible by other services within the app
- Suitable for databases, caches, and message queues

### Managed Databases
### Important Note About Databases

- Database containers (MySQL, PostgreSQL, etc.) are automatically converted to DigitalOcean managed databases
- Each database runs as a standalone managed instance, not within App Platform
- Database credentials and connection strings are automatically injected into your services
While DigitalOcean offers managed database services, these cannot be automatically provisioned through one-click deployment. Instead, database containers (like MySQL, PostgreSQL, Redis) are deployed as TCP services within App Platform, allowing:

After deployment:
- Immediate deployment without pre-existing infrastructure
- Internal communication between application components
- Simplified configuration for development and testing

- Services can be accessed via links in your DigitalOcean dashboard
- Managed databases appear in your Databases section with connection details
For production use cases where you need managed databases, you should:

1. Manually create managed databases in your DigitalOcean account
2. Update the application configuration to use these managed instances

After deployment, all services can be monitored and managed through your DigitalOcean App Platform dashboard.

## Default output format

Expand All @@ -56,28 +71,32 @@ Supported variables not listed above will be ignored. They will not be translate

## Database Support

DigitalOcean App Platform does not support running containerized database workloads due to its stateless nature and TCP protocol limitations. Therefore, the parser automatically converts database containers to DigitalOcean managed databases, ensuring proper data persistence and reliability. Supported databases include:
DigitalOcean App Platform supports running database containers as internal TCP services. The parser automatically configures these services with appropriate health checks and port settings to ensure proper communication within your application.

### Supported Databases

- MySQL
- PostgreSQL
- Redis
- MongoDB
The parser recognizes and configures the following database types:

### Configuration and Customization
- MySQL/MariaDB (port 3306)
- PostgreSQL (port 5432)
- Redis (port 6379)
- MongoDB (port 27017)

The database conversion rules are defined in `src/config/digitalocean/database-types.ts`. This configuration maps Docker images to their corresponding DigitalOcean managed database services.
### Configuration Details

To add or modify database mappings:
Database service configurations are defined in `src/config/digitalocean/database-types.ts`. This configuration maps Docker images to their corresponding TCP port and health check settings.

To add or modify database configurations:

1. Locate the `database-types.ts` file
2. Edit the `digitalOceanDatabaseConfig` object
3. Define the mapping using this structure:

```typescript
'docker.io/library/mysql': {
'docker.io/library/mariadb': {
engine: 'MYSQL',
versions: ['8'],
description: 'MySQL database service - requires managed database service due to TCP protocol'
description: 'MariaDB database service - maps to MySQL managed database due to compatibility',
portNumber: 3306
}
```

Expand All @@ -101,20 +120,43 @@ Generated App Spec:

```yaml
spec:
databases:
- name: db
engine: MYSQL
version: "8"
production: false
services:
- name: db
image:
registry_type: DOCKER_HUB
registry: library
repository: mariadb
tag: "11.2"
health_check:
port: 3306
internal_ports:
- 3306
- name: app
# [service configuration]
image:
registry_type: DOCKER_HUB
registry: library
repository: nginx
tag: alpine
http_port: 80
routes:
- path: /
```

::content-alert{type="important"}
Database services in docker-compose.yml must use official images from Docker Hub (e.g., mysql, mariadb, postgres) for automatic conversion to managed databases.
While running databases as App Platform services works well for development and testing, for production workloads consider using DigitalOcean's managed database offerings for better reliability and maintenance.
::

### Understanding TCP Services

When a database image is detected, the parser:

1. Configures the service without HTTP routing
2. Sets up appropriate internal ports for database communication
3. Adds health checks on the database's standard port
4. Ensures the service can communicate with other containers in your app

This approach allows immediate deployment while maintaining proper isolation and communication between your application components.

## Volume Support

DigitalOcean App Platform supports ephemeral files only. This means:
Expand Down
Loading