microscopic-river-74022
09/01/2023, 8:45 PMmicroscopic-river-74022
09/01/2023, 8:46 PMdev
, 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:
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.microscopic-river-74022
09/01/2023, 8:46 PMmicroscopic-river-74022
09/04/2023, 5:38 AMswift-spring-8620
09/04/2023, 5:38 AMmicroscopic-river-74022
09/04/2023, 5:38 AMtrue
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:
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:
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:
----------------------microscopic-river-74022
09/07/2023, 3:27 AMswift-spring-8620
09/07/2023, 3:27 AMmicroscopic-river-74022
09/07/2023, 3:27 AMNote: you can ask me a follow up question by @ mentioning me again
:speech_balloon:
----------------------swift-spring-8620
09/07/2023, 3:32 AMmicroscopic-river-74022
09/07/2023, 3:32 AMmicroscopic-river-74022
09/07/2023, 3:32 AMyaml
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:
----------------------microscopic-river-74022
09/07/2023, 3:43 AMswift-spring-8620
09/07/2023, 3:43 AMmicroscopic-river-74022
09/07/2023, 3:43 AMgarden 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:
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:
----------------------microscopic-river-74022
09/07/2023, 3:45 AMswift-spring-8620
09/07/2023, 3:45 AMmicroscopic-river-74022
09/07/2023, 3:45 AM