I have been deploying to my staging environment on digitalocean without problems but after adding production variables and attempting a deploy, both staging and production environments are broken.
The deploys fail at
TASK [deploy : WordPress Installed?] *******************************************
System info:
Ansible 2.2.1.0; Darwin
Trellis at “Allow for per-project packagist.com authentication”
Error: Error establishing a database connection. This either means that the
username and password information in your wp-config.php
file is incorrect
or we can’t contact the database server at localhost
. This could mean your
host’s database server is down.
fatal: [my.domain]: FAILED! => {“changed”: false, “cmd”: [“wp”, “core”, “is-installed”, “–require=/srv/www/mydomain/shared/tmp_multisite_constants.php”], “delta”: “0:00:00.195600”, “end”: “2017-05-20 09:50:57.623109”, “failed”: true, “failed_when_result”: true, “rc”: 1, “start”: “2017-05-20 09:50:57.427509”, “stderr”: “Error: Error establishing a database connection. This either means that the username and password information in your wp-config.php
file is incorrect or we can’t contact the database server at localhost
. This could mean your host’s database server is down.”, “stdout”: “”, “stdout_lines”: [], “warnings”: []}
staging is now displaying the standard WordPress ‘error establishing database connection’ when browsing the site.
I am trying to have both the production and staging environments on the same digitalocean droplet (its a small non critical hobby site so I am not concerned about keeping them separate)
My questions are:
-
Is it possible to have both staging and production trellis environments on the same box?
-
During the deploy, does trellis reset the database password both for WordPress and MySql / MariaDB?
-
how is
vault_mysql_root_password
fromvault.yml
treated if both environments are on the same machine? -
is
env()
trellis’ own function? I am used togetenv()
-
Is it possible to check the actual values being used by application.php i.e
/**
- DB settings
*/
define(‘DB_NAME’, env(‘DB_NAME’));
define(‘DB_USER’, env(‘DB_USER’));
define(‘DB_PASSWORD’, env(‘DB_PASSWORD’));
define(‘DB_HOST’, env(‘DB_HOST’) ?: ‘localhost’);
define(‘DB_CHARSET’, ‘utf8mb4’);
define(‘DB_COLLATE’, ‘’);
$table_prefix = env(‘DB_PREFIX’) ?: ‘wp_’;
- DB settings
When I ssh into the target machine, mysql is running.
printenv shows an entry called ‘OLDPW’ which is pointing at the trellis /config/environments directory