githubEdit

Production sync

For the rare cases we want to sync production from the development site

We already have a monthly syncarrow-up-right that completely overrides stage and dev environments directly from production. We don't have any automation in place for the reverse process, as it can be risky but also rarely needed.

As part of the new Information Architecture project it's often easier for NROs to content freeze on production, make all the necessary changes on their dev site and then ask from the P4 team to migrate them over to production.

Till we have an automated way of doing this type of sync, below are the manual steps needed to make it work.

Preparation

Maintenance page

Install the Maintenance plugin and configure it like documented here on both development and production sites and enable maintenance mode.

Set up env variables

Replace NRO with the name of the website (eg. indonesia) you are working on:

HELM_NAMESPACE_DEV="NRO"
HELM_NAMESPACE_PROD="NRO"
NRO="NRO"

BUCKET_DEV="planet4-NRO-stateless-develop"
BUCKET_PROD="planet4-NRO-stateless"

GCLOUD_ZONE="us-central1-a"
GCLOUD_CLUSTER_PROD="planet4-production"
GCLOUD_CLUSTER_DEV="p4-development"
GOOGLE_PROJECT_ID_PROD="planet4-production"
GOOGLE_PROJECT_ID_DEV="planet-4-151612"
circle-info

Make sure to use the same terminal from now on, to ensure those variables are set.

Development

Export development database

Production

Backup production data

Database import

First we need to open the database sql file on an editor and remove the lines that set up LOG BIN. Those are usually on the very first and on the very last lines of the file. Those command will make the import fail due to privillege issues.

circle-info

On the stateless url path make sure to adjust them accordingly for websites that are on a different domain.

Sync bucket

Flush cache

Post actions

Maintenance mode

Disable the maintenance mode from both sites. Don't remove the plugin just yet, in case it's still needed.

Cache

Trigger a new production deployment so that all content is purged from Cloudflare cache.

Last updated