Skip to content

Commit

Permalink
Removing cloud folder | Introducing Terragrunt for multitenancy | A…
Browse files Browse the repository at this point in the history
…djusting trivy config file | Creating dev cluster using K3d | Enabling `dorny paths filter` in Github Actions
  • Loading branch information
Archisman-Mridha committed Jan 28, 2024
1 parent 7a033f0 commit 4b6bb7d
Show file tree
Hide file tree
Showing 34 changed files with 330 additions and 393 deletions.
38 changes: 19 additions & 19 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -141,31 +141,31 @@ jobs:

## If sourcecode of the microservice has changed, only then we will rebuild, push, sign
## and scan the container image.
## - name: Detect sourcecode change
## uses: dorny/paths-filter@v2
## id: path-filter
## with:
## base: ${{ github.ref }}
## filters: ${{ matrix.microservice.path_filters }}
- name: Detect sourcecode change
uses: dorny/paths-filter@v2
id: path-filter
with:
base: ${{ github.ref }}
filters: ${{ matrix.microservice.path_filters }}

- name: Set up QEMU
## if: steps.path-filter.outputs.changed == 'true'
if: steps.path-filter.outputs.changed == 'true'
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
## if: steps.path-filter.outputs.changed == 'true'
if: steps.path-filter.outputs.changed == 'true'
uses: docker/setup-buildx-action@v2

- name: Login to GitHub Container Registry
## if: steps.path-filter.outputs.changed == 'true'
if: steps.path-filter.outputs.changed == 'true'
uses: docker/login-action@v2.1.0
with:
registry: ghcr.io
username: archisman-mridha
password: ${{ secrets.GITHUB_TOKEN }}

- name: Restore cached Cargo dependencies (if exists)
## if: steps.path-filter.outputs.changed == 'true'
if: steps.path-filter.outputs.changed == 'true'
uses: actions/cache/restore@v3
with:
path: |
Expand All @@ -174,7 +174,7 @@ jobs:
key: ${{ runner.os }}-cargo-${{ matrix.microservice.name }}-${{ hashFiles('**/Cargo.lock') }}

- name: Build and push AMD64 container image
## if: steps.path-filter.outputs.changed == 'true'
if: steps.path-filter.outputs.changed == 'true'
uses: docker/build-push-action@v4
with:
context: .
Expand All @@ -191,7 +191,7 @@ jobs:
cache-to: type=gha,mode=max

- name: Cache Cargo dependencies
## if: steps.path-filter.outputs.changed == 'true'
if: steps.path-filter.outputs.changed == 'true'
uses: actions/cache@v3
with:
path: |
Expand All @@ -200,20 +200,20 @@ jobs:
key: ${{ runner.os }}-cargo-${{ matrix.microservice.name }}-${{ hashFiles('**/Cargo.lock') }}

- name: Remove cached folders from local machine
## if: steps.path-filter.outputs.changed == 'true'
if: steps.path-filter.outputs.changed == 'true'
run: |
rm -rf /usr/local/cargo/registry/ target/
## Cosign is a command line utility that can sign and verify software artifact, such as
## container images and blobs.
- name: Install Cosign
## if: steps.path-filter.outputs.changed == 'true'
if: steps.path-filter.outputs.changed == 'true'
uses: sigstore/cosign-installer@v3.1.1
with:
cosign-release: v2.2.1

- name: Sign the published container image
## if: steps.path-filter.outputs.changed == 'true'
if: steps.path-filter.outputs.changed == 'true'
env:
COSIGN_PASSWORD: ${{ secrets.COSIGN_PASSWORD }}
run: |
Expand All @@ -225,11 +225,11 @@ jobs:
ghcr.io/archisman-mridha/instagram-clone-${{ matrix.microservice.name }}:${{ github.sha }} -y
- name: Create outputs directory
## if: steps.path-filter.outputs.changed == 'true'
if: steps.path-filter.outputs.changed == 'true'
run: mkdir -p ./outputs/trivy

- name: Scan container image for vulnerabilities
## if: steps.path-filter.outputs.changed == 'true'
if: steps.path-filter.outputs.changed == 'true'
uses: aquasecurity/trivy-action@master
with:
image-ref: ghcr.io/archisman-mridha/instagram-clone-${{ matrix.microservice.name }}:${{ github.sha }}
Expand All @@ -240,14 +240,14 @@ jobs:
output: ./outputs/trivy/${{ matrix.microservice.name }}.container-image-scan-result.sarif

- name: Upload the scan result as Github artifact
## if: steps.path-filter.outputs.changed == 'true'
if: steps.path-filter.outputs.changed == 'true'
uses: actions/upload-artifact@v3
with:
name: trivy.${{ matrix.microservice.name }}-microservice.container-image-scan-result.sarif
path: ./outputs/trivy/${{ matrix.microservice.name }}.container-image-scan-result.sarif

- name: Update container image tag in Kubernetes manifests
## if: steps.path-filter.outputs.changed == 'true'
if: steps.path-filter.outputs.changed == 'true'
run: |
git config --global user.name "Archisman-Mridha"
git config --global user.email "archismanmridha12345@gmail.com"
Expand Down
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,15 @@ override.tf.json
.terraformrc
terraform.rc

#--- Terragrunt ---

# terragrunt cache directories
**/.terragrunt-cache/*

# Terragrunt debug output file (when using `--terragrunt-debug` option)
# See: https://terragrunt.gruntwork.io/docs/reference/cli-options/#terragrunt-debug
terragrunt-debug.tfvars.json

# --- RUST ---

# Generated by Cargo
Expand Down
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,10 @@ gen-sealed-secrets:

## Generate a token using which we can signin into the Kiali dashboard.
get-kiali-token:
kubectl -n istio-system create token kiali-service-account
kubectl -n istio-system create token kiali-service-account

get-argocd-admin-password:
kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d

show-argocd-ui:
kubectl port-forward svc/argocd-server -n argocd 8080:443
5 changes: 2 additions & 3 deletions backend/microservices/feeds/adapters/kafka.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,11 @@ impl KafkaAdapter {
let consumeMessage: bool;

match payload.op {
DbOperation::Create =>
// TODO: For each message, spin up a new thread (or take a thread from a thread-pool)
// and do the processing in that separate thread parallaly.
// and do the processing in that separate thread parallely.
//
// TODO: If any error occurs, then send it to a central log management system.
{
DbOperation::Create => {
consumeMessage = usecases
.pushPostToFeeds(payload.after.unwrap())
.await
Expand Down
104 changes: 0 additions & 104 deletions cloud/.terraform.lock.hcl

This file was deleted.

36 changes: 0 additions & 36 deletions cloud/1.cluster.tf

This file was deleted.

31 changes: 0 additions & 31 deletions cloud/2.cilium.tf

This file was deleted.

14 changes: 0 additions & 14 deletions cloud/3.prepare-cluster.tf

This file was deleted.

Loading

0 comments on commit 4b6bb7d

Please sign in to comment.