# Data Migration (LIRMM -> INRAE)

### Virtuoso

* first stop the virtuoso in both servers
* Do rsync between the two servers: `sudo rsync -avzP --numeric-ids stageportal:/srv/ontoportal/data/virtuoso-opensource/ /opt/virtuoso`
* Move the data to the /srv/ontoportal/data/virtuoso

  ```
  	mkdir /srv/ontoportal/data/virtuoso
  	cd /opt/virtuoso/database/
  	mv virtuoso.db virtuoso.log virtuoso.pxa virtuoso.trx virtuoso-temp.db /srv/ontoportal/data/virtuoso
  ```
* Change the config of virtuoso.ini in /opt/virtuoso/database/virtuoso.ini

  ```
  DatabaseFile = /srv/ontoportal/data/virtuoso/virtuoso.db
  ErrorLogFile = /srv/ontoportal/data/virtuoso/virtuoso.log 
  LockFile = /srv/ontoportal/data/virtuoso/virtuoso.lck
  TransactionFile = /srv/ontoportal/data/virtuoso/virtuoso.trx 
  xa_persistent_file = /srv/ontoportal/data/virtuoso/virtuoso.pxa
  ....
  DatabaseFile = /srv/ontoportal/data/virtuoso/virtuoso-temp.db 
  TransactionFile = /srv/ontoportal/data/virtuoso/virtuoso-temp.trx
  ```
* Change owner to virtuoso user

  ```
  chown -R virtuoso:virtuoso /opt/virtuoso
  chown -R virtuoso:virtuoso /srv/ontoportal/data/virtuoso
  ```
* Restart virtuoso in new server `systemctl restart virtuoso.service`
* Clear the cache to see it in the browser `sudo opclearcaches`

### Tomcat

* We have to build each project into a war file and put it in the tomcat webapps directory
  * annotator.war  => <https://github.com/ontoportal-lirmm/annotators/tree/master/sifr-bioportal-annotator-proxy>
  * annotatorplus.war => <https://github.com/ontoportal-lirmm/annotators/tree/ncbo_annotator>
  * fairness-assessment.war => <https://github.com/agroportal/fairness>
  * ncbo_proxy.war => <https://github.com/ontoportal-lirmm/ncboproxy?tab=readme-ov-file#iii1-building-the-war-file-and-configuring-the-proxy>
  * biomixer.war

### Redis

* Stop redis on both servers
* Give the user ontoportal the permission to enter the redis_persistent folder with `sudo usermod -aG redis ontoportal`
* Rsync `sudo rsync -avzP stageportal:/srv/ontoportal/data/redis_persistent/dump.rdb /srv/ontoportal/data/redis_persistent/ `
* `sudo systemctl restart redis-server-persistent.service redis-server-http_cache.service redis-server-goo_cache.service`

### Mgrep

* Rsync the file

  ```
  rsync -avzP agroportal:/srv/ontoportal/data/mgrep/dictionary/dictionary.txt /srv/ontoportal/data/mgrep/dictionary
  ```

### Mgrep-lem

* Rsync the dictionary file

  ```
  rsync -avzP agroportal:/srv/ontoportal/data/mgrep/dictionary/dictionary-lem.txt /srv/ontoportal/data/mgrep/dictionary
  ```
* add this in `/etc/systemd/system/mgrep-lem.service`

  ```
  [Unit]
  Description=mgrep server running on port 55557
  After=network.target
  
  [Service]
  Type=forking
  ExecStart=/opt/mgrep/mgrep --port=55557 -f /srv/ontoportal/data/mgrep/dictionary/dictionary-lem.txt -w /opt/mgrep/word_divider.txt -c /opt/mgrep/CaseFolding.txt
  StandardOutput=syslog
  StandardError=syslog
  SyslogIdentifier=mgrep-lem
  User=mgrep
  Group=ontoportal
  PermissionsStartOnly=false
  TimeoutSec=900
  TimeoutStopSec=10
  
  [Install]
  WantedBy=multi-user.target
  ```

### Files

* first stop the virtuoso in both servers
* remove the repository folder if it exist in /srv/ontoportal/data
* Do rsync between the two servers: `rsync -avzP --numeric-ids stageportal:/srv/ontoportal/data/repository /srv/ontoportal/data/repository`
* Restart the server
* Clear the cache to see it in the browser `sudo opclearcaches`

### Solr Indexation

* Reindexing the ontologies, agents and submissions from the admin page
* for property search and term search we can do
  * Execute this script in ncbo_cron `./bin/ncbo_ontology_index -a -l ./reindexing.log`

### Ontologies Report

* Regenerate it from the UI

### Outline ([agroportal.eu](http://agroportal.eu))

* <https://github.com/ontoportal-lirmm/agroportal_outline>

### Nginx

```bash
ubuntu@localhost:/etc/nginx/sites-enabled$ ls
ontologies_api.conf  ontoportal_web_ui.conf  services.agroportal.eu.conf  wiki.agroportal.eu.conf
```

---

**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)