From 32e337898a3832a80e511646299f3d83dccb14a0 Mon Sep 17 00:00:00 2001 From: Dario Anongba Varela Date: Tue, 2 Jul 2024 15:05:30 +0200 Subject: [PATCH] swissknife image working --- .dockerignore | 1 - .github/workflows/ci.yml | 29 +++++++++++++++++++++++++++++ Dockerfile | 5 +++++ Makefile | 7 ++++++- config/development.yml | 23 +++++++++++++++++++++++ deps/lightningd/regtest.conf | 22 ---------------------- docker-compose.yml | 31 ++++++++++++++++--------------- 7 files changed, 79 insertions(+), 39 deletions(-) create mode 100644 .github/workflows/ci.yml create mode 100644 config/development.yml delete mode 100644 deps/lightningd/regtest.conf diff --git a/.dockerignore b/.dockerignore index 631575d..674f445 100644 --- a/.dockerignore +++ b/.dockerignore @@ -9,7 +9,6 @@ target certs deps storage -target .dockerignore .git .gitignore diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..2c3ac57 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,29 @@ +name: CI + +on: + pull_request: + branches: + - main + push: + branches: + - main + +jobs: + lint: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + with: + toolchain: 1.79 + components: clippy, rustfmt + - run: make lint + - run: make fmt + + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + - run: cargo test --all-features diff --git a/Dockerfile b/Dockerfile index a28d1da..aab361c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,7 +6,12 @@ COPY . . RUN cargo chef prepare --recipe-path recipe.json FROM chef AS builder + +# Install required packages +RUN apt-get update && apt-get install -y protobuf-compiler + COPY --from=planner /app/recipe.json recipe.json +COPY ./migration ./migration # Fetch dependencies RUN cargo chef cook --release --recipe-path recipe.json diff --git a/Makefile b/Makefile index 1643c5e..290f5b3 100644 --- a/Makefile +++ b/Makefile @@ -2,6 +2,7 @@ COMPOSE := docker compose -f docker-compose.yml DB_SERVICE := postgres PGADMIN_SERVICE := pgadmin LIGHTNINGD_SERVICE := lightningd +SWISSKNIFE_SERVICE := swissknife IMAGE_NAME := swissknife:latest .PHONY: up up-lightningd up-postgres up-pgadmin shutdown down generate-certs build-docker run-docker @@ -10,6 +11,10 @@ up: @$(MAKE) down @$(MAKE) up-postgres +up-swissknife: + @$(COMPOSE) up -d $(SWISSKNIFE_SERVICE) + @until $(COMPOSE) logs $(SWISSKNIFE_SERVICE) | grep 'Listening on'; do sleep 1; done + up-lightningd: @$(COMPOSE) up -d $(LIGHTNINGD_SERVICE) @until $(COMPOSE) logs $(LIGHTNINGD_SERVICE) | grep 'lightningd: Server started'; do sleep 1; done @@ -58,5 +63,5 @@ deps-outdated: lint: @cargo clippy -lint-fix: +fmt: @cargo fmt \ No newline at end of file diff --git a/config/development.yml b/config/development.yml new file mode 100644 index 0000000..d38a485 --- /dev/null +++ b/config/development.yml @@ -0,0 +1,23 @@ +domain: "swissknife" +ln_provider: breez +auth_provider: bypass + +logging: + format: compact + ansi: true + level: trace + filter: swissknife=trace + +oauth2: + domain: "dev-z3xohtidpayxvzid.us.auth0.com" + +web: + addr: 0.0.0.0:3000 + request_timeout: 180s + +cln_rest_config: + endpoint: "http://127.0.0.1:8184" + +cln_config: + endpoint: "https://127.0.0.1:11004" + certs_dir: "/Users/darioanongbavarela/.polar/networks/2/volumes/c-lightning/dave/lightningd/regtest" diff --git a/deps/lightningd/regtest.conf b/deps/lightningd/regtest.conf deleted file mode 100644 index ac80b7b..0000000 --- a/deps/lightningd/regtest.conf +++ /dev/null @@ -1,22 +0,0 @@ -developer -bitcoin-rpcuser=polaruser -bitcoin-rpcpassword=polarpass -bitcoin-rpcconnect=polar-n1-backend1 -bitcoin-rpcport=18443 -bitcoin-retry-timeout=3600 -alias=NumeraireSwissKnife -rgb=55C692 -fee-base=800 -fee-per-satoshi=8 -min-capacity-sat=10000 -ignore-fee-limits=true -max-concurrent-htlcs=30 -funding-confirms=3 -dev-allowdustreserve=true -grpc-port=50051 -experimental-anchors -disable-dns -clnrest-port=3010 -clnrest-host=0.0.0.0 -clnrest-protocol=http -log-level=debug \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 91b4e45..911c38d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,6 +1,6 @@ services: postgres: - image: postgres:15.5 + image: postgres:16.3 environment: POSTGRES_USER: ${POSTGRES_USER:-postgres} POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-postgres} @@ -24,7 +24,7 @@ services: - "log_destination=stderr" # Send logs to stderr pgadmin: - image: dpage/pgadmin4:8.5 + image: dpage/pgadmin4:8.9 environment: PGADMIN_DEFAULT_EMAIL: ${PGADMIN_DEFAULT_EMAIL:-pgadmin4@pgadmin.org} PGADMIN_DEFAULT_PASSWORD: ${PGADMIN_DEFAULT_PASSWORD:-admin} @@ -37,23 +37,24 @@ services: depends_on: - postgres - lightningd: - image: elementsproject/lightningd:v24.05 + swissknife: + image: swissknife:latest environment: - LIGHTNINGD_NETWORK: "regtest" + RUN_MODE: ${RUN_MODE:-production} + SWISSKNIFE_DATABASE__URL: ${SWISSKNIFE_DATABASE__URL:-postgres://postgres:postgres@postgres/numeraire} + SWISSKNIFE_BREEZ_CONFIG__API_KEY: ${SWISSKNIFE_BREEZ_CONFIG__API_KEY:-} + SWISSKNIFE_BREEZ_CONFIG__SEED: ${SWISSKNIFE_BREEZ_CONFIG__SEED:-} + SWISSKNIFE_CLN_REST_CONFIG__RUNE: ${SWISSKNIFE_CLN_REST_CONFIG__RUNE:-} + SWISSKNIFE_JWT__PASSWORD: ${SWISSKNIFE_JWT__PASSWORD:-} + depends_on: + - postgres ports: - - 3010:3010 - - 50051:50051 + - "3000:3000" volumes: - - ./deps/lightningd/data:/root/.lightning/regtest - - ./deps/lightningd/regtest.conf:/root/.lightning/regtest/config - networks: - - polar-network-1_default + - ./config/development.yml:/config/development.yml + - ./certs/greenlight:/certs/greenlight + - ./storage/breez:/storage/breez volumes: db: pgadmin: - -networks: - polar-network-1_default: - external: true