Project:RunImporter: Difference between revisions

From MaRDI portal
Rim (talk | contribs)
No edit summary
Rim (talk | contribs)
No edit summary
 
Line 1: Line 1:
=== Overview ===
=== Overview ===


instructions for how to run the importer locally, on staging, and on the portal
This section details how to import items or test new changes to the importer locally, on the [https://staging.mardi4nfdi.org/wiki/Main_Page staging portal], and on the [https://portal.mardi4nfdi.de/wiki/Portal main portal].


=== Import Locally ===
=== Import Locally ===
Development, testing, and debugging can be done locally on a virtual machine. Instructions for setting up the VM and connecting to it can be found [https://portal.mardi4nfdi.de/wiki/Project:Docker_OpenStackVM here].
Development, testing, and debugging can be done locally on a virtual machine. Instructions for setting up the VM and connecting to it can be found [https://portal.mardi4nfdi.de/wiki/Project:Docker_OpenStackVM here].


To set up the repositories for local development:


# clone the [https://github.com/MaRDI4NFDI/portal-compose portal-compose GitHub repository] and follow the steps detailed in the ReadMe section for the installation and configuration.
# clone the [https://github.com/MaRDI4NFDI/docker-importer docker-compose GitHub repository] and follow the steps detailed in the ReadMe section to set up the configuration.


=== Import to the staging server ===
After implementing any changes to the importer:


# navigate to the portal-compose repo <code>cd portal-compose</code>
# Start the containers (if they are not already up) (which might take a while the first time)  <code>sudo docker compose up -d</code>
# Access the importer container  <code>sudo docker exec -it mardi-importer bash</code>
# Run the importer <code>python3 /mardi_importer/mardi_importer/scripts/import.py --mode <mode></code>
# If the run was successful, you should be able to load a local instance on [[localhost:8080]] in your browser. Make sure to forward the port first eg. <code>shh -L 8080:127.0.0.1:8080 user@vm_ip_address</code>
During development, if you need to pull any new changes to the portal-compose repo, you can restart your containers by following these steps:
# <code>cd portal-compose</code>
# <code>sudo docker compose down</code>
# <code>sudo docker volume prune --all</code>
# <code>sudo docker compose up -d</code>
=== Import to the staging portal ===
After local development, changes can be tested on the [https://staging.mardi4nfdi.org/wiki/Main_Page staging portal] where the rest of the team can also check them and provide feedback.
# If changes have been made to the script, they need to be pushed and merged to the [https://github.com/MaRDI4NFDI/docker-importer docker-importer] repo so that the docker image includes the changes. Make sure the commits are [https://docs.github.com/en/authentication/managing-commit-signature-verification/signing-commits signed].
# If changes have been made to the script, they need to be pushed and merged to the [https://github.com/MaRDI4NFDI/docker-importer docker-importer] repo so that the docker image includes the changes. Make sure the commits are [https://docs.github.com/en/authentication/managing-commit-signature-verification/signing-commits signed].
# Trigger the workflow on the [https://github.com/MaRDI4NFDI/srv-mardi03 mardi03 GitHub repo] (instructions are on git). (?)
# Trigger the workflow on the [https://github.com/MaRDI4NFDI/srv-mardi03 mardi03 GitHub repo] (instructions are on git). (?)
Line 19: Line 37:
#*# execute the importer script that's in <code>/mardi_importer/mardi_importer/scripts</code>
#*# execute the importer script that's in <code>/mardi_importer/mardi_importer/scripts</code>
#* '''Executing the script in [https://portainer.staging.mardi4nfdi.org/#!/auth Portainer]:'''
#* '''Executing the script in [https://portainer.staging.mardi4nfdi.org/#!/auth Portainer]:'''
#*# log in to Portainer (user: admin)
#*# log in to '''[https://portainer.staging.mardi4nfdi.org/#!/auth Portainer]''' (user: admin)
#*# Under 'Environments' click 'local' and then click 'containers' in the side panel on the left
#*# Under 'Environments' click 'local' and then click 'containers' in the side panel on the left
#*# Search for the mardi-importer container
#*# Search for the mardi-importer container
#*# If changes have been made to the code, click on "Recreate" with the option to re-pull the image, to pull the latest changes from the docker-importer repo.  
#*# If changes have been made to the code, click on "Recreate" with the option to re-pull the image, to pull the latest changes from the docker-importer repo.
#*# Click '>_ Console' and 'Connect' to access the container.
#*# Click '>_ Console' and 'Connect' to access the container.
#*# execute the importer script that's in <code>/mardi_importer/mardi_importer/scripts</code>
#*# execute the importer script that's in <code>/mardi_importer/mardi_importer/scripts</code>
Line 29: Line 47:
It is recommended to have executed a trial run involving any new changes on the staging server before uploading to the main portal. Assuming changes are already merged to the main branch on the docker-importer GitHub repo  and included in the mardi-importer container, the execution steps are similar to those above.
It is recommended to have executed a trial run involving any new changes on the staging server before uploading to the main portal. Assuming changes are already merged to the main branch on the docker-importer GitHub repo  and included in the mardi-importer container, the execution steps are similar to those above.


# Trigger the workflow on the [https://github.com/MaRDI4NFDI/srv-mardi02 mardi02 GitHub repo].
# Trigger the workflow on the [https://github.com/MaRDI4NFDI/srv-mardi02 mardi02 GitHub repo] (?).
# Execute the script on the mardi02 server:
# Execute the script on the mardi02 server:
## connect to mardi03 via ssh <code>shh mardi02</code>
## connect to mardi03 via ssh <code>shh mardi02</code>

Latest revision as of 15:26, 25 March 2025

Overview

This section details how to import items or test new changes to the importer locally, on the staging portal, and on the main portal.

Import Locally

Development, testing, and debugging can be done locally on a virtual machine. Instructions for setting up the VM and connecting to it can be found here.

To set up the repositories for local development:

  1. clone the portal-compose GitHub repository and follow the steps detailed in the ReadMe section for the installation and configuration.
  2. clone the docker-compose GitHub repository and follow the steps detailed in the ReadMe section to set up the configuration.

After implementing any changes to the importer:

  1. navigate to the portal-compose repo cd portal-compose
  2. Start the containers (if they are not already up) (which might take a while the first time) sudo docker compose up -d
  3. Access the importer container sudo docker exec -it mardi-importer bash
  4. Run the importer python3 /mardi_importer/mardi_importer/scripts/import.py --mode <mode>
  5. If the run was successful, you should be able to load a local instance on localhost:8080 in your browser. Make sure to forward the port first eg. shh -L 8080:127.0.0.1:8080 user@vm_ip_address

During development, if you need to pull any new changes to the portal-compose repo, you can restart your containers by following these steps:

  1. cd portal-compose
  2. sudo docker compose down
  3. sudo docker volume prune --all
  4. sudo docker compose up -d

Import to the staging portal

After local development, changes can be tested on the staging portal where the rest of the team can also check them and provide feedback.

  1. If changes have been made to the script, they need to be pushed and merged to the docker-importer repo so that the docker image includes the changes. Make sure the commits are signed.
  2. Trigger the workflow on the mardi03 GitHub repo (instructions are on git). (?)
  3. Execute the importer script from within the mardi-importer container. To do this, there are two options:
    • Executing the script on the mardi03 server:
      1. connect to mardi03 via ssh shh mardi03
      2. navigate to the portal-compose directory: cd portal-compose
      3. access the importer container: docker exec -it mardi-importer bash
      4. execute the importer script that's in /mardi_importer/mardi_importer/scripts
    • Executing the script in Portainer:
      1. log in to Portainer (user: admin)
      2. Under 'Environments' click 'local' and then click 'containers' in the side panel on the left
      3. Search for the mardi-importer container
      4. If changes have been made to the code, click on "Recreate" with the option to re-pull the image, to pull the latest changes from the docker-importer repo.
      5. Click '>_ Console' and 'Connect' to access the container.
      6. execute the importer script that's in /mardi_importer/mardi_importer/scripts

Import to the portal

It is recommended to have executed a trial run involving any new changes on the staging server before uploading to the main portal. Assuming changes are already merged to the main branch on the docker-importer GitHub repo and included in the mardi-importer container, the execution steps are similar to those above.

  1. Trigger the workflow on the mardi02 GitHub repo (?).
  2. Execute the script on the mardi02 server:
    1. connect to mardi03 via ssh shh mardi02
    2. navigate to the portal-compose directory: cd portal-compose
    3. access the importer container: docker exec -it mardi-importer bash
    4. execute the importer script that's in /mardi_importer/mardi_importer/scripts