|
1 |
| -# Local Devtron Dev Setup |
| 1 | +# Development Guide for Devtron |
2 | 2 |
|
3 |
| -For all the open source contributors out there looking for contributing to Devtron’s code base, here’s how easily you can start contributing in Devtron. |
| 3 | +This document provides instructions for setting up a development environment to help you get started with contributing to [Devtron](github.com/devtron-labs/devtron). Make sure to review the [contributing.md](https://github.com/devtron-labs/devtron/blob/main/CONTRIBUTING.md) file for more details on contributing. This document will help guide you through understanding the build process. |
4 | 4 |
|
5 |
| -## Prerequisite |
6 |
| -Any kubernetes Cluster |
| 5 | +## Requirements |
| 6 | +- [Go Programming language](https://go.dev/) |
| 7 | +- [Docker](https://www.docker.com/) |
| 8 | +- [Kubernetes Cluster](https://kubernetes.io/) |
| 9 | +- [Helm v3](https://helm.sh/) |
7 | 10 |
|
8 | 11 | ## Setup Guide
|
9 |
| -We have documented some of the most popular and easiest ways of creating local kubernetes clusters and setting up the development environment for devtron in our machine. |
10 | 12 |
|
11 |
| -* [Over Minikube Cluster](https://dev.to/arushi09/local-kubernetes-development-made-easy-with-minikube-devtron-17hf) |
12 |
| -* [Over k3s Cluster using k3d](https://hackernoon.com/how-to-install-k3d-and-devtron-locally-for-local-kubernetes-development) |
| 13 | +### Install Devtron in a Kubernetes cluster |
| 14 | + |
| 15 | +1. [Create a Kubernetes Cluster](https://docs.devtron.ai/getting-started#create-a-kubernetes-cluster) |
| 16 | + - 2 vCPUs |
| 17 | + - 4GB+ of free memory |
| 18 | + - 20GB+ free disk space |
| 19 | + |
| 20 | +2. [Install Devtron with CI/CD along with GitOps (Argo CD) - Full mode](https://docs.devtron.ai/install/install-devtron-with-cicd-with-gitops) |
| 21 | + |
| 22 | + ```bash |
| 23 | + helm repo add devtron https://helm.devtron.ai |
| 24 | + helm repo update devtron |
| 25 | + helm install devtron devtron/devtron-operator \ |
| 26 | + --create-namespace --namespace devtroncd \ |
| 27 | + --set installer.modules={cicd} \ |
| 28 | + --set argo-cd.enabled=true |
| 29 | + ``` |
| 30 | + |
| 31 | + Note: If you want to install Devtron on a Managed Kubernetes cluster, please [refer to the guide](https://docs.devtron.ai/install/demo-tutorials). |
| 32 | + |
| 33 | +3. [Download the kubeconfig file](https://kubernetes.io/docs/tasks/access-application-cluster/configure-access-multiple-clusters/(url)) to access your cluster. It’s a good idea to set it up locally and configure the context to point to the specific cluster you’re working with. |
| 34 | + |
| 35 | +4. Forward the necessary service ports (e.g., PostgreSQL, NATS) for local access |
| 36 | + |
| 37 | + ``` |
| 38 | + #Required |
| 39 | + kubectl -n devtroncd port-forward svc/devtron-nats 4222:4222 # Allows event driven communictation between microservices. |
| 40 | + kubectl -n devtroncd port-forward svc/postgresql-postgresql 5432:5432 #Allows your local code to connect to the database running in the cluster. |
| 41 | + |
| 42 | + #Optional |
| 43 | + kubectl -n devtroncd port-forward svc/argocd-server 8000:80 #Required to interact with ArgoCD's API (GitOps) |
| 44 | + kubectl -n devtroncd port-forward svc/argocd-dex-server 5556:5556 #Required for SSO Logins. |
| 45 | + kubectl -n devtroncd port-forward svc/kubelink-service 50051:50051 #Required for no-gitops (helm) and fetches the status of resources. |
| 46 | + kubectl -n devtroncd port-forward svc/git-sensor-service 7070:80 # Monitors Git repositories for changes and triggers appropriate workflows in Devtron. |
| 47 | + ``` |
| 48 | +
|
| 49 | +5. Use this command to extract the password of PostgreSQL (Required to put in ENV): |
| 50 | +
|
| 51 | + ```bash |
| 52 | + kubectl exec -it -n devtroncd postgresql-postgresql-0 -- printenv | grep POSTGRES_PASSWORD |
| 53 | + ``` |
| 54 | +
|
| 55 | +### Prepare Your Local Workspace |
| 56 | +
|
| 57 | +Navigate to the `github.com` directory on your local machine: |
| 58 | +
|
| 59 | +- `cd go/src/github.com` |
| 60 | +- `git clone http://github.com/devtron-labs/devtron` |
| 61 | +- Configure [Environment Variables](https://github.com/devtron-labs/devtron/blob/main/scripts/dev-conf/envfile.env) |
| 62 | +- Install [wire](https://github.com/google/wire) (Required) |
| 63 | +- Run the server: |
| 64 | +
|
| 65 | + ```bash |
| 66 | + make run |
| 67 | + ``` |
| 68 | +
|
| 69 | +This will start your server on `localhost:8080`. |
| 70 | +
|
| 71 | +## Cleanup |
| 72 | +
|
| 73 | + ``` |
| 74 | + 1. Uninstall Devtron and delete the 'devtroncd' namespace |
| 75 | + helm uninstall devtron -n devtroncd |
| 76 | + kubectl delete namespace devtroncd |
| 77 | + |
| 78 | + 2. Remove the local Devtron codebase |
| 79 | + rm -rf ~/go/src/github.com/devtron-labs/devtron |
| 80 | + ``` |
| 81 | +## Contributing |
| 82 | +Please check [contributing guidelines](https://github.com/devtron-labs/devtron/blob/main/CONTRIBUTING.md) |
| 83 | +
|
| 84 | +## Need help? |
| 85 | +
|
| 86 | +If you’re looking for the fastest response to your questions, we encourage you to visit our Discord community. Specifically, you can post your inquiries in the [#setup-and-installation](https://discord.com/channels/769482988882493450/801441246849007667) channel, where our team and community members are actively available to assist you on discord channel. |
| 87 | +
|
| 88 | +
|
| 89 | +
|
0 commit comments