From c83b001d3218433f6b3f647037af88d7fb721ad0 Mon Sep 17 00:00:00 2001 From: Paulo Ribeiro Date: Fri, 15 Jul 2022 15:26:40 +0100 Subject: [PATCH 1/9] doc: Add placeholder for new Caching page --- docs/configuration/caching.md | 5 +++++ mkdocs.yml | 1 + 2 files changed, 6 insertions(+) create mode 100644 docs/configuration/caching.md diff --git a/docs/configuration/caching.md b/docs/configuration/caching.md new file mode 100644 index 00000000..4899bd81 --- /dev/null +++ b/docs/configuration/caching.md @@ -0,0 +1,5 @@ +--- +description: +--- + +# Caching diff --git a/mkdocs.yml b/mkdocs.yml index b4e17b49..24786f2a 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -62,6 +62,7 @@ nav: - configuration/integrations/bitbucket-cloud.md - configuration/integrations/bitbucket-server.md - configuration/integrations/email.md + - configuration/caching.md - configuration/monitoring.md - configuration/logging.md - "Maintenance and operations": From 55f2801c0f9b57f8e9ca5444e3bd94408da0aab8 Mon Sep 17 00:00:00 2001 From: Paulo Ribeiro Date: Fri, 15 Jul 2022 15:35:14 +0100 Subject: [PATCH 2/9] doc: Fix indentation in YAML code block --- .../integrations/bitbucket-server.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/configuration/integrations/bitbucket-server.md b/docs/configuration/integrations/bitbucket-server.md index 1be28748..12101227 100644 --- a/docs/configuration/integrations/bitbucket-server.md +++ b/docs/configuration/integrations/bitbucket-server.md @@ -66,15 +66,15 @@ After creating the Bitbucket Server application link, you must configure it on C ```yaml bitbucketEnterprise: - enabled: "true" - login: "true" # Show login button for Bitbucket Server - hostname: "bitbucket.example.com" # Hostname of your Bitbucket Server instance - protocol: "https" # Protocol of your Bitbucket Server instance - port: 7990 # Port of your Bitbucket Server instance - consumerKey: "" # Generated when creating the Bitbucket Server application link - consumerPublicKey: "" # Generated when creating the Bitbucket Server application link - consumerPrivateKey: "" # Generated when creating the Bitbucket Server application link - contextPath: "" # Context path of your Bitbucket Server, if configured + enabled: "true" + login: "true" # Show login button for Bitbucket Server + hostname: "bitbucket.example.com" # Hostname of your Bitbucket Server instance + protocol: "https" # Protocol of your Bitbucket Server instance + port: 7990 # Port of your Bitbucket Server instance + consumerKey: "" # Generated when creating the Bitbucket Server application link + consumerPublicKey: "" # Generated when creating the Bitbucket Server application link + consumerPrivateKey: "" # Generated when creating the Bitbucket Server application link + contextPath: "" # Context path of your Bitbucket Server, if configured ``` 3. Apply the new configuration by performing a Helm upgrade. To do so execute the command [used to install Codacy](../../index.md#helm-upgrade): From 8e437cadfd32ac9e6a74eb5eb10e76ecf48b9e47 Mon Sep 17 00:00:00 2001 From: Paulo Ribeiro Date: Fri, 15 Jul 2022 15:44:34 +0100 Subject: [PATCH 3/9] doc: Add instructions on how to configure external NFS server --- docs/configuration/caching.md | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/docs/configuration/caching.md b/docs/configuration/caching.md index 4899bd81..e7b09054 100644 --- a/docs/configuration/caching.md +++ b/docs/configuration/caching.md @@ -3,3 +3,37 @@ description: --- # Caching + +Codacy Self-hosted includes a built-in NFS server provisioner that deploys a shared volume to cache the cloned repository files while they're being analyzed by each tool. However, if you're dealing with big repositories or a high volume of analysis, using an NFS server external to the cluster will improve the performance of the cache. + +To use your own external NFS server: + +1. Edit the file `values-production.yaml` that you [used to install Codacy](../../index.md#helm-upgrade). + +1. Set `nfsserverprovisioner.enabled: "false"` and define the remaining values as described below: + + ```yaml + nfsserverprovisioner: + enabled: "false" + + cache: + name: "listener-cache" + path: "/data" + nfs: + server: "" # The IP address of the external NFS server + path: "/var/nfs/data/" # External NFS server directory or file system to be mounted + ``` + +1. Apply the new configuration by performing a Helm upgrade. To do so execute the command [used to install Codacy](../../index.md#helm-upgrade): + + !!! important + **If you're using MicroK8s** you must use the file `values-microk8s.yaml` together with the file `values-production.yaml`. + + To do this, uncomment the last line before running the `helm upgrade` command below. + + ```bash + helm upgrade (...options used to install Codacy...) \ + --version {{ version }} \ + --values values-production.yaml \ + # --values values-microk8s.yaml + ``` From 2fa08d84f6d9e5f12be865c9b1f595aad2a5e64a Mon Sep 17 00:00:00 2001 From: Paulo Ribeiro Date: Fri, 15 Jul 2022 15:48:14 +0100 Subject: [PATCH 4/9] doc: Add meta description --- docs/configuration/caching.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/configuration/caching.md b/docs/configuration/caching.md index e7b09054..6135a77a 100644 --- a/docs/configuration/caching.md +++ b/docs/configuration/caching.md @@ -1,5 +1,5 @@ --- -description: +description: Configure Codacy Self-hosted to use an external NFS server to improve the performance of the cloned repository cache. --- # Caching From aaa090b591de6fd0d541d3942432949053c7e5ce Mon Sep 17 00:00:00 2001 From: Paulo Ribeiro Date: Fri, 15 Jul 2022 15:54:14 +0100 Subject: [PATCH 5/9] doc: Fix configuration paths --- docs/configuration/caching.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/docs/configuration/caching.md b/docs/configuration/caching.md index 6135a77a..c2ea74c3 100644 --- a/docs/configuration/caching.md +++ b/docs/configuration/caching.md @@ -10,18 +10,18 @@ To use your own external NFS server: 1. Edit the file `values-production.yaml` that you [used to install Codacy](../../index.md#helm-upgrade). -1. Set `nfsserverprovisioner.enabled: "false"` and define the remaining values as described below: +1. Set `listener.nfsserverprovisioner.enabled: "false"` and define the remaining `listener.cache.*` values as described below: ```yaml - nfsserverprovisioner: - enabled: "false" - - cache: - name: "listener-cache" - path: "/data" - nfs: - server: "" # The IP address of the external NFS server - path: "/var/nfs/data/" # External NFS server directory or file system to be mounted + listener: + nfsserverprovisioner: + enabled: false + cache: + name: listener-cache + path: /data" + nfs: + server: # IP address of the external NFS server + path: /var/nfs/data/ # External NFS server directory or file system to be mounted ``` 1. Apply the new configuration by performing a Helm upgrade. To do so execute the command [used to install Codacy](../../index.md#helm-upgrade): From 494859bb8e12cd0260b1b2ba6962858445501885 Mon Sep 17 00:00:00 2001 From: Paulo Ribeiro Date: Fri, 15 Jul 2022 16:07:43 +0100 Subject: [PATCH 6/9] doc: Add listener.cache.* configurations to README --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 05075f67..3b8a2524 100644 --- a/README.md +++ b/README.md @@ -185,6 +185,10 @@ The following parameters are specific to each Codacy component. | `listener.nfsserverprovisioner.persistence.enabled` | Creates an NFS provisioner | `true` | | `listener.nfsserverprovisioner.persistence.size` | Size of the NFS server disk | `120Gi` | | `listener.cacheCleanup.olderThanDays` | Data retention policy in days | `30` | +| `listener.cache.name` | External NFS volume name | `listener-cache` | +| `listener.cache.path` | External NFS volume mount path | `/data` | +| `listener.cache.nfs.server` | IP address of external NFS server | `0.0.0.0` | +| `listener.cache.nfs.path` | External NFS server directory or file system to be mounted | `/` | | `engine.replicaCount` | Number of replicas | `1` | | `engine.image.repository` | Image repository | from dependency | | `engine.image.tag` | Image tag | from dependency | From 3e60d0f9e2ee8950b7e2c31f8cac3b1e566d10a9 Mon Sep 17 00:00:00 2001 From: Paulo Ribeiro Date: Fri, 15 Jul 2022 16:09:43 +0100 Subject: [PATCH 7/9] doc: Fix broken link --- docs/configuration/caching.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/configuration/caching.md b/docs/configuration/caching.md index c2ea74c3..0297d62a 100644 --- a/docs/configuration/caching.md +++ b/docs/configuration/caching.md @@ -8,7 +8,7 @@ Codacy Self-hosted includes a built-in NFS server provisioner that deploys a sha To use your own external NFS server: -1. Edit the file `values-production.yaml` that you [used to install Codacy](../../index.md#helm-upgrade). +1. Edit the file `values-production.yaml` that you [used to install Codacy](../index.md#helm-upgrade). 1. Set `listener.nfsserverprovisioner.enabled: "false"` and define the remaining `listener.cache.*` values as described below: @@ -24,7 +24,7 @@ To use your own external NFS server: path: /var/nfs/data/ # External NFS server directory or file system to be mounted ``` -1. Apply the new configuration by performing a Helm upgrade. To do so execute the command [used to install Codacy](../../index.md#helm-upgrade): +1. Apply the new configuration by performing a Helm upgrade. To do so execute the command [used to install Codacy](../index.md#helm-upgrade): !!! important **If you're using MicroK8s** you must use the file `values-microk8s.yaml` together with the file `values-production.yaml`. From a525899e7fca605009c33e7b986462f046eb233a Mon Sep 17 00:00:00 2001 From: Paulo Ribeiro Date: Fri, 15 Jul 2022 16:29:51 +0100 Subject: [PATCH 8/9] doc: Remove spurious quote --- docs/configuration/caching.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/configuration/caching.md b/docs/configuration/caching.md index 0297d62a..e0d7f348 100644 --- a/docs/configuration/caching.md +++ b/docs/configuration/caching.md @@ -18,7 +18,7 @@ To use your own external NFS server: enabled: false cache: name: listener-cache - path: /data" + path: /data nfs: server: # IP address of the external NFS server path: /var/nfs/data/ # External NFS server directory or file system to be mounted From 7d5274102a166689354fa2ae5432137efaed7461 Mon Sep 17 00:00:00 2001 From: Paulo Ribeiro Date: Fri, 15 Jul 2022 16:45:33 +0100 Subject: [PATCH 9/9] doc: Add step to validate that the external NFS server is being used --- docs/configuration/caching.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/docs/configuration/caching.md b/docs/configuration/caching.md index e0d7f348..6ae5257a 100644 --- a/docs/configuration/caching.md +++ b/docs/configuration/caching.md @@ -37,3 +37,18 @@ To use your own external NFS server: --values values-production.yaml \ # --values values-microk8s.yaml ``` + +1. Validate that the `repository-listener` pod is now using the external NFS server: + + ```bash + $ kubectl describe pod -n codacy codacy-listener-<...> + + [...] + + Volumes: + listener-cache: + Type: NFS (an NFS mount that lasts the lifetime of a pod) + Server: + Path: /var/nfs/data/ + ReadOnly: false + ```