sixfeetup / scaf

scaf provides developers and DevOps engineers with a complete blueprint for a new project using Kubernetes
BSD 3-Clause "New" or "Revised" License
80 stars 12 forks source link

Strip out remaining docker compose items #179

Open sjlawson opened 7 months ago

sjlawson commented 7 months ago
hillairet commented 5 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.

abosio commented 5 months ago

@sjlawson @hillairet Why are we removing clean commands instead of replacing their substance with equivalent k8s stuff?

hillairet commented 5 months ago

:shrug: @balavec @rochecompaan @licquia will know best. Maybe k8s is self-cleaning? :sweat_smile:

abosio commented 5 months ago

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.

hillairet commented 5 months ago

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.

abosio commented 5 months ago

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.