Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
local k8s working - as in the services starts without error
  • Loading branch information
FilipHarald committed Aug 24, 2024
0 parents commit 3002694
Show file tree
Hide file tree
Showing 240 changed files with 26,747 additions and 0 deletions.
29 changes: 29 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
*

!.yarn/cache
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
!.pnp.*
!.yarnrc.yml
!yarn.lock
!k8s

!package.json

# workaround for wildcards not working in exclusions (requires docker engine >23 https://docs.docker.com/engine/release-notes/23.0/#bug-fixes-and-enhancements-1)
# find . -name 'package.json' -not -path './.yarn/*' -not -path './packages/*' -maxdepth 3 | sed -e 's/^.\//!/'
!services/auth/package.json
!services/dummy-node/package.json
!services/aztec-listener/package.json
!services/explorer-api/package.json
!services/explorer-ui/package.json
# find . -name 'package.json' -not -path './.yarn/*' -not -path './services/*' -maxdepth 3 | sed -e 's/^.\//!/'
!packages/logger-server
!packages/message-bus
!packages/message-registry
!packages/types
!packages/error-middleware
!packages/auth0-middleware
19 changes: 19 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# dependencies
node_modules/

# production
build/

# scripts
scripts/

# test coverage
coverage/

# lint config *.js
!.*.js
!.*.mjs
!.*.cjs

# except for pnp
.pnp.*
98 changes: 98 additions & 0 deletions .github/workflows/obscura-dev.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
name: CI/CD Obscura Dev
# TODO

on:
pull_request:
branches:
- develop
types:
- closed

jobs:
build_and_deploy:
runs-on:
labels: large-runner-gh

steps:
- name: Retrieve cache
uses: actions/cache@v3
with:
path: |
~/.skaffold
key: cicd-dev-${{ github.sha }}
restore-keys: |
cicd-dev-${{ github.sha }}
cicd-dev-
- name: Checkout Repository
uses: actions/checkout@v2

- name: Create LFS file list
run: git lfs ls-files -l | cut -d' ' -f1 | sort > .lfs-assets-id

- name: Restore LFS cache
uses: actions/cache@v3
id: lfs-cache
with:
path: .git/lfs
key: ${{ runner.os }}-lfs-${{ hashFiles('.lfs-assets-id') }}-v1-${{ github.sha }}
restore-keys: |
${{ runner.os }}-lfs-${{ hashFiles('.lfs-assets-id') }}-v1-${{ github.sha }}
${{ runner.os }}-lfs-${{ hashFiles('.lfs-assets-id') }}-v1-
- name: Git LFS Pull
run: git lfs pull

- name: Install Skaffold
run: |
curl -Lo skaffold https://storage.googleapis.com/skaffold/releases/latest/skaffold-linux-amd64
sudo install skaffold /usr/local/bin/
shell: bash

- name: Configure AWS CLI
run: |
echo $AWS_ACCESS_KEY_ID
echo $AWS_SECRET_ACCESS_KEY
echo $AWS_DEFAULT_REGION
aws eks --region $AWS_DEFAULT_REGION update-kubeconfig --name obscura-dev
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_DEV_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_DEV_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: eu-west-3

- name: Login to Amazon ECR
run: |
aws ecr get-login-password --region eu-west-3 | docker login --username AWS --password-stdin 097733725684.dkr.ecr.eu-west-3.amazonaws.com
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_DEV_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_DEV_SECRET_ACCESS_KEY }}

- name: Build and push Docker images
run: |
echo $AWS_ACCESS_KEY_ID
echo $AWS_SECRET_ACCESS_KEY
echo $AWS_DEFAULT_REGION
envsubst < k8s/development/kafka-ui/configmap-env.template.yaml > k8s/development/kafka-ui/configmap-env.yaml
skaffold run --filename k8s/development/skaffold.dev.yaml
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_DEV_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_DEV_SECRET_ACCESS_KEY }}
AWS_MSK_ALL_SECRET_ACCESS_KEY: ${{ secrets.AWS_MSK_ALL_SECRET_ACCESS_KEY }}
KAFKA_UI_PASSWORD: ${{ secrets.KAFKA_UI_PASSWORD }}
AWS_DEFAULT_REGION: eu-west-3
shell: bash

- name: Store cache
uses: actions/cache/save@v3
if: always()
with:
path: |
~/.skaffold
key: cicd-dev-${{ github.sha }}

- name: Store LFS cache
uses: actions/cache/save@v3
if: always()
with:
path: .git/lfs
key: ${{ runner.os }}-lfs-${{ hashFiles('.lfs-assets-id') }}-v1-${{ github.sha }}
52 changes: 52 additions & 0 deletions .github/workflows/obscura-merge-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Obscura Merge Check
# TODO

on:
pull_request:
branches:
- master
- develop
merge_group:
types: [checks_requested]

jobs:
attempt_build:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Create LFS file list
run: git lfs ls-files -l | cut -d' ' -f1 | sort > .lfs-assets-id

- name: Restore LFS cache
uses: actions/cache@v3
id: lfs-cache
with:
path: .git/lfs

key: ${{ runner.os }}-lfs-${{ hashFiles('.lfs-assets-id') }}-v1-${{ github.sha }}
restore-keys: |
${{ runner.os }}-lfs-${{ hashFiles('.lfs-assets-id') }}-v1-${{ github.sha }}
${{ runner.os }}-lfs-${{ hashFiles('.lfs-assets-id') }}-v1-
- name: Git LFS Pull
run: git lfs pull

- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: "20.x"

- run: yarn install
- run: yarn build
- run: yarn lint

- name: Store LFS cache
uses: actions/cache/save@v3
if: always()
with:
path: .git/lfs
key: ${{ runner.os }}-lfs-${{ hashFiles('.lfs-assets-id') }}-v1-${{ github.sha }}
53 changes: 53 additions & 0 deletions .github/workflows/obscura-pre-dev.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: CI/CD Obscura pre-Dev
# TODO

on:
pull_request:
types: [labeled]

jobs:
build_and_deploy:
if: ${{ github.event.label.name == 'dev-frontend' }}
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v2
with:
lfs: "true"

- name: Install Skaffold
run: |
curl -Lo skaffold https://storage.googleapis.com/skaffold/releases/latest/skaffold-linux-amd64
sudo install skaffold /usr/local/bin/
shell: bash

- name: Configure AWS CLI
run: |
echo $AWS_ACCESS_KEY_ID
echo $AWS_SECRET_ACCESS_KEY
echo $AWS_DEFAULT_REGION
aws eks --region $AWS_DEFAULT_REGION update-kubeconfig --name obscura-dev
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_DEV_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_DEV_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: eu-west-3

- name: Login to Amazon ECR
run: |
aws ecr get-login-password --region eu-west-3 | docker login --username AWS --password-stdin 097733725684.dkr.ecr.eu-west-3.amazonaws.com
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_DEV_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_DEV_SECRET_ACCESS_KEY }}

- name: Build and push Docker images
run: |
echo $AWS_ACCESS_KEY_ID
echo $AWS_SECRET_ACCESS_KEY
echo $AWS_DEFAULT_REGION
skaffold run --filename k8s/pre-development/skaffold.pre-dev.yaml
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_DEV_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_DEV_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: eu-west-3
shell: bash
56 changes: 56 additions & 0 deletions .github/workflows/obscura-prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: CI/CD Obscura Prod
# TODO

on:
pull_request:
branches:
- master
types:
- closed

jobs:
build_and_deploy:
runs-on:
labels: large-runner-gh

steps:
- name: Checkout Repository
uses: actions/checkout@v2
with:
lfs: "true"

- name: Install Skaffold
run: |
curl -Lo skaffold https://storage.googleapis.com/skaffold/releases/latest/skaffold-linux-amd64
sudo install skaffold /usr/local/bin/
shell: bash

- name: Configure AWS CLI
run: |
echo $AWS_ACCESS_KEY_ID
echo $AWS_SECRET_ACCESS_KEY
echo $AWS_DEFAULT_REGION
aws eks --region $AWS_DEFAULT_REGION update-kubeconfig --name obscura-prod
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: eu-west-3

- name: Login to Amazon ECR
run: |
aws ecr get-login-password --region eu-west-3 | docker login --username AWS --password-stdin 097733725684.dkr.ecr.eu-west-3.amazonaws.com
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

- name: Build and push Docker images
run: |
echo $AWS_ACCESS_KEY_ID
echo $AWS_SECRET_ACCESS_KEY
echo $AWS_DEFAULT_REGION
skaffold run --filename k8s/production/skaffold.prod.yaml
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: eu-west-3
shell: bash
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.idea
build*
node_modules*
.DS_Store

# file used to set env vars to local cluster
set_local_env.sh

decodeKeys.js

ignore/
3 changes: 3 additions & 0 deletions .husky/post-checkout
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh
command -v git-lfs >/dev/null 2>&1 || { echo >&2 "\nThis repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting the 'post-checkout' file in the hooks directory (set by 'core.hookspath'; usually '.git/hooks').\n"; exit 2; }
git lfs post-checkout "$@"
3 changes: 3 additions & 0 deletions .husky/post-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh
command -v git-lfs >/dev/null 2>&1 || { echo >&2 "\nThis repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting the 'post-commit' file in the hooks directory (set by 'core.hookspath'; usually '.git/hooks').\n"; exit 2; }
git lfs post-commit "$@"
3 changes: 3 additions & 0 deletions .husky/post-merge
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh
command -v git-lfs >/dev/null 2>&1 || { echo >&2 "\nThis repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting the 'post-merge' file in the hooks directory (set by 'core.hookspath'; usually '.git/hooks').\n"; exit 2; }
git lfs post-merge "$@"
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

yarn lint-staged
3 changes: 3 additions & 0 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh
command -v git-lfs >/dev/null 2>&1 || { echo >&2 "\nThis repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting the 'pre-push' file in the hooks directory (set by 'core.hookspath'; usually '.git/hooks').\n"; exit 2; }
git lfs pre-push "$@"
7 changes: 7 additions & 0 deletions .lintstagedrc.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/* eslint-disable import/no-default-export */

const config = {
"*.{json,md,yml,yaml,html,css}": ["prettier --write"],
};

export default config;
7 changes: 7 additions & 0 deletions .vim/coc-settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"eslint.nodePath": ".yarn/sdks",
"eslint.packageManager": "yarn",
"tsserver.tsdk": ".yarn/sdks/typescript/lib",
"tsserver.useLocalTsdk": true,
"workspace.workspaceFolderCheckCwd": false
}
7 changes: 7 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"recommendations": [
"arcanis.vscode-zipfs",
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode"
]
}
Loading

0 comments on commit 3002694

Please sign in to comment.