Roots Discourse

Uploading production assets to remote server

I’m managed to set up up a droplet on DigitalOcean that’s working with my local development and am able to run successful deploys to the droplet. My local changes/compiled assets are not being pushed to my remote server. I’m curious why this doesn’t happen by default, and if, by design, I need to ssh into the remote server and re-compile manually every time I deploy?

I read through the thread below which outlines using a capistrano script, but it seems overly complicated when I was hoping my life was going to be simplified! I’m sure there’s a simple explanation to this.


Commit changes to your repo so that the deploy will pull those up-to-date source files.

You can have the deploy sync up your locally compiled assets using deploy hooks, specifically by uncommenting what you need in build-before.yml, which is already hooked up.

Related: Build Steps and Deployment from @austin.

@fullyint - thanks for the quick response; appreciate it.

That did the trick. (Maybe this could be explained a bit more in the Trellis docs., or maybe I missed it.)

I assume that plugins files get transferred automatically?
Is there any way to upload my local database to remote, as well?

If your repo has a composer.json file listing plugins, the deploy will “Install Composer dependencies” (as mentioned in the default hooks section of the docs). If you have private plugins, search discourse for how people are handling those via composer. It’s probably less of a good idea than composer, but you could use deploy hooks to set up additional sync tasks for plugins, like the sync task in build-before.yml for compiled theme assets.

Thanks for the feedback regarding the docs. It would be fantastic if you could help us improve the docs via pull request. :grin:

Thanks, @fullyint. I’ll see what I can do :slightly_smiling:

Sometimes I’ll have a separate script for the uploads dir because I don’t necessarily want to sync them every time I deploy nor do I want them in my repo. Just do what works for your situation :slight_smile:
Here’s an example: Pushing or pulling uploads with Trellis

1 Like

Makes sense. Thanks, @erit, I’ll take a look.

What do you guys use to sync local and remote databases? Manual exports, wp-db migrate, or can trellis handle it as well?

I just use wp-cli which is included in Trellis, scp the file to local and commit to repo, plus weekly server backups. Probably a good idea to set up a script and/or cron for this too.

From what I’ve seen, a lot of people prefer a plugin that does this regularly, like BackupBuddy. I believe wp-db is still a manual process.

1 Like