generoi/bedrock

Automate staging and production WP_HOST on kinsta

oxyc opened this issue · 4 comments

oxyc commented

This would be useful so you can freely backup and restore between the environments.

I've inquired from Kinsta and there's no environment variable set up. They have WP_ENVIRONMENT_TYPE set in nginx but that wouldnt work with CLI tasks so not usable. On non-bedrock stacks they create the wp-config.php. Only way I see is to sniff the hostname and see if it contains the word staging but that's not ideal.

I have used a new branch of deployer-genero in this PR for the functionality which can be updated to master once its PR is approved.

tested on Kinsta and following steps followed
https://testsitebedrock.kinsta.cloud/

Setup project:

echo 'Project directory:'; read project; composer create-project --keep-vcs --repository-url="https://packagist.minasithil.genero.fi" generoi/bedrock:dev-feature/set-wp-home#bc2ab038822da2bfdfdb30bfe9a8e248f0966170 $project; cd $project;

Setup Kinsta environments and filled info in robo.yml and wp-cli.yml file

Setup ENV:
./vendor/bin/dep setup production
./vendor/bin/dep setup staging

Commit the code

Deploy to production:
./vendor/bin/dep setup production

Clone From Kinsta Production to Staging

oxyc commented

with your current setup you would need to add a config/production.php file to bedrock no?

yes ./vendor/bin/dep setup production setups the WP_HOME link in the config/environments/production.php file