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

Refactor + Block store #1

Merged
merged 36 commits into from
Oct 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
7a0da34
standards
n8maninger Oct 5, 2023
36e8f47
working
n8maninger Oct 6, 2023
6d5a160
api: split out api package
n8maninger Oct 6, 2023
0a9eebc
ipfs: calculate blocks, add block store interface
n8maninger Oct 6, 2023
51f6636
badger: add block database
n8maninger Oct 6, 2023
edd82e3
cmd: cleanup, add block store, init ipfs node repo
n8maninger Oct 6, 2023
ee1e317
all: update deps
n8maninger Oct 6, 2023
0f2f5ca
doc: update readme
n8maninger Oct 6, 2023
16c01db
chore: add license and contributing
n8maninger Oct 6, 2023
20ce8db
ci: add golangci lint
n8maninger Oct 6, 2023
dc5fa0b
http: split api and gateway
n8maninger Oct 6, 2023
311d43e
build, config: add config and build
n8maninger Oct 6, 2023
f7b9262
cmd: use cfg.Renterd when necessary to workaround broken client
n8maninger Oct 6, 2023
1f71cfa
all: fix lint errors
n8maninger Oct 6, 2023
498326e
deps: add yaml package
n8maninger Oct 6, 2023
60672cf
docker: update dockerfile
n8maninger Oct 6, 2023
204fc77
all: remove copy-pasta
n8maninger Oct 6, 2023
c781d8b
ci: add publish and test actions
n8maninger Oct 6, 2023
8119d4a
docker: update dockerfile
n8maninger Oct 6, 2023
8287b6d
add blockservice and exchange
n8maninger Oct 6, 2023
4e97f82
ci: fix lint
n8maninger Oct 6, 2023
f5d0232
dockerfile: fix dockerfile and leveldb
n8maninger Oct 6, 2023
126525c
cmd: fix repo premature close
n8maninger Oct 6, 2023
d3b4070
all: rename
n8maninger Oct 6, 2023
450e706
all: rename
n8maninger Oct 6, 2023
ad1119c
all: refactor, small node
n8maninger Oct 7, 2023
896eee7
all: fix lint errors
n8maninger Oct 7, 2023
c978a1a
ipfs: use dag session to download remote blocks
n8maninger Oct 7, 2023
88b1d62
ipfs, http, fsd: add remote fetching
n8maninger Oct 7, 2023
58ed5b0
try load private key from config
n8maninger Oct 7, 2023
df7b688
docker: use scratch
n8maninger Oct 7, 2023
8e2d855
docs: update example yml
n8maninger Oct 7, 2023
9822ea8
ci: disable mac and windows runners while private
n8maninger Oct 7, 2023
de5ce8c
ipfs: remove flaky test
n8maninger Oct 7, 2023
aab678a
ipfs: use fullrt
n8maninger Oct 7, 2023
999e7a4
Update README.md
alexfreska Oct 6, 2023
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
20 changes: 20 additions & 0 deletions .github/actions/test/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Test
description: Lints and tests fsd

runs:
using: composite
steps:
- name: Configure git # required for golangci-lint on Windows
shell: bash
run: git config --global core.autocrlf false
- name: Generate
shell: bash
run: go generate ./...
- name: Lint
uses: golangci/golangci-lint-action@v3
with:
skip-cache: true
- name: Test
uses: n8maninger/action-golang-test@v1
with:
args: "-race;-tags=testing netgo"
30 changes: 30 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Main
on:
workflow_dispatch:
pull_request:
push:
branches:
- master

jobs:
test:
runs-on: ${{ matrix.os }}
permissions:
contents: read
strategy:
matrix:
os: [ ubuntu-latest ] #, macos-latest, windows-latest ]
go-version: [ '1.20', '1.21' ]
steps:
- name: Configure git
run: git config --global core.autocrlf false # required on Windows
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}
- name: Test
uses: ./.github/actions/test
- name: Build
env:
CGO_ENABLED: 1
run: go build -o bin/ ./cmd/fsd
212 changes: 212 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,212 @@
name: Publish

# Controls when the action will run.
on:
# Triggers the workflow on new SemVer tags
push:
branches:
- master
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
- 'v[0-9]+.[0-9]+.[0-9]+-**'

jobs:
test:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 'stable'
- name: Test
uses: ./.github/actions/test
docker:
runs-on: ubuntu-latest
needs: [ test ]
permissions:
packages: write
contents: read
steps:
- uses: actions/checkout@v3
- uses: docker/setup-qemu-action@v2
- uses: docker/setup-buildx-action@v2
- uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/metadata-action@v4
name: generate tags
id: meta
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=ref,event=branch
type=sha,prefix=
type=semver,pattern={{version}}
- uses: docker/build-push-action@v4
with:
context: .
file: ./docker/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
cache-from: type=gha
cache-to: type=gha,mode=max
# build-linux:
# runs-on: ubuntu-latest
# needs: [ test ]
# steps:
# - uses: actions/checkout@v3
# - uses: actions/setup-go@v3
# with:
# go-version: 'stable'
# - name: Setup
# run: |
# sudo apt update
# sudo apt install -y gcc-aarch64-linux-gnu
# go generate ./...
# - name: Build amd64
# env:
# CGO_ENABLED: 1
# GOOS: linux
# GOARCH: amd64
# run: |
# mkdir -p release
# ZIP_OUTPUT=release/fsd_${GOOS}_${GOARCH}.zip
# go build -tags='netgo' -trimpath -o bin/ -a -ldflags '-s -w -linkmode external -extldflags "-static"' ./cmd/fsd
# cp README.md LICENSE bin/
# zip -qj $ZIP_OUTPUT bin/*
# - name: Build arm64
# env:
# CGO_ENABLED: 1
# GOOS: linux
# GOARCH: arm64
# CC: aarch64-linux-gnu-gcc
# run: |
# mkdir -p release
# ZIP_OUTPUT=release/fsd_${GOOS}_${GOARCH}.zip
# go build -tags='netgo' -trimpath -o bin/ -a -ldflags '-s -w' ./cmd/fsd
# cp README.md LICENSE bin/
# zip -qj $ZIP_OUTPUT bin/*
# - uses: actions/upload-artifact@v3
# with:
# name: fsd
# path: release/
# build-mac:
# runs-on: macos-latest
# needs: [ test ]
# steps:
# - uses: actions/checkout@v3
# - uses: actions/setup-go@v3
# with:
# go-version: 'stable'
# - name: Setup
# env:
# APPLE_CERT_ID: ${{ secrets.APPLE_CERT_ID }}
# APPLE_API_KEY: ${{ secrets.APPLE_API_KEY }}
# APPLE_API_ISSUER: ${{ secrets.APPLE_API_ISSUER }}
# APPLE_KEY_B64: ${{ secrets.APPLE_KEY_B64 }}
# APPLE_CERT_B64: ${{ secrets.APPLE_CERT_B64 }}
# APPLE_CERT_PASSWORD: ${{ secrets.APPLE_CERT_PASSWORD }}
# APPLE_KEYCHAIN_PASSWORD: ${{ secrets.APPLE_KEYCHAIN_PASSWORD }}
# run: |
# # extract apple cert
# APPLE_CERT_PATH=$RUNNER_TEMP/apple_cert.p12
# KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
# echo -n "$APPLE_CERT_B64" | base64 --decode --output $APPLE_CERT_PATH
#
# # extract apple key
# mkdir -p ~/private_keys
# APPLE_API_KEY_PATH=~/private_keys/AuthKey_$APPLE_API_KEY.p8
# echo -n "$APPLE_KEY_B64" | base64 --decode --output $APPLE_API_KEY_PATH
#
# # create temp keychain
# security create-keychain -p "$APPLE_KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
# security default-keychain -s $KEYCHAIN_PATH
# security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
# security unlock-keychain -p "$APPLE_KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
#
# # import keychain
# security import $APPLE_CERT_PATH -P $APPLE_CERT_PASSWORD -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
# security find-identity -v $KEYCHAIN_PATH -p codesigning
# security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k $APPLE_KEYCHAIN_PASSWORD $KEYCHAIN_PATH
#
# # generate
# go generate ./...
# - name: Build amd64
# env:
# APPLE_CERT_ID: ${{ secrets.APPLE_CERT_ID }}
# APPLE_API_KEY: ${{ secrets.APPLE_API_KEY }}
# APPLE_API_ISSUER: ${{ secrets.APPLE_API_ISSUER }}
# APPLE_KEY_B64: ${{ secrets.APPLE_KEY_B64 }}
# APPLE_CERT_B64: ${{ secrets.APPLE_CERT_B64 }}
# APPLE_CERT_PASSWORD: ${{ secrets.APPLE_CERT_PASSWORD }}
# APPLE_KEYCHAIN_PASSWORD: ${{ secrets.APPLE_KEYCHAIN_PASSWORD }}
# CGO_ENABLED: 1
# GOOS: darwin
# GOARCH: amd64
# run: |
# ZIP_OUTPUT=release/fsd_${GOOS}_${GOARCH}.zip
# mkdir -p release
# go build -tags='netgo' -trimpath -o bin/ -a -ldflags '-s -w' ./cmd/fsd
# cp README.md LICENSE bin/
# /usr/bin/codesign --deep -f -v --timestamp -o runtime,library -s $APPLE_CERT_ID bin/fsd
# ditto -ck bin $ZIP_OUTPUT
# xcrun notarytool submit -k ~/private_keys/AuthKey_$APPLE_API_KEY.p8 -d $APPLE_API_KEY -i $APPLE_API_ISSUER --wait --timeout 10m $ZIP_OUTPUT
# - name: Build arm64
# env:
# APPLE_CERT_ID: ${{ secrets.APPLE_CERT_ID }}
# APPLE_API_KEY: ${{ secrets.APPLE_API_KEY }}
# APPLE_API_ISSUER: ${{ secrets.APPLE_API_ISSUER }}
# APPLE_KEY_B64: ${{ secrets.APPLE_KEY_B64 }}
# APPLE_CERT_B64: ${{ secrets.APPLE_CERT_B64 }}
# APPLE_CERT_PASSWORD: ${{ secrets.APPLE_CERT_PASSWORD }}
# APPLE_KEYCHAIN_PASSWORD: ${{ secrets.APPLE_KEYCHAIN_PASSWORD }}
# CGO_ENABLED: 1
# GOOS: darwin
# GOARCH: arm64
# run: |
# ZIP_OUTPUT=release/fsd_${GOOS}_${GOARCH}.zip
# mkdir -p release
# go build -tags='netgo' -trimpath -o bin/ -a -ldflags '-s -w' ./cmd/fsd
# cp README.md LICENSE bin/
# /usr/bin/codesign --deep -f -v --timestamp -o runtime,library -s $APPLE_CERT_ID bin/fsd
# ditto -ck bin $ZIP_OUTPUT
# xcrun notarytool submit -k ~/private_keys/AuthKey_$APPLE_API_KEY.p8 -d $APPLE_API_KEY -i $APPLE_API_ISSUER --wait --timeout 10m $ZIP_OUTPUT
# - uses: actions/upload-artifact@v3
# with:
# name: fsd
# path: release/
# build-windows:
# runs-on: windows-latest
# needs: [ test ]
# steps:
# - uses: actions/checkout@v3
# - uses: actions/setup-go@v3
# with:
# go-version: 'stable'
# - name: Setup
# shell: bash
# run: |
# dotnet tool install --global AzureSignTool
# go generate ./...
# - name: Build amd64
# env:
# CGO_ENABLED: 1
# GOOS: windows
# GOARCH: amd64
# shell: bash
# run: |
# mkdir -p release
# ZIP_OUTPUT=release/fsd_${GOOS}_${GOARCH}.zip
# go build -tags='netgo' -trimpath -o bin/ -a -ldflags '-s -w -linkmode external -extldflags "-static"' ./cmd/fsd
# azuresigntool sign -kvu "${{ secrets.AZURE_KEY_VAULT_URI }}" -kvi "${{ secrets.AZURE_CLIENT_ID }}" -kvt "${{ secrets.AZURE_TENANT_ID }}" -kvs "${{ secrets.AZURE_CLIENT_SECRET }}" -kvc ${{ secrets.AZURE_CERT_NAME }} -tr http://timestamp.digicert.com -v bin/fsd.exe
# cp README.md LICENSE bin/
# 7z a $ZIP_OUTPUT ./bin/*
# - uses: actions/upload-artifact@v3
# with:
# name: fsd
# path: release/
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
filestore
config.yml
config.yml
data
bin
Loading