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

feat: Adjusts to release S3 + WebServer #361

Merged
merged 33 commits into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
86db991
fix(repo): Solving publisher slowness (#352)
pedronauck Dec 16, 2024
a444792
build(repo): Add DNS/TLS configuration for Nats (#357)
pedronauck Dec 17, 2024
ad5a3af
build(repo): Update NATS dependency on chart (#358)
pedronauck Dec 19, 2024
d89681f
Merge branch 'main' of github.com:FuelLabs/data-systems into pn/nats-s3
pedronauck Dec 20, 2024
4095c3d
refactor(repo): remove FuelNetwork from nats
pedronauck Dec 20, 2024
d4d8677
refactor(repo): remove unused benches
pedronauck Dec 20, 2024
559d20e
refactor(repo): general improvements
pedronauck Dec 20, 2024
43b28ff
fix(repo): general fixes
pedronauck Dec 20, 2024
7d8d3e5
build(repo): adjust chart for new architecture
pedronauck Dec 20, 2024
2d12e1e
build(repo): adjust chart
pedronauck Dec 20, 2024
525a6b2
build(repo): fix chart
pedronauck Dec 20, 2024
6ec29ec
build(repo): fix chart
pedronauck Dec 20, 2024
a392ce6
build(repo): fix chart
pedronauck Dec 20, 2024
3705e74
build(repo): fix chart
pedronauck Dec 20, 2024
a2c4bc4
build(repo): docker image
pedronauck Dec 20, 2024
ad1eee3
build(repo): bump chart
pedronauck Dec 20, 2024
ac3390c
build(repo): fix emitter Dockerimage
pedronauck Dec 20, 2024
82cf679
build(repo): adjust workflow dispatch for docker
pedronauck Dec 20, 2024
ff334ed
build(repo): docker action
pedronauck Dec 20, 2024
bbc7f61
build(repo): fix publisher config
pedronauck Dec 20, 2024
6e842c4
build(repo): bump chart
pedronauck Dec 20, 2024
55013f2
build(repo): general fixes and adjustments
pedronauck Dec 20, 2024
9cbdbc3
build(repo): bump chart
pedronauck Dec 20, 2024
485a318
fix(repo): s3 client workaround
pedronauck Dec 21, 2024
ea44676
refactor(repo): rename crates to be consistent
pedronauck Dec 21, 2024
5319115
build(repo): bump chart
pedronauck Dec 21, 2024
66c7acd
build(repo): some adjusts
pedronauck Dec 21, 2024
a4f64e5
fix(consumer): remove max_messages
pedronauck Dec 21, 2024
e511286
refactor(repo): change s3 path
pedronauck Dec 21, 2024
7d1c405
build(repo): bump chart
pedronauck Dec 21, 2024
6f46368
refactor(repo): perf improvements
pedronauck Dec 21, 2024
64bd803
refactor(webserver): send decoded payload direct on websocket
pedronauck Dec 22, 2024
16a915e
Merge branch 'nats-s3-hybrid-publishing' of github.com:FuelLabs/data-…
pedronauck Dec 23, 2024
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
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,7 @@ trim_trailing_whitespace = false

[*.{yml,yaml}]
indent_size = 2

[{Makefile,**.mk}]
# Use tabs for indentation (Makefiles require tabs)
indent_style = tab
34 changes: 21 additions & 13 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -1,26 +1,34 @@
# Common Configuration
# Authentication & Security
KEYPAIR=generated-p2p-secret
NATS_URL=nats://localhost:4222
NATS_ADMIN_PASS=generated-secret
NATS_SYSTEM_PASS=generated-secret
JWT_AUTH_SECRET=generated-secret

# AWS S3 Configuration
AWS_ACCESS_KEY_ID=test
AWS_SECRET_ACCESS_KEY=test
AWS_REGION=us-east-1
AWS_ENDPOINT_URL=http://localhost:4566
AWS_S3_BUCKET_NAME=fuel-streams-testnet
AWS_REGION=us-east-1
AWS_S3_ENABLED=false
AWS_S3_BUCKET_NAME=fuel-streams-local

# NATS Configuration
NATS_URL=nats://localhost:4222
NATS_PUBLISHER_URL=nats://localhost:4333
NATS_SYSTEM_USER=sys
NATS_SYSTEM_PASS=sys
NATS_ADMIN_USER=admin
NATS_ADMIN_PASS=admin
NATS_PUBLIC_USER=default_user
NATS_PUBLIC_PASS=""

# Monitoring & Logging
USE_ELASTIC_LOGGING=false
USE_METRICS=true
PUBLISHER_MAX_THREADS=16

# Elasticsearch Configuration
ELASTICSEARCH_URL=http://127.0.0.1:9200
ELASTICSEARCH_USERNAME=elastic
ELASTICSEARCH_PASSWORD=generated-secret
AWS_S3_ENABLED=false
AWS_ACCESS_KEY_ID=s3-access-key-id
AWS_SECRET_ACCESS_KEY=s3-secret-access-key
AWS_REGION=s3-region
AWS_ENDPOINT_URL=s3-endpoint
AWS_S3_BUCKET_NAME=fuel-streams-local
JWT_AUTH_SECRET=generated-secret

# Mainnet Configuration
MAINNET_RELAYER=https://mainnet.infura.io/v3/<infura-api-key>
Expand Down
12 changes: 10 additions & 2 deletions .github/actions/setup-rust/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,16 @@ runs:
- name: Create .env file with NATS environment variables
shell: bash
run: |
echo "NATS_ADMIN_PASS=${NATS_ADMIN_PASS:-default_pass}" >> .env
echo "NATS_PUBLIC_PASS=${NATS_PUBLIC_PASS:-temp-public-pass}" >> .env
set_env_var() {
echo "$1=${!1:-$2}" >> $GITHUB_ENV
echo "$1=${!1:-$2}" >> .env
}
set_env_var "NATS_SYSTEM_USER" "sys"
set_env_var "NATS_SYSTEM_PASS" "sys"
set_env_var "NATS_ADMIN_USER" "admin"
set_env_var "NATS_ADMIN_PASS" "admin"
set_env_var "NATS_PUBLIC_USER" "default_user"
set_env_var "NATS_PUBLIC_PASS" ""

- name: Install Rust
uses: dtolnay/rust-toolchain@master
Expand Down
130 changes: 67 additions & 63 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
name: CI

on:
workflow_dispatch:
pull_request:
types:
- opened
Expand Down Expand Up @@ -190,33 +189,38 @@ jobs:
- name: Install dependencies
run: cargo fetch

test-helm:
needs: install-deps
name: Test Helm
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Helm
uses: azure/setup-helm@v4
with:
version: "latest"

- name: Install helm unittest plugin
run: |
helm plugin install https://github.com/helm-unittest/helm-unittest.git

- name: Run Helm unit tests
run: |
make helm-test
# test-helm:
# needs: install-deps
# name: Test Helm
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - name: Set up Helm
# uses: azure/setup-helm@v4
# with:
# version: "latest"

# - name: Install helm unittest plugin
# run: |
# helm plugin install https://github.com/helm-unittest/helm-unittest.git

# - name: Run Helm unit tests
# run: |
# make helm-test

test:
needs: install-deps
name: Test ${{ matrix.package }}
runs-on: ubuntu-latest
env:
NATS_URL: nats://127.0.0.1:4222
NATS_ADMIN_PASS: secret
NATS_PUBLIC_PASS: secret
NATS_PUBLISHER_URL: nats://127.0.0.1:4333
NATS_SYSTEM_USER: sys
NATS_SYSTEM_PASSWORD: sys
NATS_ADMIN_USER: admin
NATS_ADMIN_PASS: admin
NATS_PUBLIC_USER: default_user
NATS_PUBLIC_PASS: ""
AWS_ACCESS_KEY_ID: test
AWS_SECRET_ACCESS_KEY: test
AWS_REGION: us-east-1
Expand All @@ -226,13 +230,12 @@ jobs:
fail-fast: false
matrix:
package:
# - fuel-data-parser
- fuel-data-parser
- fuel-streams
- fuel-streams-core
- fuel-streams-macros
- fuel-streams-publisher
- fuel-streams-ws

- sv-webserver
- sv-publisher
steps:
- uses: actions/checkout@v4

Expand Down Expand Up @@ -266,8 +269,9 @@ jobs:
fail-fast: false
matrix:
package:
- fuel-streams-publisher
- fuel-streams-ws
- sv-consumer
- sv-publisher
- sv-webserver
is_release:
- ${{ github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch' }}
platform:
Expand Down Expand Up @@ -336,34 +340,34 @@ jobs:
rustup target add ${{ matrix.platform.target }}
cargo build --release --locked --target ${{ matrix.platform.target }} --package ${{ matrix.package }}

- name: Strip binaries
run: ./scripts/strip-binary.sh "${{ matrix.platform.target }}"

- name: Set Artifact Name
id: artifact-name
shell: bash
run: |
echo "value=${{ matrix.package }}-${{ matrix.platform.os_name }}" >> $GITHUB_OUTPUT

- name: Package as archive
shell: bash
run: |
cd target/${{ matrix.platform.target }}/release
tar czvf ../../../${{ steps.artifact-name.outputs.value }}.tar.gz ${{ matrix.package }}
cd -

- name: Publish release artifacts
uses: actions/upload-artifact@v4
if: >-
(github.event_name == 'push' &&
github.ref == 'refs/heads/main' &&
contains(github.event.head_commit.message, 'ci(release): Preparing')) ||
github.event_name == 'workflow_dispatch'
with:
name: ${{ steps.artifact-name.outputs.value }}
path: ${{ matrix.package }}-*
if-no-files-found: error
retention-days: 30
# - name: Strip binaries
# run: ./scripts/strip-binary.sh "${{ matrix.platform.target }}"

# - name: Set Artifact Name
# id: artifact-name
# shell: bash
# run: |
# echo "value=${{ matrix.package }}-${{ matrix.platform.os_name }}" >> $GITHUB_OUTPUT

# - name: Package as archive
# shell: bash
# run: |
# cd target/${{ matrix.platform.target }}/release
# tar czvf ../../../${{ steps.artifact-name.outputs.value }}.tar.gz ${{ matrix.package }}
# cd -

# - name: Publish release artifacts
# uses: actions/upload-artifact@v4
# if: >-
# (github.event_name == 'push' &&
# github.ref == 'refs/heads/main' &&
# contains(github.event.head_commit.message, 'ci(release): Preparing')) ||
# github.event_name == 'workflow_dispatch'
# with:
# name: ${{ steps.artifact-name.outputs.value }}
# path: ${{ matrix.package }}-*
# if-no-files-found: error
# retention-days: 30

release:
name: Create Release with Knope
Expand All @@ -374,7 +378,7 @@ jobs:
github.event_name == 'workflow_dispatch'
needs:
- test
- test-helm
# - test-helm
- build
runs-on: ubuntu-latest
permissions:
Expand All @@ -384,14 +388,14 @@ jobs:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Download Artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
merge-multiple: true
# - name: Download Artifacts
# uses: actions/download-artifact@v4
# with:
# path: artifacts
# merge-multiple: true

- name: List Artifacts
run: ls -R artifacts
# - name: List Artifacts
# run: ls -R artifacts

- name: Run Knope Action
uses: knope-dev/[email protected]
Expand Down
53 changes: 24 additions & 29 deletions .github/workflows/docker_publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@ name: Build and publish Docker image
on:
workflow_dispatch:
inputs:
image_type:
description: "Choose which image to build (publisher/webserver/both)"
required: true
package:
type: choice
description: "Package to build and publish"
default: "all"
required: true
options:
- publisher
- webserver
- both
default: "both"
- all
- sv-publisher
- sv-webserver
- sv-consumer
push:
branches:
- main
Expand All @@ -30,36 +31,30 @@ concurrency:
jobs:
build-and-publish-image:
runs-on: ubuntu-latest
if: |
(github.event_name == 'release' && github.event.action == 'published') ||
github.ref == 'refs/heads/main' ||
github.event_name == 'workflow_dispatch' ||
github.event_name == 'pull_request'
strategy:
matrix:
package:
- name: sv-webserver
image: cluster/docker/sv-webserver.Dockerfile
- name: sv-publisher
image: cluster/docker/sv-publisher.Dockerfile
- name: sv-consumer
image: cluster/docker/sv-consumer.Dockerfile
steps:
- uses: actions/checkout@v4

- name: Get short SHA
id: sha
run: echo "short_sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT

- name: Build and push Docker for publisher
if: github.event.inputs.image_type == 'publisher' || github.event.inputs.image_type == 'both'
|| github.event_name != 'workflow_dispatch'
uses: ./.github/actions/docker-publish
id: publish-fuel-streams-nats
with:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
image: ghcr.io/fuellabs/fuel-streams-publisher
dockerfile: cluster/docker/fuel-streams-publisher.Dockerfile

- name: Build and push Docker for webserver
if: github.event.inputs.image_type == 'webserver' || github.event.inputs.image_type == 'both'
|| github.event_name != 'workflow_dispatch'
- name: Build and push Docker for ${matrix.package.name} (${{ steps.sha.outputs.short_sha }})
if: |
(github.event_name == 'workflow_dispatch' && (github.event.inputs.package == 'all' || github.event.inputs.package == matrix.package.name)) ||
github.event_name != 'workflow_dispatch'
uses: ./.github/actions/docker-publish
id: publish-fuel-webserver-nats
id: publish
with:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
image: ghcr.io/fuellabs/fuel-streams-ws
dockerfile: cluster/docker/fuel-streams-ws.Dockerfile
image: ghcr.io/fuellabs/${{ matrix.package.name }}
dockerfile: ${{ matrix.package.image }}
Loading
Loading