Deployment New Project to Staging with existing project: database connection error

I have a staging site for another project running on a DreamCompute server and I wanted to add another staging site for another project. So I set things up and used the same ip address, new Bitbucket repo and settings and fired the deployment after the site worked locally. Locally I created a new site folder with site and trellis and this I wanted to push to the same staging server I was using for another project. So structure I have is the following root folders with their own site and trellis folder:

  • site.nl - site and trellis folder
  • site.com - site and trellis folder
    (both sites for both projects I want to run on the same server.)

Then I ran into a database error:

TASK: [deploy | WordPress Installed?] ***************************************** 
    failed: [xx.xxx.xx.xx] => {"changed": false, "cmd": ["wp", "core", "is-installed"], "delta": "0:00:00.168663", "end": "2015-12-28 08:59:46.071244", "failed": true, "failed_when_result": true, "rc": 1, "start": "2015-12-28 08:59:45.902581", "stdout_lines": [], "warnings": []}
    stderr: Error: Error establishing a database connection

    PLAY RECAP ******************************************************************** 
to retry, use: --limit @/Users/jasper/deploy.retry
xx.xxx.xx.xx               : ok=19   changed=10   unreachable=0    failed=1

I thought the script would with ease create a new database with the details added to staging/wordpress_sites.yml . I even used Sequel Pro to add the database user, password and database as I wondered whether the second deploy needed this.

However, it now states it could not connect to the database… like it is not creating but just connecting and cannot using the envs I added to the new wordpress_sites.yml? Am I doing something illogical here?

i got the same issue too, did you find the solutions for this ?

@jasperfrumau I haven’t looked into the specifics of what might be producing the database error.

I’m not too surprised that two separate Trellis projects with configurations for different sites might have trouble running on the same server. I think you’ll have more luck with “one-to-one” or “one-to-many” in terms of Trellis projects to servers (vs. “many-to-one”). So, instead of this:

# Multiple Trellis projects, one server
site.nl/
    site/
    trellis/
site.com/
    site/
    trellis/

I think you’ll have more luck with this:

# One Trellis, one or more servers
my-sites/
    site.com/
    site.nl/
    trellis/

See these links for related notes on implementation.

Edit. I couldn’t tell whether you reran server.yml with the second site’s info before running deploy.yml, but you should.