I’d like to run several sites on one VM provisioned with bedrock-ansible. I’ve read this thread:
where @emaildano was trying to achieve the same set-up. I can see there is a number of hints on how this can be achieved, but I thought maybe this process is now simplified in the latest version of bedrock-ansible ?
I noticed that the latest Vagrantfile is now designed so that it iterates through wordpress.sites and syncronizes folders for each site. It made me think that the previous thread might be now outdated.
I inspected .env in the current folder on my Vagrant machine and it contains correct database information. However, .env on my local drive is totally empty. This might be the problem because these files are supposed to be shared, aren’t they?
Also, just to clarify, I assume that do not need to manually create a database for my second site.
I actually run vagrant reload --provision at my first attempt. Anyway, I managed to get the database working be reloading vagrant yet again.
Unfortunately, another obstacle has come up. I have two sites added to my group_vars/development file. It appears that the second defined database overrides the first one so, in consequence, I end up with two wordpress installs, but only with one database - the one that was defined last.
To be clearer, my configuration of databases look like this:
I’m totally new to ansible, but it does not seem to be overwriting each created database with the next database it is creating. Might the reason be that I’m using the same user for both databases, or is it irrelevant?
I managed to solve the issue. Once I used a different user for each stie’s database, all is working as expected. Both sites can communicate with their databases. I only need to log in to these mysql databases with different credentials.
I’m still wondering where in the configuration files it is determined that one db_user should have only one database assigned to him…
If you are working locally and want to use one user for all databases, you may as well use the root user. If it’s for a staging/production site, then you’ll be safer using one user per database/site anyways.
However, I’d still like to see when in the ansible playbooks it is determined that there should be one db user for one database. I was not able to find such fragment of configuration in the playbooks. Just pure curiosity