Digital Ocean App Platform Deployment

Dear all
i have an issue regarding the deployment of Strapi in digital ocean App platform.
Each time i perform a new deployment, my database is truncated.
Do you have any clues? is it digital ocean issue or do i have to change my configuration?

Thanks in advance

Can you provide any log about this please?

I’m running into this issue still. I’ve tried a few things but the database resets each time I deploy. I deploy and then I’m invited to sign up as the first admin user.

When deploying, here is my setup.

For the Build Command: yarn build
For the Run Command: yarn start

I have NODE_ENV=production as an environment variable.

Here are the logs:
2021-12-29T21:10:32.912431769Z => Initializing build
2021-12-29T21:10:32.932584227Z => Retrieving source code to /workspace
2021-12-29T21:10:32.951465033Z => Selecting branch "main"
2021-12-29T21:10:33.818785948Z => Checking out commit "268c7d4a1f946bf981d866c098ffc62e3853321f"
2021-12-29T21:10:34.479067065Z => Got source_dir: /
2021-12-29T21:10:34.495108389Z => Using workspace root /workspace
2021-12-29T21:10:34.532267750Z => Building app using buildpacks
2021-12-29T21:10:34.697183004Z => Injecting app environment variables:
2021-12-29T21:10:34.701104669Z => Configuring custom build command to be run at the end of the build:
2021-12-29T21:10:34.716216387Z      yarn build
2021-12-29T21:10:35.122439677Z => Running buildpack detection
2021-12-29T21:10:35.663633718Z heroku/nodejs-engine  0.5.0
2021-12-29T21:10:35.663686124Z digitalocean/node     0.3.4
2021-12-29T21:10:35.663784917Z digitalocean/procfile 0.0.3
2021-12-29T21:10:35.663901607Z digitalocean/custom   0.1.0
2021-12-29T21:10:35.716994017Z For documentation on the buildpacks used to build your app, please see:
2021-12-29T21:10:35.717014313Z    Node.js:
2021-12-29T21:10:35.972161005Z => Checking for cache from a previous build
2021-12-29T21:10:38.713798477Z Restoring metadata for "heroku/nodejs-engine:nodejs" from app image
2021-12-29T21:10:38.714751394Z Restoring metadata for "heroku/nodejs-engine:yarn" from app image
2021-12-29T21:10:38.715845438Z Restoring metadata for "heroku/nodejs-engine:toolbox" from cache
2021-12-29T21:10:38.716899929Z Restoring metadata for "digitalocean/node:node_modules" from cache
2021-12-29T21:10:40.934978835Z Restoring data for "heroku/nodejs-engine:nodejs" from cache
2021-12-29T21:10:40.935730794Z Restoring data for "heroku/nodejs-engine:toolbox" from cache
2021-12-29T21:10:40.936751477Z Restoring data for "heroku/nodejs-engine:yarn" from cache
2021-12-29T21:10:40.938577002Z Restoring data for "digitalocean/node:node_modules" from cache
2021-12-29T21:11:01.836118101Z => Building app
2021-12-29T21:11:01.970154313Z ---> Node.js Buildpack
2021-12-29T21:11:01.981211064Z ---> Installing toolbox
2021-12-29T21:11:01.995698929Z ---> Getting Node version
2021-12-29T21:11:02.016926425Z ---> Resolving Node version
2021-12-29T21:11:04.297177461Z ---> Reusing Node v16.13.1
2021-12-29T21:11:04.297322625Z ---> Parsing package.json
2021-12-29T21:11:05.831764788Z ---> Installing yarn@1.22.17
2021-12-29T21:11:09.976804168Z ---> No file to start server
2021-12-29T21:11:09.976861327Z ---> either use 'docker run' to start container or add index.js or server.js
2021-12-29T21:11:10.005246275Z Project contains yarn.lock, using yarn
2021-12-29T21:11:10.008786404Z Reusing cached node_modules from yarn.lock
2021-12-29T21:11:27.194581356Z Running custom build command: yarn build
2021-12-29T21:11:27.663435343Z yarn run v1.22.17
2021-12-29T21:11:27.727771001Z $ strapi build
2021-12-29T21:11:30.587046101Z Building your admin UI with production configuration ...
2021-12-29T21:11:32.640314708Z ℹ Compiling Webpack
2021-12-29T21:12:46.374740278Z ✔ Webpack: Compiled successfully in 1.23m
2021-12-29T21:12:47.655835700Z Admin UI built successfully
2021-12-29T21:12:47.800552683Z Done in 80.14s.
2021-12-29T21:13:03.982854139Z => Uploading the built Docker image to the container registry...
2021-12-29T21:13:04.985078646Z Reusing layers from image <registry-uri-0>
2021-12-29T21:13:09.689706711Z Reusing layer 'heroku/nodejs-engine:nodejs'
2021-12-29T21:13:09.834423002Z Reusing layer 'heroku/nodejs-engine:yarn'
2021-12-29T21:14:15.218150422Z Reusing 1/2 app layer(s)
2021-12-29T21:14:15.218223671Z Adding 1/2 app layer(s)
2021-12-29T21:14:15.232725866Z Reusing layer 'launcher'
2021-12-29T21:14:15.242472210Z Reusing layer 'config'
2021-12-29T21:14:15.244407115Z Adding label 'io.buildpacks.lifecycle.metadata'
2021-12-29T21:14:15.246476991Z Adding label ''
2021-12-29T21:14:15.246498495Z Adding label 'io.buildpacks.project.metadata'
2021-12-29T21:14:19.805223555Z *** Images (sha256:35671324819f7d30b4a78e275e6469be85cca6e95fef5ba39bbdc61ef8149b6e):
2021-12-29T21:14:19.805272664Z       <image-1>
2021-12-29T21:14:20.532047158Z Reusing cache layer 'heroku/nodejs-engine:nodejs'
2021-12-29T21:14:20.613418722Z Reusing cache layer 'heroku/nodejs-engine:toolbox'
2021-12-29T21:14:20.615926707Z Reusing cache layer 'heroku/nodejs-engine:yarn'
2021-12-29T21:15:12.921301989Z Reusing cache layer 'digitalocean/node:node_modules'
2021-12-29T21:15:15.063841219Z => Uploaded the built image to the container registry
2021-12-29T21:15:15.077728640Z => Build complete

And here is my database config file located at config/env/production/database.js:

const { parse } = require("pg-connection-string");

module.exports = ({ env }) => {
  const { host, port, database, user, password } = parse(env("DATABASE_URL"));

  return {
    defaultConnection: "default",
    connections: {
      default: {
        connector: "bookshelf",
        settings: {
          client: "postgres",
          ssl: {
            rejectUnauthorized: false,
        options: {},

One other note is I’m using the new VPC connection string on the Digital Ocean App Platform to connect to my managed Postgres DB securely.

I tried using the Public Network Connection String and still resets the database each time.