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
17 changes: 17 additions & 0 deletions .github/workflows/audit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Security audit

on:
schedule:
- cron: '0 0 * * 0'
push:
paths:
- 'Cargo.toml'
- 'Cargo.lock'

jobs:
security_audit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Scan for vulnerabilities
run: cargo audit
26 changes: 26 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Publish Docker image

# on:
# release:
# types: [published]
on:
push:
tags:
- '*'

jobs:
push_to_registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v4

- name: Log in to Docker Hub
run: docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}

- name: Build and push Docker image
run: docker build . --file Dockerfile --tag rllola/prototype:${{ github.ref_name }}

- name: Push Docker image
run: docker push rllola/eth-prototype:${{ github.ref_name }}
25 changes: 25 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Run tests

on:
pull_request:
branches: [ main ]

jobs:
fmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- run: rustup update nightly && rustup default nightly && rustup component add rustfmt
- name: Enforce formatting
run: cargo fmt --check

# test:
# name: Tests
# runs-on: ubuntu-latest
# steps:
# - name: Checkout Repo
# uses: actions/checkout@v3
# - name: Run tests
# run: cargo test --verbose
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ archive/
data/
script/
privatekeys.txt
Makefile.prod
Makefile.prod
docker-compose.prod.yml
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
name = "prototype"
version = "0.1.0"
edition = "2021"
authors = ["Lola Rigaut-Luczak <me@laflemme.lol>"]

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand Down
5 changes: 2 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ COPY --from=builder /usr/local/cargo/bin/prototype /usr/local/bin/prototype
RUN apt-get update && rm -rf /var/lib/apt/lists/*

# default env
ENV NETWORK "dogecoin"
ENV TESTNET "true"
ENV NETWORK "dogecoin_testnet"
ENV RUST_LOG "prototype=info"

CMD prototype ${NETWORK} ${TESTNET}
CMD prototype ${NETWORK}
2 changes: 1 addition & 1 deletion TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
- [x] Create a thread that would queue data to save in the database
- [x] ~~Prometheus + grafana~~ influxdb data collector and syncing monitoring
- [x] Dockerfile
- [ ] Remove warnings
- [x] Remove warnings
- [ ] Improve development process
- [ ] Use `init.sh` to create tables
- [ ] Improve sql query (in NOTES.md) to avoid the encoding call
Expand Down
10 changes: 10 additions & 0 deletions config.example.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[database]
host = "localhost"
user = "postgres"
password = "wow"
dbname = "blockchains"

# Mainnet
[peer]
ip = "127.0.0.1"
port = 8333
116 changes: 116 additions & 0 deletions contrib/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
version: "3.9"

services:
# Bitcoin Mainnet
indexer_bitcoin_mainnet:
build: ../.
depends_on:
- postgres
environment:
NETWORK: "bitcoin_mainnet"
RUST_LOG: "prototype=info"
volumes:
- ../config.bitcoin_mainnet.toml:/config.toml
depends_on:
postgres:
condition: service_healthy

# Bitcoin testnet
indexer_bitcoin_testnet:
build: ../.
depends_on:
- postgres
environment:
NETWORK: "bitcoin_testnet"
RUST_LOG: "prototype=info"
volumes:
- ../config.bitcoin_testnet.toml:/config.toml
depends_on:
postgres:
condition: service_healthy

# Dogecoin Mainnet
indexer_dogecoin_mainnet:
build: ../.
depends_on:
- postgres
environment:
NETWORK: "dogecoin_mainnet"
RUST_LOG: "prototype=info"
volumes:
- ../config.dogecoin_mainnet.toml:/config.toml
depends_on:
postgres:
condition: service_healthy

# Dogecoin testnet
indexer_dogecoin_testnet:
build: ../.
depends_on:
- postgres
environment:
NETWORK: "dogecoin_testnet"
RUST_LOG: "prototype=info"
volumes:
- ../config.dogecoin_testnet.toml:/config.toml
depends_on:
postgres:
condition: service_healthy

# Litecoin Mainnet
indexer_litecoin_mainnet:
build: ../.
depends_on:
- postgres
environment:
NETWORK: "litecoin_mainnet"
RUST_LOG: "prototype=info"
volumes:
- ../config.litecoin_mainnet.toml:/config.toml
depends_on:
postgres:
condition: service_healthy

# Litecoin Testnet
indexer_litecoin_testnet:
build: ../.
depends_on:
- postgres
environment:
NETWORK: "litecoin_testnet"
RUST_LOG: "prototype=info"
volumes:
- ../config.litecoin_testnet.toml:/config.toml
depends_on:
postgres:
condition: service_healthy

# Namecoin Mainnet
indexer_namecoin_mainnet:
build: ../.
depends_on:
- postgres
environment:
NETWORK: "namecoin_mainnet"
RUST_LOG: "prototype=info"
volumes:
- ../config.namecoin_mainnet.toml:/config.toml
depends_on:
postgres:
condition: service_healthy

postgres:
image: "postgres:latest"
container_name: "postgres"
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: wow
POSTGRES_DB: blockchains
# ¡IMPORTANT! If you don't want to lose your data you should uncomment this
volumes:
- ./data/:/var/lib/postgresql/data/
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 10s
timeout: 5s
retries: 5
98 changes: 0 additions & 98 deletions docker-compose.yml

This file was deleted.

Loading