'Plan B' Deployment using non-Cap method

Capistrano looks great, and in the slightly longer-term I intend on conquering it, but I need a short-term solution for a project I’m working on. Until discovering Roots/Sage, I simply (naively) stored all my compiled assets/binaries etc in my git repo, and deployed with deployhq.com.

I was launching this site yesterday, so upon failing to comprehend Cap, I tried removing a few rules from my .gitignore file, let my WP files/uploads/dist etc into my repo and attempted a deploy onto my staging server to see if I could launch that way. It didn’t work (haha you can see the fruits of my labour here: http://dev.theagsc.com/; it just produced a lonely message saying ‘wrong file’). I’m sure there are ways of debugging what went wrong (php error logs? Some sort of verbose debug mode to enable?) but my experience is limited here.

What is the best way to deploy using something other than Capistrano? I’m sure it would be helpful to take a look at some of my files to know what might have gone wrong in my deploy to deployhq.com, but as I’m not sure what is most relevant, and don’t want to clog up this post with a bunch of code blocks, please do ask, I’m happy to share anything helpful.

Also, another quick question; where in our Bedrock files do we define our staging and production database names and credentials? I understand that e.g. environments/staging.php has the following:

/* Staging */
define('DB_NAME', getenv('DB_NAME'));
define('DB_USER', getenv('DB_USER'));
define('DB_PASSWORD', getenv('DB_PASSWORD'));
define('DB_HOST', getenv('DB_HOST') ? getenv('DB_HOST') : 'localhost');

define('WP_HOME', getenv('WP_HOME'));
define('WP_SITEURL', getenv('WP_SITEURL'));

ini_set('display_errors', 0);
define('WP_DEBUG_DISPLAY', false);
define('SCRIPT_DEBUG', false);
define('DISALLOW_FILE_MODS', true); // this disables all file modifications including updates and update notifications

This may be a stupid question, but am I correct in thinking these are variables? Or have I failed to fill in some very important information haha. I know that .env has our local credentials.

Finally, the screencast currently up on roots.io covering Capistrano describes the Gemfile as including grunt and npm; is this neccesary now in Sage? I understand there’s a new screencast coming, so I imagine a lot of my questions may be answered in that.

Thanks as always for the help!

Regarding the credentials, you should have these set differently for each environment and contained within their own .env file, just as you do in your development environment.

On the staging and production server, the .env file should be contained within the shared folder: /srv/www/example.com/shared/.env

Capistrano then symlinks this to the current release file in the same way it does the uploads folder. So you can upload it once and forget about it for all future deploys.

1 Like

The way you wanted to deploy is perfectly fine. Adding compiled assets into the repo and just deploying it should work.

Something else is going on with your host and that error message is especially crazy. Literally never seen that ever.

You’ll definitely want to find your PHP error logs but we can’t be of help with that since we have no idea how your host is set up.

No problem. Good to know that it should have worked, and it wasn’t a Roots/Sage/Bedrock related issue. Thanks Scott.