Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed dependency issue with last SDK version #32

Merged
merged 1 commit into from
Apr 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM debian:bullseye
FROM debian:bookworm

RUN apt-get update && apt-get -y upgrade && apt-get install -y \
git \
Expand All @@ -13,3 +13,4 @@ COPY . .

RUN mkdir /opt/packages
RUN pip install -t /opt/packages .
ENV PYTHONPATH=/opt/packages
4 changes: 4 additions & 0 deletions deploy-with-docker.sh
Original file line number Diff line number Diff line change
@@ -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


9 changes: 7 additions & 2 deletions deployment/deploy_vrf_vms.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)


Expand All @@ -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}")
Expand All @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion run-in-docker.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
docker build -t aleph-vrf .
docker run --rm -ti -v "$(pwd)":/usr/src/aleph_vrf aleph-vrf bash
docker run --rm -ti -v "$(pwd)":/usr/src/aleph_vrf aleph-vrf bash
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Loading