Logo

dev-resources.site

for different kinds of informations.

Using Daytona to maintain a Development Environment

Published at
1/9/2025
Categories
opensource
daytona
development
Author
kanakos01
Categories
3 categories in total
opensource
open
daytona
open
development
open
Author
9 person written this
kanakos01
open
Using Daytona to maintain a Development Environment

As a developer and someone exploring Open Source, setting up new projects and configuring their development environments have been such a headache and a time eater.

I found Daytona in the Quira Quest 23. Our task was to use Daytona to configure and automate our development environment.

Sounds difficult? Not so much. Just 3 steps and I was all done.

1. Setup your project in you system

In my case this was already done. I had a RAG application that allows you to have a q/a session with any github repository of your choice.
It uses Daytona for managing environment, weaviate cloud vector database to store the embeddings, LangChain with OpenAI for llm models and facilitate queries with context and streamlit for UI.

2. Create a .devcontainer/devcontainer.json file in the root dir of the project.

3. Generate a devcontainer.json

Go to DevContainer.ai, create your own devcontainer.json using AI and paste its content in the file you created.

{
  "name": "Git Chat Development Environment",
  "image": "mcr.microsoft.com/devcontainers/base:ubuntu", 
  "features": {
    "python": "3.10"
  },
  "forwardPorts": [
    8501
  ],
  "customizations": {
    "vscode": {
      "settings": {
        "python.defaultInterpreterPath": "${workspaceFolder}/gitchat-venv/bin/python",
        "python.linting.enabled": true,
        "python.linting.pylintEnabled": true,
        "python.formatting.autopep8Path": "${workspaceFolder}/gitchat-venv/bin/autopep8",
        "python.formatting.blackPath": "${workspaceFolder}/gitchat-venv/bin/black",
        "python.linting.flake8Path": "${workspaceFolder}/gitchat-venv/bin/flake8",
        "python.linting.mypyPath": "${workspaceFolder}/gitchat-venv/bin/mypy",
        "python.linting.pydocstylePath": "${workspaceFolder}/gitchat-venv/bin/pydocstyle",
        "python.linting.pycodestylePath": "${workspaceFolder}/gitchat-venv/bin/pycodestyle"
      },
      "extensions": [
        "ms-python.python",
        "ms-python.vscode-pylance",
        "njpwerner.autodocstring"
      ]
    }
  },
  "postCreateCommand": "python -m venv gitchat-venv && . gitchat-venv/bin/activate && pip install -r requirements.txt"
}
Enter fullscreen mode Exit fullscreen mode

And you are done. That's it.
But what are the benefits of this you ask?
Here you go.
Benefits of Dev Containers

How Daytona comes into play

Daytona abstracts a lot of steps and allows you to setup development containers without much effort. It simplifies the process of managing environments by providing a clean, modular workspace. Instead of manually cloning repositories, setting up environments, and troubleshooting dependencies, Daytona handles it with a few commands.

Getting started with Daytona

Documentation ยท Daytona

Start managing your Workspaces with Daytona.

favicon daytona.io

The daytona documentation is very easy to go through. Here I will be going through some basic steps to setup and use Daytona. You can browse the docs for detailed info.

1. Installing Daytona

For Linux, run this in your shell:

(curl -sf -L https://download.daytona.io/daytona/install.sh | sudo bash) && daytona server -y && daytona
Enter fullscreen mode Exit fullscreen mode

Checkout the installation guide for other OS.

2. Configurations

  • git providers
daytona git-providers add
Enter fullscreen mode Exit fullscreen mode

This helps you work with git and manage your repositories. There are a number of options like github, gitlab, bitbucket etc.

  • providers
daytona provider install
Enter fullscreen mode Exit fullscreen mode

This allows you to connect to a provider like GCP, AWS etc.

  • set target
daytona target set
Enter fullscreen mode Exit fullscreen mode

target is the location where you want to set up your development environment.
Select docker if you want to set it up locally on you system.
Select the configurations as they popup. I used all the default configs with docker server.

  • select ide
daytona ide
Enter fullscreen mode Exit fullscreen mode

Daytona allows you to work with you preferred IDE out of the box without you configuring various things. You can also include IDE specific settings in you .devcontainer/devcontainer.json file to customize the dev env further.

3. Create Workspace

A workspace is a dedicated development environment for the project you are working on.

This can be done simply with the following command:

daytona create https://github.com/kanakOS01/gitchat-daytona
Enter fullscreen mode Exit fullscreen mode

This is my project url which has a .devcontainer/devcontainer.json file. You can replace this with any repo which has a devcontainer.json file in it.

You can find a list of sample repos which you can try out here.

My Takeaways from Using Daytona

  • Time Saved: By automating repetitive setup tasks, Daytona allowed me to focus on building Git Chatโ€™s core functionality.
  • Consistency Across Environments: Whether I worked locally or collaborated with others, Daytona ensured the environment was identical every time.
  • Ease of Use: The intuitive CLI commands and clear documentation made Daytona accessible even for someone trying it for the first time.
daytona Article's
27 articles in total
Favicon
From Legacy to Lightning: Modernizing an Astro App with Daytona
Favicon
Daytona_Sample_Project : CareCradle
Favicon
Stremlining Development with Daytona
Favicon
๐Ÿ”ฎ Daytona + EchoBrain โ€“ AI Development Reimagined
Favicon
Daytona-Sample-React: Text AI
Favicon
PathGen with Daytona: Revolutionizing Personalized Learning Paths
Favicon
Integrate Daytona into a Machine Learning Project with React, Node, and Python
Favicon
How Daytona Helped Me Streamline My Development Workflow
Favicon
Make your Day with Daytona
Favicon
Effortless Full Stack Development: Set Up Django-React Application with One Command Using Daytona
Favicon
Daytona: Your Projectโ€™s New Best Friend
Favicon
Comprehensive Guide: Creating and Running the "Sample Video Generator" with Daytona
Favicon
Simplifying Recipe Discovery: Integrating Daytona into Recipe Finder๐Ÿโ˜•๏ธ
Favicon
How to generate devcontainer.json automatically without using devcontainer.ai
Favicon
Using Daytona to maintain a Development Environment
Favicon
๐Ÿš€ Simplify Your Dev Workflow with Daytona: Building a Pydantic AI-Powered Flask App
Favicon
Conquering the Setup Loop with Daytona
Favicon
Discord Image Generation Bot with Daytona
Favicon
My Journey with Daytona and How I Plan to Use It Going Forward
Favicon
Mastering Daytona Integration in Python: A Detailed Step-by-Step Guide ๐Ÿš€
Favicon
Integrate DAYTONA and let the magic begin....
Favicon
Integrate Daytona into Your React Project: A Step-by-Step Guide
Favicon
Integrate Daytona in your NextJS app
Favicon
How to Set Up Dev Environment on a Remote Machine
Favicon
Streamlined DevEx with the Daytona Installer Script
Favicon
The days of โ€œit works on my machineโ€ are gone; meet standardized development environments
Favicon
Daytona, a Secure Alternative to GitHub Codespaces, Launched by Cloud Development Veterans

Featured ones: