I try to deploy the repo: Perceptively/employer-survey_website

which has this .do/app.yaml:

databases:
  - engine: MYSQL
    name: MYDB
    num_nodes: 1
    production: true
    cluster_name: MY_CLUSTER
instance_size_slug: professional-xs
name: my_backend
services:
  - environment_slug: python
    github:
      branch: mybranch
      deploy_on_push: true
      repo: company/website
    name: my_backend

but I never get the option for MySQL, only Postgres. Why can’t I use MySQL with app platform?

edited by kamaln7
1 comment
  • sorry, can’t edit. Here’s the app spec:

    databases:
      - engine: MYSQL
        name: MYDB
        num_nodes: 1
        production: true
        cluster_name: MY_CLUSTER
    instance_size_slug: professional-xs
    name: my_backend
    services:
      - environment_slug: python
        github:
          branch: mybranch
          deploy_on_push: true
          repo: company/website
        name: my_backend
    
    

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
1 answer

Hi @SmallAquaMantaRay

App Platform supports PostgreSQL, MySQL, and Redis Managed Databases. Some repos have an app spec at .do/app.yaml however that is not used by App Platform at all - it’s mostly a convention to store the app spec at that path so that others can find it easily.

You can add the database from the control panel by browsing to your App -> Components -> Add Database and then select your MySQL database.

Alternatively, you can edit your App Spec directly and use the doctl CLI tool to apply the changes to your app. Also, in spec you posted, num_nodes has been deprecated and instance_size_slug should be a property of the service component like so:

databases:
  - engine: MYSQL
    name: MYDB
    production: true
    cluster_name: MY_CLUSTER
name: my_backend
services:
  - environment_slug: python
    github:
      branch: mybranch
      deploy_on_push: true
      repo: company/website
    name: my_backend
    instance_size_slug: professional-xs

If you do not have doctl installed, you can follow these instructions.

To create a new app from the spec, run doctl apps create --spec app.yaml.

If you have an existing app that you want to edit:

  1. List your apps and find your app’s UUID: doctl apps list
  2. Save your app’s spec to a file: doctl apps spec get APP-UUID > app.yaml
  3. Open app.yaml in a text editor and add the database.
  4. Update your app with the new spec: doctl apps update --spec app.yaml APP-UUID. This will kick off a new deployment.

See the App Specification Reference for more info about app specs.

Submit an Answer