ardanlabs / service

Starter-kit for writing services in Go using Kubernetes.
https://www.ardanlabs.com
Apache License 2.0
3.59k stars 649 forks source link

Simplify development mode #433

Closed Dodje closed 3 weeks ago

Dodje commented 3 weeks ago

Hi!

Is it possible to simplify development experience in case of codebase changes in dev mode?

What I mean is that there is no need in lots of docker containers like metrics, grafana etc. And it's too slow to rebuild "sales" app into container after changes. ~1 second raw run vs half a minute or more in docker.

Would be nice to build containers for auth, postgres and run "sales" app localy. And use the full k8s power with metrics if only needed.

As frontend-dev I don't have anough k8s experience and just might be wrong in case that it's actually easy to do myself, but if possible it would be nice to see some instraction or w/e

Thanks alot

ardan-bkennedy commented 3 weeks ago

You don't need K8s at all and sometimes I teach with class without K8s. Not every project I work on uses K8s. You can do exactly what you want to do. You could use docker compose as well, which you will find support for since that is what I use to run the services when not teaching K8s. You can find that in the zarf/ folder.

Your biggest problem will be running database migrations when you are not using an orchestration system. I don't really like having the code do that, however on my Mongo projects that's exactly what I do. I will usually do that in the main function.

Dodje commented 3 weeks ago

Thank you for the quick reply! The config is so rich that I somehow missed the docker compose file. All works fine! Thanks again!

ardan-bkennedy commented 3 weeks ago

I would comment out the service from the compose file. You might want to leave in init-migrate-seed and only build if you change something with the database or run that manually.

These might work. I think you can access anything from inside compose.

SALES_AUTH_HOST=http://0.0.0.0:6000 SALES_DB_HOST=0.0.0.0 SALES_TEMPO_HOST=0.0.0.0:4317

Dodje commented 3 weeks ago

Yeah, thanks again!