Open sjlawson opened 7 months ago
I will add to the list that the Makefile still contains references in PHONY to some of the docker instructions such as clean
that are already removed.
@sjlawson @hillairet
Why are we removing clean
commands instead of replacing their substance with equivalent k8s stuff?
:shrug: @balavec @rochecompaan @licquia will know best. Maybe k8s is self-cleaning? :sweat_smile:
But as a developer working locally I need to be able to purge the data easily if data gets bad during development or I just need to start over. Or maybe I'm developing an import that I have to keep running over and over until it is finished. So I need to start fresh each time.
On my current project I added this k8s version to my Makefile:
destroy-dev-data: ## Destroy the local dev db and recreate a clean one
kubectl get deployments -o jsonpath='{.items[*].metadata.name}' | xargs -n 1 kubectl scale deployment --replicas=0
kubectl exec --tty --stdin pod/postgres-0 -- dropdb -U [dbuser] [dbname]
kubectl exec --tty --stdin pod/postgres-0 -- createdb -U [dbuser] -h localhost [dname]
kubectl get deployments -o jsonpath='{.items[*].metadata.name}' | xargs -n 1 kubectl scale deployment --replicas=1
This may need to be adjusted for specific project needs but is a good starting point based on what scaf sets up.
It looks like this might work on dev OR sandbox, but I wasn't sure reading the sandbox k8s yaml if things would be named the same. I'm also hoping it does not work on prod. If it does, there would be an argument for somehow making it so this command will only work in dev and maybe sandbox in order to prevent accidentally running it on prod.
May I suggest to start a new issue because this one is about clearing the docker-compose stuff while having a "make clean" is a separate conversation.
Ok, it was just that the 3rd bullet point in this Issue was "Where available, replace makefile docker compose commands with equivalent kubectl / kind commands" and destroy-data
was a removed command.
make build-dev
which is obselete