Question

On App Platform, Where do I put db migration and other commands, run or buid?

I just started working with App Platform and I am unsure which commands I should be adding in Run vs Build steps.

I am deploying a Laravel App and I need to run DB migrations, route caching, & config caching.

php artisan migrate --force
# Clear caches
php artisan cache:clear

# Clear expired password reset tokens
php artisan auth:clear-resets

# Clear and cache routes
php artisan route:cache

# Clear and cache config
php artisan config:cache

# Clear and cache views
php artisan view:cache

Should these be Build Commands after my composer install or should they be Run Commands before I run heroky-php-apahce2?

Or does it matter?


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

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.

Bobby Iliev
Site Moderator
Site Moderator badge
March 4, 2021
Accepted Answer

Hi there,

I would usually put then in the run section.

Here is a cool 1 hour long video that shows how to build and deploy Laravel on the App platform:

https://youtu.be/QnNA7YdvCYA?t=2278

At minute 38:00 you can see the migration part.

Another good resource is this tutorial here that shows you how to use the doctl command line to deploy Laravel to the App platform:

https://dev.to/erikaheidi/deploying-a-laravel-application-to-digitalocean-app-platform-via-doctl-with-an-app-spec-yaml-file-4dib

In that article, Erika uses a separate Job component for the migrations.

Hope that this helps! Regards, Bobby

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Become a contributor for community

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and SMBs

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.

New accounts only. By submitting your email you agree to our Privacy Policy

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.