Tuesday, October 8, 2024
Google search engine
HomeData Modelling & AIInstall and Use OneDev – Self-hosted Git Server with Kanban and CI/CD

Install and Use OneDev – Self-hosted Git Server with Kanban and CI/CD

.tdi_3.td-a-rec{text-align:center}.tdi_3 .td-element-style{z-index:-1}.tdi_3.td-a-rec-img{text-align:left}.tdi_3.td-a-rec-img img{margin:0 auto 0 0}@media(max-width:767px){.tdi_3.td-a-rec-img{text-align:center}}

CI/CD is an abbreviation for Continuous Integration and Continuous Delivery (or Deployment). This refers to a set of software development practices aimed at improving the efficiency and reliability of the software delivery process.

Continuous Integration (CI) is the practice of regularly integrating code changes into a shared repository to detect and resolve conflicts as early as possible. In this process, every time a developer commits code changes to the repository, an automated build and testing process is triggered to verify that the changes do not break the existing codebase.

Continuous Delivery (CD) or Continuous Deployment (CD) is the practice of automating the software delivery process to release new changes to the production environment quickly, reliably, and frequently. In this process, once the code changes pass the automated build and testing process, they are automatically deployed to a staging or production environment, where they are further tested and reviewed before being released to end users.

.tdi_2.td-a-rec{text-align:center}.tdi_2 .td-element-style{z-index:-1}.tdi_2.td-a-rec-img{text-align:left}.tdi_2.td-a-rec-img img{margin:0 auto 0 0}@media(max-width:767px){.tdi_2.td-a-rec-img{text-align:center}}

The CI/CD pipeline is the entire process of continuous integration and continuous delivery, including all the automated steps, from code, commit to deployment to production. The pipeline includes automated testing, code quality checks, packaging, deployment, and other steps that help ensure that software changes are thoroughly tested and ready for production release.

There are many CI/CD tools available to help software development teams automate and streamline their software delivery processes. Some popular CI/CD tools include; Jenkins, Travis CI, CircleCI, GitLab CI/CD, Bamboo, GitHub Actions, Azure DevOps e.t.c

What is OneDev?

OneDev is a modern, open-source CI/CD platform that provides a complete solution for software development and delivery. It allows software development teams to automate their software delivery process, from code commit to production deployment, with an easy-to-use interface and powerful automation features.

OneDev supports multiple programming languages and frameworks, including Java, JavaScript, Python, and Ruby. It provides built-in support for popular development tools like Git, Jenkins, and Docker, and integrates with other popular tools like JIRA and Slack.

OneDev has a web-based interface that is easy to use and provides a visual representation of the software delivery process, with real-time feedback on the status of builds and deployments. It also provides powerful analytics and reporting features, allowing teams to track their progress, identify bottlenecks, and optimize their software delivery process.

There is a set of features for software development and delivery provided by OneDev. The most popular ones are:

  • Code repository management: It provides a built-in Git repository management system, allowing teams to manage their codebase and collaborate on code changes.
  • Continuous integration: It allows teams to automate the build and testing of their applications with flexible build pipelines and support for parallel builds.
  • Continuous delivery: It supports automated deployment to multiple environments, including Kubernetes and Docker Swarm, with rollbacks and approval workflows.
  • Artefact management: It provides a built-in artefact repository, allowing teams to manage and version their binaries and other artefacts.
  • Environment management: OneDev allows teams to manage their development, staging, and production environments, with support for infrastructure as code tools like Terraform.
  • Release management: OneDev provides a built-in release management system, allowing teams to manage the release of their applications and track their progress.
  • Collaboration and communication: It provides support for collaboration and communication tools like JIRA, Slack, and Mattermost, allowing teams to work together more effectively.
  • Analytics and reporting: It provides powerful analytics and reporting features, allowing teams to track their progress and optimize their software delivery process.
  • Flexibility and customization: OneDev is highly flexible and customizable, with support for plugins, scripts, and custom workflows, allowing teams to tailor the platform to their specific needs.

Today we will learn how to install and use OneDev, the Self-hosted Git Server with Kanban and CI/CD.

System Requirements

For this guide, you need the following:

  • Browser requirement:
    • Microsoft Edge
    • Safari 7.0 or higher
    • Chrome 40.0 or higher
    • Firefox 40.0 or higher
  • At least 2G physical memory

Step 1: Install OneDev on Your System

There are many methods to get OneDev installed and running. The possible installation methods are:

  • Run as a Docker container
  • Deploy into Kubernetes
  • Run on Bare Metal/Virtual Machine

In this guide, we will learn how to install OneDev on Bare Metal/Virtual Machine and Docker containers. So, you are free to choose any of the below methods that fascinate you!

Option 1 – Run OneDev on Bare Metal / Virtual Machine

This method is quite involving, as several dependency packages are required. First, ensure that the following are installed:

##On Debian/Ubuntu
sudo apt update && sudo apt install curl git -y

##On Rhel/Rocky Linux/Alma Linux
sudo yum install curl git -y

##On Arch Linux
sudo pacman -S git

On Arch Linux, you need the required fonts installed:

sudo pacman -S fontconfig ttf-dejavu

Once the required packages have been installed, pull the latest OneDev release. You can also pull the desired release, for example, the 8.0.13 version:

mkdir onedev && cd onedev
wget https://code.onedev.io/~downloads/projects/160/builds/3540/artifacts/onedev-8.0.15.tar.gz

Now extract the archive:

tar -xvf onedev-*.tar.gz

Now navigate into the directory:

cd onedev-*/

Now install the service. First, edit conf\wraper.conf and set the value of the wrapper.java.command as the path to the java command if it does not exist in the system path. For example, In my case, I have Java at /opt/jdk-18/

$ vim conf/wrapper.conf
wrapper.java.command=/opt/jdk-18/bin/java

Once the changes have been made, run the below command to install the service:

##On Windows(from the same folder with administrator privilege)
server.bat install

##On Linux/MacOS
sudo bin/server.sh install

The system service for OneDev will be created. Start and enable the service:

sudo systemctl enable --now onedev

Check the status of the service:

$ systemctl status onedev
 onedev.service - OneDev
     Loaded: loaded (/etc/systemd/system/onedev.service; enabled; vendor preset: enabled)
     Active: active (running) since Tue 2023-03-21 12:47:16 EAT; 12s ago
    Process: 23265 ExecStart=/home/ubuntu22/onedev/onedev-8.0.13/bin/server.sh start sysd (code=exited, status=0/SUCCESS)
   Main PID: 23350 (wrapper-linux-x)
      Tasks: 39 (limit: 4629)
     Memory: 185.3M
        CPU: 9.441s
     CGroup: /system.slice/onedev.service
             ├─23350 /home/ubuntu22/onedev/onedev-8.0.13/bin/../boot/wrapper-linux-x86-64 /home/ubuntu22/onedev/onedev-8.0.13/bin/../conf/wrapper.conf wrapper.syslog.ident=onedev wrapper.pi>
             └─23370 /opt/jdk-18/bin/java -Djava.awt.headless=true --add-opens=java.base/sun.nio.ch=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.r>

Mac 21 12:47:12 onedev.geeksforgeeks.org systemd[1]: Starting OneDev...
Mac 21 12:47:13 onedev.geeksforgeeks.org server.sh[23265]: Starting OneDev...
Mac 21 12:47:16 onedev.geeksforgeeks.org server.sh[23265]: Waiting for OneDev......
Mac 21 12:47:16 onedev.geeksforgeeks.org server.sh[23265]: running: PID:23350
Mac 21 12:47:16 onedev.geeksforgeeks.org systemd[1]: Started OneDev.

Option 2 – Run OneDev as a Docker container

This option is best for those who want to avoid the complexity involve when installing the dependencies. Here, all you need is to have the Docker Engine installed and running. This can be done using the aid provide here

Once installed, add your system user to the docker group.

sudo usermod -aG docker $USER
newgrp docker

Now create a storage directory for OneDev

sudo mkdir /onedev
sudo chmod -R 777 /onedev

On Rhel-based systems, configure SELinux for the path to be accessible:

sudo setenforce 0
sudo sed -i 's/^SELINUX=.*/SELINUX=permissive/g' /etc/selinux/config

Now you can easily spin the container using the command:

docker run -d \
  --name onedev \
  --restart always \
  -v /var/run/docker.sock:/var/run/docker.sock \
  -v /onedev:/opt/onedev \
  -p 6610:6610 \
  -p 6611:6611 \
  1dev/server

Check the status of the container:

$ docker ps
CONTAINER ID   IMAGE                                      COMMAND                  CREATED          STATUS          PORTS                                                           NAMES
486341cf8a7f   1dev/server                                "/root/bin/entrypoin…"   17 seconds ago   Up 14 seconds   0.0.0.0:6610-6611->6610-6611/tcp, :::6610-6611->6610-6611/tcp   onedev

Step 2: Access OneDev Web UI

Once OneDev has been installed, you can now access it using the URL http://domain_name:6610. First, create the admin user.

Install and Use OneDev

Set the URL for your site.

Install and Use OneDev 1

Now you are ready to use OneDev.

Install and Use OneDev 2

Step 3: Use OneDev – Git with Kanban and CI/CD

Now we are set to use the OneDev Self-hosted Git Server with Kanban and CI/CD. We will begin by creating a test project from the web UI.

Install and Use OneDev 3

Once created, we will create a react application from the terminal. First, install Node.js 14 or higher on your system before you proceed.

### On RHEL, CentOS or Fedora, for Node.js LTS ###
sudo yum install gcc-c++ make
curl --silent --location https://rpm.nodesource.com/setup_16.x | sudo bash -
sudo yum -y install nodejs

###  Debian  / Ubuntu ###
curl -sL https://deb.nodesource.com/setup_16.x | sudo -E bash -
sudo apt install -y nodejs

Now create the application.

npx create-react-app myapp

After this, you will have a directory my-app created in the current directory. To push this code to OneDev, navigate into the directory:

cd myapp

Now push the code to OneDev

git remote add origin http://localhost:6610/myapp
git push origin master:master

Sample output:

Install and Use OneDev 4

Now you should have your code pushed as shown in the web UI.

Install and Use OneDev 5

Now click on “adding onedev buildspec” to bring up the GUI and add a build specification

Install and Use OneDev 6

Here, we will use the default template. Save this spec and commit the changes.

Install and Use OneDev 7

Now you will see the CI build in progress here.

Install and Use OneDev 8

To view the progress, click on it.

Install and Use OneDev 9

Once complete, you should have one build as shown

Install and Use OneDev 10

Closing Thoughts

That marks the end of this guide. We have only covered a simple quickstart on OneDev, there are many other practical examples which I believe you can try on your own. I hope this was informative.

See more:

.tdi_4.td-a-rec{text-align:center}.tdi_4 .td-element-style{z-index:-1}.tdi_4.td-a-rec-img{text-align:left}.tdi_4.td-a-rec-img img{margin:0 auto 0 0}@media(max-width:767px){.tdi_4.td-a-rec-img{text-align:center}}

RELATED ARTICLES

Most Popular

Recent Comments