is there a way to setup a single production enviro...
# 🤖|ask-kapa
m
Please stand by @swift-spring-8620 as I search the knowledge base. I normally take about 20 seconds or so. :wave:
---------------------- Based on the provided extracts, Garden allows you to set up multiple environments such as
dev
,
ci
,
preview
, and
prod
in your project. Each environment can be broken down into several "namespaces", and each Garden run operates in a specific namespace. However, the extracts do not provide specific information on setting up multiple hostnames for a single production environment. It is mentioned that you can set a hostname variable and reuse it in the action configuration, but it doesn't explicitly state if you can have multiple hostnames for a single environment. Here's an example of how you can set a hostname in your configuration:
Copy code
yaml
apiVersion: garden.io/v1
kind: Project
name: my-project
defaultEnvironment: dev
id: <cloud-id>
domain: <cloud-domain>
variables:
  ci-env-name: my-project-ci-${local.env.BUILD_NUMBER || 0} # <--- Depends on your CI provider
  prev-env-name: my-project-preview-${local.env.PR_NUMBER || 0} # <--- Depends on your CI provider
  dev-env-name: my-project-${local.username}
environments:
- name: ci
  defaultNamespace: ${var.ci-env-name}
  variables:
    hostname: ${var.ci-env-name}.ci.<my-company>.com # <--- Use this in your service config to ensure unique hostnames per instance
In this example, the hostname is set as a variable and used in the service configuration to ensure unique hostnames per instance. For more detailed information or specific use cases, you may want to refer to the official Garden documentation or their GitHub issues page.
Sources: - Garden.io - Namespaces () - Garden.io - Project Config () - Garden.io - Using Garden in CI () - Garden.io - Projects () ----------------------
Note: you can ask me a follow up question by @ mentioning me again
:speech_balloon: ----------------------
Let me check the knowledge base for you. One moment! :books:
s
@microscopic-river-74022 can you run workflows with the production flag?
m
---------------------- Yes, you can run workflows with the production flag. The production flag is a configuration setting in Garden that you can set to
true
for your production environment. This flag activates protection on the
build
,
delete
,
deploy
,
dev
, and
test
commands, requiring user confirmation every time these commands are run against an environment marked as production. When running workflows, which are sequences of Garden commands and custom scripts, the production flag will apply if the workflow includes any of the protected commands and is run against a production environment. Here's an example of how you might set the production flag in your environment configuration:
Copy code
yaml
environments:
- name: production
  production: true
And here's an example of a workflow that includes a
deploy
command, which would be affected by the production flag:
Copy code
yaml
kind: Workflow
name: my-workflow
steps:
- command: [deploy]
In this case, if you run the workflow with
garden workflow my-workflow
against the production environment, you will be prompted for confirmation before the
deploy
command is executed. Sources: - Garden.io - Project Config () - Garden.io - Workflows () ----------------------
Note: you can ask me a follow up question by @ mentioning me again
:speech_balloon: ----------------------
Let me check the knowledge base for you. One moment! :books:
s
@microscopic-river-74022 can garden workflows be referenced in other garden workflows?
m
---------------------- Based on the provided extracts, workflows in Garden cannot currently depend on each other. This means that a workflow cannot be referenced in another workflow. Workflows stand outside of the Stack Graph, and nothing in the Stack Graph can reference or otherwise depend on workflows. Here's the relevant extract: > Unlike actions, workflows stand outside of the Stack Graph. They cannot currently depend on each other, and nothing in the Stack Graph can reference or otherwise depend on workflows. Source: Garden.io - Workflows () ----------------------
Note: you can ask me a follow up question by @ mentioning me again
:speech_balloon: ----------------------
s
@microscopic-river-74022 can garden workflows reference external bash scripts?
m
Let me check the knowledge base for you. One moment! :books:
---------------------- Based on the provided extracts, Garden workflows can run custom scripts as part of their steps. However, it's not explicitly stated whether these scripts can be external bash scripts stored in separate files. Here's an example of how a script can be included in a workflow:
Copy code
yaml
kind: Workflow
name: my-workflow
steps:
- script: |
    echo "Hello there!"
In this example, the script is directly written in the workflow configuration. For more detailed information or specific use cases, you may want to refer to the official Garden documentation or their GitHub issues page. Sources: - Garden.io - Workflows () - Garden.io - Workflow Config () ----------------------
Note: you can ask me a follow up question by @ mentioning me again
:speech_balloon: ----------------------
Let me check the knowledge base for you. One moment! :books:
s
@microscopic-river-74022 my kubernetes environment crashed, how can I restart garden?
m
---------------------- If your Kubernetes environment crashed and you need to restart Garden, you can use the
garden dev
command to start the development mode. This command watches your project for changes and automatically applies them to your environment. Here's how you can use it:
Copy code
bash
garden dev
If a pod is in
CrashLoopBackOff
state and you start
garden dev
, you might encounter an issue where you are unable to redeploy the said pod. This is a known issue as per the GitHub issue here (). In case of a
CrashLoopBackOff
, Garden has a local application restart policy. By default, the local application will be restarting infinitely with 1000ms between attempts. This is specified by the
localMode.restart
configuration key in your Garden configuration. You can also specify a delay in milliseconds between the local application restart attempts using the
localMode.restart.delayMsec
configuration key. The default value for this delay is 1000ms. Sources: - Garden.io - localMode.restart () - Garden.io - localMode.restart.delayMsec () - GitHub Issue - When in dev mode, Garden fails to redeploy CrashLoopBackOff pods () ----------------------
Note: you can ask me a follow up question by @ mentioning me again
:speech_balloon: ----------------------
Let me check the knowledge base for you. One moment! :books:
s
@microscopic-river-74022 how can I completely reboot garden. I am getting the following error: garden dev pkg/prelude/bootstrap.js:1872 throw error; ^ Error: ENOENT: no such file or directory, uv_cwd
m
@swift-spring-8620 That's a great question, but unfortunately I am only capable of responding to a maximum of five questions per thread. Don't hesitate to create a new thread for any further questions you have though. I'm here to help!