I am currently trying to automate my Atlas App Services workflow and need some help setting the environment. To start, I’ve been reading the documentation as well as working from this article:
I’m starting with a simple use case where I have:
- connected each of my pre-existing apps to a branch in my Github repo
- set up each of the apps to use Github automatic deployment
- created different values in my app’s
/environment
folder fordevelopment.json
,testing.json
,production.json
, etc.
However, I need to find a way to dynamically modify root_config.json
as part of the deploy process to set the environment based on the particular Github branch being committed (dev
, qa
, testing
).
That’s where things get confusing.
I’m following the instructions in the article on how to use Github actions to modify the root_config.json
file, e.g.
sed -i txt 's/{/{ "environment": "development",/' root_config.json
But even after this action runs successfully, the deploy isn’t working on AppServices and it’s giving a really vague error (Failed: error processing request
). I have no additional information from the deploy to help me troubleshoot what went wrong, and trying to export the state just exports the last successful build – not the one that’s throwing the error.
Digging in deeper, the example from the article doesn’t seem to be using Github automatic deployment at all. It looks like it’s manually pushing the commit to Realm using the CLI tool inside Github Actions.
So am I supposed to use Github automatic deployment? If so, how can I set the environment based on the branch?
Or if the only way to do that is with Github actions, does that mean I have to disable Github automatic deployment entirely and just rely on Github actions to do the pushes directly via the realm-cli inside my Github action?
And if I disable Github automatic deployment, that seems like it could potentially impact sync issues with any updates I might have to potentially make using the UI.
My experience with this has been confusing and the docs aren’t helping at all to explain how these two things interact, so thought someone else here might have some insight.