Skip to content

Commit

Permalink
feat: auth_rust (#164)
Browse files Browse the repository at this point in the history
* feat: initial migration to auth rust

* refactor(auth_rust): remove dynamic dispatch trait and use generic trait

* feat(auth_rust): added back authrepo function and remove unnecessary code

* feat(auth_rust): functional program

* feat(auth_rust): otel improvement

* feat(auth_rust): introduce dockerfile

* feat(auth_rust): move to sentry instead of otel

* feat(auth_rust): add metrics for successful authentication

* fix(auth_rust): reflect code review

* fix(auth_rust): acquire redis connection string from environment variable

* fix(auth_rust): trial key should be in lowercase

---------

Co-authored-by: Mustafa Zaki Assagaf <mustafa.segf@gmail.com>
  • Loading branch information
aldy505 and mustafasegf authored Apr 11, 2024
1 parent 31d6fff commit 5ad1a3b
Show file tree
Hide file tree
Showing 9 changed files with 2,467 additions and 0 deletions.
59 changes: 59 additions & 0 deletions .github/workflows/systems-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,23 @@ jobs:
with:
flags: auth

auth_rust:
name: Auth Rust
runs-on: ubuntu-latest
container: rust:1.77
timeout-minutes: 30
defaults:
run:
working-directory: ./auth_rust
services:
db:
image: redis:7-bookworm
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build
run: cargo build --release

rce:
name: RCE
runs-on: ubuntu-latest
Expand Down Expand Up @@ -227,6 +244,48 @@ jobs:
environment: production
ignore_empty: true

build-auth_rust:
name: Build Auth Rust
runs-on: ubuntu-latest
timeout-minutes: 30
needs:
- auth_rust
permissions:
contents: read
packages: write
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-auth_rust
flavor: |
latest=false
tags: |
type=edge
type=sha
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: "{{defaultContext}}:auth_rust"
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

build-landing:
name: Build Landing
runs-on: ubuntu-latest
Expand Down
59 changes: 59 additions & 0 deletions .github/workflows/systems-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,23 @@ jobs:
with:
flags: auth

auth_rust:
name: Auth Rust
runs-on: ubuntu-latest
container: rust:1.77
timeout-minutes: 30
defaults:
run:
working-directory: ./auth_rust
services:
db:
image: redis:7-bookworm
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build
run: cargo build --release

rce:
name: RCE
runs-on: ubuntu-latest
Expand Down Expand Up @@ -171,6 +188,48 @@ jobs:
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

build-auth_rust:
name: Build Auth Rust
runs-on: ubuntu-latest
timeout-minutes: 30
needs:
- auth_rust
permissions:
contents: read
packages: write
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-auth_rust
flavor: |
latest=false
tags: |
type=ref,event=pr
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: "{{defaultContext}}:auth_rust"
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}


build-landing:
name: Build Landing
runs-on: ubuntu-latest
Expand Down
39 changes: 39 additions & 0 deletions .github/workflows/systems-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,45 @@ jobs:
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

auth_rust:
name: Auth Rust
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
contents: read
packages: write
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-auth_rust
flavor: |
latest=true
tags: |
type=semver,pattern={{version}}
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: "{{defaultContext}}:auth_rust"
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

database:
name: Database
runs-on: ubuntu-latest
Expand Down
16 changes: 16 additions & 0 deletions auth_rust/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
### Rust template
# Generated by Cargo
# will have compiled files and executables
debug/
target/

# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
# Cargo.lock

# These are backup files generated by rustfmt
**/*.rs.bk

# MSVC Windows builds of rustc generate these, which store debugging information
*.pdb

16 changes: 16 additions & 0 deletions auth_rust/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
### Rust template
# Generated by Cargo
# will have compiled files and executables
debug/
target/

# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
# Cargo.lock

# These are backup files generated by rustfmt
**/*.rs.bk

# MSVC Windows builds of rustc generate these, which store debugging information
*.pdb

Loading

0 comments on commit 5ad1a3b

Please sign in to comment.