DigitalOcean - Parser Full Documentation

The parser for DigitalOcean translates the docker-compose.yml file into a DigitalOcean App Spec template. The parser logic can be found in GitHub inside the docker-to-iac repo.

Parser language abbreviation for API

  • languageAbbreviation: DOP.

Prerequisite to deploy DigitalOcean App Spec

To use the DigitalOcean App Spec, you need a valid DigitalOcean account with access to the App Platform and sufficient credits.

Architecture

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

App Platform Services

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

Important Note About Databases

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:

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

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

  • The default output format for this parser: YAML.

Supported Docker Compose Variables

This parser supports the following Docker Compose variables for services:

  • image
  • environment
  • ports
  • command
Note
📝
Supported variables not listed above will be ignored. They will not be translated into the Infrastructure as Code from docker-compose.yml or docker run command.

Database Support

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

The parser recognizes and configures the following database types:

  • MySQL/MariaDB (port 3306)
  • PostgreSQL (port 5432)
  • Redis (port 6379)
  • MongoDB (port 27017)

Configuration Details

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/mariadb': {
  engine: 'MYSQL',
  description: 'MariaDB database service - maps to MySQL managed database due to compatibility',
  portNumber: 3306
}

Example Transformation

Original docker-compose.yml:

yaml
services:
  db:
    image: mariadb:11.2
    environment:
      MYSQL_DATABASE: myapp
  app:
    image: nginx:alpine
    ports:
      - "80:80"

Generated App Spec:

yaml
spec:
  services:
    - name: db
      image:
        registry_type: DOCKER_HUB
        registry: library
        repository: mariadb
        tag: "11.2"
      health_check:
        port: 3306
      internal_ports:
        - 3306
    - name: app
      image:
        registry_type: DOCKER_HUB
        registry: library
        repository: nginx
        tag: alpine
      http_port: 80
      routes:
        - path: /
Important
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:

  • No persistent volume storage is available
  • Local filesystem is limited to 2GB
  • Files are temporary and will be deleted after deployments or container replacements
  • Each container instance has its own separate filesystem
  • Changes to the filesystem are lost when instances are scaled or redeployed
Warning
⚠️
Any volumes directives in your docker-compose.yml or docker run command will be ignored during the translation to App Platform specifications.

Multi Services Support

Multi services support for DigitalOcean: yes

DigitalOcean supports multiple services in a single App Spec file.

Please read more about multi service support here.