diff --git a/.github/workflows/build-deb-package.yml b/.github/workflows/build-deb-package.yml index 57ee24a71..aaac94502 100644 --- a/.github/workflows/build-deb-package.yml +++ b/.github/workflows/build-deb-package.yml @@ -3,10 +3,22 @@ on: push jobs: - build_deb_debian_11: - name: "Build Debian Package" + build_deb: + name: "Build ${{ matrix.os }} Package" runs-on: ubuntu-latest - + strategy: + matrix: + os: ["debian-11", "debian-12", "ubuntu-22.04"] + include: + - os: "debian-11" + make_target: "all-podman-debian-11" + artifact_name: "aleph-vm.debian-11.deb" + - os: "debian-12" + make_target: "all-podman-debian-12" + artifact_name: "aleph-vm.debian-12.deb" + - os: "ubuntu-22.04" + make_target: "all-podman-ubuntu-2204" + artifact_name: "aleph-vm.ubuntu-22.04.deb" steps: - name: Checkout repository uses: actions/checkout@v4 @@ -15,79 +27,25 @@ jobs: fetch-depth: 0 - run: | - cd packaging && make all-podman-debian-11 && cd .. + cd packaging && make ${{ matrix.make_target }} && cd .. ls packaging/target - uses: actions/upload-artifact@v3 with: - name: aleph-vm.debian-11.deb - path: packaging/target/aleph-vm.debian-11.deb + name: ${{ matrix.artifact_name }} + path: packaging/target/${{ matrix.artifact_name }} - build_deb_debian_12: - name: "Build Debian Package" + build_rootfs: + name: "Build runtime aleph-${{ matrix.os }}-python" runs-on: ubuntu-latest - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - # Fetch the whole history for all tags and branches (required for aleph.__version__) - fetch-depth: 0 - - - run: | - cd packaging && make all-podman-debian-12 && cd .. - ls packaging/target - - - uses: actions/upload-artifact@v3 - with: - name: aleph-vm.debian-12.deb - path: packaging/target/aleph-vm.debian-12.deb - - build_deb_ubuntu_22_04: - name: "Build Ubuntu Package" - runs-on: ubuntu-latest - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - # Fetch the whole history for all tags and branches (required for aleph.__version__) - fetch-depth: 0 - - - run: | - cd packaging && make all-podman-ubuntu-2204 && cd .. - ls packaging/target - - - uses: actions/upload-artifact@v3 - with: - name: aleph-vm.ubuntu-22.04.deb - path: packaging/target/aleph-vm.ubuntu-22.04.deb - - build_rootfs_debian_11: - name: "Build runtime aleph-debian-11-python" - runs-on: ubuntu-latest - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Workaround github issue https://github.com/actions/runner-images/issues/7192 - run: sudo echo RESET grub-efi/install_devices | sudo debconf-communicate grub-pc - - - run: | - sudo apt update - sudo apt install -y debootstrap - cd runtimes/aleph-debian-11-python && sudo ./create_disk_image.sh && cd ../.. - - - uses: actions/upload-artifact@v3 - with: - name: aleph-debian-11-python.squashfs - path: runtimes/aleph-debian-11-python/rootfs.squashfs - - build_rootfs_debian_12: - name: "Build runtime aleph-debian-12-python" - runs-on: ubuntu-latest - + strategy: + matrix: + os: ["debian-11", "debian-12"] + include: + - os: "debian-11" + artifact_name: "aleph-debian-11-python.squashfs" + - os: "debian-12" + artifact_name: "aleph-debian-12-python.squashfs" steps: - name: Checkout repository uses: actions/checkout@v4 @@ -98,17 +56,16 @@ jobs: - run: | sudo apt update sudo apt install -y debootstrap - cd runtimes/aleph-debian-12-python && sudo ./create_disk_image.sh && cd ../.. + cd runtimes/aleph-${{ matrix.os }}-python && sudo ./create_disk_image.sh && cd ../.. - uses: actions/upload-artifact@v3 with: - name: aleph-debian-12-python.squashfs - path: runtimes/aleph-debian-12-python/rootfs.squashfs + name: ${{ matrix.artifact_name }} + path: runtimes/aleph-${{ matrix.os }}-python/rootfs.squashfs build_example_venv_volume: name: "Build example squashfs volume using Docker" runs-on: ubuntu-latest - steps: - name: Checkout repository uses: actions/checkout@v4 diff --git a/.github/workflows/test-new-runtime-examples.yml b/.github/workflows/test-new-runtime-examples.yml index 3b2982577..cd0df6978 100644 --- a/.github/workflows/test-new-runtime-examples.yml +++ b/.github/workflows/test-new-runtime-examples.yml @@ -36,11 +36,11 @@ jobs: run: | doctl compute droplet create \ --image debian-12-x64 \ - --size c-2 \ - --region fra1 \ - --vpc-uuid 992896c8-c089-4da3-9288-f81e28c095a4 \ + --size c-4 \ + --region ams3 \ + --vpc-uuid 5976b7bd-4417-49e8-8522-672aaa920c30 \ --enable-ipv6 \ - --ssh-keys b3:ff:08:7f:57:00:fd:7a:14:00:f2:35:0a:f6:e8:55 \ + --ssh-keys ab:2b:25:16:46:6f:25:d0:80:63:e5:be:67:04:cb:64 \ aleph-vm-ci-runtime - name: "Build custom runtime" diff --git a/.github/workflows/test-on-droplet-debian-11.yml b/.github/workflows/test-on-droplet-debian-11.yml deleted file mode 100644 index 3dc052c84..000000000 --- a/.github/workflows/test-on-droplet-debian-11.yml +++ /dev/null @@ -1,88 +0,0 @@ -name: "Test DigitalOcean Droplet Bullseye" -on: - push - -jobs: - run_debian_11: - name: "Run in DigitalOcean Droplet with Debian 11" - runs-on: ubuntu-latest - concurrency: droplet-aleph-vm-debian-11 - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - # Fetch the whole history for all tags and branches (required for aleph.__version__) - fetch-depth: 0 - - - name: Install doctl - uses: digitalocean/action-doctl@v2 - with: - token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }} - - - name: Setup SSH private key - run: | - mkdir ~/.ssh - echo $DIGITALOCEAN_SSH_PRIVATE_KEY | base64 --decode > ~/.ssh/id_ed25519 - chmod 0700 ~/.ssh - chmod 0600 ~/.ssh/id_ed25519 - env: - DIGITALOCEAN_SSH_PRIVATE_KEY: ${{ secrets.DIGITALOCEAN_SSH_PRIVATE_KEY }} - - - name: Create the Droplet - run: | - doctl compute droplet create \ - --image debian-11-x64 \ - --size c-2 \ - --region fra1 \ - --vpc-uuid 992896c8-c089-4da3-9288-f81e28c095a4 \ - --enable-ipv6 \ - --ssh-keys b3:ff:08:7f:57:00:fd:7a:14:00:f2:35:0a:f6:e8:55 \ - aleph-vm-ci-debian-11 - - - name: Build Debian Package - run: | - cd packaging && make all-podman-debian-11 && cd .. - ls packaging/target - - - name: Wait for the system to setup and boot - run: | - export DROPLET_IPV4="$(doctl compute droplet get aleph-vm-ci-debian-11 --output json | ./.github/scripts/extract_droplet_ipv4.py)" - until ssh-keyscan -H ${DROPLET_IPV4}; do sleep 1; done - - - name: Install Aleph-VM on the Droplet - run: | - export DROPLET_IPV4="$(doctl compute droplet get aleph-vm-ci-debian-11 --output json | ./.github/scripts/extract_droplet_ipv4.py)" - ssh-keyscan -H ${DROPLET_IPV4} > ~/.ssh/known_hosts - - ssh root@${DROPLET_IPV4} DEBIAN_FRONTEND=noninteractive "apt-get update" - ssh root@${DROPLET_IPV4} DEBIAN_FRONTEND=noninteractive "apt-get upgrade -y" - ssh root@${DROPLET_IPV4} DEBIAN_FRONTEND=noninteractive "apt-get install -y docker.io apparmor-profiles" - ssh root@${DROPLET_IPV4} "docker run -d -p 127.0.0.1:4021:4021/tcp --restart=always --name vm-connector alephim/vm-connector:alpha" - - scp packaging/target/aleph-vm.debian-11.deb root@${DROPLET_IPV4}:/opt - ssh root@${DROPLET_IPV4} DEBIAN_FRONTEND=noninteractive "apt install -y /opt/aleph-vm.debian-11.deb" - ssh root@${DROPLET_IPV4} "echo ALEPH_VM_SUPERVISOR_HOST=0.0.0.0 >> /etc/aleph-vm/supervisor.env" - ssh root@${DROPLET_IPV4} "echo ALEPH_VM_ALLOCATION_TOKEN_HASH=9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08 >> /etc/aleph-vm/supervisor.env" - ssh root@${DROPLET_IPV4} "systemctl restart aleph-vm-supervisor" - - - name: Test Aleph-VM on the Droplet - run: | - export DROPLET_IPV4="$(doctl compute droplet get aleph-vm-ci-debian-11 --output json | ./.github/scripts/extract_droplet_ipv4.py)" - - sleep 3 - curl --retry 5 --max-time 10 --fail "http://${DROPLET_IPV4}:4020/about/usage/system" - curl --retry 5 --max-time 10 --fail "http://${DROPLET_IPV4}:4020/status/check/fastapi" - - - name: Schedule an instance on the Droplet by faking a call from the scheduler - run: | - export DROPLET_IPV4="$(doctl compute droplet get aleph-vm-ci-debian-11 --output json | ./.github/scripts/extract_droplet_ipv4.py)" - curl --retry 5 --max-time 10 --fail -X POST -H "Content-Type: application/json" \ - -H "X-Auth-Signature: test" \ - -d '{"persistent_vms": [], "instances": ["67705389842a0a1b95eaa408b009741027964edc805997475e95c505d642edd8"]}' \ - "http://${DROPLET_IPV4}:4020/control/allocations" - - - name: Cleanup - if: always() - run: | - doctl compute droplet delete -f aleph-vm-ci-debian-11 diff --git a/.github/workflows/test-on-droplet-debian-12.yml b/.github/workflows/test-on-droplet-debian-12.yml deleted file mode 100644 index 0d59003b9..000000000 --- a/.github/workflows/test-on-droplet-debian-12.yml +++ /dev/null @@ -1,88 +0,0 @@ -name: "Test on DigitalOcean Droplet Bookworm" -on: - push - -jobs: - run_debian_12: - name: "Run in DigitalOcean Droplet with Debian 12" - runs-on: ubuntu-latest - concurrency: droplet-aleph-vm-debian-12 - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - # Fetch the whole history for all tags and branches (required for aleph.__version__) - fetch-depth: 0 - - - name: Install doctl - uses: digitalocean/action-doctl@v2 - with: - token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }} - - - name: Setup SSH private key - run: | - mkdir ~/.ssh - echo $DIGITALOCEAN_SSH_PRIVATE_KEY | base64 --decode > ~/.ssh/id_ed25519 - chmod 0700 ~/.ssh - chmod 0600 ~/.ssh/id_ed25519 - env: - DIGITALOCEAN_SSH_PRIVATE_KEY: ${{ secrets.DIGITALOCEAN_SSH_PRIVATE_KEY }} - - - name: Create the Droplet - run: | - doctl compute droplet create \ - --image debian-12-x64 \ - --size c-2 \ - --region fra1 \ - --vpc-uuid 992896c8-c089-4da3-9288-f81e28c095a4 \ - --enable-ipv6 \ - --ssh-keys b3:ff:08:7f:57:00:fd:7a:14:00:f2:35:0a:f6:e8:55 \ - aleph-vm-ci-debian-12 - - - name: Build Debian Package - run: | - cd packaging && make all-podman-debian-12 && cd .. - ls packaging/target - - - name: Wait for the system to setup and boot - run: | - export DROPLET_IPV4="$(doctl compute droplet get aleph-vm-ci-debian-12 --output json | ./.github/scripts/extract_droplet_ipv4.py)" - until ssh-keyscan -H ${DROPLET_IPV4}; do sleep 1; done - - - name: Install Aleph-VM on the Droplet - run: | - export DROPLET_IPV4="$(doctl compute droplet get aleph-vm-ci-debian-12 --output json | ./.github/scripts/extract_droplet_ipv4.py)" - ssh-keyscan -H ${DROPLET_IPV4} > ~/.ssh/known_hosts - - ssh root@${DROPLET_IPV4} DEBIAN_FRONTEND=noninteractive "apt-get update" - ssh root@${DROPLET_IPV4} DEBIAN_FRONTEND=noninteractive "apt-get upgrade -y" - ssh root@${DROPLET_IPV4} DEBIAN_FRONTEND=noninteractive "apt-get install -y docker.io apparmor-profiles" - ssh root@${DROPLET_IPV4} "docker run -d -p 127.0.0.1:4021:4021/tcp --restart=always --name vm-connector alephim/vm-connector:alpha" - - scp packaging/target/aleph-vm.debian-12.deb root@${DROPLET_IPV4}:/opt - ssh root@${DROPLET_IPV4} DEBIAN_FRONTEND=noninteractive "apt install -y /opt/aleph-vm.debian-12.deb" - ssh root@${DROPLET_IPV4} "echo ALEPH_VM_SUPERVISOR_HOST=0.0.0.0 >> /etc/aleph-vm/supervisor.env" - ssh root@${DROPLET_IPV4} "echo ALEPH_VM_ALLOCATION_TOKEN_HASH=9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08 >> /etc/aleph-vm/supervisor.env" - ssh root@${DROPLET_IPV4} "systemctl restart aleph-vm-supervisor" - - - name: Test Aleph-VM on the Droplet - run: | - export DROPLET_IPV4="$(doctl compute droplet get aleph-vm-ci-debian-12 --output json | ./.github/scripts/extract_droplet_ipv4.py)" - - sleep 3 - curl --retry 5 --max-time 10 --fail "http://${DROPLET_IPV4}:4020/about/usage/system" - curl --retry 5 --max-time 10 --fail "http://${DROPLET_IPV4}:4020/status/check/fastapi" - - - name: Schedule an instance on the Droplet by faking a call from the scheduler - run: | - export DROPLET_IPV4="$(doctl compute droplet get aleph-vm-ci-debian-12 --output json | ./.github/scripts/extract_droplet_ipv4.py)" - curl --retry 5 --max-time 10 --fail -X POST -H "Content-Type: application/json" \ - -H "X-Auth-Signature: test" \ - -d '{"persistent_vms": [], "instances": ["67705389842a0a1b95eaa408b009741027964edc805997475e95c505d642edd8"]}' \ - "http://${DROPLET_IPV4}:4020/control/allocations" - - - name: Cleanup - if: always() - run: | - doctl compute droplet delete -f aleph-vm-ci-debian-12 diff --git a/.github/workflows/test-on-droplet-ubuntu-22.04.yml b/.github/workflows/test-on-droplet-ubuntu-22.04.yml deleted file mode 100644 index 622b1db10..000000000 --- a/.github/workflows/test-on-droplet-ubuntu-22.04.yml +++ /dev/null @@ -1,90 +0,0 @@ -name: "Test on DigitalOcean Droplet Jammy" -on: - push - -jobs: - run_ubuntu_22_04: - name: "Run in DigitalOcean Droplet with Ubuntu 22.04" - runs-on: ubuntu-latest - concurrency: droplet-aleph-vm-ubuntu-22-04 - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - # Fetch the whole history for all tags and branches (required for aleph.__version__) - fetch-depth: 0 - - - name: Install doctl - uses: digitalocean/action-doctl@v2 - with: - token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }} - - - name: Setup SSH private key - run: | - mkdir ~/.ssh - echo $DIGITALOCEAN_SSH_PRIVATE_KEY | base64 --decode > ~/.ssh/id_ed25519 - chmod 0700 ~/.ssh - chmod 0600 ~/.ssh/id_ed25519 - env: - DIGITALOCEAN_SSH_PRIVATE_KEY: ${{ secrets.DIGITALOCEAN_SSH_PRIVATE_KEY }} - - - name: Create the Droplet - run: | - doctl compute droplet create \ - --image ubuntu-22-04-x64 \ - --size c-4 \ - --region fra1 \ - --vpc-uuid 992896c8-c089-4da3-9288-f81e28c095a4 \ - --enable-ipv6 \ - --ssh-keys b3:ff:08:7f:57:00:fd:7a:14:00:f2:35:0a:f6:e8:55 \ - aleph-vm-ci-ubuntu-22-04 - - - name: Build Ubuntu Package - run: | - cd packaging && make all-podman-ubuntu-2204 && cd .. - ls packaging/target - - - name: Wait for the system to setup and boot - run: | - export DROPLET_IPV4="$(doctl compute droplet get aleph-vm-ci-ubuntu-22-04 --output json | ./.github/scripts/extract_droplet_ipv4.py)" - until ssh-keyscan -H ${DROPLET_IPV4}; do sleep 1; done - - - name: Install Aleph-VM on the Droplet - run: | - export DROPLET_IPV4="$(doctl compute droplet get aleph-vm-ci-ubuntu-22-04 --output json | ./.github/scripts/extract_droplet_ipv4.py)" - ssh-keyscan -H ${DROPLET_IPV4} > ~/.ssh/known_hosts - - # Ubuntu droplets run upgrades at boot, which locks apt-get - sleep 30 - until ssh root@${DROPLET_IPV4} "apt-get update" > /dev/null; do sleep 1; echo "Waiting for apt/dpkg lock..."; done - until ssh root@${DROPLET_IPV4} DEBIAN_FRONTEND=noninteractive "apt-get upgrade -y" > /dev/null; do sleep 1; echo "Waiting for apt/dpkg lock..."; done - until ssh root@${DROPLET_IPV4} DEBIAN_FRONTEND=noninteractive "apt-get install -y docker.io apparmor-profiles" > /dev/null; do sleep 1; echo "Waiting for apt/dpkg lock..."; done - ssh root@${DROPLET_IPV4} "docker run -d -p 127.0.0.1:4021:4021/tcp --restart=always --name vm-connector alephim/vm-connector:alpha" - - scp packaging/target/aleph-vm.ubuntu-22.04.deb root@${DROPLET_IPV4}:/opt - ssh root@${DROPLET_IPV4} DEBIAN_FRONTEND=noninteractive "apt install -y /opt/aleph-vm.ubuntu-22.04.deb" - ssh root@${DROPLET_IPV4} "echo ALEPH_VM_SUPERVISOR_HOST=0.0.0.0 >> /etc/aleph-vm/supervisor.env" - ssh root@${DROPLET_IPV4} "echo ALEPH_VM_ALLOCATION_TOKEN_HASH=9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08 >> /etc/aleph-vm/supervisor.env" - ssh root@${DROPLET_IPV4} "systemctl restart aleph-vm-supervisor" - - - name: Test Aleph-VM on the Droplet - run: | - export DROPLET_IPV4="$(doctl compute droplet get aleph-vm-ci-ubuntu-22-04 --output json | ./.github/scripts/extract_droplet_ipv4.py)" - - sleep 3 - curl --retry 5 --max-time 10 --fail "http://${DROPLET_IPV4}:4020/about/usage/system" - curl --retry 5 --max-time 10 --fail "http://${DROPLET_IPV4}:4020/status/check/fastapi" - - - name: Schedule an instance on the Droplet by faking a call from the scheduler - run: | - export DROPLET_IPV4="$(doctl compute droplet get aleph-vm-ci-ubuntu-22-04 --output json | ./.github/scripts/extract_droplet_ipv4.py)" - curl --retry 5 --max-time 10 --fail -X POST -H "Content-Type: application/json" \ - -H "X-Auth-Signature: test" \ - -d '{"persistent_vms": [], "instances": ["67705389842a0a1b95eaa408b009741027964edc805997475e95c505d642edd8"]}' \ - "http://${DROPLET_IPV4}:4020/control/allocations" - - - name: Cleanup - if: always() - run: | - doctl compute droplet delete -f aleph-vm-ci-ubuntu-22-04 diff --git a/.github/workflows/test-on-droplets-matrix.yml b/.github/workflows/test-on-droplets-matrix.yml new file mode 100644 index 000000000..5b9af4259 --- /dev/null +++ b/.github/workflows/test-on-droplets-matrix.yml @@ -0,0 +1,131 @@ +name: "Test on DigitalOcean Droplets" + +on: + push + +jobs: + run_on_droplet: + name: "Test Droplet with ${{ matrix.os_config.os_name }}-${{ matrix.check_vm.alias }}" + runs-on: ubuntu-latest + concurrency: "${{ matrix.os_config.concurrency_group }}-${{ matrix.check_vm.alias }}" + timeout-minutes: 10 + + strategy: + matrix: + + # Check compatibility with all supported OSes. + os_config: + - os_name: "Debian 11" + os_image: "debian-11-x64" + alias: "debian-11" + package_build_command: "all-podman-debian-11" + package_name: "aleph-vm.debian-11.deb" + concurrency_group: "droplet-aleph-vm-debian-11" + + - os_name: "Debian 12" + os_image: "debian-12-x64" + alias: "debian-12" + package_build_command: "all-podman-debian-12" + package_name: "aleph-vm.debian-12.deb" + concurrency_group: "droplet-aleph-vm-debian-12" + + - os_name: "Ubuntu 22.04" + os_image: "ubuntu-22-04-x64" + alias: "ubuntu-22-04" + package_build_command: "all-podman-ubuntu-2204" + package_name: "aleph-vm.ubuntu-22.04.deb" + concurrency_group: "droplet-aleph-vm-ubuntu-22-04" + + # Check compatibility with all supported runtimes. + check_vm: + - alias: "runtime-6770" # Old runtime, using Debian 11 + item_hash: "67705389842a0a1b95eaa408b009741027964edc805997475e95c505d642edd8" + query_params: "?retro-compatibility=true" + - alias: "runtime-3fc0" # New runtime, using Debian 12 + item_hash: "3fc0aa9569da840c43e7bd2033c3c580abb46b007527d6d20f2d4e98e867f7af" + query_params: "" + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Install doctl + uses: digitalocean/action-doctl@v2 + with: + token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }} + + - name: Setup SSH private key + run: | + mkdir ~/.ssh + echo $DIGITALOCEAN_SSH_PRIVATE_KEY | base64 --decode > ~/.ssh/id_ed25519 + chmod 0700 ~/.ssh + chmod 0600 ~/.ssh/id_ed25519 + env: + DIGITALOCEAN_SSH_PRIVATE_KEY: ${{ secrets.DIGITALOCEAN_SSH_PRIVATE_KEY }} + + - name: Create the Droplet + run: | + doctl compute droplet create \ + --image ${{ matrix.os_config.os_image }} \ + --size c-4 \ + --region ams3 \ + --vpc-uuid 5976b7bd-4417-49e8-8522-672aaa920c30 \ + --enable-ipv6 \ + --ssh-keys ab:2b:25:16:46:6f:25:d0:80:63:e5:be:67:04:cb:64 \ + aleph-vm-ci-${{ matrix.os_config.alias }}-${{ matrix.check_vm.alias }} + + - name: Build Package + run: | + echo ALEPH_VM_SUPERVISOR_HOST=0.0.0.0 >> packaging/aleph-vm/etc/aleph-vm/supervisor.env + echo ALEPH_VM_ALLOCATION_TOKEN_HASH=9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08 >> packaging/aleph-vm/etc/aleph-vm/supervisor.env + echo ALEPH_VM_CHECK_FASTAPI_VM_ID=${{ matrix.check_vm.item_hash }} >> packaging/aleph-vm/etc/aleph-vm/supervisor.env + echo ALEPH_VM_SENTRY_DSN=${{ secrets.SENTRY_DSN }} >> packaging/aleph-vm/etc/aleph-vm/supervisor.env + cd packaging && make ${{ matrix.os_config.package_build_command }} && cd .. + ls packaging/target + + - name: Wait for the system to setup and boot + run: | + export DROPLET_IPV4="$(doctl compute droplet get aleph-vm-ci-${{ matrix.os_config.alias }}-${{ matrix.check_vm.alias }} --output json | ./.github/scripts/extract_droplet_ipv4.py)" + until ssh-keyscan -H ${DROPLET_IPV4}; do sleep 1; done + timeout-minutes: 3 + + - name: Install Aleph-VM on the Droplet + run: | + export DROPLET_IPV4="$(doctl compute droplet get aleph-vm-ci-${{ matrix.os_config.alias }}-${{ matrix.check_vm.alias }} --output json | ./.github/scripts/extract_droplet_ipv4.py)" + ssh-keyscan -H ${DROPLET_IPV4} > ~/.ssh/known_hosts + + ssh root@${DROPLET_IPV4} DEBIAN_FRONTEND=noninteractive "apt-get update" + ssh root@${DROPLET_IPV4} DEBIAN_FRONTEND=noninteractive "apt-get upgrade -y" + ssh root@${DROPLET_IPV4} DEBIAN_FRONTEND=noninteractive "apt-get install -y docker.io apparmor-profiles" + ssh root@${DROPLET_IPV4} "docker run -d -p 127.0.0.1:4021:4021/tcp --restart=always --name vm-connector alephim/vm-connector:alpha" + + scp packaging/target/${{ matrix.os_config.package_name }} root@${DROPLET_IPV4}:/opt + ssh root@${DROPLET_IPV4} DEBIAN_FRONTEND=noninteractive "apt install -y /opt/${{ matrix.os_config.package_name }}" + + # Allow some time for IPFS Kubo to start + sleep 5 + + - name: Test Aleph-VM on the Droplet + id: test-aleph-vm + if: always() + continue-on-error: true + run: | + export DROPLET_IPV4="$(doctl compute droplet get aleph-vm-ci-${{ matrix.os_config.alias }}-${{ matrix.check_vm.alias }} --output json | ./.github/scripts/extract_droplet_ipv4.py)" + + curl --retry 5 --max-time 10 --fail "http://${DROPLET_IPV4}:4020/about/usage/system" + curl --retry 5 --max-time 10 --fail "http://${DROPLET_IPV4}:4020/status/check/fastapi${{ matrix.check_vm.query_params }}" + + - name: Schedule an instance on the Droplet by faking a call from the scheduler + run: | + export DROPLET_IPV4="$(doctl compute droplet get aleph-vm-ci-${{ matrix.os_config.alias }}-${{ matrix.check_vm.alias }} --output json | ./.github/scripts/extract_droplet_ipv4.py)" + curl --retry 5 --max-time 10 --fail -X POST -H "Content-Type: application/json" \ + -H "X-Auth-Signature: test" \ + -d '{"persistent_vms": [], "instances": ["67705389842a0a1b95eaa408b009741027964edc805997475e95c505d642edd8"]}' \ + "http://${DROPLET_IPV4}:4020/control/allocations" + + - name: Cleanup + if: always() + run: | + doctl compute droplet delete -f aleph-vm-ci-${{ matrix.os_config.alias }}-${{ matrix.check_vm.alias }} diff --git a/vm_supervisor/views/__init__.py b/vm_supervisor/views/__init__.py index fd60df618..a60327d95 100644 --- a/vm_supervisor/views/__init__.py +++ b/vm_supervisor/views/__init__.py @@ -146,21 +146,30 @@ async def index(request: web.Request): async def status_check_fastapi(request: web.Request): + retro_compatibility: bool = ( + request.rel_url.query.get("retro-compatibility", "false") == "true" + ) + async with aiohttp.ClientSession() as session: result = { "index": await status.check_index(session), - # TODO: lifespan is a new feature that requires a new runtime to be deployed - "lifespan": await status.check_lifespan(session), "environ": await status.check_environ(session), "messages": await status.check_messages(session), "dns": await status.check_dns(session), "ipv4": await status.check_ipv4(session), - # "ipv6": await status.check_ipv6(session), "internet": await status.check_internet(session), "cache": await status.check_cache(session), "persistent_storage": await status.check_persistent_storage(session), "error_handling": await status.check_error_raised(session), } + if not retro_compatibility: + # These fields were added in the runtime running Debian 12. + result = result | { + "lifespan": await status.check_lifespan(session), + # IPv6 requires extra work from node operators and is not required yet. + # "ipv6": await status.check_ipv6(session), + } + return web.json_response(result, status=200 if all(result.values()) else 503)