Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

code move: move servers into subdirectory #345

Merged
merged 8 commits into from
Oct 31, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ on:
pull_request:
branches: [master]
paths:
- 'drivechain-server/**'
- 'servers/**'
- '.github/workflows/**'

defaults:
run:
working-directory: drivechain-server
working-directory: servers/bitwindow

jobs:
lint:
Expand All @@ -19,7 +19,7 @@ jobs:
- uses: bufbuild/[email protected]
- uses: bufbuild/[email protected]
with:
input: drivechain-server
input: servers/bitwindow

- name: verify Proto files are formatted correctly
run: buf format --exit-code proto
Expand All @@ -37,7 +37,7 @@ jobs:
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
working-directory: drivechain-server
working-directory: servers/bitwindow
version: latest

go-build:
Expand All @@ -48,7 +48,7 @@ jobs:
runs-on: ${{ matrix.os }}
defaults:
run:
working-directory: drivechain-server
working-directory: servers/bitwindow
steps:
- uses: extractions/setup-just@v1
- uses: actions/checkout@v4
Expand All @@ -68,15 +68,15 @@ jobs:
- uses: actions/upload-artifact@v4
with:
name: bdk-cli${{ runner.os == 'Windows' && '.exe' || '' }}-${{ runner.os }}
path: drivechain-server/bin
path: servers/bitwindow/bin
if-no-files-found: error

- name: Build drivechain-server
- name: Build bitwindowd
run: |
just build-go
mv bin/drivechain-server bin/drivechain-server-${{ runner.os }}
mv bin/bitwindowd bin/bitwindowd-${{ runner.os }}
- uses: actions/upload-artifact@v4
with:
name: drivechain-server-${{ runner.os }}
path: drivechain-server/bin
name: bitwindowd-${{ runner.os }}
path: servers/bitwindow/bin
if-no-files-found: error
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ on:
push:
branches: [master]
paths:
- 'drivechain-server/**'
- 'servers/**'
- 'clients/scripts/**'
- 'clients/bitwindow/**'
- 'clients/sidesail/**'
- '.github/workflows/**'
pull_request:
branches: [master]
paths:
- 'drivechain-server/**'
- 'servers/**'
- 'clients/scripts/**'
- 'clients/bitwindow/**'
- 'clients/sidesail/**'
Expand Down Expand Up @@ -73,7 +73,7 @@ jobs:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
- uses: extractions/setup-just@v1
# Setup go for building drivechain-server
# Setup go for building bitwindowd
- uses: actions/setup-go@v5
with:
go-version: "1.23"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ on:
pull_request:
branches: [master]
paths:
- 'faucet-backend/**'
- 'servers/faucet/**'
- '.github/workflows/**'

defaults:
run:
working-directory: faucet-backend
working-directory: servers/faucet

jobs:
go-lint:
Expand All @@ -25,7 +25,7 @@ jobs:
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
working-directory: faucet-backend
working-directory: servers/faucet
version: latest

go-build:
Expand Down
12 changes: 6 additions & 6 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
"type": "dart",
"toolArgs": [
"--dart-define",
"DRIVECHAIN_HOST=localhost",
"BITWINDOWD_HOST=localhost",
"--dart-define",
"DRIVECHAIN_PORT=8080"
"BITWINDOWD_PORT=8080"
]
},
{
Expand All @@ -24,9 +24,9 @@
"flutterMode": "profile",
"toolArgs": [
"--dart-define",
"DRIVECHAIN_HOST=localhost",
"BITWINDOWD_HOST=localhost",
"--dart-define",
"DRIVECHAIN_PORT=8080"
"BITWINDOWD_PORT=8080"
]
},
{
Expand All @@ -37,9 +37,9 @@
"flutterMode": "release",
"toolArgs": [
"--dart-define",
"DRIVECHAIN_HOST=localhost",
"BITWINDOWD_HOST=localhost",
"--dart-define",
"DRIVECHAIN_PORT=8080"
"BITWINDOWD_PORT=8080"
]
},
{
Expand Down
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
A collection of various Drivechain-related applications.

- [SideSail](packages/sidesail/README.md)
- [Faucet frontend](packages/faucet/README.md)
- [Faucet backend](faucet-backend/README.md)
- [Drivechain server](drivechain-server/README.md)
- [SideSail](clients/sidesail/README.md)

- [Faucet frontend](clients/faucet/README.md)
- [Faucet server](servers/faucet/README.md)

- [Bitwindow frontend](clients/bitwindow/README.md)
- [Bitwindow server](servers/bitwindow/README.md)
2 changes: 1 addition & 1 deletion clients/bitwindow/Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ format:
find . -name "*.dart" -not -path "./lib/gen/*" | xargs dart format -l 120

gen:
buf generate ../../drivechain-server
buf generate ../../bitwindow

gen-enforcer:
buf generate --template buf.gen.yaml https://github.com/LayerTwo-Labs/cusf_sidechain_proto.git
6 changes: 3 additions & 3 deletions clients/bitwindow/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ This package contains a frontend for interacting with a Drivechain-enabled layer
To get the app(s) up and running, make sure you have the following dependencies:

* The [Flutter SDK](https://flutter.dev)
* An instance of [drivechain-server](../../drivechain-server) running
* The `DRIVECHAIN_HOST` and `DRIVECHAIN_PORT` environment variable pointing to the above instance
* An instance of [bitwindowd](../../servers/bitwindow) running
* The `BITWINDOWD_HOST` and `BITWINDOWD_PORT` environment variable pointing to the above instance
* A BIP 300/301 enabled node running

Running the app is as simple as the following command:

```bash
flutter run --dart-define DRIVECHAIN_HOST=localhost --dart-define DRIVECHAIN_PORT=8080
flutter run --dart-define BITWINDOWD_HOST=localhost --dart-define BITWINDOWD_PORT=8080
```

The project is set up with launch configurations for Visual Studio Code as well.
4 changes: 2 additions & 2 deletions clients/bitwindow/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ void main() async {
const windowOptions = WindowOptions(
minimumSize: Size(600, 700),
titleBarStyle: TitleBarStyle.normal,
title: 'Drivechain (Bitcoin Core)',
title: 'Bitcoin Core + CUSF BIP 300/301 Activator',
);

unawaited(
Expand Down Expand Up @@ -126,7 +126,7 @@ Future<void> initDependencies(Logger log, File logFile) async {
host: env(Environment.drivechainHost),
port: env(Environment.drivechainPort),
conf: mainchainConf,
binary: 'drivechain-server',
binary: 'bitwindowd',
logPath: serverLogFile,
),
);
Expand Down
14 changes: 7 additions & 7 deletions clients/bitwindow/scripts/download-binaries.sh
Original file line number Diff line number Diff line change
Expand Up @@ -116,24 +116,24 @@ fi
echo Going back to $old_cwd
cd $old_cwd

cd ../../drivechain-server
cd ../../servers/bitwindow
server_cwd=$(pwd)

# Build bdk-cli and drivechain-server
echo "Building bdk-cli and drivechain-server in $server_cwd"
# Build bdk-cli and bitwindowd
echo "Building bdk-cli and bitwindowd in $server_cwd"

# Build bdk-cli
echo "Building bdk-cli"
just build-bdk-cli

# Build drivechain-server
echo "Building drivechain-server"
# Build bitwindowd
echo "Building bitwindowd"
just build-go

# Move the necessary binaries to the assets directory
mv bin/drivechain-server $assets_dir/
mv bin/bitwindowd $assets_dir/

echo "drivechain-server with embedded bdk-cli have been built and moved to $assets_dir"
echo "bitwindowd with embedded bdk-cli have been built and moved to $assets_dir"

echo Going back to $old_cwd
cd $old_cwd
Empty file removed drivechain-server/bdk/bin/.gitkeep
Empty file.
1 change: 0 additions & 1 deletion faucet-backend/.gitignore

This file was deleted.

15 changes: 0 additions & 15 deletions faucet-backend/Dockerfile

This file was deleted.

10 changes: 5 additions & 5 deletions scripts/deploy-faucet.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/usr/bin/env bash

set -e
set -e

cd faucet-backend/
docker build -t faucet-backend .
cd ../
cd servers/faucet/
docker build -t faucet .
cd ../../
docker compose --file docker-compose.faucet.yml up -d --force-recreate

cd ./clients/faucet
Expand All @@ -15,4 +15,4 @@ flutter build web --profile --dart-define=Dart2jsOptimization=O0 --output=./buil
# Clean old stuff
sudo rm -rf /var/www/drivechain-live/*
# Move over new stuff
sudo cp -r ./build/web/* /var/www/drivechain-live/
sudo cp -r ./build/web/* /var/www/drivechain-live/
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
drivechain-server
bitwindowd
bin/
.crates*
/*.mdb
2 changes: 1 addition & 1 deletion drivechain-server/Justfile → servers/bitwindow/Justfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
build-go:
go build -o ./bin/drivechain-server .
go build -o ./bin/bitwindowd .

build: build-bdk-cli build-enforcer build-go

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ $ ./enforcer/bin/bip300301_enforcer \
#
# The same Electrum server also powers the mempool instance
# at https://drivechain.ngu-tek.no.
$ ./bin/drivechain-server \
$ ./bin/bitwindowd \
--electrum.host=drivechain.live:50001 \
--electrum.no-ssl \
--bitcoincore.rpcuser=user \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"slices"

"connectrpc.com/connect"
pb "github.com/LayerTwo-Labs/sidesail/drivechain-server/gen/bitcoind/v1"
rpc "github.com/LayerTwo-Labs/sidesail/drivechain-server/gen/bitcoind/v1/bitcoindv1connect"
pb "github.com/LayerTwo-Labs/sidesail/servers/bitwindow/gen/bitcoind/v1"
rpc "github.com/LayerTwo-Labs/sidesail/servers/bitwindow/gen/bitcoind/v1/bitcoindv1connect"
corepb "github.com/barebitcoin/btc-buf/gen/bitcoin/bitcoind/v1alpha"
coreproxy "github.com/barebitcoin/btc-buf/server"
"github.com/btcsuite/btcd/btcutil"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import (
"context"

"connectrpc.com/connect"
validatorpb "github.com/LayerTwo-Labs/sidesail/drivechain-server/gen/cusf/mainchain/v1"
validatorrpc "github.com/LayerTwo-Labs/sidesail/drivechain-server/gen/cusf/mainchain/v1/mainchainv1connect"
pb "github.com/LayerTwo-Labs/sidesail/drivechain-server/gen/drivechain/v1"
rpc "github.com/LayerTwo-Labs/sidesail/drivechain-server/gen/drivechain/v1/drivechainv1connect"
validatorpb "github.com/LayerTwo-Labs/sidesail/servers/bitwindow/gen/cusf/mainchain/v1"
validatorrpc "github.com/LayerTwo-Labs/sidesail/servers/bitwindow/gen/cusf/mainchain/v1/mainchainv1connect"
pb "github.com/LayerTwo-Labs/sidesail/servers/bitwindow/gen/drivechain/v1"
rpc "github.com/LayerTwo-Labs/sidesail/servers/bitwindow/gen/drivechain/v1/drivechainv1connect"
coreproxy "github.com/barebitcoin/btc-buf/server"
"github.com/btcsuite/btcd/chaincfg/chainhash"
"github.com/rs/zerolog"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ import (
"time"

"connectrpc.com/connect"
"github.com/LayerTwo-Labs/sidesail/drivechain-server/bdk"
"github.com/LayerTwo-Labs/sidesail/drivechain-server/drivechain"
validatorrpc "github.com/LayerTwo-Labs/sidesail/drivechain-server/gen/cusf/mainchain/v1/mainchainv1connect"
drivechainpb "github.com/LayerTwo-Labs/sidesail/drivechain-server/gen/drivechain/v1"
drivechainrpc "github.com/LayerTwo-Labs/sidesail/drivechain-server/gen/drivechain/v1/drivechainv1connect"
pb "github.com/LayerTwo-Labs/sidesail/drivechain-server/gen/wallet/v1"
rpc "github.com/LayerTwo-Labs/sidesail/drivechain-server/gen/wallet/v1/walletv1connect"
"github.com/LayerTwo-Labs/sidesail/servers/bitwindow/bdk"
"github.com/LayerTwo-Labs/sidesail/servers/bitwindow/drivechain"
validatorrpc "github.com/LayerTwo-Labs/sidesail/servers/bitwindow/gen/cusf/mainchain/v1/mainchainv1connect"
drivechainpb "github.com/LayerTwo-Labs/sidesail/servers/bitwindow/gen/drivechain/v1"
drivechainrpc "github.com/LayerTwo-Labs/sidesail/servers/bitwindow/gen/drivechain/v1/drivechainv1connect"
pb "github.com/LayerTwo-Labs/sidesail/servers/bitwindow/gen/wallet/v1"
rpc "github.com/LayerTwo-Labs/sidesail/servers/bitwindow/gen/wallet/v1/walletv1connect"
corepb "github.com/barebitcoin/btc-buf/gen/bitcoin/bitcoind/v1alpha"
coreproxy "github.com/barebitcoin/btc-buf/server"
"github.com/btcsuite/btcd/btcutil"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"sync"
"time"

"github.com/LayerTwo-Labs/sidesail/drivechain-server/dir"
"github.com/LayerTwo-Labs/sidesail/servers/bitwindow/dir"
"github.com/btcsuite/btcd/btcutil"
"github.com/btcsuite/btcd/chaincfg/chainhash"
"github.com/btcsuite/btcd/wire"
Expand All @@ -30,7 +30,7 @@
"filippo.io/age"
)

//go:embed bin/*

Check failure on line 33 in servers/bitwindow/bdk/bdk.go

View workflow job for this annotation

GitHub Actions / go-lint

pattern bin/*: no matching files found (typecheck)
var bdkCliBinary embed.FS

var (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ managed:
enabled: true
override:
- file_option: go_package_prefix
value: github.com/LayerTwo-Labs/sidesail/drivechain-server/gen
value: github.com/LayerTwo-Labs/sidesail/servers/bitwindow/gen

plugins:
# Base types for Go. Generates message and enum types.
Expand Down
2 changes: 1 addition & 1 deletion drivechain-server/buf.yaml → servers/bitwindow/buf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ breaking:

modules:
- path: proto
name: buf.build/layertwo-labs/drivechain-server
name: buf.build/layertwo-labs/bitwindowd
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import (
"time"

"connectrpc.com/connect"
pb "github.com/LayerTwo-Labs/sidesail/drivechain-server/gen/cusf/mainchain/v1"
rpc "github.com/LayerTwo-Labs/sidesail/drivechain-server/gen/cusf/mainchain/v1/mainchainv1connect"
pb "github.com/LayerTwo-Labs/sidesail/servers/bitwindow/gen/cusf/mainchain/v1"
rpc "github.com/LayerTwo-Labs/sidesail/servers/bitwindow/gen/cusf/mainchain/v1/mainchainv1connect"
"github.com/btcsuite/btcd/chaincfg/chainhash"
"github.com/rs/zerolog"
"golang.org/x/net/http2"
Expand Down
File renamed without changes.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading