Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automated deployment #181

Closed
ryardley opened this issue Nov 13, 2024 · 2 comments · Fixed by #195
Closed

Automated deployment #181

ryardley opened this issue Nov 13, 2024 · 2 comments · Fixed by #195
Assignees
Labels
chore Ciphernode Related to the ciphernode package

Comments

@ryardley
Copy link
Contributor

ryardley commented Nov 13, 2024

We should set up an automated deployment:

  • push to devnet-xxxxxxx (we should vote on the name)
  • 3 bootstrapped ciphernodes are deployed to a container orchestrator
  • 1 permissioned aggregator is deployed
  • The urls of the nodes should be hardcoded as bootstrap nodes

Users can then join the network by pulling down the docker container and connecting to the bootstrap nodes

@ryardley ryardley added Ciphernode Related to the ciphernode package chore labels Nov 13, 2024
@ryardley
Copy link
Contributor Author

ryardley commented Dec 2, 2024

AI generated deployment action:

name: Build and Deploy CipherNode to ECS

on:
  push:
    branches: [ "main" ]
    paths:
      - 'packages/ciphernode/**'
  pull_request:
    branches: [ "main" ]
    paths:
      - 'packages/ciphernode/**'

env:
  AWS_REGION: us-east-1
  ECR_REPOSITORY: ciphernode
  ECS_SERVICE: ciphernode-service
  ECS_CLUSTER: ciphernode-cluster
  CONTAINER_NAME: ciphernode
  TASK_DEFINITION: ciphernode-task-definition
  WORKSPACE_PATH: packages/ciphernode

permissions:
  contents: read

jobs:
  deploy:
    name: Deploy
    runs-on: ubuntu-latest
    environment: production

    steps:
    - name: Checkout
      uses: actions/checkout@v3

    - name: Configure AWS credentials
      uses: aws-actions/configure-aws-credentials@v1
      with:
        aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
        aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
        aws-region: ${{ env.AWS_REGION }}

    - name: Login to Amazon ECR
      id: login-ecr
      uses: aws-actions/amazon-ecr-login@v1

    - name: Build, tag, and push image to Amazon ECR
      id: build-image
      env:
        ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
        IMAGE_TAG: ${{ github.sha }}
      run: |
        cd ${{ env.WORKSPACE_PATH }}
        docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
        docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
        echo "image=$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" >> $GITHUB_OUTPUT

    - name: Download task definition
      run: |
        aws ecs describe-task-definition --task-definition ${{ env.TASK_DEFINITION }} \
        --query taskDefinition > task-definition.json

    - name: Fill in the new image ID in the Amazon ECS task definition
      id: task-def
      uses: aws-actions/amazon-ecs-render-task-definition@v1
      with:
        task-definition: task-definition.json
        container-name: ${{ env.CONTAINER_NAME }}
        image: ${{ steps.build-image.outputs.image }}

    - name: Deploy Amazon ECS task definition
      uses: aws-actions/amazon-ecs-deploy-task-definition@v1
      with:
        task-definition: ${{ steps.task-def.outputs.task-definition }}
        service: ${{ env.ECS_SERVICE }}
        cluster: ${{ env.ECS_CLUSTER }}
        wait-for-service-stability: true

@ryardley
Copy link
Contributor Author

ryardley commented Dec 2, 2024

Steps:

  • Create packages/ciphernode/Dockerfile for deployment pay attention to config db location and secrets files
  • Ensure adequate credentials and setup above deployment action

@hmzakhalid hmzakhalid linked a pull request Dec 3, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Ciphernode Related to the ciphernode package
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants