Skip to content

Commit

Permalink
swissknife image working
Browse files Browse the repository at this point in the history
  • Loading branch information
darioAnongba committed Jul 2, 2024
1 parent 01d1d1a commit 32e3378
Show file tree
Hide file tree
Showing 7 changed files with 79 additions and 39 deletions.
1 change: 0 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ target
certs
deps
storage
target
.dockerignore
.git
.gitignore
Expand Down
29 changes: 29 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -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
5 changes: 5 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -58,5 +63,5 @@ deps-outdated:
lint:
@cargo clippy

lint-fix:
fmt:
@cargo fmt
23 changes: 23 additions & 0 deletions config/development.yml
Original file line number Diff line number Diff line change
@@ -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"
22 changes: 0 additions & 22 deletions deps/lightningd/regtest.conf

This file was deleted.

31 changes: 16 additions & 15 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -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}
Expand All @@ -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}
Expand All @@ -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

0 comments on commit 32e3378

Please sign in to comment.