Skip to content

Commit 03b780b

Browse files
committed
Fix: vm-connector used obsolete software
The vm-connector service used to run with obsolete versions of the aleph-sdk and Python. Solution: Use the latest the version of the SDK and pin the version of dependencies.
1 parent f09bdd2 commit 03b780b

File tree

6 files changed

+34
-23
lines changed

6 files changed

+34
-23
lines changed

.github/workflows/test-new-runtime-examples.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ jobs:
7979
ssh root@${DROPLET_IPV4} DEBIAN_FRONTEND=noninteractive "apt-get -o DPkg::Lock::Timeout=60 update"
8080
ssh root@${DROPLET_IPV4} DEBIAN_FRONTEND=noninteractive "apt-get -o DPkg::Lock::Timeout=60 upgrade -y"
8181
ssh root@${DROPLET_IPV4} DEBIAN_FRONTEND=noninteractive "apt-get -o DPkg::Lock::Timeout=60 install -y docker.io apparmor-profiles"
82-
ssh root@${DROPLET_IPV4} "docker run -d -p 127.0.0.1:4021:4021/tcp --restart=always --name vm-connector alephim/vm-connector:alpha"
82+
ssh root@${DROPLET_IPV4} "docker run -d -p 127.0.0.1:4021:4021/tcp --restart=always --name vm-connector alephim/vm-connector:2025-03"
8383
8484
scp packaging/target/aleph-vm.debian-12.deb root@${DROPLET_IPV4}:/opt
8585
scp -pr ./examples root@${DROPLET_IPV4}:/opt/

.github/workflows/test-using-pytest.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
services:
1212
# Run vm connector for the execution tests
1313
vm-connector:
14-
image: alephim/vm-connector:alpha
14+
image: alephim/vm-connector:2025-03
1515
ports:
1616
- 4021:4021
1717

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ Unless your focus is developing the VM-Connector, using the Docker image is easi
6666
See the [VM-Connector README](./vm_connector/README.md) for more details.
6767

6868
```shell
69-
docker run -d -p 127.0.0.1:4021:4021/tcp --restart=always --name vm-connector alephim/vm-connector:alpha
69+
docker run -d -p 127.0.0.1:4021:4021/tcp --restart=always --name vm-connector alephim/vm-connector:2025-03
7070
```
7171

7272
2. **Install the Debian Package**

docker/vm_connector.dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
FROM python:3.9
1+
FROM python:3.13
22

33
RUN apt-get update && apt-get -y upgrade && apt-get install -y \
44
libsecp256k1-dev \
55
zip \
66
&& rm -rf /var/lib/apt/lists/*
77

8-
RUN pip install fastapi aiofiles uvicorn aleph-client eth-account
8+
RUN pip install 'fastapi==0.115.11' 'aiofiles==24.1.0' 'uvicorn==0.34.0' 'aleph-sdk-python==1.4.0' 'setuptools==76.0.0'
99

1010
WORKDIR /opt
1111
ENV PYTHONPATH=/opt

vm_connector/README.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,22 @@ apt update
2020
apt install -y docker.io
2121
```
2222

23-
### 2.b. Pull the Docker image
23+
### 2.b. Build the docker image
24+
```shell
25+
docker build -f ./docker/vm_connector.dockerfile -t vm-connector .
26+
```
27+
28+
### 2.c. Pull the Docker image
2429

2530
```shell
26-
docker pull alephim/vm-connector:alpha
31+
docker pull alephim/vm-connector:2025-03
2732
```
2833

2934
## 3. Running
3035

3136
Run the Docker image
3237
```shell
33-
docker run -d -p 4021:4021/tcp --restart=always --name vm-connector alephim/vm-connector:alpha
38+
docker run -d -p 4021:4021/tcp --restart=always --name vm-connector alephim/vm-connector:2025-03
3439
```
3540

3641
## 4. Configuration

vm_connector/main.py

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,16 @@
33
from typing import Optional
44

55
import aiohttp
6-
from aleph_client.asynchronous import create_post
7-
from aleph_client.chains.common import get_fallback_private_key
8-
from aleph_client.chains.ethereum import ETHAccount
9-
from aleph_client.types import StorageEnum
6+
from aleph_message.status import MessageStatus
107
from fastapi import FastAPI, HTTPException, Request
118
from fastapi.responses import Response, StreamingResponse
129
from pydantic import BaseModel
1310

11+
from aleph.sdk import AuthenticatedAlephHttpClient
12+
from aleph.sdk.chains.common import get_fallback_private_key
13+
from aleph.sdk.chains.ethereum import ETHAccount
14+
from aleph.sdk.types import StorageEnum
15+
1416
from .conf import settings
1517

1618
logger = logging.getLogger(__file__)
@@ -165,17 +167,21 @@ async def publish_data(body: PostBody):
165167
content = json.loads(message["item_content"])
166168
content_content = content["content"]
167169

168-
result = await create_post(
169-
account=account,
170-
post_content=content_content,
171-
post_type=content["type"],
172-
address=content["address"],
173-
ref=None,
174-
channel=message["channel"],
175-
inline=True,
176-
storage_engine=StorageEnum.storage,
177-
)
178-
return {"status": "success"}
170+
async with AuthenticatedAlephHttpClient(account) as client:
171+
result, status = await client.create_post(
172+
post_content=content_content,
173+
post_type=content["type"],
174+
address=content["address"],
175+
ref=None,
176+
channel=message["channel"],
177+
inline=True,
178+
storage_engine=StorageEnum.storage,
179+
sync=True,
180+
)
181+
if status == MessageStatus.PROCESSED:
182+
return {"status": "success"}
183+
else:
184+
return {"status": "error"}
179185

180186

181187
@app.get("/properties")

0 commit comments

Comments
 (0)