Skip to content

Commit e758789

Browse files
committed
Merge branch 'main' into chore/quickstart
2 parents b54896b + 536f884 commit e758789

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+2182
-613
lines changed

.env.example

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ CLICKHOUSE_PASSWORD=""
2121
# Misc Configs
2222
PUBLISHMQ_MAX_CONCURRENCY=1
2323
DELIVERYMQ_MAX_CONCURRENCY=1
24-
TOPICS="orders.created,orders.updated,orders.deleted" # comma separated list of topics to subscribe to, replace with your own topics
24+
TOPICS="user.created,user.updated,user.deleted" # comma separated list of topics to subscribe to, replace with your own topics
2525

2626
# MQs, Uncomment the one you want to use
2727

.env.test

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
TEST_CLICKHOUSE_URL="localhost:39000"
2+
TEST_LOCALSTACK_URL="localhost:34566"
3+
TEST_RABBITMQ_URL="localhost:35672"

.github/workflows/release.yml

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
env:
12+
# https://goreleaser.com/customization/docker_manifest/
13+
DOCKER_CLI_EXPERIMENTAL: "enabled"
14+
steps:
15+
- name: Code checkout
16+
uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0
19+
- uses: actions/setup-node@v4
20+
with:
21+
node-version: "20.x"
22+
registry-url: "https://registry.npmjs.org"
23+
- name: Install JS dependencies
24+
run: npm install
25+
working-directory: internal/portal
26+
- name: Build Portal
27+
run: npm run build
28+
working-directory: internal/portal
29+
- name: Docker Login
30+
uses: docker/login-action@v3
31+
with:
32+
username: ${{ secrets.DOCKER_USERNAME }}
33+
password: ${{ secrets.DOCKER_PASSWORD }}
34+
- name: Set up Docker QEMU
35+
uses: docker/setup-qemu-action@v3
36+
- name: Set up Docker Buildx
37+
uses: docker/setup-buildx-action@v3
38+
- name: Set up Go
39+
uses: actions/setup-go@v5
40+
with:
41+
go-version: 1.23.0
42+
- name: Run GoReleaser
43+
uses: goreleaser/goreleaser-action@v4
44+
with:
45+
version: latest
46+
args: release -f build/.goreleaser.yaml --clean
47+
env:
48+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22
.env
33

44
# Built binaries
5+
/dist
56
/bin
67
/tmp
78

89
# Golang test coverage
910
/*.out
1011

1112
# Misc
12-
.DS_Store
13+
.DS_Store

Makefile

+6
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ down/uptrace:
2929
up/portal:
3030
cd internal/portal && npm install && npm run dev
3131

32+
up/test:
33+
docker-compose -f build/test/compose.yml up -d
34+
35+
down/test:
36+
docker-compose -f build/test/compose.yml down
37+
3238
test:
3339
go test $(TEST) $(TESTARGS)
3440

build/.goreleaser.yaml

+99
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
version: 2
2+
3+
before:
4+
hooks:
5+
- go mod tidy
6+
- go generate ./...
7+
8+
project_name: outpost
9+
10+
builds:
11+
- id: outpost
12+
ldflags:
13+
- -s -w
14+
binary: outpost
15+
env:
16+
- CGO_ENABLED=0
17+
main: ./cmd/outpost/main.go
18+
goos:
19+
- linux
20+
goarch:
21+
- amd64
22+
- id: outpost-arm64
23+
ldflags:
24+
- -s -w
25+
binary: outpost
26+
env:
27+
- CGO_ENABLED=0
28+
main: ./cmd/outpost/main.go
29+
goos:
30+
- linux
31+
goarch:
32+
- arm64
33+
34+
archives:
35+
- format: tar.gz
36+
# this name template makes the OS and Arch compatible with the results of `uname`.
37+
name_template: >-
38+
{{ .ProjectName }}_
39+
{{- title .Os }}_
40+
{{- if eq .Arch "amd64" }}x86_64
41+
{{- else if eq .Arch "386" }}i386
42+
{{- else }}{{ .Arch }}{{ end }}
43+
{{- if .Arm }}v{{ .Arm }}{{ end }}
44+
# use zip for windows archives
45+
format_overrides:
46+
- goos: windows
47+
format: zip
48+
49+
changelog:
50+
sort: asc
51+
filters:
52+
exclude:
53+
- "^docs:"
54+
- "^test:"
55+
56+
dockers:
57+
- goos: linux
58+
goarch: amd64
59+
dockerfile: ./build/Dockerfile.goreleaser
60+
ids:
61+
- outpost
62+
image_templates:
63+
- "hookdeck/outpost:latest-amd64"
64+
- "hookdeck/outpost:{{ .Tag }}-amd64"
65+
build_flag_templates:
66+
- "--pull"
67+
- "--label=org.opencontainers.image.created={{.Date}}"
68+
- "--label=org.opencontainers.image.name={{.ProjectName}}"
69+
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
70+
- "--label=org.opencontainers.image.version={{.Version}}"
71+
- "--label=repository=https://github.com/hookdeck/outpost"
72+
- "--label=homepage=https://hookdeck.com"
73+
- "--platform=linux/amd64"
74+
- goos: linux
75+
goarch: arm64
76+
dockerfile: ./build/Dockerfile.goreleaser
77+
ids:
78+
- outpost-arm64
79+
image_templates:
80+
- "hookdeck/outpost:latest-arm64"
81+
- "hookdeck/outpost:{{ .Tag }}-arm64"
82+
build_flag_templates:
83+
- "--pull"
84+
- "--label=org.opencontainers.image.created={{.Date}}"
85+
- "--label=org.opencontainers.image.name={{.ProjectName}}"
86+
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
87+
- "--label=org.opencontainers.image.version={{.Version}}"
88+
- "--label=repository=https://github.com/hookdeck/outpost"
89+
- "--label=homepage=https://hookdeck.com"
90+
- "--platform=linux/arm64/v8"
91+
docker_manifests:
92+
- name_template: "hookdeck/outpost:latest"
93+
image_templates:
94+
- "hookdeck/outpost:latest-amd64"
95+
- "hookdeck/outpost:latest-arm64"
96+
- name_template: "hookdeck/outpost:{{ .Tag }}"
97+
image_templates:
98+
- "hookdeck/outpost:{{ .Tag }}-amd64"
99+
- "hookdeck/outpost:{{ .Tag }}-arm64"

build/Dockerfile.goreleaser

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
FROM scratch
2+
COPY outpost /bin/outpost
3+
ENTRYPOINT ["/bin/outpost"]

build/dev/compose.yml

+23-5
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ services:
99
volumes:
1010
- ../../:/app
1111
depends_on:
12-
- redis
12+
redis:
13+
condition: service_started
14+
clickhouse:
15+
condition: service_healthy
1316
ports:
1417
- "${PORT}:${PORT}"
1518
env_file: ../../.env
@@ -21,8 +24,12 @@ services:
2124
volumes:
2225
- ../..:/app
2326
depends_on:
24-
- redis
25-
- api
27+
redis:
28+
condition: service_started
29+
clickhouse:
30+
condition: service_healthy
31+
api:
32+
condition: service_started
2633
env_file: ../../.env
2734
environment:
2835
SERVICE: delivery
@@ -32,8 +39,12 @@ services:
3239
volumes:
3340
- ../..:/app
3441
depends_on:
35-
- redis
36-
- api
42+
redis:
43+
condition: service_started
44+
clickhouse:
45+
condition: service_healthy
46+
api:
47+
condition: service_started
3748
env_file: ../../.env
3849
environment:
3950
SERVICE: log
@@ -60,6 +71,8 @@ services:
6071

6172
clickhouse:
6273
image: clickhouse/clickhouse-server:24-alpine
74+
environment:
75+
CLICKHOUSE_DB: outpost
6376
ports:
6477
# tcp
6578
- 9000:9000
@@ -84,6 +97,11 @@ services:
8497
nofile:
8598
soft: 262144
8699
hard: 262144
100+
healthcheck:
101+
test: ["CMD", "wget", "--spider", "-q", "http://127.0.0.1:8123/ping"]
102+
interval: 1s
103+
timeout: 1s
104+
retries: 30
87105

88106
volumes:
89107
redis:

build/test/compose.yml

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: "outpost-test"
2+
3+
services:
4+
clickhouse:
5+
image: clickhouse/clickhouse-server:24-alpine
6+
ports:
7+
- 39000:9000
8+
rabbitmq:
9+
image: rabbitmq:3-management
10+
ports:
11+
- 35672:5672
12+
- 45672:15672
13+
aws:
14+
image: localstack/localstack:latest
15+
environment:
16+
- SERVICES=sns,sts,sqs
17+
ports:
18+
- 34566:4566
19+
- 34571:4571

0 commit comments

Comments
 (0)