For some reason the wrong .env file gets copied to the wrong website folder.
What I’m trying to achieve:
- Use a monorepo with three folders,
/frontend
,/backend
and/server
- Have multiple sites in
wordpress_sites.yml
- Use this setup to run two WordPress websites (noten.nl and nussmarkt.de) which will be there own unique businesses and have different languages (Dutch and German), but are built on the same codebase
Reproducing the bug:
- Run
vagrant destroy
to remove all local configurations and files - Configure
wordpress_sites.yml
andvault.yml
in thedevelopment
folder - Run
vagrant up --prosivion
and keep an eye on the two Ansible .env tasks:Create .env file
andCopy .env file into web root
- SSH into the server and navigate to
/tmp
where the temporary .env files are stored. These values are correct and match with the data inwordpress_sites.yml
- Navigate to the webroots and check the .env file in the
/current
folder -
Here’s the bug
: The .env file data of the lowest website in wordpress_sites.yml (in my case that’s nussmarkt.de) is copied to both of the webroots.
My wordpress_sites.yml:
wordpress_sites:
noten.nl:
site_hosts:
- canonical: api-development.noten.nl
local_path: ../backend
admin_email: ******@noten.nl
multisite:
enabled: false
ssl:
enabled: false
cache:
enabled: false
env:
cookie_domain: noten.nl
frontend_url: http://development.noten.nl
nussekaufen.de:
site_hosts:
- canonical: api-development.nussekaufen.de
local_path: ../backend
admin_email: ******@nussekaufen.de
multisite:
enabled: false
ssl:
enabled: false
cache:
enabled: false
env:
cookie_domain: nussekaufen.de
frontend_url: http://development.nussekaufen.de
.env file of noten.nl (/srv/www/noten.nl/current) - (contains data of NusseKaufen.de, which it shouldn’t):
ACF_PRO_KEY=‘******’
AUTH_KEY='******'
AUTH_SALT='******'
COOKIE_DOMAIN='nussekaufen.de'
DB_HOST='localhost'
DB_NAME='nussekaufen_de_development'
DB_PASSWORD='******'
DB_USER='nussekaufen_de'
DB_USER_HOST='localhost'
DISABLE_WP_CRON='True'
DOMAIN_CURRENT_SITE='api-development.nussekaufen.de'
FRONTEND_URL='http://development.nussekaufen.de'
GRAPHQL_JWT_AUTH_SECRET_KEY='******'
LOGGED_IN_KEY='******'
LOGGED_IN_SALT='******'
NONCE_KEY='******'
NONCE_SALT='******'
SECURE_AUTH_KEY='******'
SECURE_AUTH_SALT='******'
WP_DEBUG_LOG='/srv/www/nussekaufen.de/logs/debug.log'
WP_ENV='development'
WP_HOME='http://api-development.nussekaufen.de'
WP_SITEURL='http://api-development.nussekaufen.de/wp'
.env file of nussekaufen.de (/srv/www/nussekaufen.de/current):
ACF_PRO_KEY=‘******’
AUTH_KEY='******'
AUTH_SALT='******'
COOKIE_DOMAIN='nussekaufen.de'
DB_HOST='localhost'
DB_NAME='nussekaufen_de_development'
DB_PASSWORD='******'
DB_USER='nussekaufen_de'
DB_USER_HOST='localhost'
DISABLE_WP_CRON='True'
DOMAIN_CURRENT_SITE='api-development.nussekaufen.de'
FRONTEND_URL='http://development.nussekaufen.de'
GRAPHQL_JWT_AUTH_SECRET_KEY='******'
LOGGED_IN_KEY='******'
LOGGED_IN_SALT='******'
NONCE_KEY='******'
NONCE_SALT='******'
SECURE_AUTH_KEY='******'
SECURE_AUTH_SALT='******'
WP_DEBUG_LOG='/srv/www/nussekaufen.de/logs/debug.log'
WP_ENV='development'
WP_HOME='http://api-development.nussekaufen.de'
WP_SITEURL='http://api-development.nussekaufen.de/wp'
Setup
- Trellis 1.7.0
- macOS Big Sur 11.1 (20C69)
- Ansible 2.10.3
- Vagrant 2.2.14
This problem only occurs on local development.
Any idea where to start debugging?