hey Is there a possibility in garden that corresp...
# 🤖|ask-kapa
g
hey @microscopic-river-74022 Is there a possibility in garden that corresponds to the functionality of "profiles" in docker compose? My goal is to define all actions in a monorepo, but only start a certain subset of services when starting garden dev
m
Please stand by @gentle-umbrella-55872 as I search the knowledge base. I normally take about 20 seconds or so. :wave:
---------------------- Yes, Garden provides a way to manage and operate subsets of services similar to "profiles" in Docker Compose. This is achieved through the use of Garden's configuration files and custom commands. In Garden, each service is defined in a configuration file (e.g.,
*.garden.yml
). You can specify dependencies between services, allowing you to control the order in which services are started. For example, in the
frontend/frontend.garden.yml
file, the
backend
deployment is specified as a dependency, which makes the database (
mongo
) an indirect dependency. This means that when you start the
frontend
service, the
backend
and
mongo
services will also be started if they are not already running.
Copy code
yaml
kind: Deploy
apiVersion: garden.io/v1
name: frontend
description: The frontend server and UI components container
type: container
dependencies:
 - build.frontend
 - deploy.backend
spec:
 image: ${actions.build.frontend.outputs.deploymentImageId}
 env:
 DANGEROUSLY_DISABLE_HOST_CHECK: true
 sync:
 paths:
 - source: ./src
 target: /usr/src/app/src
 mode: "one-way-replica"
 ports:
 - name: http
 containerPort: 3000
 healthCheck:
 httpGet:
 path: /
 port: http
 ingresses:
 - path: /
 port: http
Source () Additionally, you can define custom commands in Garden, which can be used to start a specific subset of services. Custom commands are defined in a Garden project and can include any number of actions, such as starting specific services, running tests, or deploying infrastructure. These commands can be run using the
garden
CLI, making it easy to start a specific subset of services.
Copy code
yaml
kind: Command
name: api-dev
description:
 short: Start garden with preconfigured options for API development
exec:
 command:
 - sh
 - -c
 - git submodule update --recursive --remote # Because we keep forgetting to update these, amirite?
gardenCommand:
 - deploy
 - --sync
 - api,worker
 - --log-level
 - debug
 - $concat: ${args.$all} # Allow any arguments/options on top of the fixed ones above
Source () In this example, the
api-dev
command starts the
api
and
worker
services. You can define similar commands for other subsets of services in your monorepo. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
g
at the and the answer is for me "garden deploy SERVICE" 😄