How is .env created? prod .env shows dev data

Hope this category is okay for that.

I’m working on a first trial-and-error with the roots-example-projects template and deployed the production environment to a DO machine after setting this up with Trellis before.

All deployment worked without errors but when i call the site in the browser i get redirected to /wp-admin/install.php which should be the case because Wordpress doesn’t see an installed version of itself. After grabbing around a bit i found that the config fetches database data from the env and .env file on the production server contains development db data. I guess that should be production data in there, right?

My group_vars/production/wordpress_sites.yml contains all stuff filled out including the production mysql data, keys and salts etc.

i deployed using

/ production

where is the site name i used in the yml (guess this is correct?):smile:


Data looks to be transferred well from the git repo.

Do i need to write the .env file manually to the server?

the .env is automatically generated during every deploy based on your wordpress_sites variable which comes from group_vars/production/wordpress_sites.yml.

It appears you’ve done things correctly. I’d double check you somehow didn’t accidentally commit .env to your repository for one thing.

Maybe the problem was that i first setup with hhvm enabled - after changing this and running

ansible-playbook -i hosts/production server.yml

again it didn’t probably update right. I’m sure there’s another command to update an already installed server but i didn’t find it yet. As i now made another mistake in the wordpress_sites variable i would need to update this again - is there a way to do it or do i need to do this changes manually?

No you should never need to make updates to the server manually with an Ansible setup. If you ever make changes to the configuration just run that command again and Ansible will run through the playbooks making any necessary changes (ideally).

thanks @kalenjohnson - it worked now. My fault was i controlled it while beeing in the directory without realizing that the directory changes with every task and current directory get’s remapped.

looks like it’s working fine now and i can mess around with transferring data between the different environments.

1 Like