Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Taming you application's environments

Salaboy
November 17, 2024

Taming you application's environments

for more info visit https://salaboy.com

Salaboy

November 17, 2024
Tweet

More Decks by Salaboy

Other Decks in Technology

Transcript

  1. Intro + Agenda - What is an environment? - Making

    your applications cross-environment - Delivering unified user experience that works in all environments
  2. Are these environments? - Is my local machine an environment?

    - Is Docker Compose an environment? - Is my KIND Cluster an environment? - Is that VM over there an environment? - Is that CI pipeline an environment? - Is a Pull Request an environment?
  3. What do all these environments share in common? - Must

    provide an application runtime - Must provide all the application infrastructure required by our apps - Someone must configure all this infrastructure - Orchestrate their lifecycle (create, deploy, tear-down, etc) - No matter the shape or size, how can we simplify the experience when interacting with these environments??
  4. Let’s ask to an LLM… - Create a workflow to

    build, test and package a Java application in a Container that needs to work locally, in CI and in a Kubernetes cluster. - Tons of non-reusable boilerplate - Hard to verify the output correctness (hallucinations) - Mix of new and outdated practices - LLM’s are not good at creating abstractions (yet).
  5. APIs to decouple our cloud native apps from envs -

    Dapr exposes a set of high-level APIs that decouple infrastructure and common cloud native challenges from applications - This enables resiliency and observability out of the box for our apps - Environments can be configured uniformly for local, remote and CI pipelines
  6. Software delivery process - Push and pray 🙏 - One

    toolchain per team 🔧 - It works in Dev, why is CI failing? 😐
  7. Dagger 101 FROM golang:1.19 as build WORKDIR /app COPY go.mod

    go.sum ./ RUN go mod download COPY *.go ./ RUN CGO_ENABLED=0 GOOS=linux go build -o /app EXPOSE 8080 CMD ["/app"] Dagger Dockerfile func Build(src *dagger.Directory) *dagger.Container { return dag.Container().From("golang:1.19"). WithWorkdir("/app"). WithDirectory(".", src, Include: []string{"go.mod", "go.sum"}). WithExec([]string{"go", "mod", "download"}). WithDirectory(".", src). WithEnvVariable("CGO_ENABLED", "0"). WithEnvVariable("GOOS", "linux"). WithExec([]string{"go", "build", "-o", "/app"}). WithDefaultArgs([]string{"/app"}) }
  8. Dagger 101 Dagger factory test: docker compose up -d ./wait-for-everything-ready.sh

    - DB_URL=localhost:5432 go test \ -coverprofile cover.out ./... ./more-scripts-to-handle-report.sh Makefile factory func (m *Module) Test() *myorg.AppTestResult { report, error:= m.Base(). WithServiceBinding(“db” dag.Postgres()). WithEnvVariable(“DB_URL”, “db:5432”). WithExec([]string{“go”, “test”, “-coverprofile”, “cover.out”, “./..."). File(“cover.out”) return &myorg.AppTestResult { Report: report Error: err } }
  9. Takeaways - Environments can take very different shapes and forms

    - Think about APIs and interfaces, that will allow to design your factory and applications better - Software Delivery pipelines are applications, treat them as such - Adapt the tools to your needs, not the other way around - Have fun while building, it’s ok to brag a bit about it.