Skip to content
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
5 changes: 4 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,7 @@ RPC_URL=https://eth-sepolia.g.alchemy.com/v2/URjQnzNCUHumxPFL8VDoFBmpX4uqL6X8
PRIVATE_KEY=
BLOCK_INTERVAL=

DATA_STRATEGY=delete
DATA_STRATEGY=delete

STREAM_ID=0x567853282663b601bfdb9203819b1fbb3fe18926/m3tering/test
STREAMR_ENV=live
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: Create and publish a Docker image
name: Create and publish Prover Docker image

on:
push:
branches: [ "main", "staging" ]
branches: [ "main" ]
pull_request:
branches: [ "main" ]

Expand All @@ -22,6 +22,7 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v5
- name: Log in to the Container registry
if: github.event_name != 'pull_request'
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ${{ env.REGISTRY }}
Expand All @@ -37,11 +38,12 @@ jobs:
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
with:
context: .
push: true
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

- name: Generate artifact attestation
if: github.event_name != 'pull_request'
uses: actions/attest-build-provenance@v3
with:
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
Expand Down
55 changes: 55 additions & 0 deletions .github/workflows/docker-image-streamr-client.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Create and publish Prover streamr client image

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}/streamr-client

jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
attestations: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v5
- name: Checkout streamr client directory
working-directory: ./streamr-client
run: |
echo "Current directory is $(pwd)"
- name: Log in to the Container registry
if: github.event_name != 'pull_request'
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push Docker image
id: push
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

- name: Generate artifact attestation
if: github.event_name != 'pull_request'
uses: actions/attest-build-provenance@v3
with:
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ pgo-data.profdata

# Env
**/.env
.env.prebuilt

# DIESEL files
schema.rs
Expand All @@ -29,4 +30,4 @@ db/password.txt
docker-compose-tmp.yml

**/node_modules


44 changes: 21 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,43 +8,41 @@ This repository implements an [SP1](https://github.com/succinctlabs/sp1) based p
- [SP1](https://docs.succinct.xyz/docs/sp1/getting-started/install)
- [PostgreSQL](https://www.postgresql.org/download/)
- [Diesel CLI](https://diesel.rs/guides/getting-started/)
- [Docker](https://www.docker.com/get-started/)

## Quick Setup (Recommended)
## Quick Setup

To make setup easy, use the provided `setup.sh` script. This will:
- Clone the repository (if not already cloned)
- Check for required dependencies
- Create the `.env` file if missing
- Create the PostgreSQL database
- Run Diesel migrations
The setup uses prebuilt docker images of the `prover` and the `prover/streamr-client`.

Run the setup script from your terminal:
- Clone the repository

```sh
bash <(curl -sSL https://raw.githubusercontent.com/M3tering/Prover/refs/tags/v0.1.0-sepolia/setup.sh)
git clone https://github.com/M3tering/Prover.git
```

## AWS Setup
```sh
cd Prover
```

For automated deployment on AWS EC2 or similar Linux servers, use the provided `setup-aws.sh` script. This script:
- Set up environment variables

```sh
cp .env.example .env
```

- Installs all required system dependencies (Rust, Diesel CLI, PostgreSQL, Nginx, etc.)
- Sets up PostgreSQL with a dedicated user and database
- Clones the latest project release
- Runs Diesel migrations
- Installs SP1 and verifies installation
- Creates a `.env` file with your database credentials and other configuration
- Configures and enables a systemd service for automatic startup
- Sets up Nginx as a reverse proxy (with optional domain name support)
> Make sure you set all the variables in the `.env` file

To run the AWS setup script:
- Start the docker containers

```sh
bash <(curl -sSL https://raw.githubusercontent.com/M3tering/Prover/refs/tags/v0.1.0-sepolia/setup-aws.sh)
docker compose up --build -d
```

You will be prompted for your domain name (optional) and PostgreSQL password.
After setup, the service will be running and accessible via your domain or server IP.
- See Logs

```sh
docker compose logs
```

## Manual Setup

Expand Down
15 changes: 2 additions & 13 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@

# You must create `db/password.txt` and add
# a password of your choosing to it before running `docker compose up`.

services:
db:
image: postgres:15
restart: always
# secrets:
# - db-password
volumes:
- db-data:/var/lib/postgresql/data
environment:
Expand All @@ -21,10 +15,8 @@ services:
interval: 10s
timeout: 5s
retries: 5

energy-tracker:
build:
context: .
image: ghcr.io/m3tering/prover:main
ports:
- 8080:8080
environment:
Expand All @@ -37,10 +29,8 @@ services:
depends_on:
db:
condition: service_healthy
image: energy-tracker.public.dappnode.eth:0.1.0
restart: unless-stopped

streamr-client:
streamr-client:
build:
context: ./streamr-client
ports:
Expand All @@ -55,6 +45,5 @@ services:
condition: service_healthy
image: streamr-client.public.dappnode.eth:0.1.0
restart: unless-stopped

volumes:
db-data:
Loading
Loading