netlify-cms-with-selfhosted-gotrue-and-git-gateway
netlify-cms-with-selfhosted-gotrue-and-git-gateway copied to clipboard
Multi-instance mode
Hey there,
First of all, thanks so much for making this tutorial. It helped me get a grasp on how gotrue and git-gateway work. I have been able to successfully set up a docker-compose file for local development that spins up a mysql database that gotrue and git-gateway both use via an init sql script. The project I'm working on is going to have many different repos in our github enterprise instance with markdown representing different sites. I'm trying to avoid the devops challenge of having to run many instances of git-gateway all pointed at different repos. I've been able to spin up git-gateway in multi instance mode and get it pointed at its own database, and also got the migrations to run after setting GITGATEWAY_DB_AUTOMIGRATE=true
in my .env file. However, it isn't quite apparent exactly how this mode is supposed to be used and I've had trouble with it. Running git-gateway in multi mode seems to completely change the behavior of the service, and Netlify CMS doesn't seem to be able to interact with it anymore directly. I was able to get it to create an "instance" manually by modifying the Go code to do so upon startup, and then I can use Postman to see the details about this instance by making a POST to http://localhost:3000/.netlify/git/instances/test
(with test being the ID of my test instance) and it returns the configuration of this instance with the Github info that I set on it, but I can't figure out how to point Netlify CMS at git-gateway properly in this mode and have it specifically use an instance configuration. Have you tried this at all?
Hi @gumaerc, I'm in the same situation as you described here. Did you ever figure out how the multi-instance mode works?
@hfte Thank you so much for that guide! hope you have some experience with the multi-instance mode and can add it to the guide. You are the best!
Hey @john395 ,
It's been some time, but I'll try and recall exactly where I ended up here. I think that "multi-instance" mode isn't exactly what it appears to be. We moved forward on our project without Netlify CMS, as it ended up being a bit too restricting. I didn't have a chance to document my findings, but I'll try and recall what I can.
Basically, I remember coming to the conclusion that Netlify is probably using the Kubernetes Operator pattern behind the scenes to spawn the git-gateway
processes. There was an environment variable containing the word OPERATOR
that was some kind of token. I had more details worked out, but forgot them since I never got a chance to document my findings. Either way, the point is that it was a dead end as far as I can tell. I can't say for certain what they're doing, and asked for a bit more insight in the Netlify CMS Slack and was linked a video to the founder supposedly "explaining everything" about this situation but the video doesn't actually explain anything:
https://www.youtube.com/watch?v=YyRwMy59d4M
I think we came to the conclusion that unfortunately we would have to spawn a buttload of containers for each git-gateway process and decided to come up with our own custom solution down the road.