PyPI: Launch Docker container

- Related to https://github.com/status-im/status-bot/issues/22
This commit is contained in:
Nick Ninov
2026-05-24 21:26:27 +03:00
parent f97f6b66b6
commit cc9e0db455
6 changed files with 79 additions and 23 deletions
+29 -20
View File
@@ -14,13 +14,14 @@ Currently this repository is not on [PyPi](https://pypi.org/) but will be added
```mermaid
graph TB
subgraph backend[status-im/status-go]
subgraph Endpoints[Network: status-bridge]
subgraph backend[status-im/status-go]
subgraph Endpoints[Network: status-bridge]
RPC[RPC]
HTTP[REST]
SOCKET[Web Socket]
end
Vol[(Backup)]
Vol1[(Backup)]
Vol2[(Assets)]
end
@@ -35,13 +36,14 @@ graph TB
EVM
end
SDK --> SIGNAL
SDK --> |Port 8080| RPC
SDK --> |Port 8080| HTTP
SIGNAL --> |Port 8080| SOCKET
SDK --> Vol
RPC --> |coingecko_api_key| COINGECKO
RPC --> |infura_token| EVM
SDK --> SIGNAL
SDK --> |Port 8080| RPC
SDK --> |Port 8080| HTTP
SIGNAL --> |Port 8080| SOCKET
SDK --> Vol1
SDK --> Vol2
RPC --> |coingecko_api_key| COINGECKO
RPC --> |infura_token| EVM
```
## Setup
@@ -63,16 +65,6 @@ sequenceDiagram
Note over User,Python: from bot import Account<br>account = Account()
```
### Docker
Setup [`status-im/status-go`](https://github.com/status-im/status-go/) with the provided `docker-compose.yaml` file.
```
docker compose up -d
```
**Note**: To run on Windows, please make sure you clone `status-im/status-go` and change the context to the folder. If you do not want to clone the repository, make sure you have set up [WSL](https://learn.microsoft.com/en-us/windows/wsl/install) and started it.
### Python
1. Setup environment. [Conda](https://www.anaconda.com/) example:
@@ -87,3 +79,20 @@ conda create -n status-sdk python=3.12
```bash
pip install -r ./requirements.txt
```
### Docker
Setup [`status-im/status-go`](https://github.com/status-im/status-go/) with the provided `docker-compose.yaml` file.
```
docker compose up -d
```
If you would like to initialize and start the container with Python:
```python
from bot import launch_docker_container
launch_docker_container()
```
**Note**: To run on Windows, please make sure you clone `status-im/status-go` and change the context to the folder. If you do not want to clone the repository, make sure you have set up [WSL](https://learn.microsoft.com/en-us/windows/wsl/install) and started it.
+1
View File
@@ -1 +1,2 @@
from .account import Account
from .utils import launch_docker_container
+32
View File
@@ -0,0 +1,32 @@
import shutil, os, subprocess, sys
from pathlib import Path
def launch_docker_container():
"""
Launch the Status Backend Docker container using `docker-compose.yaml`
"""
is_windows = sys.platform == "win32"
if not shutil.which("docker"):
raise Exception("Please install Docker.")
DOCKER_COMPOSE_PATH = os.path.join(os.path.dirname(os.path.dirname(__file__)), "docker-compose.yaml")
docker_path = DOCKER_COMPOSE_PATH
if is_windows:
p = Path(DOCKER_COMPOSE_PATH)
drive = p.drive.rstrip(":").lower()
docker_path = f"/mnt/{drive}/" + "/".join(p.parts[1:])
cmd = ["docker", "compose", "-f", docker_path, "up", "-d"]
if is_windows:
if not shutil.which("wsl"):
raise Exception("Please install wsl - https://learn.microsoft.com/en-us/windows/wsl/install.")
cmd.insert(0, "wsl")
result = subprocess.run(
cmd,
cwd=os.path.dirname(DOCKER_COMPOSE_PATH),
stderr=subprocess.PIPE,
text=True,
)
if result.returncode != 0:
raise Exception(result.stderr.strip())
-3
View File
@@ -1,3 +0,0 @@
# Summary
[Account](./account.md)
Binary file not shown.

After

Width:  |  Height:  |  Size: 843 KiB

+17
View File
@@ -0,0 +1,17 @@
# Utils
![Utils header image](./images/overview-utils.png)
Helper functions for setting up the Status Backend environment.
## Methods
### `launch_docker_container()`
Launch Status Backend Docker container in the background using `docker-compose.yaml`. If `docker` is not installed, or if the container fails to start, an **exception will be raised** with the error message from Docker.
```python
from bot import launch_docker_container
launch_docker_container()
```