Question

DigitalOcean App Engine + Magaged Database - Whitelisting delay

Posted August 20, 2021 103 views
DigitalOcean Managed MySQL DatabaseDigitalOcean App Platform

Normally, and ideally, you want to run certain processes automatically each deployment. For a laravel app, you can think of:

php artisan migrate for instance.

Adding apps as trusted sources has been added to App Engine, but from what I can tell, the IP-address is whitelist after the deployment has fully finished. This means, we can’t run any tasks that require database access during deployment, which is the often the case.

It would be great if this can be added towards the future, so that we can further optimize the build-pipeline and automate more processes.

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.

×
Submit an Answer
2 answers

It actually seems the db environment variables for the database arent scoped for runtime. Why is this?

  • key: DATABASEURL scope: RUNTIME value: ${views.DATABASE_URL}

Hi softwareRay,

You can run your migrations before every deploy by adding a Job component to your app.

  1. Visit the Apps management page in Cloud UI
  2. Click on your app
  3. Click Actions -> Create Component
  4. Choose the same repo and branch as your Laravel app and click Next
  5. In the Type section click Edit
  6. In the Type dropdown select Job
  7. In the When to Run select Before every deploy
  8. In the Run Command section click Edit
  9. Enter the run command and set it to php artisan migrate
  10. Click Next
  11. Choose the container size necessary for your migrations (the smallest one is usually enough for this task)
  12. Click Launch

From then on, every time you push a new commit to your app, migrations will be run before every deployment after a successful build.

Best,
Moises