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

Merge Nats s3 hybrid publishing into main #362

Closed
wants to merge 15 commits into from
Closed
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
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
28 changes: 24 additions & 4 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -1,11 +1,31 @@
# Common Configuration
# Authentication & Security
KEYPAIR=generated-p2p-secret
JWT_AUTH_SECRET=generated-secret

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

# NATS Configuration
NATS_URL=nats://localhost:4222
NATS_ADMIN_PASS=generated-secret
NATS_SYSTEM_PASS=generated-secret
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_PUBLISHER_METRICS=true
USE_METRICS=true
PUBLISHER_MAX_THREADS=16

# Elasticsearch Configuration
ELASTICSEARCH_URL=http://127.0.0.1:9200
ELASTICSEARCH_USERNAME=elastic
ELASTICSEARCH_PASSWORD=generated-secret
Expand Down
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @luizstacio @pedronauck @jurshsmith @0xterminator
* @luizstacio @pedronauck @jurshsmith @0xterminator @cue8it
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
138 changes: 76 additions & 62 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 @@ -49,10 +48,13 @@ jobs:
deps
release
core
publisher
data-parser
networks
fuel-streams
macros
publisher
storage
ws

lockfile:
name: Validate Lockfile
Expand Down Expand Up @@ -187,43 +189,53 @@ 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
AWS_ENDPOINT_URL: http://localhost:4566
AWS_S3_BUCKET_NAME: fuel-streams-test
strategy:
fail-fast: false
matrix:
package:
# - fuel-data-parser
- fuel-data-parser
- fuel-streams
- fuel-streams-core
- fuel-streams-macros
- fuel-streams-publisher

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

Expand Down Expand Up @@ -257,7 +269,9 @@ jobs:
fail-fast: false
matrix:
package:
- fuel-streams-publisher
- sv-consumer
- sv-publisher
- sv-webserver
is_release:
- ${{ github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch' }}
platform:
Expand Down Expand Up @@ -326,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 @@ -364,7 +378,7 @@ jobs:
github.event_name == 'workflow_dispatch'
needs:
- test
- test-helm
# - test-helm
- build
runs-on: ubuntu-latest
permissions:
Expand All @@ -374,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
34 changes: 26 additions & 8 deletions .github/workflows/docker_publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@ name: Build and publish Docker image

on:
workflow_dispatch:
inputs:
package:
type: choice
description: "Package to build and publish"
default: "all"
required: true
options:
- all
- sv-publisher
- sv-webserver
- sv-consumer
push:
branches:
- main
Expand All @@ -20,23 +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 (${{ steps.sha.outputs.short_sha }})
- 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
with:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
image: ghcr.io/fuellabs/fuel-streams-publisher
dockerfile: cluster/docker/fuel-streams-publisher.Dockerfile
image: ghcr.io/fuellabs/${{ matrix.package.name }}
dockerfile: ${{ matrix.package.image }}
Loading
Loading