Skip to content

Commit

Permalink
ci: remove deployment script (#139)
Browse files Browse the repository at this point in the history
* ci: remove deployment script

* ci: independently built database (#140)
  • Loading branch information
aldy505 authored Sep 18, 2023
1 parent 691e067 commit ebefdfa
Show file tree
Hide file tree
Showing 5 changed files with 98 additions and 71 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/sdks-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
go: [ '1.19', '1.20' ]
go: [ '1.19', '1.20', '1.21' ]
timeout-minutes: 30
defaults:
run:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sdks-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
go: [ '1.19', '1.20' ]
go: [ '1.19', '1.20', '1.21' ]
timeout-minutes: 30
defaults:
run:
Expand Down
92 changes: 40 additions & 52 deletions .github/workflows/systems-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,46 @@ jobs:
- name: Build
run: dotnet build "Registration.csproj" --no-restore -c Release

build-database:
name: Build Database
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
contents: read
packages: write
steps:
- name: Checkout code
uses: actions/checkout@v3

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

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

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

build-auth:
name: Build Auth
runs-on: ubuntu-latest
Expand Down Expand Up @@ -411,55 +451,3 @@ jobs:
env:
PESTO_URL: http://localhost:50051/

deploy:
name: Deploy
runs-on: ubuntu-latest
container: debian:bookworm
timeout-minutes: 120
needs:
- build-auth
- build-rce
- build-landing
- build-registration
steps:
- name: Install required packages
run: apt-get update && apt-get upgrade -y && apt-get install -y tar gzip curl ssh

- name: Register SSH key
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.SSH_KEY }}
name: id_ed25519
known_hosts: ${{ secrets.SSH_IP }}
if_key_exists: replace

- name: SSH Keyscan
run: ssh-keyscan -p ${{ secrets.SSH_PORT }} -H ${{ secrets.SSH_IP }} >> /root/.ssh/known_hosts

- name: Pull latest code
run: >
ssh
-i /root/.ssh/id_ed25519
-p ${{ secrets.SSH_PORT }}
-t ${{ secrets.SSH_USER }}@${{ secrets.SSH_IP }}
'ssh pesto "cd ${{ secrets.SSH_WORKDIR }}/pesto && git pull" '
- name: Build Docker images
run: >
ssh
-i /root/.ssh/id_ed25519
-p ${{ secrets.SSH_PORT }}
-t ${{ secrets.SSH_USER }}@${{ secrets.SSH_IP }}
"ssh pesto 'echo ${{ secrets.SSH_PASSWORD }} | sudo -S bash -c '\"'cd ${{ secrets.SSH_WORKDIR }}/pesto &&
docker compose pull &&
docker compose up -d --pull always registration rce landing auth '\"' ' "
- name: Clean up docker artifacts
run: >
ssh
-i /root/.ssh/id_ed25519
-p ${{ secrets.SSH_PORT }}
-t ${{ secrets.SSH_USER }}@${{ secrets.SSH_IP }}
"ssh pesto 'echo ${{ secrets.SSH_PASSWORD }} | sudo -S bash -c '\"'docker container prune -f &&
docker image prune -f &&
docker builder prune -f '\"' ' "
71 changes: 55 additions & 16 deletions .github/workflows/systems-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ jobs:
permissions:
contents: read
packages: write
defaults:
run:
working-directory: ./auth
steps:
- name: Checkout code
uses: actions/checkout@v3

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

- name: Log in to the Container registry
uses: docker/login-action@v2
with:
Expand All @@ -44,7 +44,46 @@ jobs:
- name: Build and push Docker image
uses: docker/build-push-action@v3
with:
context: .
context: "{{defaultContext}}:auth"
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

database:
name: Database
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
contents: read
packages: write
steps:
- name: Checkout code
uses: actions/checkout@v3

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

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

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-redis
flavor: |
latest=true
tags: |
type=semver,pattern={{version}}
- name: Build and push Docker image
uses: docker/build-push-action@v3
with:
context: "{{defaultContext}}:redis"
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
Expand All @@ -56,13 +95,13 @@ jobs:
permissions:
contents: read
packages: write
defaults:
run:
working-directory: ./rce
steps:
- name: Checkout code
uses: actions/checkout@v3

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

- name: Log in to the Container registry
uses: docker/login-action@v2
with:
Expand All @@ -83,7 +122,7 @@ jobs:
- name: Build and push Docker image
uses: docker/build-push-action@v3
with:
context: .
context: "{{defaultContext}}:rce"
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
Expand All @@ -95,13 +134,13 @@ jobs:
permissions:
contents: read
packages: write
defaults:
run:
working-directory: ./landing
steps:
- name: Checkout code
uses: actions/checkout@v3

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

- name: Log in to the Container registry
uses: docker/login-action@v2
with:
Expand All @@ -122,7 +161,7 @@ jobs:
- name: Build and push Docker image
uses: docker/build-push-action@v3
with:
context: .
context: "{{defaultContext}}:landing"
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
Expand All @@ -134,13 +173,13 @@ jobs:
permissions:
contents: read
packages: write
defaults:
run:
working-directory: ./registration
steps:
- name: Checkout code
uses: actions/checkout@v3

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

- name: Log in to the Container registry
uses: docker/login-action@v2
with:
Expand All @@ -161,7 +200,7 @@ jobs:
- name: Build and push Docker image
uses: docker/build-push-action@v3
with:
context: .
context: "{{defaultContext}}:registration"
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ services:
- pesto

db:
build: ./redis
image: ghcr.io/teknologi-umum/pesto-redis:edge
platform: linux/amd64
healthcheck:
test: "redis-cli ping | grep PONG"
Expand Down

0 comments on commit ebefdfa

Please sign in to comment.