Skip to content

Commit 9961a24

Browse files
EvolveArtgraniet
andauthored
✨ New Architecture (#29)
* WIP: first init * add timescaledb to compose * update error handling * add comment * WIP: ingestor service * update arch with entities * refactoring * refactoring * rustfmt * update infra arch * update arch * update infra arch * update readme.md * update readme.md with getting started * feat: release workflow * fix: linter * fix: linters * fix: remove markdown lint * fix: clippy * fix: release workflow package name * fix: ignore test --------- Co-authored-by: graniet <graniet75@gmail.com>
1 parent f3b9db8 commit 9961a24

File tree

95 files changed

+5029
-770
lines changed

Some content is hidden

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

95 files changed

+5029
-770
lines changed

.dockerignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
**/charts
2222
**/docker-compose*
2323
**/compose*
24-
**/Dockerfile*
24+
infra/pragma-ingestor/Dockerfile
2525
**/node_modules
2626
**/npm-debug.log
2727
**/secrets.dev.yaml

.github/workflows/docker-build.yml

+135
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
---
2+
name: Task - Build and Push Docker Image
3+
4+
on:
5+
workflow_dispatch:
6+
inputs:
7+
release_tag_name:
8+
description: "Release tag name"
9+
type: string
10+
required: true
11+
docker_context:
12+
description: "Docker context"
13+
type: string
14+
required: true
15+
package_name:
16+
description: "Package name"
17+
type: string
18+
required: true
19+
workflow_call:
20+
inputs:
21+
release_tag_name:
22+
description: "Release tag name"
23+
type: string
24+
required: true
25+
docker_context:
26+
description: "Docker context"
27+
type: string
28+
required: true
29+
package_name:
30+
description: "Package name"
31+
type: string
32+
required: true
33+
34+
jobs:
35+
build:
36+
runs-on: ubuntu-latest
37+
strategy:
38+
fail-fast: false
39+
matrix:
40+
platform:
41+
- linux/amd64
42+
- linux/arm64
43+
steps:
44+
- name: Checkout
45+
uses: actions/checkout@v3
46+
47+
- name: Docker meta
48+
id: meta
49+
uses: docker/metadata-action@v4
50+
with:
51+
images: ${{ inputs.package_name }}
52+
tags: |
53+
type=raw,value=${{ inputs.release_tag_name }}
54+
55+
- name: Set up QEMU
56+
uses: docker/setup-qemu-action@v2
57+
58+
- name: Set up Docker Buildx
59+
uses: docker/setup-buildx-action@v2
60+
61+
- name: Login to GitHub Container Registry
62+
uses: docker/login-action@v2
63+
with:
64+
registry: ghcr.io
65+
username: ${{ github.actor }}
66+
password: ${{ secrets.GITHUB_TOKEN }}
67+
68+
- name: Build and push by digest
69+
id: build
70+
uses: docker/build-push-action@v4
71+
with:
72+
context: ${{ inputs.docker_context }}
73+
file: Dockerfile
74+
platforms: ${{ matrix.platform }}
75+
labels: ${{ steps.meta.outputs.labels }}
76+
outputs: type=image,name=${{ inputs.package_name
77+
}},push-by-digest=true,name-canonical=true,push=true
78+
79+
- name: Export digest
80+
run: |
81+
mkdir -p /tmp/digests
82+
digest="${{ steps.build.outputs.digest }}"
83+
touch "/tmp/digests/${digest#sha256:}"
84+
85+
- name: Upload digest
86+
uses: actions/upload-artifact@v3
87+
with:
88+
name: digests
89+
path: /tmp/digests/*
90+
if-no-files-found: error
91+
retention-days: 1
92+
93+
merge:
94+
runs-on: ubuntu-latest
95+
needs:
96+
- build
97+
steps:
98+
- name: Download digests
99+
uses: actions/download-artifact@v3
100+
with:
101+
name: digests
102+
path: /tmp/digests
103+
104+
- name: Set up Docker Buildx
105+
uses: docker/setup-buildx-action@v2
106+
107+
- name: Docker meta
108+
id: meta
109+
uses: docker/metadata-action@v4
110+
with:
111+
images: ${{ inputs.package_name }}
112+
tags: |
113+
type=raw,value=${{ inputs.release_tag_name }}
114+
115+
- name: Login to GitHub Container Registry
116+
uses: docker/login-action@v2
117+
with:
118+
registry: ghcr.io
119+
username: ${{ github.actor }}
120+
password: ${{ secrets.GITHUB_TOKEN }}
121+
122+
- name: Create manifest list and push
123+
working-directory: /tmp/digests
124+
run: |
125+
tags=$(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON")
126+
if [[ -z "$tags" ]]; then
127+
echo "No tags specified, skipping docker buildx imagetools create command"
128+
else
129+
docker buildx imagetools create $tags \
130+
$(printf '${{ inputs.package_name }}@sha256:%s ' *)
131+
fi
132+
133+
- name: Inspect image
134+
run: |
135+
docker buildx imagetools inspect ${{ inputs.package_name }}:${{ steps.meta.outputs.version }}

.github/workflows/linters.yml

-10
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,6 @@ jobs:
1414
run: |-
1515
npx prettier --check .
1616
17-
markdown-lint:
18-
runs-on: ubuntu-latest
19-
steps:
20-
- uses: actions/checkout@v3
21-
- uses: avto-dev/markdown-lint@v1
22-
with:
23-
config: "./.markdownlint.json"
24-
args: "."
25-
ignore: "./target"
26-
2717
toml-lint:
2818
runs-on: ubuntu-latest
2919
steps:

.github/workflows/release.yml

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
name: Workflow - Release
3+
4+
on:
5+
workflow_dispatch:
6+
release:
7+
types: [published]
8+
9+
jobs:
10+
docker_release_build_ingestor:
11+
name: Docker release build
12+
uses: ./.github/workflows/docker-build.yml
13+
with:
14+
release_tag_name: ${{ github.event.release.tag_name }}
15+
docker_context: ./infra/pragma-ingestor
16+
package_name: ghcr.io/pragma-ingestor
17+
docker_release_build_node:
18+
name: Docker release build
19+
uses: ./.github/workflows/docker-build.yml
20+
with:
21+
release_tag_name: ${{ github.event.release.tag_name }}
22+
docker_context: ./infra/pragma-node
23+
package_name: ghcr.io/pragma-node

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
/target
22
.idea
33
.env
4+
db/
5+
infra/db/password.txt

0 commit comments

Comments
 (0)