LogoLogo
Bonsai (0.13) DocsGitHubDiscord CommunityGarden Enterprise
Acorn (0.12)
Acorn (0.12)
  • Welcome!
  • 🌳Basics
    • How Garden Works
    • Quickstart Guide
    • The Stack Graph (Terminology)
  • 🌻Tutorials
    • Your First Project
      • 1. Initialize a Project
      • 2. Connect to a Cluster
      • 3. Deploy and Test
      • 4. Configure Your Project
  • 💐Using Garden
    • Configuration Overview
    • Projects
    • Modules
    • Services
    • Tests
    • Tasks
    • Workflows
    • Variables and templating
    • Module Templates
    • Using the CLI
  • 🌿Kubernetes Plugins
    • About
    • Remote K8s Plugin Configuration
      • 1. Create a Cluster
        • AWS
        • GCP
        • Azure
      • 2. Configure Container Registry (Optional)
        • AWS
        • GCP
        • Azure
      • 3. Set Up Ingress, TLS and DNS
      • 4. Configure the Provider
    • Local K8s Plugin Configuration
      • 1. Install Local Kubernetes
      • 2. Configure the Provider
    • Module Configuration
      • Container
      • Kubernetes
      • Helm
      • PersistentVolumeClaim
      • ConfigMap
    • Advanced
      • In-Cluster Building
      • Minimal RBAC Configuration for Development Clusters
      • Deploying to Production
  • 🌺Terraform Plugin
    • About
    • Provider Configuration
    • Module Configuration
  • ☘️Pulumi Plugin
    • About
    • Provider Configuration
    • Module Configuration
  • 🌹Other Plugins
    • Container
    • Exec (local scripts)
  • 🌼Guides
    • Installing Garden
    • Adopting Garden
    • Code Synchronization (Dev Mode)
    • Connecting a local service to a K8s cluster (Local Mode)
    • Environments and namespaces
    • Hot Reload
    • Migrating from Docker Compose to Garden
    • Using Garden in CI
  • 🌷Advanced
    • cert-manager Integration
    • Using Remote Sources
    • Custom Commands
  • 🪷Reference
    • Providers
      • conftest-container
      • conftest-kubernetes
      • conftest
      • container
      • exec
      • hadolint
      • jib
      • kubernetes
      • local-kubernetes
      • maven-container
      • octant
      • openfaas
      • pulumi
      • terraform
    • Module Types
      • configmap
      • conftest
      • container
      • exec
      • hadolint
      • helm
      • jib-container
      • kubernetes
      • maven-container
      • openfaas
      • persistentvolumeclaim
      • pulumi
      • templated
      • terraform
    • Template Strings
      • Project configuration context
      • Environment configuration context
      • Provider configuration context
      • Module configuration context
      • Remote Source configuration context
      • Project Output configuration context
      • Custom Command configuration context
      • Workflow configuration context
      • Template Helper Functions
    • Glossary
    • Commands
    • Project Configuration
    • Module Template Configuration
    • Workflow Configuration
  • 🎋Misc
    • FAQ
    • Troubleshooting
    • Telemetry
Powered by GitBook
On this page

Was this helpful?

  1. Tutorials
  2. Your First Project

1. Initialize a Project

PreviousYour First ProjectNext2. Connect to a Cluster

Last updated 1 year ago

Was this helpful?

With the Garden CLI , we'll kick off by configuring a simple example project for use with Garden.

Start by cloning our repo and finding the example project:

git clone https://github.com/garden-io/garden.git
cd garden/examples/demo-project-start

This directory contains two directories, with one container service each, backend and frontend. We'll first define a boilerplate Garden project, and then a Garden module for each of the services.

To initialize the project, we can use a helper command:

garden create project --skip-comments

This will create a basic boilerplate project configuration in the current directory, making it our project root.

kind: Project
name: demo-project
environments:
  - name: default
providers:
  - name: local-kubernetes

We have one environment (default) and a single provider. We'll get back to this later.

Next, let's create module configs for each of our two modules, starting with backend. You can omit the --skip-comments flag to create a module with commented-out fields, which reveal all the options available.

cd backend
garden create module --skip-comments
cd ..

You'll get a suggestion to make it a container module. Pick that, and give it the default name as well. Then do the same for the frontend module:

cd frontend
garden create module --skip-comments
cd ..

This is now enough configuration to build the project. Before we can deploy, we need to configure services in each module configuration, as well as set up a local cluster or connect to a remote cluster.

Starting with the former, go ahead and open the newly created backend/garden.yml file. Just to keep things simple for now, go ahead and append to the file the following:

services:
  - name: backend
    ports:
      - name: http
        containerPort: 8080
        servicePort: 80
    ingresses:
      - path: /hello-backend
        port: http

This is enough information for Garden to be able to deploy and expose the backend service. Now do the same for the frontend service, with the following block:

services:
  - name: frontend
    ports:
      - name: http
        containerPort: 8080
    ingresses:
      - path: /hello-frontend
        port: http
      - path: /call-backend
        port: http
    dependencies:
      - backend

This does the same for the frontend service, with the addition of declaring a runtime dependency on the backend service.

Now, let's move on to our next section, and .

🌻
connect to a Kubernetes cluster
installed