From staging environment to production environment

I used the whole “package” (trellis, bedrock and sage), I am ready to push the website from the staging environment to the production environment, and I am wondering what are the steps that I have to follow (before I fuck it up with a step something completely wrong).

I already created the production environment a few months ago on Digital ocean, did the provision and running WordPress without problems.
the last few months I worked only on the staging environment, so now my production environment is out of date.

it is clear to me the step that I have to export/import the uploads folder and the database (reset the db and do a search-replace) on the production website.

And of course run ./bin/ production from the trellis directory.

am I missing something?
what about the plugins that I have installed on the staging but not on production?

if somebody could clarify to me what are the steps in chronological order that I have to follow (from staging to production), it would be really helpful, as I said, I am worried that I will fuck it up the last step before going live :frowning:

many thanks in advance :pray:

This is pretty much it

The plugins are in the codebase via Composer I’m assuming? If so, the database upload from staging to prod will take care of that

For automating this you can use something like:

@ben this sounds great, I think that I will give a go with the next project, thanks for creating this.

at the end, I did the export/import the uploads folder and the database, and it worked.

Now I would like to migrate from staging to development (on my local machine).

are these steps correct?

  1. ssh to DO droplet, change directories to web root:
    $ ssh
    $ cd /srv/www/
    $ wp db export

  2. exit the ssh session (type exit )

  3. Download the dump file from the DO droplet in /srv/www/
    I usually just use an (S)FTP client for this. Also copy the uploads directory from /srv/www/ to site/web/app/

  4. ssh to my Vagrant box, reset the database and then import the new database:
    $ cd trellis && vagrant ssh
    $ cd /srv/www/
    $ wp db reset
    $ wp db import domain_com_xxxxx.sql

  5. Search and replace production URL with development URL:
    $wp search-replace domain.test

I am not 100% sure about these steps, they make sense in my mind, but I am not super confident with these.
is it a right workflow? (i know that there are better ways to manage this, I will try new ways with the next project)

many thanks

1 Like

This is exactly right and this is how I do it every time.

@MWDelaney I followed one of your old answer in another topic (from development to production), I printed your answer, I keep it on my desk, and I used to follow that like a bible every time that I have to do the migration task.

but I was not sure that the steps make sense also in the opposite way from production to development.

is it a thumb up from your side?

1 Like


It’s a thumbs up from me!

great, thanks :wink:

This topic was automatically closed after 42 days. New replies are no longer allowed.