Skip to content
This repository has been archived by the owner on Sep 4, 2024. It is now read-only.

Commit

Permalink
🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
dmikey committed Feb 21, 2024
0 parents commit d9e1e37
Show file tree
Hide file tree
Showing 29 changed files with 3,427 additions and 0 deletions.
81 changes: 81 additions & 0 deletions .github/workflows/build_push_ecr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# This workflow will build and push a new container image to Amazon ECR,
# and then will deploy a new task definition to Amazon ECS which will be run by Fargate when a release is created
name: Build and Push docker image to ECR

on:
# push:
# branches:
# - main
# pull_request:
push:
tags:
- 'v*'
- dev-latest

concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
jobs:
build-push:
name: Build and Push docker image
runs-on: ubuntu-latest

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

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1

- 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-push-image
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: ${{github.event.repository.name}} # Naming convention: ECR registry name == GITHUB repo name
MAIN_BRANCH: main # Images from this branch will be tagged as "latest"
run: |
#! Due to we trigger on push.tags GITHUB_REF - is the tag name
GIT_TAG="$(echo $GITHUB_REF| sed 's#refs/tags/##')"
IMAGE_TAG="${GITHUB_SHA:0:8}"
EXTRA_IMAGE_TAGS=$GIT_TAG
#! Add latest tag only if on named releases tag='v*'
if [[ ${GIT_TAG} == v* ]]; then
EXTRA_IMAGE_TAGS="${EXTRA_IMAGE_TAGS};latest"
fi
# compute-node HEADS
ECR_REPOSITORY_HEAD="${ECR_REPOSITORY}-head"
docker build --pull -f docker/Dockerfile_head \
--build-arg "GH_TOKEN=${{ secrets.GH_READONLY_PAT }}" \
-t $ECR_REGISTRY/$ECR_REPOSITORY_HEAD:$IMAGE_TAG .
docker push $ECR_REGISTRY/$ECR_REPOSITORY_HEAD:$IMAGE_TAG
# Build and PUSH additional tags
for tag in $(echo $EXTRA_IMAGE_TAGS| tr ";" "\n"); do
docker tag $ECR_REGISTRY/$ECR_REPOSITORY_HEAD:$IMAGE_TAG $ECR_REGISTRY/$ECR_REPOSITORY_HEAD:$tag
docker push $ECR_REGISTRY/$ECR_REPOSITORY_HEAD:$tag
done
# Build a docker container and push it to ECR so that it can be deployed to ECS.
# compute-node workers
docker build --pull -f docker/Dockerfile_worker \
--build-arg "GH_TOKEN=${{ secrets.GH_READONLY_PAT }}" \
-t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
# Build and PUSH additional tags
for tag in $(echo $EXTRA_IMAGE_TAGS| tr ";" "\n"); do
docker tag $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG $ECR_REGISTRY/$ECR_REPOSITORY:$tag
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$tag
done
29 changes: 29 additions & 0 deletions .github/workflows/build_push_ghcr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Build and Release Docker Images on GHCR

on:
release:
types: [created]
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v3
with:
go-version: "1.21.0"
check-latest: true
- uses: actions/checkout@v2
- name: Prepare Release Variables
id: vars
uses: ignite/cli/actions/release/vars@main
- name: build head
run: |
echo "${{ secrets.GHCR_TOKEN }}" | docker login ghcr.io -u "${{ secrets.GHCR_USER }}" --password-stdin
docker build . --tag ghcr.io/${{ github.repository }}_head:${{ steps.vars.outputs.tag_name }} --build-arg "GH_TOKEN=${{ secrets.GHCR_TOKEN }}" --build-arg="BLS_EXTENSION_VER=dev.3" -f docker/Dockerfile_head
docker push ghcr.io/${{ github.repository }}_head:${{ steps.vars.outputs.tag_name }}
- name: build worker
run: |
echo "${{ secrets.GHCR_TOKEN }}" | docker login ghcr.io -u "${{ secrets.GHCR_USER }}" --password-stdin
docker build . --tag ghcr.io/${{ github.repository }}_worker:${{ steps.vars.outputs.tag_name }} --build-arg "GH_TOKEN=${{ secrets.GHCR_TOKEN }}" --build-arg="BLS_EXTENSION_VER=dev.3" -f docker/Dockerfile_worker
docker push ghcr.io/${{ github.repository }}_worker:${{ steps.vars.outputs.tag_name }}
18 changes: 18 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
dist/
peer-db/
function-db/
protocol-state-machine-module
go-libp2p-raft
runtime
worker-pdb
worker-fdb
workspace
runtime.tar.gz
cmd/node/node
cmd/keys/keys
data
keys
data-head
data-worker
main.py
.DS_Store
79 changes: 79 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch Head Node",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceFolder}/cmd/node",
"args": [
"--peer-db",
"/tmp/allora/head-peer-db",
"--function-db",
"/tmp/allora/head-fdb",
"--log-level",
"debug",
"--port",
"9527",
"--role",
"head",
"--workspace",
"/tmp/debug/head",
"--private-key",
"${workspaceFolder}/configs/testkeys/ident1/priv.bin",
"--rest-api",
":8081",
"--allora-chain-key-name",
"alice"
],
"cwd": "${workspaceFolder}"
},
{
"name": "Launch Worker Node",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceFolder}/cmd/node",
"args": [
"--peer-db",
"/tmp/allora/worker-peer-db",
"--function-db",
"/tmp/allora/worker-fdb",
"--log-level",
"debug",
"--port",
"0",
"--role",
"worker",
"--runtime-path",
"/tmp/runtime",
"--runtime-cli",
"bls-runtime",
"--workspace",
"/tmp/debug/worker",
"--private-key",
"${workspaceFolder}/configs/testkeys/ident2/priv.bin",
"--boot-nodes",
"/ip4/0.0.0.0/tcp/9527/p2p/12D3KooWH9GerdSEroL2nqjpd2GuE5dwmqNi7uHX7FoywBdKcP4q"
],
"cwd": "${workspaceFolder}"
},
{
"name": "Launch Manager",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceFolder}/cmd/manager",
"args": [
"-l",
"3333",
"--private-key",
"${workspaceFolder}/configs/testkeys/ident2/priv.bin",
"--allowed-peer",
"QmSz8bJZjg9gWfvrJjYibo4UhSo8dXYtpNRb4kxn28SoHG"
],
"cwd": "${workspaceFolder}"
}
]
}
18 changes: 18 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Any contribution that you make to this repository will
be under the Apache 2 License, as dictated by that
[license](http://www.apache.org/licenses/LICENSE-2.0.html):

~~~
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
~~~

Contributors must sign-off each commit by adding a `Signed-off-by: ...`
line to commit messages to certify that they have the right to submit
the code they are contributing to the project according to the
[Developer Certificate of Origin (DCO)](https://developercertificate.org/).
Loading

0 comments on commit d9e1e37

Please sign in to comment.