diff --git a/.github/workflows/dip-upload.yml b/.github/workflows/dip-upload.yml index 920e4207..3e9b318b 100644 --- a/.github/workflows/dip-upload.yml +++ b/.github/workflows/dip-upload.yml @@ -20,133 +20,116 @@ on: jobs: test: name: "DIP upload test" - runs-on: "ubuntu-latest" + runs-on: "ubuntu-22.04" env: am_version: "${{ inputs.am_version }}" ss_version: "${{ inputs.ss_version }}" atom_version: "${{ inputs.atom_version }}" - am_vagrant_box_id: "ubuntu/jammy64" - atom_vagrant_box_id: "ubuntu/focal64" + python_version: "3.9" steps: - - name: "Check out code" + - name: "Check out the code" uses: "actions/checkout@v4" - - name: "Create Vagrant boxes directory" + - name: "Upgrade crun (supports Ubuntu's systemd in the Dockerfile)" run: | - mkdir -p /home/runner/.vagrant.d/boxes - - name: "Cache Vagrant boxes" - uses: "actions/cache@v4" - with: - path: "/home/runner/.vagrant.d/boxes" - key: "${{ runner.os }}-boxes" + wget https://github.com/containers/crun/releases/download/1.14.4/crun-1.14.4-linux-amd64 + sudo install crun-1.14.4-linux-amd64 /usr/bin/crun + rm crun-1.14.4-linux-amd64 - name: "Install Python" uses: "actions/setup-python@v5" with: - python-version: "3.9" - - name: "Install Vagrant" - run: | - wget -O- https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg - echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list - sudo apt update && sudo apt install vagrant - - name: "Install VirtualBox" - run: | - wget -O- https://www.virtualbox.org/download/oracle_vbox_2016.asc | sudo gpg --yes --output /usr/share/keyrings/oracle-virtualbox-2016.gpg --dearmor - echo "deb [arch=amd64 signed-by=/usr/share/keyrings/oracle-virtualbox-2016.gpg] https://download.virtualbox.org/virtualbox/debian jammy contrib" | sudo tee /etc/apt/sources.list.d/virtualbox.list - sudo apt update && sudo apt install virtualbox-7.0 - - name: "Downgrade VirtualBox" - run: | - sudo apt-get purge virtualbox-7.0 - wget -O /tmp/virtualbox-7.0_7.0.14-161095~Ubuntu~jammy_amd64.deb -L https://download.virtualbox.org/virtualbox/7.0.14/virtualbox-7.0_7.0.14-161095~Ubuntu~jammy_amd64.deb - sudo dpkg -i /tmp/virtualbox-7.0_7.0.14-161095~Ubuntu~jammy_amd64.deb - - name: "Install the vagrant-vbguest plugin" - run: | - vagrant plugin install vagrant-vbguest - - name: "Update the VirtualBox networks file" - run: | - sudo mkdir -p /etc/vbox/ - echo "* 192.168.33.0/24" | sudo tee -a /etc/vbox/networks.conf - - name: "Install ansible" + python-version: "${{ env.python_version }}" + cache: "pip" + cache-dependency-path: | + tests/dip-upload/requirements.txt + - name: "Cache the virtual environment" + id: "venv-cache" + uses: "actions/cache@v4" + with: + path: | + tests/dip-upload/.venv/ + key: "os-${{ runner.os }}-python_version-${{ env.python_version }}-hash-${{ hashFiles('tests/dip-upload/requirements.txt') }}" + - name: "Set up the virtual environment" + if: "steps.venv-cache.outputs.cache-hit == false" working-directory: "${{ github.workspace }}/tests/dip-upload" run: | python3 -m venv .venv - source .venv/bin/activate - python3 -m pip install ansible==8.5.0 ansible-core==2.15.5 - - name: "Start the Archivematica VM" + .venv/bin/python -m pip install -r requirements.txt + - name: "Add virtual environment to PATH" + working-directory: "${{ github.workspace }}/tests/dip-upload" + run: + echo "$PWD/.venv/bin" >> $GITHUB_PATH + - name: "Generate an SSH key and copy it next to the Dockerfile" + run: | + mkdir $HOME/.ssh + ssh-keygen -t rsa -f $HOME/.ssh/id_rsa -N "" + cp $HOME/.ssh/id_rsa.pub ${{ github.workspace }}/tests/dip-upload/ssh_pub_key + - name: "Start the Compose environment" working-directory: "${{ github.workspace }}/tests/dip-upload" - env: - VAGRANT_BOX: "${{ env.am_vagrant_box_id }}" run: | - vagrant up archivematica + podman-compose up --detach - name: "Install Archivematica" working-directory: "${{ github.workspace }}/tests/dip-upload" env: ANSIBLE_HOST_KEY_CHECKING: "False" + ANSIBLE_REMOTE_PORT: 2222 run: | - source .venv/bin/activate ansible-galaxy install -f -p roles/ -r requirements.yml - ansible-playbook -i 192.168.33.2, archivematica.yml \ - -u vagrant \ - --private-key ${{ github.workspace }}/tests/dip-upload/.vagrant/machines/archivematica/virtualbox/private_key \ + ansible-playbook -i localhost, archivematica.yml \ + -u ubuntu \ -e "archivematica_src_am_version=${{ env.am_version }} archivematica_src_ss_version=${{ env.ss_version }}" \ -v - - name: "Add the vagrant user to the archivematica group" + - name: "Add the ubuntu user to the archivematica group" working-directory: "${{ github.workspace }}/tests/dip-upload" run: | - vagrant ssh archivematica -c 'sudo usermod -a -G archivematica vagrant' + podman-compose exec --user root archivematica usermod -a -G archivematica ubuntu - name: "Get the archivematica SSH public key" id: archivematica_ssh_pub_key working-directory: "${{ github.workspace }}/tests/dip-upload" run: | - echo "key=$(vagrant ssh archivematica -c 'sudo cat /var/lib/archivematica/.ssh/id_rsa.pub')" >> $GITHUB_OUTPUT - - name: "Start the AtoM VM" - working-directory: "${{ github.workspace }}/tests/dip-upload" - env: - VAGRANT_BOX: "${{ env.atom_vagrant_box_id }}" - run: | - vagrant up atom + echo "key=$(podman-compose exec --user archivematica archivematica cat /var/lib/archivematica/.ssh/id_rsa.pub)" >> $GITHUB_OUTPUT - name: "Install AtoM" working-directory: "${{ github.workspace }}/tests/dip-upload" env: ANSIBLE_HOST_KEY_CHECKING: "False" + ANSIBLE_REMOTE_PORT: 9222 run: | - source .venv/bin/activate - ansible-playbook -i 192.168.33.3, atom.yml \ - -u vagrant \ - --private-key ${{ github.workspace }}/tests/dip-upload/.vagrant/machines/atom/virtualbox/private_key \ + ansible-playbook -i localhost, atom.yml \ + -u ubuntu \ -e "atom_repository_version=${{ env.atom_version }} archivematica_ssh_pub_key='${{ steps.archivematica_ssh_pub_key.outputs.key }}'" \ -v - name: "Call an Archivematica API endpoint" run: | curl \ --header "Authorization: ApiKey admin:this_is_the_am_api_key" \ - http://192.168.33.2/api/processing-configuration/ + http://localhost:8000/api/processing-configuration/ - name: "Call a Storage Service API endpoint" run: | curl \ --header "Authorization: ApiKey admin:this_is_the_ss_api_key" \ - http://192.168.33.2:8000/api/v2/pipeline/ + http://localhost:8001/api/v2/pipeline/ - name: "Call an AtoM API endpoint" run: | curl \ --header "REST-API-Key: this_is_the_atom_dip_upload_api_key" \ - http://192.168.33.3/index.php/api/informationobjects + http://localhost:9000/index.php/api/informationobjects - name: "Create a processing configuration for DIP upload" working-directory: "${{ github.workspace }}/tests/dip-upload" run: | - vagrant ssh archivematica -c "sudo -u archivematica cp /var/archivematica/sharedDirectory/sharedMicroServiceTasksConfigs/processingMCPConfigs/{automated,dipupload}ProcessingMCP.xml" + podman-compose exec --user archivematica archivematica cp /var/archivematica/sharedDirectory/sharedMicroServiceTasksConfigs/processingMCPConfigs/automatedProcessingMCP.xml /var/archivematica/sharedDirectory/sharedMicroServiceTasksConfigs/processingMCPConfigs/dipuploadProcessingMCP.xml - name: "Update the DIP upload processing configuration" working-directory: "${{ github.workspace }}/tests/dip-upload" run: | # Change 'Normalize for preservation' to 'Normalize for preservation and access' - vagrant ssh archivematica -c "sudo -u archivematica sed --in-place 's|612e3609-ce9a-4df6-a9a3-63d634d2d934|b93cecd4-71f2-4e28-bc39-d32fd62c5a94|g' /var/archivematica/sharedDirectory/sharedMicroServiceTasksConfigs/processingMCPConfigs/dipuploadProcessingMCP.xml" + podman-compose exec --user archivematica archivematica sed --in-place 's|612e3609-ce9a-4df6-a9a3-63d634d2d934|b93cecd4-71f2-4e28-bc39-d32fd62c5a94|g' /var/archivematica/sharedDirectory/sharedMicroServiceTasksConfigs/processingMCPConfigs/dipuploadProcessingMCP.xml # Change 'Do not upload DIP' to 'Upload DIP to AtoM/Binder' - vagrant ssh archivematica -c "sudo -u archivematica sed --in-place 's|6eb8ebe7-fab3-4e4c-b9d7-14de17625baa|0fe9842f-9519-4067-a691-8a363132ae24|g' /var/archivematica/sharedDirectory/sharedMicroServiceTasksConfigs/processingMCPConfigs/dipuploadProcessingMCP.xml" - - name: "Import Atom sample data" + podman-compose exec --user archivematica archivematica sed --in-place 's|6eb8ebe7-fab3-4e4c-b9d7-14de17625baa|0fe9842f-9519-4067-a691-8a363132ae24|g' /var/archivematica/sharedDirectory/sharedMicroServiceTasksConfigs/processingMCPConfigs/dipuploadProcessingMCP.xml + - name: "Import the Atom sample data" working-directory: "${{ github.workspace }}/tests/dip-upload" run: | - vagrant ssh atom -c "cd /usr/share/nginx/atom/ && sudo -u www-data php -d memory_limit=-1 symfony csv:import /usr/share/nginx/atom/lib/task/import/example/isad/example_information_objects_isad.csv" - vagrant ssh atom -c "cd /usr/share/nginx/atom/ && sudo -u www-data php -d memory_limit=-1 symfony propel:build-nested-set" - vagrant ssh atom -c "cd /usr/share/nginx/atom/ && sudo -u www-data php -d memory_limit=-1 symfony cc" - vagrant ssh atom -c "cd /usr/share/nginx/atom/ && sudo -u www-data php -d memory_limit=-1 symfony search:populate" + podman-compose exec --user www-data --workdir /usr/share/nginx/atom/ atom php -d memory_limit=-1 symfony csv:import /usr/share/nginx/atom/lib/task/import/example/isad/example_information_objects_isad.csv + podman-compose exec --user www-data --workdir /usr/share/nginx/atom/ atom php -d memory_limit=-1 symfony propel:build-nested-set + podman-compose exec --user www-data --workdir /usr/share/nginx/atom/ atom php -d memory_limit=-1 symfony cc + podman-compose exec --user www-data --workdir /usr/share/nginx/atom/ atom php -d memory_limit=-1 symfony search:populate - name: "Start a transfer and upload the DIP to the sample archival description" run: | curl \ @@ -154,12 +137,12 @@ jobs: --request POST \ --data "{ \ \"name\": \"dip-upload-test\", \ - \"path\": \"$(echo -n '/home/vagrant/archivematica-sampledata/SampleTransfers/DemoTransferCSV' | base64 -w 0)\", \ + \"path\": \"$(echo -n '/home/ubuntu/archivematica-sampledata/SampleTransfers/DemoTransferCSV' | base64 -w 0)\", \ \"type\": \"standard\", \ \"processing_config\": \"dipupload\", \ \"access_system_id\": \"example-item\" \ }" \ - http://192.168.33.2/api/v2beta/package + http://localhost:8000/api/v2beta/package - name: "Wait for the transfer to finish" run: | sleep 120 @@ -167,5 +150,4 @@ jobs: run: | curl \ --header "REST-API-Key: this_is_the_atom_dip_upload_api_key" \ - --silent \ - http://192.168.33.3/index.php/api/informationobjects/beihai-guanxi-china-1988 | python3 -m json.tool | grep '"parent": "example-item"' + http://localhost:9000/index.php/api/informationobjects/beihai-guanxi-china-1988 | python3 -m json.tool | grep '"parent": "example-item"' diff --git a/tests/dip-upload/.gitignore b/tests/dip-upload/.gitignore new file mode 100644 index 00000000..d5000d37 --- /dev/null +++ b/tests/dip-upload/.gitignore @@ -0,0 +1,3 @@ +ssh_pub_key +.venv +roles diff --git a/tests/dip-upload/Dockerfile b/tests/dip-upload/Dockerfile new file mode 100644 index 00000000..66aee7e3 --- /dev/null +++ b/tests/dip-upload/Dockerfile @@ -0,0 +1,19 @@ +ARG UBUNTU_VERSION=22.04 + +FROM ubuntu:${UBUNTU_VERSION} + +ENV DEBIAN_FRONTEND noninteractive + +RUN apt-get update && apt-get install -y sudo openssh-server rsync locales && apt-get clean + +RUN useradd --home-dir /home/ubuntu --system ubuntu + +COPY --chown=ubuntu:ubuntu --chmod=600 ssh_pub_key /home/ubuntu/.ssh/authorized_keys + +RUN mkdir -p /etc/sudoers.d/ && echo 'ubuntu ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers.d/ubuntu + +EXPOSE 22 +EXPOSE 80 +EXPOSE 8000 + +CMD [ "/sbin/init" ] diff --git a/tests/dip-upload/README.md b/tests/dip-upload/README.md index b40a783f..b04a96cd 100644 --- a/tests/dip-upload/README.md +++ b/tests/dip-upload/README.md @@ -2,19 +2,11 @@ ## Software requirements -- Vagrant 2.4.1 (with vagrant-vbguest plugin) -- VirtualBox 7.0 +- Podman +- crun >= 1.14.4 - Python 3 - curl -## Tested Vagrant boxes - -This playbook has been tested with Vagrant 2.4.1 and VirtualBox 7.0.14 r161095 -using any of the following Vagrant boxes and versions: - -- Archivematica: ubuntu/jammy64 (v20240403.0.0) -- AtoM: ubuntu/focal64 (v20231003.0.0) - ## Installing Ansible Create a virtual environment and activate it: @@ -24,11 +16,11 @@ python3 -m venv .venv source .venv/bin/activate ``` -Install `ansible` and `ansible-core` (these versions are compatible with +Install the Python requirements (these versions are compatible with symbolic links which are used in the the artefactual-atom role): ```shell -python3 -m pip install ansible==8.5.0 ansible-core==2.15.5 +python3 -m pip install -r requirements.txt ``` Install the playbook requirements: @@ -37,69 +29,56 @@ Install the playbook requirements: ansible-galaxy install -f -p roles/ -r requirements.yml ``` -## Setting up VirtualBox +## Starting the Compose environment -Install the `vagrant-vbguest` plugin: +Copy your SSH public key as the `ssh_pub_key` file next to the `Containerfile`: ```shell -vagrant plugin install vagrant-vbguest +cp $HOME/.ssh/id_rsa.pub ssh_pub_key ``` -Add the VMs IP network to the VirtualBox networks file: +Start the Compose services: ```shell -sudo mkdir -p /etc/vbox/ -echo "* 192.168.33.0/24" | sudo tee -a /etc/vbox/networks.conf +podman-compose up --detach ``` -## Provisioning the Archivematica VM - -Start the VM passing the `VAGRANT_BOX` environment variable with the ID of the -Ubuntu 22.04 Vagrant Cloud: - -```shell -env VAGRANT_BOX=ubuntu/jammy64 vagrant up archivematica -``` +## Installing Archivematica Run the Archivematica installation playbook: ```shell -ansible-playbook -i 192.168.33.2, archivematica.yml \ - -u vagrant \ - --private-key $PWD/.vagrant/machines/archivematica/virtualbox/private_key \ +export ANSIBLE_HOST_KEY_CHECKING=False +export ANSIBLE_REMOTE_PORT=2222 +ansible-playbook -i localhost, archivematica.yml \ + -u ubuntu \ -v ``` -Add the `vagrant` user to the `archivematica` group so it can copy AIPs +Add the `ubuntu` user to the `archivematica` group so it can copy AIPs from the shared directory: ```shell -vagrant ssh archivematica -c 'sudo usermod -a -G archivematica vagrant' +podman-compose exec --user root archivematica usermod -a -G archivematica ubuntu ``` Get the SSH public key of the `archivematica` user so we can use it when -provisioning the AtoM VM: +installing AtoM: ```shell -AM_SSH_PUB_KEY=$(vagrant ssh archivematica -c 'sudo cat /var/lib/archivematica/.ssh/id_rsa.pub') +AM_SSH_PUB_KEY=$(podman-compose exec --user archivematica archivematica cat /var/lib/archivematica/.ssh/id_rsa.pub) ``` -## Provisioning the AtoM VM - -Start the VM passing the `VAGRANT_BOX` environment variable with the ID of the -Ubuntu 20.04 Vagrant Cloud: - -```shell -env VAGRANT_BOX=ubuntu/focal64 vagrant up atom -``` +## Installing AtoM Run the AtoM installation playbook passing the `archivematica_ssh_pub_key` variable with the contents of `$AM_SSH_PUB_KEY`: ```shell -ansible-playbook -i 192.168.33.3, atom.yml \ - -u vagrant \ - --private-key $PWD/.vagrant/machines/atom/virtualbox/private_key \ +export ANSIBLE_HOST_KEY_CHECKING=False +export ANSIBLE_REMOTE_PORT=9222 +ansible-playbook -i localhost, atom.yml \ + -u ubuntu \ -e "archivematica_ssh_pub_key='$AM_SSH_PUB_KEY'" \ -v ``` @@ -109,13 +88,13 @@ ansible-playbook -i 192.168.33.3, atom.yml \ Call an Archivematica API endpoint: ```shell -curl --header "Authorization: ApiKey admin:this_is_the_am_api_key" http://192.168.33.2/api/processing-configuration/ +curl --header "Authorization: ApiKey admin:this_is_the_am_api_key" http://localhost:8000/api/processing-configuration/ ``` Call a Storage Service API endpoint: ```shell -curl --header "Authorization: ApiKey admin:this_is_the_ss_api_key" http://192.168.33.2:8000/api/v2/pipeline/ +curl --header "Authorization: ApiKey admin:this_is_the_ss_api_key" http://localhost:8001/api/v2/pipeline/ ``` ## Testing the AtoM installation @@ -123,7 +102,7 @@ curl --header "Authorization: ApiKey admin:this_is_the_ss_api_key" http://192.16 Call an AtoM API endpoint: ```shell -curl --header "REST-API-Key: this_is_the_atom_dip_upload_api_key" http://192.168.33.3/index.php/api/informationobjects +curl --header "REST-API-Key: this_is_the_atom_dip_upload_api_key" http://localhost:9000/index.php/api/informationobjects ``` ## Testing DIP upload @@ -131,25 +110,25 @@ curl --header "REST-API-Key: this_is_the_atom_dip_upload_api_key" http://192.168 Create a processing configuration for DIP upload: ```shell -vagrant ssh archivematica -c "sudo -u archivematica cp /var/archivematica/sharedDirectory/sharedMicroServiceTasksConfigs/processingMCPConfigs/{automated,dipupload}ProcessingMCP.xml" +podman-compose exec --user archivematica archivematica cp /var/archivematica/sharedDirectory/sharedMicroServiceTasksConfigs/processingMCPConfigs/automatedProcessingMCP.xml /var/archivematica/sharedDirectory/sharedMicroServiceTasksConfigs/processingMCPConfigs/dipuploadProcessingMCP.xml ``` Update the DIP upload processing configuration: ```shell # Change 'Normalize for preservation' to 'Normalize for preservation and access' -vagrant ssh archivematica -c "sudo -u archivematica sed --in-place 's|612e3609-ce9a-4df6-a9a3-63d634d2d934|b93cecd4-71f2-4e28-bc39-d32fd62c5a94|g' /var/archivematica/sharedDirectory/sharedMicroServiceTasksConfigs/processingMCPConfigs/dipuploadProcessingMCP.xml" +podman-compose exec --user archivematica archivematica sed --in-place 's|612e3609-ce9a-4df6-a9a3-63d634d2d934|b93cecd4-71f2-4e28-bc39-d32fd62c5a94|g' /var/archivematica/sharedDirectory/sharedMicroServiceTasksConfigs/processingMCPConfigs/dipuploadProcessingMCP.xml # Change 'Do not upload DIP' to 'Upload DIP to AtoM/Binder' -vagrant ssh archivematica -c "sudo -u archivematica sed --in-place 's|6eb8ebe7-fab3-4e4c-b9d7-14de17625baa|0fe9842f-9519-4067-a691-8a363132ae24|g' /var/archivematica/sharedDirectory/sharedMicroServiceTasksConfigs/processingMCPConfigs/dipuploadProcessingMCP.xml" +podman-compose exec --user archivematica archivematica sed --in-place 's|6eb8ebe7-fab3-4e4c-b9d7-14de17625baa|0fe9842f-9519-4067-a691-8a363132ae24|g' /var/archivematica/sharedDirectory/sharedMicroServiceTasksConfigs/processingMCPConfigs/dipuploadProcessingMCP.xml ``` -Import Atom sample data: +Import the Atom sample data: ```shell -vagrant ssh atom -c "cd /usr/share/nginx/atom/ && sudo -u www-data php -d memory_limit=-1 symfony csv:import /usr/share/nginx/atom/lib/task/import/example/isad/example_information_objects_isad.csv" -vagrant ssh atom -c "cd /usr/share/nginx/atom/ && sudo -u www-data php -d memory_limit=-1 symfony propel:build-nested-set" -vagrant ssh atom -c "cd /usr/share/nginx/atom/ && sudo -u www-data php -d memory_limit=-1 symfony cc" -vagrant ssh atom -c "cd /usr/share/nginx/atom/ && sudo -u www-data php -d memory_limit=-1 symfony search:populate" +podman-compose exec --user www-data --workdir /usr/share/nginx/atom/ atom php -d memory_limit=-1 symfony csv:import /usr/share/nginx/atom/lib/task/import/example/isad/example_information_objects_isad.csv +podman-compose exec --user www-data --workdir /usr/share/nginx/atom/ atom php -d memory_limit=-1 symfony propel:build-nested-set +podman-compose exec --user www-data --workdir /usr/share/nginx/atom/ atom php -d memory_limit=-1 symfony cc +podman-compose exec --user www-data --workdir /usr/share/nginx/atom/ atom php -d memory_limit=-1 symfony search:populate ``` Start a transfer and upload the DIP to the sample archival description: @@ -160,12 +139,12 @@ curl \ --request POST \ --data "{ \ \"name\": \"dip-upload-test\", \ - \"path\": \"$(echo -n '/home/vagrant/archivematica-sampledata/SampleTransfers/DemoTransferCSV' | base64 -w 0)\", \ + \"path\": \"$(echo -n '/home/ubuntu/archivematica-sampledata/SampleTransfers/DemoTransferCSV' | base64 -w 0)\", \ \"type\": \"standard\", \ \"processing_config\": \"dipupload\", \ \"access_system_id\": \"example-item\" \ }" \ - http://192.168.33.2/api/v2beta/package + http://localhost:8000/api/v2beta/package ``` Wait for the transfer to finish: @@ -180,5 +159,5 @@ Verify a digital object was uploaded and attached to the sample archival descrip curl \ --header "REST-API-Key: this_is_the_atom_dip_upload_api_key" \ --silent \ - http://192.168.33.3/index.php/api/informationobjects/beihai-guanxi-china-1988 | python3 -m json.tool | grep '"parent": "example-item"' + http://localhost:9000/index.php/api/informationobjects/beihai-guanxi-china-1988 | python3 -m json.tool | grep '"parent": "example-item"' ``` diff --git a/tests/dip-upload/Vagrantfile b/tests/dip-upload/Vagrantfile deleted file mode 100644 index 2480cfe1..00000000 --- a/tests/dip-upload/Vagrantfile +++ /dev/null @@ -1,64 +0,0 @@ -# -*- mode: ruby -*- -# vi: set ft=ruby : - -Vagrant.configure(2) do |config| - - # Detect the Vagrant Cloud box ID from environment variables. - config.vm.box = ENV.fetch("VAGRANT_BOX", "ubuntu/jammy64") - - # Set VM specifications. - config.vm.provider "virtualbox" do |vb| - vb.memory = "8192" - vb.cpus = "2" - if ENV.fetch("VAGRANT_BOX", "").include? "rockylinux/" - vb.customize ["modifyvm", :id, "--firmware", "efi64"] - end - end - - # Turn off the default synced folder. - config.vm.synced_folder ".", "/vagrant", disabled: true - - config.vm.define "archivematica" do |archivematica| - # Set a fixed IP address. - archivematica.vm.network "private_network", ip: "192.168.33.2" - end - - config.vm.define "atom" do |atom| - # Set a fixed IP address. - atom.vm.network "private_network", ip: "192.168.33.3" - end - - # VirtualBox Guest Additions are not needed for installing Archivematica. - # This requires the vagrant-vbguest plugin to be installed, but it works - # accross all the supported Vagrant boxes. - config.vbguest.auto_update = false - - # The disk on these boxes has less than 40GB which might be insufficient for - # running some of the larger feature files of the acceptance tests. - # This resizes it (and its root partition) to 40GB. - if ENV.fetch("VAGRANT_BOX", "").start_with?("rockylinux/", "almalinux/") - config.vm.disk :disk, size: "40GB", primary: true - config.vm.provision "shell", inline: $resize_root_filesystem - end - - # The almalinux/9 box only comes with the C.UTF-8 locale but Archivematica - # services use the en_US.UTF-8 locale, so this installs it. - if ENV.fetch("VAGRANT_BOX", "").start_with?("almalinux/") - config.vm.provision "shell", inline: "yum install -y glibc-langpack-en" - end - -end - -$resize_root_filesystem = <<-SCRIPT -# The root partition has the highest number in the disk. -export ROOT_PARTITION=$(grep -c "sda[0-9]" /proc/partitions) - -# Resize the root partition. -echo "- +" | sudo sfdisk --no-reread -N "${ROOT_PARTITION}" /dev/sda - -# Read the new partition table. -sudo partprobe - -# Resize the filesystem in the root partition. -sudo xfs_growfs "/dev/sda${ROOT_PARTITION}" -SCRIPT diff --git a/tests/dip-upload/archivematica-vars.yml b/tests/dip-upload/archivematica-vars.yml index 617a7cd8..62992b4f 100644 --- a/tests/dip-upload/archivematica-vars.yml +++ b/tests/dip-upload/archivematica-vars.yml @@ -9,12 +9,12 @@ archivematica_src_configure_am_user: "admin" archivematica_src_configure_am_password: "archivematica" archivematica_src_configure_am_email: "admin@example.com" archivematica_src_configure_am_api_key: "this_is_the_am_api_key" -archivematica_src_configure_am_site_url: "http://192.168.33.2" +archivematica_src_configure_am_site_url: "http://archivematica" archivematica_src_configure_ss_user: "admin" archivematica_src_configure_ss_password: "archivematica" archivematica_src_configure_ss_api_key: "this_is_the_ss_api_key" -archivematica_src_configure_ss_url: "http://192.168.33.2:8000" +archivematica_src_configure_ss_url: "http://archivematica:8000" archivematica_src_configure_ss_email: "admin@example.com" archivematica_src_am_db_password: "aaGKHyMls.20ki$" @@ -85,8 +85,8 @@ archivematica_src_configure_fprule: # Instead, these custom settings are populated in the post tasks of the # Archivematica provisioning playbook. custom_archivematica_src_configure_dashboardsettings: - url: "http://192.168.33.3" - rsync_target: "192.168.33.3:/home/archivematica/atom_sword_deposit" + url: "http://atom" + rsync_target: "atom:/home/archivematica/atom_sword_deposit" email: "dip_upload@example.com" password: "dip_upload@example.com" key: "this_is_the_atom_dip_upload_api_key" diff --git a/tests/dip-upload/compose.yaml b/tests/dip-upload/compose.yaml new file mode 100644 index 00000000..08e2c08d --- /dev/null +++ b/tests/dip-upload/compose.yaml @@ -0,0 +1,23 @@ +--- +name: dip-upload-test + +services: + + archivematica: + build: + args: + UBUNTU_VERSION: "22.04" + ports: + - "2222:22" + - "8000:80" + - "8001:8000" + + atom: + build: + args: + UBUNTU_VERSION: "20.04" + ports: + - "9222:22" + - "9000:80" + links: + - "archivematica" diff --git a/tests/dip-upload/requirements.txt b/tests/dip-upload/requirements.txt new file mode 100644 index 00000000..7b2ecd66 --- /dev/null +++ b/tests/dip-upload/requirements.txt @@ -0,0 +1,3 @@ +ansible==8.5.0 +ansible-core==2.15.5 +git+https://github.com/containers/podman-compose.git@2681566580b4eaadfc5e6000ad19e49e56006e2b#egg=podman-compose