diff --git a/Dockerfile b/Dockerfile index e5667b4..321b337 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM debian:bullseye +FROM debian:bookworm RUN apt-get update && apt-get -y upgrade && apt-get install -y \ git \ @@ -13,3 +13,4 @@ COPY . . RUN mkdir /opt/packages RUN pip install -t /opt/packages . +ENV PYTHONPATH=/opt/packages diff --git a/deploy-with-docker.sh b/deploy-with-docker.sh new file mode 100644 index 0000000..2953d65 --- /dev/null +++ b/deploy-with-docker.sh @@ -0,0 +1,4 @@ +docker build -t aleph-vrf . +docker run --rm -ti -v "$(pwd)":/usr/src/aleph_vrf -v "$(echo $HOME/.aleph-im/private-keys/)":/root/.aleph-im/private-keys/ -e PYTHONPATH=/opt/packages aleph-vrf python3 ./deployment/deploy_vrf_vms.py + + diff --git a/deployment/deploy_vrf_vms.py b/deployment/deploy_vrf_vms.py index 435dfdd..f4928b6 100644 --- a/deployment/deploy_vrf_vms.py +++ b/deployment/deploy_vrf_vms.py @@ -10,14 +10,18 @@ from aleph.sdk.client import AuthenticatedAlephHttpClient from aleph.sdk.chains.common import get_fallback_private_key from aleph.sdk.chains.ethereum import ETHAccount +from aleph.sdk.types import StorageEnum from aleph_message.models import ItemHash, ProgramMessage +from aleph_message.models.execution.base import Encoding from aleph_message.models.execution.volume import ImmutableVolume from aleph_message.status import MessageStatus from aleph_vrf.settings import settings +# Debian 12 with Aleph SDK 0.9.1 DEBIAN12_RUNTIME = ItemHash( - "ed2c37ae857edaea1d36a43fdd0fb9fdb7a2c9394957e6b53d9c94bf67f32ac3" + # "ed2c37ae857edaea1d36a43fdd0fb9fdb7a2c9394957e6b53d9c94bf67f32ac3" Old Debian 12 runtime with SDK 0.7.0 + "7041de41c6e3de6792b06f44ab4b698616981efde8d229da8d4fceaa43eb7479" ) @@ -43,7 +47,7 @@ async def upload_dir_as_volume( mksquashfs(dir_path, volume_path) store_message, status = await aleph_client.create_store( - file_path=volume_path, sync=True, channel=channel + file_path=volume_path, sync=True, channel=channel, storage_engine=StorageEnum.ipfs ) if status not in (MessageStatus.PENDING, MessageStatus.PROCESSED): raise RuntimeError(f"Could not upload venv volume: {status}") @@ -62,6 +66,7 @@ async def deploy_python_program( program_message, status = await aleph_client.create_program( program_ref=code_volume_hash, entrypoint=entrypoint, + encoding=Encoding.squashfs, runtime=DEBIAN12_RUNTIME, volumes=[ ImmutableVolume( diff --git a/run-in-docker.sh b/run-in-docker.sh index c72f88a..425fe2f 100644 --- a/run-in-docker.sh +++ b/run-in-docker.sh @@ -1,2 +1,2 @@ docker build -t aleph-vrf . -docker run --rm -ti -v "$(pwd)":/usr/src/aleph_vrf aleph-vrf bash \ No newline at end of file +docker run --rm -ti -v "$(pwd)":/usr/src/aleph_vrf aleph-vrf bash diff --git a/setup.cfg b/setup.cfg index bffe831..8b8c225 100644 --- a/setup.cfg +++ b/setup.cfg @@ -48,7 +48,7 @@ package_dir = # For more information, check out https://semver.org/. install_requires = aiohttp - aleph-sdk-python~=0.8.0 + aleph-sdk-python~=0.9.0 hexbytes fastapi>=0.95.1 importlib-metadata; python_version<"3.8"