WP setup screen after Capistrano production deploy

I’m trying to learn the best bedrock-ansible workflow and it’s a bit hard for a newbie to make it right the first try. The process is mostly trial and error until it works (or you think it does). Will there be a nice bedrock/ansible avalable in the near future (take my money please! :smile:) ? Or just bedrock?

I used the only “tutorial” i could find - https://github.com/roots/bedrock-ansible/issues/119 approach. But used Bitbucket as a git repository and DigitalOcean as droplet (god i have destroyed +10 of these :slight_smile: )First problem was that i needed to add my remote SSH key and add it to my bitbucket account (took 2 days to change the log from Info to debug to see exactly what the error was. Also had to use --ask-sudo-pass for provisioning the droplet.

But after that i could use bundle exec cap production deploy:check normally, but i got 3 errors on bundle exec cap production deploy which i can’t seem to figure out with the debug. The failed errors are:

 DEBUG[ff77824a] Command: [ -L /srv/www/domain.com/releases/20150320211555/.env ]
DEBUG[ff77824a] Finished in 0.044 seconds with exit status 1 (failed).

DEBUG[9be85cb8] Command: [ -f /srv/www/domain.com/releases/20150320211555/.env ]
DEBUG[9be85cb8] Finished in 0.043 seconds with exit status 1 (failed).

DEBUG[87cd67c9] Command: [ -L /srv/www/domain.com/releases/20150320211555/web/app/uploads ]
DEBUG[87cd67c9] Finished in 0.047 seconds with exit status 1 (failed).

I and after that i have to setup the install for wordpress (use the same info from the bedrock ansible for db name etc.) and the site comes back again. It’s a bit strange though.

Watched the roots capistrano screencast which helped with the debug setting only. Did i miss a step somewhere? Any help pointing in the right direction for me to look/check would be well appreciated. Vagrant works perfectly though.

Seeing the setup screen after install is very weird. I think the only way that would happen is if the database was empty (did have WP tables). I’ve never experienced that otherwise.

The non-development/Vagrant workflow of bedrock-ansible is a bit of a mess right now. Soon this will be a lot better once we switch to Ansible based deploys. This will also involve a better process and more documentation for remote (staging/prod) servers.

And after that update, I should have 1 or 2 more screencasts coming specifically about Bedrock itself, and also bedrock-ansible.

Regarding your actual issues: despite deploy:check succeeding, I’d still verify all the files/folders and permissions manually. It looks like those errors are for when Capistrano verifies that the symlinks were created near the end of the deploy.

It’s hard to offer much more help than that right now just going on the information above.

Can’t wait for those screencasts! :slight_smile: Thanks for the feedback, it’s probably better to wait a bit for the ansible deploys like you said.

It’s been a while but i got the same error again.

After Trellis/Bedrock deploy (or even just bedrock). I get a wordpress setup screen for creating the wp-config.php file. Now if i input the database name etc. I get wordpress working, but there is not a theme or plugins in there.

The thing i found out is that it’s not picking up the .env file and the reason for this is, that my deploy (git) was missing the web/wp-config.php file which has this code in it:

    <?php
/**
 * Do not edit this file. Edit the config files found in the config/ dir instead.
 * This file is required in the root directory so WordPress can find it.
 * WP is hardcoded to look in its own directory or one directory up for wp-config.php.
 */
require_once(dirname(__DIR__) . '/vendor/autoload.php');
require_once(dirname(__DIR__) . '/config/application.php');
require_once(ABSPATH . 'wp-settings.php');

This file helps loading the .env. Also if i go back to the setup screen problem, that wp-config.php (default wp one) will be created in web/wp.

I don’t know the reason why this happened, maybe .gitignore? I used the latest Trellis/Bedrock and if i check my github i only have app/ and index.php in there (no wp/ as this one is created with composer if i’m correct?). Local works fine.

This problem was haunting me for months hehe :smiley: I know how to fix it (git add web/wp-config.php) but i have no idea why this happened a lot of times before.

Thanks for posting this @darjanpanic - it helped me spot the issue with a Digital Ocean deployment I’d just setup.

My fix was to add the following bolded line below in my .gitignore located in the site folder.

# WordPress
web/wp
web/.htaccess
!web/wp-config.php

Then I committed this file to the repo and re-deployed and it worked.

Prior to adding the wp-config.php to the repo, I was getting the following error when running the deploy.sh script to push my site to staging:

TASK: [deploy | WordPress Installed?] *****************************************
failed: [104.236.136.110] => {“changed”: false, “cmd”: [“wp”, “core”, “is-installed”], “delta”: “0:00:00.076316”, “end”: “2015-10-14 19:23:08.751949”, “failed”: true, “failed_when_result”: true, “rc”: 1, “start”: “2015-10-14 19:23:08.675633”, “stdout_lines”: [], “warnings”: []}
stderr: Error: wp-config.php not found.
Either create one manually or use wp core config.

Am I correct in saying that this is the line blocking the wp-config.php from being included in the repo:

web/wp

If it were web/wp/ it would pick up only the directory, but without the trailing slash, it gets both file and directory? Or is this file being ignored elsewhere and I’m not spotting it?

Never heard of this happening. web/wp without the slash shouldn’t do a wildcard match. You’d need web/wp* to also affect wp-config.php.

Thanks @swalkinshaw, I thought you’d need to add a wildcard too.

I know we have two sites we’re working on at the moment where the wp-config.php was ignored by default, but I’m still not sure why.

The site I posted about earlier was one I just setup from scratch yesterday and I’m positive I didn’t explicitly ignore wp-config.php. I have to setup another few Roots sites in the next few days and will do some testing and report back.

There was a reason/idea for this happening in another thread but i cant find it. I think it may have something to do with BitBucket having it’s own global gitignore for files/data with delicate information.

Make sure you double check your global Git ignore rules.

Make sure you double check your global Git ignore rules.

That was totally it! Thanks for the tip and sorry for not finding that sooner.