Skip to content

Latest commit

 

History

History
262 lines (230 loc) · 12.5 KB

File metadata and controls

262 lines (230 loc) · 12.5 KB

Configuration

The configuration file is a YAML file that defines the application, its resources, and the providers used for deployment. The configuration file is typically named altdeploy.yml and should be placed in the root directory of your project.

Contents

Providers

Providers are the cloud or on-prem platforms that AltDeploy deploys to. to deploy applications. Each provider has its own set of configurations.

Types:

  • azure: Represents an Azure provider.
  • docker: Represents a Docker provider.
  • (Not implemented yet) digital-ocean: Represents a DigitalOcean provider.
  • (Not implemented yet) remote-host: Represents a Remote Host provider.
  • (Not implemented yet) kubernetes: Represents a Kubernetes provider.

Attributes:

Attribute Type Description
type string (required) The type of the provider (e.g., azure, docker-local).
monitoring boolean Enable monitoring for the provider. Defaults to true.
registries array of Registry All registries to use for the provider.
Azure
clientId string (required) The client ID for Azure AD authentication.
clientSecret string (required) The client secret for Azure AD authentication.
tenantId string (required) The tenant ID for Azure AD authentication.
subscriptionId string (required) The subscription ID for Azure resources.
location string (required) The Azure region for deployment.

Examples:

providers:
  my-docker-local: # Custom identifier for the provider
    type: docker-local                                     # Local Docker provider
    monitoring: true                                       # Enable monitoring
  my-azure: # Custom identifier for the provider
    type: azure                                            # Azure provider
    clientId: "3f9be7fc-b733-4a1e-8ebe-aaaaaaaa1111"       # Client ID from Azure AD
    clientSecret: ${AZURE_CLIENT_SECRET}                   # Secret value from environment variable
    tenantId: "9d1a5fc8-321e-4101-ae63-555555555555"       # Tenant ID from Azure AD
    subscriptionId: "79df4d72-bd03-4744-a111-aaa11a111111" # Subscription ID from Azure
    location: "switzerlandnorth"                           # Azure region for deployment
    registries:
      my-docker-registry: # Custom identifier for the registry
        url: index.docker.io              # URL of the Docker registry
        username: username                # Username for the Docker registry
        password: ${DOCKERHUB_PASSWORD}   # Password for the Docker registry

Registry

The registry where the container images are stored. All registries are applied to all providers.

Attributes:

Attribute Type Description
url string (required) The URL of the Docker registry (e.g., index.docker.io).
username string (required) The username for the Docker registry.
password string (required) The password for the Docker registry.

Example:

registries:
  my-docker-registry: # Custom identifier for the registry
    url: index.docker.io              # URL of the Docker registry
    username: username                # Username for the Docker registry
    password: ${DOCKERHUB_PASSWORD}   # Password for the Docker registry

Resources

Resources are the components that make up an application, such as containers, databases and storage.

Types:

  • container: Represents a container resource.
  • database: Represents a database resource.
  • storage: Represents a storage resource.

Attributes:

Attribute Type Description
type string (required) The type of the resource (e.g., container, database).
provider string The provider where the resource is deployed. Defaults to first defined provider
Container
image string (required) The Docker image to use for the container. name:tag
replicas non-negative integer The number of replicas for the container (Currently max 1 is supported and it defaults to 0).
ports array (required) Ports to expose from the container in FROM:TO format.
environment array Environment variables for the container in VARIABLE=VALUE format.
envFrom array of EnvFrom Environment variables from a other resource
liveness.port string The port to check for liveness. Defaults to first defined port.
liveness.path string The path to check for liveness. Defaults to /livez.
readiness.port string The port to check for readiness. Defaults to first defined port.
readiness.path string The path to check for readiness. Defaults to /readyz.
resources.request.cpu string The CPU resources allocated to the container.
resources.request.memory string The memory resources allocated to the container.
resources.limit.cpu string The maximum CPU resources allocated to the container.
resources.limit.memory string The maximum memory resources allocated to the container.
Database
database string (required) The name of the database.
databaseType string (required) The type of database (e.g., postgres). MongoDB and redis are not implemented yet.
version string (required) The version of the database.
credentials.username string (required) The username for the database.
credentials.password string (required) The password for the database.
Storage
bucket string (required) The name of the storage bucket.

Examples:

resources:
  my-container: # Custom identifier for the resource
    type: container                    # Type of resource
    provider: my-docker-local          # Reference to the provider
    image: stefanprodan/podinfo:latest # Docker image to use
    replicas: 1                        # Number of replicas for the container
    ports: # Ports to expose
      - "9898:9898"                    # Port mapping for the container FROM:TO
    environment: # Environment variables for the container
      - ENV=int                        # VARIABLE=VALUE
    envFrom: # Environment variables from another resource
      - resource: my-database          # Reference to the resource
        key: connectionString          # Key of the value in the resource
        name: DATABASE_URL             # Name of the environment variable in the container
  my-database: # Custom identifier for the resource
    type: database                     # Type of resource
    provider: azure1                   # Reference to the provider
    databaseType: postgres             # Type of database
    version: "16"                      # Version of the database
    database: myPosgres                # Name of the database
    credentials: # Credentials for the database
      username: postgres               # Username for the database
      password: ${DB_PASSWORD}         # Password for the database from environment variable
  my-storage: # Custom identifier for the resource
    type: storage                      # Type of resource
    provider: azure1                   # Reference to the provider
    bucket: my-bucket                   # Name of the storage bucket

EnvFrom

The envFrom attribute allows you to reference environment variables from another resource. This is useful for runtime dependencies like a database connection string or API endpoints that are defined in another resource.

Attribute Type Description
resource string (required) The identifier of the resource to reference.
key string (required) The key of the environment variable to reference.
name string (required) The name of the environment variable in the container.
format string Optional reformatting of the value (e.g. "redis://%s")

Example:

envFrom:
  - resource: my-database
    key: connectionString
    name: DATABASE_URL
    format: "postgres://%s"

Full Configuration Example

providers:
  azure1:
    type: azure
    monitoring: true
    clientId: 3f9be7fc-b733-4a1e-8ebe-aaaaaaaa1111
    clientSecret: ${AZURE_CLIENT_SECRET}
    tenantId: 9d1a5fc8-321e-4101-ae63-555555555555
    subscriptionId: 79df4d72-bd03-4744-a111-aaa11a111111
    location: switzerlandnorth
    registries:
      docker-registry:
        url: index.docker.io
        username: username
        password: ${DOCKERHUB_PASSWORD}

resources:
  outline-app:
    type: container
    provider: azure1
    replicas: 1
    image: outlinewiki/outline:0.85
    ports:
      - "3000:3000"
    environment:
      - URL=http://localhost:3000
      - SECRET_KEY=${OUTLINE_SECRET_KEY}
      - UTILS_SECRET=${OUTLINE_UTILS_SECRET}
      - HOST=0.0.0.0
      - COLLABORATION_URL=http://outlineapp.switzerlandnorth.azurecontainerapps.io:3000
      - FORCE_HTTPS=false
    liveness:
      port: 3000
      path: /
    readiness:
      port: 3000
      path: /
    resources:
      requests:
        cpu: "1000m"
        memory: "512Mi"
      limits:
        cpu: "1500m"
        memory: "1024Mi"
    envFrom:
      - resource: outline-db
        key: connectionString
        name: DATABASE_URL
      - resource: outline-redis
        key: hostname
        name: REDIS_URL
        format: "redis://%s"
      - resource: outline-storage
        key: endpoint
        name: AWS_S3_UPLOAD_BUCKET_URL
      - resource: outline-storage
        key: bucket
        name: AWS_S3_UPLOAD_BUCKET_NAME
      - resource: outline-storage
        key: accessKeyId
        name: AWS_ACCESS_KEY_ID
      - resource: outline-storage
        key: secretAccessKey
        name: AWS_SECRET_ACCESS_KEY
  outline-redis:
    type: container
    provider: azure1
    replicas: 1
    image: redis:latest
    ports:
      - "6379"
  outline-storage:
    type: storage
    provider: azure1
    bucket: bucket-name
  outline-db:
    type: database
    database: outline-db
    provider: azure1
    databaseType: postgres
    version: "16"
    credentials:
      username: postgres
      password: ${POSTGRES_PASSWORD}