My company uses Azure as our cloud-infrastructure provider, and we are making use of their Azure Webapp PaaS offering to individually deploy our SPA (react.js) and corresponding API (Golang). Haven't felt the need to move to Kubernetes as of yet.
For CI/CD we utilize the GitHub Actions + Azure Web App Deployment slots - a relatively simple setup. Currently both our API and React SPA have three deployment slots in their Web App resource called:
- Production (the web app itself)
- Main
- Stage
Merging on stage branch leads to deployment on stage slot, and merging on main branch leads to a deployment on main slot. When given the go-ahead the Main slot is swapped with the Production one and so now we have code from main branch in the production slot (environment). Swapping allows for zero downtime of production app and avoids directly deploying to the production slot.
For the react spa, all env variables need to be specified at build time; these includes: api_uri, auth_system_uris, etc. This means when merging on the main branch we need to specify all env variables for production slot (not really the main slot). I understand that there shouldn't be the slightest bit of difference between these two deployments but still am confused about the overall architecture.
Do I even need three deployments for my React SPA, if so, how do I make it work? Should main slot of my spa communicate with main slot of api (but that wouldn't work due to the necessity of keeping things same between prod and main slots) ? It would be great help if someone could briefly describe how this architecture should best be set up. Thanks.