Home Products How to use an external NFS Server with Codacy

How to use an external NFS Server with Codacy

Author

Date

Category

Part of my job as a Solutions Engineer at Codacy is to help customers performing on-prem installations.

Although Codacy on-prem comes with a built-in NFS server provisioner, it’s possible to use an external NFS Server. This tutorial will cover how to do that. It’s based on AWS but, give or take, should work for any other cloud provider.

First, let’s create a basic Ubuntu-based EC2 instance.

⚠️ Don’t forget to respect the system requirements regarding disk size. ⚠️

Amazon Machine Image Ubuntu Server

Regarding Security Groups, ports 2049 (NFS) and 22 (SSH) should be open. In this example, I’ve opened for the world but you should limit it for obvious security reasons.

Security Groups ports

Now, let’s jump inside our new EC2 instance, update it, install nfs-kernel-server and create a data folder.

sudo apt update
sudo apt install nfs-kernel-server
sudo mkdir /var/nfs/data -p
sudo chown nobody:nogroup /var/nfs/data/

After this step, we need to configure /etc/exports in order to add the created folder.

/var/nfs/data CLIENT_IP(rw,sync,no_subtree_check,no_root_squash)

🚨 CLIENT_IP should be replaced with the IP address of your Codacy instance/cluster IP address 🚨

And then, restart the nfs-kernel-server.

sudo systemctl restart nfs-kernel-server

At this stage, the NFS server should be ready. We just need to configure Codacy. In order to do that, we must edit the values-production.yaml file:

nfsserverprovisioner:
  enabled: false
cache:
  name: listener-cache
  path: /data
  nfs:
    server: NFS_SERVER_IP
    path: /var/nfs/data/

🚨 NFS_SERVER_IP is the IP address for your NFS server 🚨

Now, a quick deploy ⌛️

helm upgrade --install codacy codacy-stable/codacy \
--namespace codacy \
--version $VERSION \
--values values-production.yaml
# --values values-microk8s.yaml

And Codacy is using an External NFS Server 🎊

kubectl describe pod -n codacy codacy-listener-######
Volumes:
  listener-cache:
    Type:      NFS (an NFS mount that lasts the lifetime of a pod)
    Server:    NFS_SERVER_IP
    Path:      /var/nfs/data/
    ReadOnly:  false
Codacy using external NFS server

Full documentation on how to install Codacy on-prem can be found here.

This article was originally published by Hélio Rocha, Lead Solutions Engineer at Codacy on his Medium account.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Subscribe to our newsletter

To be updated with all the latest news, offers and special announcements.

Recent posts

21 AI Tools for Developers in 2023

A 2023 survey by Alteryx shows that 31% of companies using tools powered by artificial intelligence (AI) are using them to generate code. When asking...

Codacy Pioneers: A Fellowship Program for Open-Source Creators

Here at Codacy, we recognize the importance of the open-source software (OSS) community and are dedicated to nurturing and supporting it in any way...

AI-Assisted Coding: 7 Pros and Cons to Consider

According to a recent GitHub survey, 92% of developers polled said they are already actively using coding assistants powered by artificial intelligence (AI). AI-assisted...

Now Available. Centralized view of security issues & risk within Codacy

Codacy is empowering engineering teams to bring their security auditing process to the surface. Today we're giving all Codacy...