Closed doudejans closed 4 years ago
I was looking at some solution to help manage the many k8s files but apparently it's not that easy. I found this StackOverflow question which suggests to use Helm. Perhaps someone wants to look in to that in a separate issue down the line.
GitHub Actions was acting weird and I couldn't find how to trigger a rerun. Therefore, I force-pushed the last commit amended with no actual changes. 😛
@plammerts Hmm that is weird... Based on these screenshots I cannot figure out what went wrong on your machine. It looks like Kubernetes managed to start Cassandra successfully but it never became ready, hence the repeatedly failing readiness probes. Once Cassandra works properly, the other services likely will start correctly as well. Probably your best bet is to double-check the Cassandra logs using kubectl logs cassandra-0
.
The exact same thing is happening on my machine. There is nothing weird going on in the cassandra logs:
@mcomans Seems like it is just hanging on startup. Might be some kind of memory issue. I'll try to look into it.
Seemed to be a memory issue, with 4GB of memory for minikube the deployment works.
I tested various configurations in order to see if I could get the memory requirement down. However, Cassandra seems to be very picky about the memory that it needs. It seemed to work with about 3.5GB allocated to Minikube but cluster operations would be very slow or even unresponsive at that point. I also tried specifying resources for Cassandra specifically but to no avail. Therefore, I just pushed a commit that edits the setup script to start Minikube with 4GB of memory (and lowers the disk space to 10GB). This seems to work reliably for me. Hopefully this amount is fine on your machines as well.
This PR adds the first major step towards deploying our microservices: local deployment using Minikube. I wrote a little script that should automatically sets up a Minikube cluster along with the services, Traefik, PostgreSQL and Cassandra. Please refer to the README in order to learn how to use it. Please note that this script is meant for the first time setup only. Once you have everything up and running, you're better off just stopping the cluster using
minikube stop
and restarting it later usingminikube start
when you need it again.This PR also adds GitHub Workflows for the microservices which checks various flake8 errors and builds and pushes Docker images for the services.
Some notes:
kubectl
,minikube
andhelm
in your path.cassandra-driver
takes very long due to Cython compilation. However, thanks to Docker layer caching, building the driver only has to be done once. Something to keep in mind.docker build -t payment-service -f Dockerfile ./payment-service
. Then you can simply instruct Kubernetes to roll out a restart for the particular deployment that you want to update, e.g.kubectl rollout restart deployment/payment-service-cass
./payment
). Hence I added a middleware that removes this prefix before forwarding the request.My apologies for the size of this PR. However, a lot of files are very similar.