Garden.io: what is it and why should you be using it? 🪴
Tags: gardenio, cloud, productivity, tutorial
Published: 2023-01-31 21:47:15

Ready to streamline your development and operations processes? In this comprehensive guide, we'll dive deep into all that Garden.io has to offer, from its powerful features to its  user-friendliness. You won't want to pass up the efficiency and productivity boost that Garden.io can bring to your applications, regardless of their scopes of complexity. 

### 🪴 What is Garden.io?

Garden.io is a cloud native application development, testing, and deployment platform. It defines the build and deployment procedure for your application in a configuration file named 'garden.yml'. It is compatible with a variety of programming languages, including JavaScript, and may be used in projects developed using React, VueJS, NodeJS, and other frontend and backend technologies.

{% embed https://twitter.com/garden_io/status/1585631425734144000 %}

Garden.io was developed in response to the demand for a standardized and adaptable method of managing and deploying applications, particularly in large and complex environments. It was created to support a broad variety of languages and frameworks, be simple to use, connect with well-known tools like Docker and Kubernetes, and be flexible.

The platform has grown in popularity among developers since its inception.
With constant additions of new features and integrations to fulfill the demands of companies and developers, it continues to expand and get better. 

![brent rambo thumbs up meme](https://media.tenor.com/myWhE0y5rTsAAAAC/brent-rambo-thumbs-up.gif)

Sounds cool, right? 😉

### 🤔 Why should you be using it?

<img src="https://uploads-ssl.webflow.com/62b28d5404e4318fe1ed6cca/632147d9a9338e6bbd4ed10b_img-diagram-3-p-1080.png">

I will give you some reasons why you should be using Garden.io in your projects:

- Garden.io makes complex app management easier by allowing you to describe all of your app's dependencies, build processes, and deployment configurations in a single configuration file.

- CI/CD processes are streamlined by providing you with a configuration file that defines your pipeline's build, test, and deploy methods, automating the whole process of building, testing, and deploying your code.

- Garden.io lets you design a consistent workflow for your projects, including the tools and processes for developing, testing, and delivering code. This ensures that all of your projects adhere to the same set of standards and procedures.

- It supports a wide range of languages and frameworks, including Node.js, Python, and Java, making it a versatile and adaptable solution for managing and deploying your applications.

Let's look at some of the principles that will help you better comprehend the workflow. 

### 🤽‍♀️ DevOps

DevOps is a software engineering methodology that emphasizes cooperation and communication between software developers and information technology (IT) experts while automating software delivery and infrastructure changes.
It seeks to shorten the development lifecycle and enable continuous delivery of high-quality software. 

### 🔮 CI/CD

![ci/cd hot dog](https://community.atlassian.com/t5/image/serverpage/image-id/137126i42CF00FCADA7DB47/image-dimensions/265x199?v=v2)

Continuous Integration/Continuous Deployment is abbreviated as CI/CD. It is a software development approach that tries to increase software delivery speed, quality, and dependability.

Continuous Integration (CI) is the technique of merging code changes into a central repository on a frequent basis, generally many times per day. This helps developers to recognize and resolve issues early in the development process, rather than waiting until later stages when they may be more difficult to resolve.

Continuous Deployment (CD) extends CI by automating the process of delivering code changes to production. This implies that if a change is made and successfully integrated into the central repository, it is immediately deployed to the production environment without any manual involvement.

### ⚙️ Installing Kubernetes, Docker and Garden.io

To utilize Garden.io, you must first install Kubernetes and Docker on your machine. You will need these as Garden.io relies on Docker and Kubernetes to manage and deploy containerized applications.

#### 📦 Kubernetes

Install Kubernetes using NPM:

```
npm install -g kubernetes-cli
```

Install Kubernetes using Yarn:

```
yarn global add kubernetes-cli
```

Install Kubernetes using Homebrew:

```
brew install kubernetes-cli
```

#### 🐳 Docker

Install Docker using NPM:

```
npm install -g docker
```

Install Docker using Yarn:

```
yarn global add docker
```

Install Docker using Homebrew:

```
brew install docker
```

#### 🪴 Garden.io

After the latter tools have finished installing, it's time to install Garden.io.

##### Homebrew

```
brew tap garden-io/garden
brew install garden-cli
```

##### Installation script

```
curl -sfL https://git.io/get-garden | sh -s -- -b /usr/local/bin
```

The instructions above were designed for MacOS, but you can read more in the documentation if you are using Windows or Linux: https://docs.garden.io/getting-started/1-installation.

![gardenio installation complete terminal](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0nwo90g7u76p38xyzqr6.png)

After Garden.io finishes installing, you should see a beautiful terminal look like the above!🤩

### 👨‍💻 Setting up Garden.io

In order to setup Garden.io in your project, run the following command:

```
garden init
```

Then, configure the project by adding the following as example to the `garden.yml` file, which is the file that specifies services, tasks, tests, and so on:

```yml
services:
  web:
    build: .
    ports:
      - target: 3000
        published: 3000
        protocol: tcp
```

The configuration for Garden.io is now complete (based on the specific needs of your project, of course). 

### 🚧 Building the application

After having setup the configurations for Garden.io in your project, you can now run it by navigating to the project directory and running the following command:

```
garden start
```

Now that you have setup, configured Garden.io in your project and is now running, Garden will start the project and create a container for each service that you defined in the `garden.yml` file. If you access `http://localhost:3000` in your browser, you should be able to access your project!🎉

### 🧪 Testing the application

In order to setup testing in your Garden.io (because testing is also important, right?😉), you can do so by first setting up a section in your `garden.yml` file called `tests`. 

```yml
tests:
  my-tests:
    service: web
    command: npm run test
```

Here, you can define the specific testing that you need for your project. Then, when you run the following command, you should be able to see the test suites running:

```
garden test
```

This test, for example, will run `npm run test` in the `web` service. See? Testing in Garden.io is as easy as eating a slice of pizza!🍕

### 🚚 Deploying

The question now is: "How do I deploy a project using Garden.io?" 🤔 Well, it's also easy!😀

You can deploy it to various cloud providers and Kubernetes clusters, by creating a target environment section to your `garden.yml` file:

```yml
target:
  name: my-kubernetes-cluster
  provider: kubernetes
```

In this example, we specify that the target environment is a Kubernetes cluster called `my-kubernetes-cluster`. Note that you would need to have `kubectl` installed on your machine and have access to it in order to deploy to a Kubernetes cluster.

Then, you run the following command to deploy it:

```
garden deploy
```

After completing these steps, Garden.io will start the deployment process and create the necessary resources in your cloud provider or Kubernetes cluster. You can accompany the state of deployment in your lovely terminal 🥰 

![deploying terminal laptop](https://media1.giphy.com/media/3og0IAQG2BtR13joe4/giphy.gif)

Then, in order to access your deployed project, open the URL or IP address of the deployed environment, depending on the specific cloud provider or Kubernetes setup you are using. After following these steps, you can see how Garden.io is so easy to work with when setting up, testing and deploying your project 😁

### 🌻 The official documentation

🪴 Garden.io's official documentation may be found here: https://docs.garden.io/ -
It covers all of the information you'll need in greater detail. 

![roses aesthetic](https://66.media.tumblr.com/035913a2deced9382e7eeb5199f21066/tumblr_otf7v2Wfgv1uvsi7jo1_500.gifv)

And what a beatiful documentation they have written!👏

### Thank you for reading!👋

I'd like to thank you for reading my article! I hope it helped you getting to know a great tool and that it can be useful in your future projects 😁 I would also like to invite you to follow me on Dev.to, as well as my other platforms:

GitHub: https://github.com/bcostaaa01
Twitter: https://twitter.com/bruno2001costa

I look forward to seeing you on my next one!

Until then,
Happy Coding!👩‍💻