Roots Discourse

Correct way to deploy with capistrano bedrock and sage

I’m new to the Roots world, and I’m trying to deploy a site with Bedrock and Sage. Trellis was too scary for me, as there where so many concept I have no idea about. So I started to do it with Capistrano.
After some hard work, now with bundle exec cap staging deploy composer runs in both the root directory and in my Sage theme directory.
I try to use capistrano-yarn.
Yarn runs also succesfully in production mode. I wanted to build my scripts with yarn build:production, but thats not working, because webpack is only dev-dependency. Should I change that?
If I try to run yarn not in production, I also get an error in my server: make: g++: Command not found.
What’s the recommended way to solve it?

Not really an answer but may I suggest you try deploying with Deployer instead? I used to deploy using Bedrock Capistrano and while it did work (and I am grateful for its existance), keeping track of node versions across projects and keeping separate versions of Capistrano for different projects across the team was, to my PHP-centered brain, a pita.

Deployer is managed using composer and the tasks are written in a PHP-file.

If you are interested, I can share my Deploy.php-file with the tasks used to deploy a Bedrock/Sage9-setup.

Thanks for the suggestion. Yes, im intrested in your deploy.php!

I have removed tasks for creating a DB-backup, restarting PHP FPM since they were specific to the server provider that I am using. But I want to mention it here since it may be a good idea to add them yourself.

My deploy.yml holds nothing special except for the name of the database to backup on deploy.

Edit: changed Gist-URL

2 Likes

Thanks @folbert, it’s much simpler to work with deployer for me, as with capistrano. I succesfully deployed my site with it! :slight_smile:
I also found a helpful package to sync db and media files: https://github.com/sourcebroker/deployer-extended-wordpress-composer