Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/frain-dev/convoy into smart-ia
Browse files Browse the repository at this point in the history
  • Loading branch information
mekilis committed Jan 16, 2025
2 parents 8fb7cc6 + 94a7ea6 commit 1db2a22
Show file tree
Hide file tree
Showing 16 changed files with 296 additions and 135 deletions.
128 changes: 128 additions & 0 deletions .github/workflows/build-rolling-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
name: Build and Push Docker Images to AWS
on:
workflow_dispatch:
inputs:
name:
description: "Manual workflow name"
required: true
push:
branches:
- main

env:
AWS_REGION: ${{ secrets.AWS_REGION }}
IMAGE_NAME: ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.${{ secrets.AWS_REGION }}.amazonaws.com/convoy-rolling-updates

jobs:
build_ui:
name: Build UI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build Artifact
run: "make ui_install type=ce"
- name: Archive Build artifacts
uses: actions/upload-artifact@v4
with:
name: dist-without-markdown
path: |
web/ui/dashboard/dist
!web/ui/dashboard/dist/**/*.md
build-and-push-arch:
runs-on: ubuntu-latest
needs: [build_ui]
strategy:
matrix:
include:
- arch: amd64
platform: linux/amd64
dockerfile: release.Dockerfile
- arch: arm64
platform: linux/arm64
dockerfile: release.Dockerfile

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set short hash
run: echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV

- name: Download Build Artifact
uses: actions/download-artifact@v4
with:
name: dist-without-markdown
path: api/ui/build

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.22

- name: Get and verify dependencies
run: go mod tidy && go mod download && go mod verify

- name: Go vet
run: go vet ./...

- name: Build app to make sure there are zero issues
run: |
export CGO_ENABLED=0
export GOOS=linux
export GOARCH=${{ matrix.arch }}
go build -o convoy ./cmd
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}

- name: Login to Amazon ECR
uses: aws-actions/amazon-ecr-login@v2

- name: Build and push arch specific images
uses: docker/build-push-action@v6
with:
context: .
file: ${{ matrix.dockerfile }}
platforms: ${{ matrix.platform }}
push: true
tags: |
${{ env.IMAGE_NAME }}:${{ env.SHORT_SHA }}-${{ matrix.arch }}
build-args: |
ARCH=${{ matrix.arch }}
build-and-push-default:
runs-on: ubuntu-latest
needs: [build-and-push-arch]
steps:
- uses: actions/checkout@v4

- name: Set short hash
run: echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}

- name: Login to Amazon ECR
uses: aws-actions/amazon-ecr-login@v2

- name: Create and push manifest for version
run: |
docker buildx imagetools create -t ${{ env.IMAGE_NAME }}:${{ env.SHORT_SHA }} \
${{ env.IMAGE_NAME }}:${{ env.SHORT_SHA }}-amd64 \
${{ env.IMAGE_NAME }}:${{ env.SHORT_SHA }}-arm64
18 changes: 17 additions & 1 deletion configs/local/convoy.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,21 @@
"redis": {
"port": 6379,
"host": "redis_server"
}
},
"server": {
"http": {
"port": 5005,
"agent_port": 5008,
"ingest_port": 5009,
"worker_port": 5006
}
},
"metrics": {
"enabled": true
},
"enable_feature_flag": [
"prometheus",
"circuit-breaker",
"full-text-search"
]
}
29 changes: 9 additions & 20 deletions configs/local/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: "3"

services:
web:
image: getconvoy/convoy:latest
Expand All @@ -19,18 +17,11 @@ services:
- postgres
- redis_server
- pgbouncer
worker:
agent:
image: getconvoy/convoy:latest
command: ["./cmd", "worker", "--config", "convoy.json"]
volumes:
- ./convoy.json:/convoy.json
restart: unless-stopped
depends_on:
web:
condition: service_healthy
ingest:
image: getconvoy/convoy:latest
command: ["./cmd", "ingest", "--config", "convoy.json"]
command: ["./cmd", "agent", "--config", "convoy.json"]
ports:
- "5008:5008"
volumes:
- ./convoy.json:/convoy.json
restart: unless-stopped
Expand All @@ -52,19 +43,17 @@ services:
ports:
- "6432:6432"
postgres:
image: bitnami/postgresql:latest
image: postgres:15.2-alpine
restart: on-failure
ports:
- "5432:5432"
environment:
POSTGRESQL_DATABASE: convoy
POSTGRESQL_USERNAME: convoy
POSTGRES_DB: convoy
POSTGRES_USER: convoy
POSTGRES_PASSWORD: pg_password
POSTGRESQL_MAX_CONNECTIONS: 250
POSTGRESQL_POSTGRES_PASSWORD: postgres
POSTGRESQL_SHARED_PRELOAD_LIBRARIES: pg_stat_statements
PGDATA: /data/postgres
volumes:
- postgresql_master_data:/bitnami/postgresql
- postgresql_master_data:/data/postgres
healthcheck:
test: ["CMD-SHELL", "pg_isready -U convoy"]
interval: 10s
Expand Down
4 changes: 2 additions & 2 deletions database/postgres/delivery_attempts.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ BEGIN
request_http_header jsonb,
response_http_header jsonb,
http_status VARCHAR,
response_data TEXT,
response_data BYTEA,
error TEXT,
status BOOLEAN,
created_at TIMESTAMP WITH TIME ZONE default now() not null,
Expand Down Expand Up @@ -332,7 +332,7 @@ begin
request_http_header jsonb,
response_http_header jsonb,
http_status VARCHAR,
response_data TEXT,
response_data BYTEA,
error TEXT,
status BOOLEAN,
created_at TIMESTAMP WITH TIME ZONE default now() not null,
Expand Down
2 changes: 1 addition & 1 deletion datastore/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ var (
CircuitBreakerConfig: &DefaultCircuitBreakerConfiguration,
}

DefaultSSLConfig = SSLConfiguration{EnforceSecureEndpoints: true}
DefaultSSLConfig = SSLConfiguration{EnforceSecureEndpoints: false}

DefaultStrategyConfig = StrategyConfiguration{
Type: LinearStrategyProvider,
Expand Down
10 changes: 5 additions & 5 deletions internal/pkg/keys/hcpvault.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,14 +123,14 @@ func (k *HCPVaultKeyManager) GetCurrentKeyFromCache() (string, error) {
return "", ErrCredentialEncryptionFeatureUnavailable
}

var currentKey string
var currentKey *string
err := k.cache.Get(context.Background(), RedisCacheKey, &currentKey)
if err != nil {
return "", err
}

if currentKey != "" {
return currentKey, nil
if currentKey != nil && *currentKey != "" {
return *currentKey, nil
}

return k.GetCurrentKey()
Expand Down Expand Up @@ -161,7 +161,7 @@ func (k *HCPVaultKeyManager) GetCurrentKey() (string, error) {
return "", err
}

return currentKey, k.cache.Set(context.Background(), RedisCacheKey, currentKey, -1)
return currentKey, k.cache.Set(context.Background(), RedisCacheKey, &currentKey, -1)
}
}

Expand Down Expand Up @@ -275,7 +275,7 @@ func (k *HCPVaultKeyManager) createOrUpdateSecret(newKey string) error {
return parseErrorResponse(resp)
}

return k.cache.Set(context.Background(), RedisCacheKey, newKey, -1)
return k.cache.Set(context.Background(), RedisCacheKey, &newKey, -1)
}

// deleteSecret deletes the existing secret to reset the versioning.
Expand Down
3 changes: 0 additions & 3 deletions internal/pkg/retention/retention.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package retention

import (
"context"
"fmt"
"github.com/frain-dev/convoy/database"
"github.com/frain-dev/convoy/database/postgres"
"github.com/frain-dev/convoy/datastore"
Expand Down Expand Up @@ -141,8 +140,6 @@ func (r *RetentionPolicy) Start(ctx context.Context, sampleRate time.Duration) {
if err != nil {
r.logger.WithError(err).Error("failed to add convoy.delivery_attempts to managed tables")
}

fmt.Printf("pro: %+v\n", len(r.partitioner.(*partman.Manager).GetConfig().Tables))
}
}
}
Expand Down
Loading

0 comments on commit 1db2a22

Please sign in to comment.