# 🛠️ Maintenance

## Manage services

* [Manage services](/doc/8fd87613-e545-47d7-ba2d-de1e9ca254f0)


## Manage disk

* The actual state of the disk

  ![](https://wiki.agroportal.eu/api/files.get?sig=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJrZXkiOiJ1cGxvYWRzL2MyODRmYzA0LTA4ZmUtNGE1Yi05ODM4LWM5MjhmYTFlNjhjNi84ODI2NWIzOC0zZjIxLTQzN2ItYjY4Ny1kNWNjNmNjYTM3MTgvaW1hZ2UucG5nIiwidHlwZSI6ImF0dGFjaG1lbnQiLCJpYXQiOjE3OTM4OTQ0MDAsImV4cCI6MTc5Mzk4MDgwMH0.jzpWcjCqwsgy7mEYdA_JIiZppRxh_hDs6eoHqB-_X78 " =4891x1242")

### Resize the disk size

#### Example: Resize /tmp and /var

* 1️⃣ Create a new partition

```bash
cfdisk /dev/sda
```

* Select **Free Space → New → size 20G (or more)**(you can do 10G for `/tmp` + 10G for `/var`)
* Set type **Linux filesystem**
* Write changes → Quit

Then refresh partition table:

```bash
partprobe /dev/sda
```

* 2️⃣ Create a PV and extend VG

```bash
pvcreate /dev/sda5   # assuming new partition is sda5
vgextend sysvg /dev/sda5
vgdisplay sysvg      # confirm free space is available
```

* 3️⃣ Extend LVs
* Add 10G to `/tmp` to be 14G:

```bash
lvextend -L +10G /dev/sysvg/lv_tmp
```

* Add 10G to `/var` to be 14G:

```bash
lvextend -L +9.9G /dev/sysvg/lv_var
```

* 4️⃣ Resize filesystems
* Check type:

```bash
df -T /tmp /var
```

* For **xfs**:

```bash
xfs_growfs /tmp
xfs_growfs /var
```

* 5️⃣ Verify

```bash
df -h /tmp /var
```


### Clean/Empty the disk

* Sometime we have problem because of the disk saturation and usually the problem in:
  * `/tmp` => just clean the tmp folder and restart the services with `sudo oprestart`
  * Logs files
    * `/opt/ontoportal/bioportal_web_ui/shared/log`
    * `/opt/ontoportal/ontologies_api/shared/log`
    * `/opt/ontoportal/ncbo_cron/shared/logs`
    * `/var/log/virtuoso-public`
    * `/var/log/tomcat/FAIR_CACHE/`
  * use `df -h` to see which folder is full
  * use `du -ah -d 1 | sort -h` inside the folder to see which files are taken space


## Processes, RAM, CPU usage

* with `htop` inside the server

  ![](https://wiki.agroportal.eu/api/files.get?sig=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJrZXkiOiJ1cGxvYWRzL2MyODRmYzA0LTA4ZmUtNGE1Yi05ODM4LWM5MjhmYTFlNjhjNi81YjBiYTI1My0yZTM5LTRlZTMtODk0Zi05OGY1YWE0NDE2N2UvaW1hZ2UucG5nIiwidHlwZSI6ImF0dGFjaG1lbnQiLCJpYXQiOjE3OTM4OTQ0MDAsImV4cCI6MTc5Mzk4MDgwMH0.Fkt0wbUiEqPofKu7b7SXszvJPwZm-WQp3K0iMOSjjeA " =1860x1013")
* With virtus (<https://virtu.serveurs.inrae.fr/>)

  ![](https://wiki.agroportal.eu/api/files.get?sig=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJrZXkiOiJ1cGxvYWRzL2MyODRmYzA0LTA4ZmUtNGE1Yi05ODM4LWM5MjhmYTFlNjhjNi9kNzViZDVjZC02OTYwLTRlYWYtOTAxMC05MDIwNmJkN2ZjOGYvaW1hZ2UucG5nIiwidHlwZSI6ImF0dGFjaG1lbnQiLCJpYXQiOjE3OTM4OTQ0MDAsImV4cCI6MTc5Mzk4MDgwMH0.PS_A-8LlgqNUqk-CdUgdO-a_KEE8dV8Btj0BxFSIZ_s " =1913x954")


## Deployment

* Go to `/opt/ontoportal/agroportal_deployment/`
* do `git pull`
* use the deploy.sh script

  ```bash
  ontoportal@localhost:/opt/ontoportal/agroportal_deployment$ ./deploy.sh help
  [-] Error: Missing arguments
  Usage: ./deploy.sh <application> <stage>
  
  Applications:
    - ALL
    - bioportal_web_ui
    - UI
    - ontologies_api
    - API
    - ncbo_cron
    - CRON
  
  Stages:
    - production
    - pre_production
  
  Example:
    ./deploy.sh ontologies_api production
    ./deploy.sh API production
  ```
* execute `./deploy.sh ALL production` or `./deploy.sh ALL pre_production` to deploy all apps
* if something wrong after deployment you can do rollback
  * Method 1: using the `deploy.sh` script: TO-DO
  * Method 2: 
    * go to the app folder example bioportal_web_ui 
    * Link the current folder with the release before the deployment (capistrano always will let the 5 last releases)

      ```bash
      ontoportal@localhost:/opt/ontoportal/bioportal_web_ui$ ls current releases/  -altr
      lrwxrwxrwx 1 ontoportal ontoportal  56 Mar 16 16:43 current -> /opt/ontoportal/bioportal_web_ui/releases/20260316164234
      
      releases/:
      total 20
      drwxrwxr-x 18 ontoportal ontoportal 4096 Mar  9 15:54 20260309155421
      drwxrwxr-x 18 ontoportal ontoportal 4096 Mar  9 16:15 20260309161504
      drwxrwxr-x 18 ontoportal ontoportal 4096 Mar 10 17:22 20260310172200
      drwxrwxr-x 18 ontoportal ontoportal 4096 Mar 11 17:06 20260311170634
      drwxrwxr-x 18 ontoportal ontoportal 4096 Mar 16 16:42 20260316164234
      ```

---

**Documents**

- [💁‍♂️ Acknowledgments](https://wiki.agroportal.eu/s/e6158eda-c109-4385-852c-51a42de9a412/doc/acknowledgments-15GdRXLQdm)
- [📚Publications and references](https://wiki.agroportal.eu/s/e6158eda-c109-4385-852c-51a42de9a412/doc/publications-and-references-87tEoeoGKy)
- [🗽Terms & Conditions](https://wiki.agroportal.eu/s/e6158eda-c109-4385-852c-51a42de9a412/doc/terms-conditions-naDsDo2Zxq)
- [🧞‍♂️Metadata guidelines and recommendations](https://wiki.agroportal.eu/s/e6158eda-c109-4385-852c-51a42de9a412/doc/metadata-guidelines-and-recommendations-pOFbK9sIfp)
- [📜 AgroPortal Release Notes](https://wiki.agroportal.eu/s/e6158eda-c109-4385-852c-51a42de9a412/doc/agroportal-release-notes-btKjZk5tU2)
- [ 👩‍🚀 User Guide](https://wiki.agroportal.eu/s/e6158eda-c109-4385-852c-51a42de9a412/doc/user-guide-ZszoBwfjGF)
- [📎 API Documentation](https://wiki.agroportal.eu/s/e6158eda-c109-4385-852c-51a42de9a412/doc/api-documentation-kMCurGKD97)
- [🤖 Developer Documentation](https://wiki.agroportal.eu/s/e6158eda-c109-4385-852c-51a42de9a412/doc/developer-documentation-LhsrucqGTa)
- [🗃External Documentation](https://wiki.agroportal.eu/s/e6158eda-c109-4385-852c-51a42de9a412/doc/external-documentation-vNPQCdArrr)
- [AgroPortal infrastructure](https://wiki.agroportal.eu/s/e6158eda-c109-4385-852c-51a42de9a412/doc/agroportal-infrastructure-ietsAU4kPs)