Development of a second site in the same vagrant box. Database config

I have a working site running and I want to setup the second site. I edited group_vars/development/wordpress_sites.yml, duplicating site an changing variables I need to. But when I do vagrant up --provision I get a database setup error:

TASK: [wordpress-install | Install WP] **************************************** 
failed: [default] => (item={'key': 'e451.net', ......etc, etc
stderr: Error: Can’t select database

This is the file. I can setup same database name and it works, but, in that case, contents are the same in both sites.

What am I doing wrong? Thank you in advance.

# Documentation: https://github.com/roots/trellis#wordpress-sites
wordpress_sites:
  abralaboca.net:
    site_hosts:
      - abralaboca.dev
    local_path: ../site # path targeting local Bedrock site directory (relative to Ansible root)
    repo: git@github.com:roots/bedrock.git
    site_install: true
    site_title: abralaboca
    admin_user: aitor
    admin_password: ************
    admin_email: aitor@e451.dev
    multisite:
      enabled: false
      subdomains: false
    ssl:
      enabled: false
    cache:
      enabled: false
      duration: 30s
    system_cron: true
    env:
      wp_home: http://abralaboca.dev
      wp_siteurl: http://abralaboca.dev/wp
      wp_env: development
      db_name: abralaboca_dev
      db_user: aitor
      db_password: ************

  e451.net:
    site_hosts:
      - e451.dev
    local_path: ../e451 # path targeting local Bedrock site directory (relative to Ansible root)
    repo: git@github.com:roots/bedrock.git
    site_install: true
    site_title: 451
    admin_user: aitor
    admin_password: ************
    admin_email: aitor@e451.dev
    multisite:
      enabled: false
      subdomains: false
    ssl:
      enabled: false
    cache:
      enabled: false
      duration: 30s
    system_cron: true
    env:
      wp_home: http://e451.dev
      wp_siteurl: http://e451.dev/wp
      wp_env: development
      db_name: e451_dev
      db_user: aitor
      db_password: ************

I answer myself: After read this example:


I’ve notice several missconfigurations.

  • I had same database users for differents sites
  • I had same git repo for differents sites

After fix it and run vagrant destroy and vagrant up, everything works.

1 Like