Skip to content

Commit f8eab86

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 eff82dc commit f8eab86

File tree

6 files changed

+37
-25
lines changed

6 files changed

+37
-25
lines changed

.github/workflows/build-deb-package-and-integration-tests.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,8 @@ jobs:
216216
ssh root@${DROPLET_IPV4} DEBIAN_FRONTEND=noninteractive "apt-get -o Dpkg::Progress-Fancy=0 -o DPkg::Lock::Timeout=60 update"
217217
ssh root@${DROPLET_IPV4} DEBIAN_FRONTEND=noninteractive "apt-get -o Dpkg::Progress-Fancy=0 -o DPkg::Lock::Timeout=60 upgrade -y"
218218
ssh root@${DROPLET_IPV4} DEBIAN_FRONTEND=noninteractive "apt-get -o Dpkg::Progress-Fancy=0 -o DPkg::Lock::Timeout=60 install -y docker.io apparmor-profiles"
219-
ssh root@${DROPLET_IPV4} "docker pull ghcr.io/aleph-im/vm-connector:alpha"
220-
ssh root@${DROPLET_IPV4} "docker run -d -p 127.0.0.1:4021:4021/tcp --restart=always --name vm-connector ghcr.io/aleph-im/vm-connector:alpha"
219+
ssh root@${DROPLET_IPV4} "docker pull ghcr.io/aleph-im/vm-connector:2025-03"
220+
ssh root@${DROPLET_IPV4} "docker run -d -p 127.0.0.1:4021:4021/tcp --restart=always --name vm-connector ghcr.io/aleph-im/vm-connector:2025-03"
221221
222222
# "--force-confold" keeps existing config files during package install/upgrade, avoiding prompts.
223223
ssh root@${DROPLET_IPV4} DEBIAN_FRONTEND=noninteractive "apt-get -o Dpkg::Progress-Fancy=0 -o DPkg::Lock::Timeout=60 -o Dpkg::Options::="--force-confold" install -y /opt/${{ matrix.os_config.package_name }}"
@@ -367,7 +367,8 @@ jobs:
367367
ssh root@${DROPLET_IPV4} DEBIAN_FRONTEND=noninteractive "apt-get -o Dpkg::Progress-Fancy=0 -o DPkg::Lock::Timeout=60 update"
368368
ssh root@${DROPLET_IPV4} DEBIAN_FRONTEND=noninteractive "apt-get -o Dpkg::Progress-Fancy=0 -o DPkg::Lock::Timeout=60 upgrade -y"
369369
ssh root@${DROPLET_IPV4} DEBIAN_FRONTEND=noninteractive "apt-get -o Dpkg::Progress-Fancy=0 -o DPkg::Lock::Timeout=60 install -y docker.io apparmor-profiles"
370-
ssh root@${DROPLET_IPV4} "docker run -d -p 127.0.0.1:4021:4021/tcp --restart=always --name vm-connector alephim/vm-connector:alpha"
370+
ssh root@${DROPLET_IPV4} "docker pull ghcr.io/aleph-im/vm-connector:2025-03"
371+
ssh root@${DROPLET_IPV4} "docker run -d -p 127.0.0.1:4021:4021/tcp --restart=always --name vm-connector ghcr.io/aleph-im/vm-connector:2025-03"
371372
372373
# Copy our example VM on the server
373374
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
@@ -2,14 +2,16 @@
22
import logging
33

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

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

1517
logger = logging.getLogger(__file__)
@@ -164,17 +166,21 @@ async def publish_data(body: PostBody):
164166
content = json.loads(message["item_content"])
165167
content_content = content["content"]
166168

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

179185

180186
@app.get("/properties")

0 commit comments

Comments
 (0)