Skip to content

Commit

Permalink
fix: rolling upgrade (bigger pg config) and add isolation
Browse files Browse the repository at this point in the history
  • Loading branch information
gfyrag committed Nov 8, 2024
1 parent ae7ec6d commit af957f2
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 12 deletions.
2 changes: 1 addition & 1 deletion cmd/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func NewServeCommand() *cobra.Command {

Handler chi.Router
HealthController *health.HealthController
Logger logging.Logger
Logger logging.Logger

MeterProvider *metric.MeterProvider `optional:"true"`
Exporter *otlpmetrics.InMemoryExporter `optional:"true"`
Expand Down
22 changes: 12 additions & 10 deletions test/rolling-upgrades/Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,20 @@ CACHE --sharing=shared --id go-cache /root/.cache/go-build

image-test:
ARG REPOSITORY=ghcr.io
ARG tag=latest
ARG TAG=latest
FROM --pass-args ../../tools/generator+build-image

DO --pass-args core+SAVE_IMAGE --COMPONENT=ledger-rolling-upgrade-test --REPOSITORY=${REPOSITORY} --TAG=$tag
DO --pass-args core+SAVE_IMAGE --COMPONENT=ledger-rolling-upgrade-test --REPOSITORY=${REPOSITORY} --TAG=$TAG

image-main:
ARG REPOSITORY=ghcr.io
BUILD --pass-args github.com/formancehq/ledger:main+build-image --tag=main
ARG TAG
BUILD --pass-args github.com/formancehq/ledger:main+build-image --tag=$TAG

image-current:
ARG REPOSITORY=ghcr.io
BUILD --pass-args ../..+build-image --tag=current
ARG TAG
BUILD --pass-args ../..+build-image --tag=$TAG

sources:
FROM core+builder-image
Expand Down Expand Up @@ -61,9 +63,9 @@ run:
ARG CLUSTER_NAME=test
WAIT
BUILD --pass-args +cluster-create
BUILD +image-test
BUILD +image-main
BUILD +image-current
BUILD +image-test --TAG=$CLUSTER_NAME
BUILD +image-main --TAG=$CLUSTER_NAME-main
BUILD +image-current --TAG=$CLUSTER_NAME-current
END

FROM --pass-args +cluster-create
Expand Down Expand Up @@ -91,9 +93,9 @@ run:
echo "Running test..."
go test \
--test-image ghcr.io/formancehq/ledger-rolling-upgrade-test:latest \
--latest-version main \
--actual-version current \
--test-image ghcr.io/formancehq/ledger-rolling-upgrade-test:$CLUSTER_NAME \
--latest-version $CLUSTER_NAME-main \
--actual-version $CLUSTER_NAME-current \
--project ledger \
--stack-prefix-name $CLUSTER_NAME- \
--no-cleanup=$NO_CLEANUP \
Expand Down
10 changes: 9 additions & 1 deletion test/rolling-upgrades/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ func deployTest(ctx *pulumi.Context) error {
pulumi.String(ledgerURL),
pulumi.String("/examples/example1.js"),
pulumi.String("-p"),
pulumi.String("100"),
pulumi.String("30"),
},
Image: pulumi.String(image),
ImagePullPolicy: pulumi.String("Always"),
Expand Down Expand Up @@ -234,6 +234,14 @@ func deployPostgres(ctx *pulumi.Context) error {
"username": pulumi.String("ledger"),
"database": pulumi.String("ledger"),
},
"primary": pulumi.Map{
"resources": pulumi.Map{
"requests": pulumi.Map{
"memory": pulumi.String("256Mi"),
"cpu": pulumi.String("250m"),
},
},
},
}),
CreateNamespace: pulumi.BoolPtr(true),
})
Expand Down

0 comments on commit af957f2

Please sign in to comment.