# Correct way to deploy with capistrano bedrock and sage

**URL:** https://discourse.roots.io/t/correct-way-to-deploy-with-capistrano-bedrock-and-sage/17966
**Category:** sage
**Tags:** webpack
**Created:** 2020-04-03T14:55:54Z
**Posts:** 5

## Post 1 by @Koli14 — 2020-04-03T14:55:55Z

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](https://github.com/ManifoldScholar/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?

---

## Post 2 by @folbert — 2020-04-03T19:10:12Z

Not really an answer but may I suggest you try deploying with [Deployer](https://deployer.org) instead? I used to deploy using [Bedrock Capistrano](https://github.com/roots/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.

---

## Post 3 by @Koli14 — 2020-04-04T18:26:47Z

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

---

## Post 4 by @folbert — 2020-04-04T19:16:43Z

> <https://gist.github.com/folbert/4f1737d16444cd4402dfb71893a39fb5>

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

---

## Post 5 by @Koli14 — 2020-04-06T09:25:47Z

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](https://github.com/sourcebroker/deployer-extended-wordpress-composer)
