Garden.io: what is it and why should you be using it? ๐Ÿชด

bcostaaa01

Bruno

Posted on January 31, 2023

Garden.io: what is it and why should you be using it? ๐Ÿชด

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.

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

Sounds cool, right? ๐Ÿ˜‰

๐Ÿค” Why should you be using it?

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

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


Enter fullscreen mode Exit fullscreen mode

Install Kubernetes using Yarn:



yarn global add kubernetes-cli


Enter fullscreen mode Exit fullscreen mode

Install Kubernetes using Homebrew:



brew install kubernetes-cli


Enter fullscreen mode Exit fullscreen mode

๐Ÿณ Docker

Install Docker using NPM:



npm install -g docker


Enter fullscreen mode Exit fullscreen mode

Install Docker using Yarn:



yarn global add docker


Enter fullscreen mode Exit fullscreen mode

Install Docker using Homebrew:



brew install docker


Enter fullscreen mode Exit fullscreen mode

๐Ÿชด 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


Enter fullscreen mode Exit fullscreen mode
Installation script


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


Enter fullscreen mode Exit fullscreen mode

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

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


Enter fullscreen mode Exit fullscreen mode

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:



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


Enter fullscreen mode Exit fullscreen mode

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


Enter fullscreen mode Exit fullscreen mode

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.



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


Enter fullscreen mode Exit fullscreen mode

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


Enter fullscreen mode Exit fullscreen mode

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:



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


Enter fullscreen mode Exit fullscreen mode

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


Enter fullscreen mode Exit fullscreen mode

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

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

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!๐Ÿ‘ฉโ€๐Ÿ’ป

๐Ÿ’– ๐Ÿ’ช ๐Ÿ™… ๐Ÿšฉ
bcostaaa01
Bruno

Posted on January 31, 2023

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related

ยฉ TheLazy.dev

About