How to prevent issues with deployment slots affecting one another in WordPress Linux App Service?

KM 0 Reputation points
2023-06-28T16:11:21.56+00:00

I followed this Microsoft document, https://learn.microsoft.com/en-us/azure/app-service/quickstart-wordpress?wt.md_id=searchAPI_azureportal_inproduct_rmskilling&sessionId=19219dd720cc4cbf970791f07139bdf4, to create my WordPress site on Azure and used the all-in-one plugin to migrate my existing WordPress site to the Azure instance. Then, I created a staging environment using deployment slots by cloning the app settings from my production slot. However, any changes I make to my staging environment immediately affect my production slot. I researched and found that it could be due to the two environments sharing a database but I'm confused because I've seen others create separate environment slots without this issue. It is important to note that Auto Swap is not a feature when using the app service with linux. Can someone provide guidance on how I can prevent this issue and isolate my production and staging environments? Thanks in advance.

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,965 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Grmacjon-MSFT 19,301 Reputation points Moderator
    2023-07-10T08:58:38.2366667+00:00

    Hi @KM ,

    To isolate your production and staging environments, you will need to use separate databases for each environment. This will ensure that changes made in your staging environment do not affect your production environment. Here are the steps you can follow to set up separate databases for your production and staging environments:

    1. Go to the Azure portal, navigate to your MySQL database and create a new database for your staging environment. You can do this by clicking on "New database" and following the prompts.
    2. In the Azure portal, navigate to your staging environment and update the connection string to use the new database. You can do this by going to "Configuration" and updating the value of the DATABASE_URL setting.
    3. Once you have updated the connection string, test your staging environment to make sure that it is using the correct database and that changes made in the staging environment do not affect the production environment.
    4. Once you are satisfied with your changes in the staging environment, deploy them to the production environment. You can do this by swapping the staging and production slots.

    By following these steps, you should be able to isolate your production and staging environments and prevent changes made in the staging environment from affecting the production environment.

    Another alternative is using WordPress Multisite on Azure App Service.. WordPress Multisite is a feature of WordPress that enables you to run and manage multiple WordPress websites using the same WordPress installation. You could update multiple websites in a single click by using the parent WordPress dashboard, and even manage individual sites through their individual dashboards. This feature was previously called WordPress Multi-User.

    Hope that helps.

    -Grace

    1 person found this answer helpful.
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.