1. Create a Garden Project

The first thing we'll do is create a Garden project. Remember that you need to have the Garden CLI installed to follow along.

Step 1 — Clone the example application

Start by cloning the example repo and checkout to the tutorial-start branch:

git clone https://github.com/garden-io/web-app-example.git
cd web-app-example
git checkout tutorial-start

The example is a three-tier web app with web, API, and database components. Garden is typically used in projects with multiple microservices but we're keeping things simple here to make it easy to follow along.

Step 2 — Create a project

Next, we'll initialize a Garden project with:

garden create project

This will create a basic boilerplate project configuration in the current directory, making it our project root. It will look something like this:

apiVersion: garden.io/v1
kind: Project
name: web-app-example

defaultEnvironment: ephemeral

  usernamespace: web-app-example-${kebabcase(local.username)}

  - name: ephemeral
    defaultNamespace: ${var.userNamespace}

  - name: local
    defaultNamespace: ${var.userNamespace}

  - name: remote-dev
    defaultNamespace: ${var.userNamespace}

  - name: staging
    production: true
    defaultNamespace: web-app-example-${git.branch}

  - name: ephemeral-kubernetes
    environments: [ephemeral]
  - name: local-kubernetes
    environments: [local]
  - name: kubernetes
    environments: [remote-dev]
  - name: kubernetes
    environments: [staging]

We have four environments (ephemeral, local, remote-dev and staging) and also four provider configurations, one for each environment.

Last updated