When NitroPack is used on a website, each site has its own instance in our system with a unique site ID and site secret key.
If a website has a live domain, and a staging domain, they both need to be connected separately to NitroPack and will have their own unique keys.
⚠️ You don’t need to purchase a separate subscription for your staging website. You can use our Free plan.
How to install NitroPack on your staging website?
To install NitroPack on your staging website, you can follow the same process as described in these articles:
How to Install, Connect and Update NitroPack for WordPress
When NitroPack is connected to a website, it does two main things that relate to the connection:
Writes the site ID and site secret values in the database
Creates a JSON file in one of the directories on the server, which holds the site information.
What to do after merging your staging website to the live version
Upon migrating from staging to live (or from another website), NitroPack normally needs to be re-connected for the credentials to be refreshed and for the correct website to be connected.
But is there a way to avoid reconnecting every time we push updates from staging to live?
Yes, there is.
We currently support this on the WordPress platform.
How to skip reconnecting after an update from staging to live (WordPress)
It requires manual modifications to the JSON file that stores the connection information for the website on the server. The file is located in /wp-content/cache/random_string-nitropack directory. It’s called config.json.
If we assume that you push from staging to live, you would probably have something like this:
staging.website.com
website.com
To avoid reconnecting each time, the JSON file can be tweaked to hold multiple site configurations. You will need the same JSON file manually placed in both the staging and live environments.
{"config_path": "03ec28ff7916c97fa3c266b9c5811556","website.com": {"siteId": "the-code","siteSecret": "the-code","blogId": 1,"compression": false,"webhookToken": "f75d6f37dce7a5c0a9e5c824e63fafc6","home_url": "https:\/\/website.com","admin_url": "https:\/\/website.com\/wp-admin\/","hosting": "siteground","alwaysBuffer": true,"isEzoicActive": false,"isApoActive": false,"isLateIntegrationInitRequired": false,"isDlmActive": false,"isWoocommerceCacheHandlerActive": false,"isWoocommerceActive": false,"isAeliaCurrencySwitcherActive": false,"dlm_downloading_url": null,"dlm_download_endpoint": null,"pluginVersion": "1.5.17","options_cache": {"cache_handler_cache_handler": false,"woocommerce_default_customer_address": "base","wc_aelia_currency_switcher": {"ipgeolocation_enabled": null}}},"staging.website.com": {"siteId": "the-code","siteSecret": "the-code","blogId": 1,"compression": false,"webhookToken": "f75d6f37dce7a5c0a9e5c824e63fafc6","home_url": "https:\/\/staging.website.com","admin_url": "https:\/\/staging.website.com\/wp-admin\/","hosting": "siteground","alwaysBuffer": true,"isEzoicActive": false,"isApoActive": false,"isLateIntegrationInitRequired": false,"isDlmActive": false,"isWoocommerceCacheHandlerActive": false,"isWoocommerceActive": false,"isAeliaCurrencySwitcherActive": false,"dlm_downloading_url": null,"dlm_download_endpoint": null,"pluginVersion": "1.5.17","options_cache": {"cache_handler_cache_handler": false,"woocommerce_default_customer_address": "base","wc_aelia_currency_switcher": {"ipgeolocation_enabled": null}}}}
In the file itself, you will need to correct the following entries with the correct information:
"website.com": {"siteId": "the-code","siteSecret": "the-code","home_url": "https:\/\/website.com","admin_url": "https:\/\/website.com\/wp-admin\/",
Basically, every entry contains the domain name and the site ID, and the site secret keys.
In case each site has already been connected separately, you can collect the information from both config.json files of each installation and combine them, as shown above.
With the above configuration for the config.json file, it will always contain the credentials for the two environments, and NitroPack should not disconnect every time you push from staging to live.
📌 If you need any assistance or have questions, reach out to our support team at [email protected] or via this link: https://support.nitropack.io