Skip to content

Commit 1b7a426

Browse files
committed
Create Beacon Node
0 parents  commit 1b7a426

94 files changed

Lines changed: 18170 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/build-file.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: "Docker Image Build and Publish (Non-Main)"
2+
3+
on:
4+
push:
5+
branches-ignore:
6+
- "main"
7+
8+
env:
9+
REGISTRY: ghcr.io
10+
IMAGE_NAME: ${{ github.repository }}
11+
12+
jobs:
13+
build:
14+
name: Build and Push Docker Image
15+
runs-on: ubuntu-latest
16+
17+
permissions:
18+
contents: read
19+
packages: write
20+
id-token: write
21+
22+
steps:
23+
- name: Checkout repository
24+
uses: actions/checkout@v3
25+
26+
- name: Setup Docker buildx
27+
uses: sigstore/cosign-installer@v3.1.1
28+
- name: Check install!
29+
run: cosign version
30+
31+
- name: Login to GitHub Container Registry
32+
if: github.event_name != 'pull_request'
33+
uses: docker/login-action@v1
34+
with:
35+
registry: ${{ env.REGISTRY }}
36+
username: ${{ secrets.GHCR_USERNAME }}
37+
password: ${{ secrets.GHCR_TOKEN }}
38+
39+
- name: Downcase Repository Name
40+
run: echo "REPO=${GITHUB_REPOSITORY,,}" >>${GITHUB_ENV}
41+
42+
- name: Build and Push Docker Image
43+
run: |
44+
export CURRENT_BRANCH=${GITHUB_REF#refs/heads/}
45+
export TAG=$CURRENT_BRANCH
46+
export GITHUB_REF_IMAGE=${{ env.REGISTRY }}/$REPO:$GITHUB_SHA
47+
export GITHUB_BRANCH_IMAGE=${{ env.REGISTRY }}/$REPO:$TAG
48+
docker build -t $GITHUB_REF_IMAGE -t $GITHUB_BRANCH_IMAGE .
49+
echo "Pushing Image to GitHub Container Registry"
50+
docker push $GITHUB_REF_IMAGE
51+
docker push $GITHUB_BRANCH_IMAGE
52+
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
name: "[MAIN] Docker Image Build and Publish"
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
7+
env:
8+
# Use docker.io for Docker Hub if empty
9+
REGISTRY: ghcr.io
10+
# github.repository as <account>/<repo>
11+
IMAGE_NAME: ${{ github.repository }}
12+
13+
jobs:
14+
deploy:
15+
name: Deploy to GitHub Container Registry
16+
runs-on: ubuntu-latest
17+
18+
permissions:
19+
contents: read
20+
packages: write
21+
# This is used to complete the identity challenge
22+
# with sigstore/fulcio when running outside of PRs.
23+
id-token: write
24+
25+
steps:
26+
- name: Checkout repository
27+
uses: actions/checkout@v3
28+
29+
# Workaround: https://github.com/docker/build-push-action/issues/461
30+
- name: Setup Docker buildx
31+
uses: sigstore/cosign-installer@v3.1.1
32+
- name: Check install!
33+
run: cosign version
34+
35+
- name: Login to GitHub Container Registry ${{ env.REGISTRY }}
36+
if: github.event_name != 'pull_request'
37+
uses: docker/login-action@v1
38+
with:
39+
registry: ${{ env.REGISTRY }}
40+
username: ${{ secrets.GHCR_USERNAME }}
41+
password: ${{ secrets.GHCR_TOKEN }}
42+
43+
- name: downcase REPO
44+
run: echo "REPO=${GITHUB_REPOSITORY,,}" >>${GITHUB_ENV}
45+
46+
- name: Build and Push Docker Image
47+
run: |
48+
export CURRENT_BRANCH=${GITHUB_REF#refs/heads/}
49+
export TAG=$([[ $CURRENT_BRANCH == "main" ]] && echo $CURRENT_BRANCH || echo "latest")
50+
export GITHUB_REF_IMAGE=ghcr.io/netsepio/erebrus:$GITHUB_SHA
51+
export GITHUB_BRANCH_IMAGE=ghcr.io/netsepio/erebrus:$TAG
52+
docker build -t $GITHUB_REF_IMAGE -t $GITHUB_BRANCH_IMAGE .
53+
echo "Pushing Image to GitHub Container Registry"
54+
docker push $GITHUB_REF_IMAGE
55+
docker push $GITHUB_BRANCH_IMAGE
56+
- name: Deploy on US server
57+
if: github.ref == 'refs/heads/prod'
58+
uses: appleboy/ssh-action@v0.1.7
59+
with:
60+
host: ${{ secrets.DEV_REMOTE_SERVER_ADDRESS_US01 }}
61+
username: ${{ secrets.DEV_SERVER_USERNAME }}
62+
key: ${{ secrets.DEV_REMOTE_SERVER_KEY }}
63+
port: ${{ secrets.DEV_SSH_PORT }}
64+
script: |
65+
pwd
66+
cd erebrus
67+
docker stop erebrus && docker rm erebrus && docker image rm ghcr.io/netsepio/erebrus:main
68+
echo ${{ secrets.GHCR_TOKEN }} | docker login ghcr.io -u ${{ secrets.GHCR_USERNAME }} --password-stdin
69+
docker pull ghcr.io/netsepio/erebrus:main
70+
docker run -d -p 9080:9080/tcp -p 51820:51820/udp --cap-add=NET_ADMIN --cap-add=SYS_MODULE --sysctl="net.ipv4.conf.all.src_valid_mark=1" --sysctl="net.ipv6.conf.all.forwarding=1" --restart unless-stopped -v /home/ubuntu/erebrus/wireguard/:/etc/wireguard/ --name erebrus --env-file .env ghcr.io/netsepio/erebrus:main
71+
- name: Deploy on EU server
72+
if: github.ref == 'refs/heads/prod'
73+
uses: appleboy/ssh-action@v0.1.7
74+
with:
75+
host: ${{ secrets.DEV_REMOTE_SERVER_ADDRESS_EU01 }}
76+
username: ${{ secrets.DEV_SERVER_USERNAME }}
77+
key: ${{ secrets.DEV_REMOTE_SERVER_KEY }}
78+
port: ${{ secrets.DEV_SSH_PORT }}
79+
script: |
80+
pwd
81+
cd erebrus
82+
docker stop erebrus && docker rm erebrus && docker image rm ghcr.io/netsepio/erebrus:main
83+
echo ${{ secrets.GHCR_TOKEN }} | docker login ghcr.io -u ${{ secrets.GHCR_USERNAME }} --password-stdin
84+
docker pull ghcr.io/netsepio/erebrus:main
85+
docker run -d -p 9080:9080/tcp -p 51820:51820/udp --cap-add=NET_ADMIN --cap-add=SYS_MODULE --sysctl="net.ipv4.conf.all.src_valid_mark=1" --sysctl="net.ipv6.conf.all.forwarding=1" --restart unless-stopped -v /home/ubuntu/erebrus/wireguard/:/etc/wireguard/ --name erebrus --env-file .env ghcr.io/netsepio/erebrus:main
86+
- name: Deploy on CA server
87+
if: github.ref == 'refs/heads/prod'
88+
uses: appleboy/ssh-action@v0.1.7
89+
with:
90+
host: ${{ secrets.DEV_REMOTE_SERVER_ADDRESS_CA01 }}
91+
username: ${{ secrets.DEV_SERVER_USERNAME }}
92+
key: ${{ secrets.DEV_REMOTE_SERVER_KEY }}
93+
port: ${{ secrets.DEV_SSH_PORT }}
94+
script: |
95+
pwd
96+
cd erebrus
97+
docker stop erebrus && docker rm erebrus && docker image rm ghcr.io/netsepio/erebrus:main
98+
echo ${{ secrets.GHCR_TOKEN }} | docker login ghcr.io -u ${{ secrets.GHCR_USERNAME }} --password-stdin
99+
docker pull ghcr.io/netsepio/erebrus:main
100+
docker run -d -p 9080:9080/tcp -p 51820:51820/udp --cap-add=NET_ADMIN --cap-add=SYS_MODULE --sysctl="net.ipv4.conf.all.src_valid_mark=1" --sysctl="net.ipv6.conf.all.forwarding=1" --restart unless-stopped -v /home/ubuntu/erebrus/wireguard/:/etc/wireguard/ --name erebrus --env-file .env ghcr.io/netsepio/erebrus:main
101+
- name: Deploy on SG server
102+
if: github.ref == 'refs/heads/prod'
103+
uses: appleboy/ssh-action@v0.1.7
104+
with:
105+
host: ${{ secrets.DEV_REMOTE_SERVER_ADDRESS_SG01 }}
106+
username: ${{ secrets.DEV_SERVER_USERNAME }}
107+
key: ${{ secrets.DEV_REMOTE_SERVER_KEY }}
108+
port: ${{ secrets.DEV_SSH_PORT }}
109+
script: |
110+
pwd
111+
cd erebrus
112+
docker stop erebrus && docker rm erebrus && docker image rm ghcr.io/netsepio/erebrus:main
113+
echo ${{ secrets.GHCR_TOKEN }} | docker login ghcr.io -u ${{ secrets.GHCR_USERNAME }} --password-stdin
114+
docker pull ghcr.io/netsepio/erebrus:main
115+
docker run -d -p 9080:9080/tcp -p 9002:9002/tcp -p 51820:51820/udp --cap-add=NET_ADMIN --cap-add=SYS_MODULE --sysctl="net.ipv4.conf.all.src_valid_mark=1" --sysctl="net.ipv6.conf.all.forwarding=1" --restart unless-stopped -v /home/ubuntu/erebrus/wireguard/:/etc/wireguard/ --name erebrus --env-file .env ghcr.io/netsepio/erebrus:main
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Build and Release Go Binary
2+
3+
on:
4+
push:
5+
branches:
6+
- node-features # Triggers only on pushes to the node-features branch
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout Repository
14+
uses: actions/checkout@v4
15+
16+
- name: Set up Go
17+
uses: actions/setup-go@v5
18+
with:
19+
go-version: stable
20+
21+
- name: Build Binary
22+
run: |
23+
go mod tidy
24+
go build -o erebrus
25+
26+
- name: Upload Binary as Artifact
27+
uses: actions/upload-artifact@v4
28+
with:
29+
name: erebrus-binary
30+
path: erebrus
31+
32+
release:
33+
needs: build
34+
runs-on: ubuntu-latest
35+
36+
steps:
37+
- name: Checkout Repository
38+
uses: actions/checkout@v4
39+
40+
- name: Get Commit SHA
41+
id: get_sha
42+
run: echo "sha=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
43+
44+
- name: Download Artifact
45+
uses: actions/download-artifact@v4
46+
with:
47+
name: erebrus-binary
48+
49+
- name: Create GitHub Release
50+
uses: softprops/action-gh-release@v2
51+
with:
52+
tag_name: ${{ env.sha }}
53+
files: erebrus
54+
env:
55+
GITHUB_TOKEN: ${{ secrets.GHCR_TOKEN }}

.gitignore

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Binaries for programs and plugins
2+
*.exe
3+
*.exe~
4+
*.dll
5+
*.so
6+
*.dylib
7+
8+
# Test binary, built with `go test -c`
9+
*.test
10+
11+
# Output of the go coverage tool, specifically when used with LiteIDE
12+
*.out
13+
14+
# Dependency directories (remove the comment below to include it)
15+
# vendor/
16+
17+
.env
18+
.idea
19+
.DS_Store
20+
21+
# Editor directories and files
22+
.vscode
23+
*.suo
24+
*.ntvs*
25+
*.njsproj
26+
*.sln
27+
*.sw?
28+
29+
#executable binary
30+
31+
erebrus
32+
erebrus-linux-x64
33+
34+
35+
# bin folder
36+
/bin
37+
38+
agents.json
39+
/characters

.sample-env

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
#Application Parameters
2+
LOAD_CONFIG_FILE=false
3+
RUNTYPE=debug
4+
SERVER=0.0.0.0
5+
HTTP_PORT=9080
6+
GRPC_PORT=9090
7+
REGION=EU
8+
9+
# PASETO Specifications
10+
PASETO_EXPIRATION_IN_HOURS=168
11+
AUTH_EULA=I Accept the Erebrus Terms of Service https://erebrus.io/terms.html for accessing the application.
12+
SIGNED_BY=Erebrus
13+
FOOTER=Erebrus 2024
14+
15+
#Node Specifications
16+
HOST_IP=ip_addr
17+
DOMAIN=http://ip_addr:9080/
18+
NODE_NAME=
19+
MNEMONIC=
20+
CHAIN_NAME=
21+
NODE_TYPE=
22+
NODE_CONFIG=
23+
24+
#Gateway Specifications
25+
GATEWAY_WALLET=0x0
26+
GATEWAY_DOMAIN=https://gateway.erebrus.io/
27+
GATEWAY_PEERID=/ip4/52.14.92.177/tcp/9001/p2p/12D3KooWJSMKigKLzehhhmppTjX7iQprA7558uU52hqvKqyjbELf
28+
29+
#Wireguard Specifications
30+
WG_CONF_DIR=
31+
WG_CLIENTS_DIR=
32+
WG_INTERFACE_NAME=wg0.conf
33+
WG_ENDPOINT_HOST=ip_addr
34+
WG_ENDPOINT_PORT=51820
35+
WG_IPv4_SUBNET=10.0.0.1/24
36+
WG_IPv6_SUBNET=fd9f:0000::10:0:0:1/64
37+
WG_DNS=1.1.1.1
38+
WG_ALLOWED_IP_1=0.0.0.0/0
39+
WG_ALLOWED_IP_2=::/0
40+
WG_PRE_UP=echo WireGuard PreUp
41+
WG_POST_UP=iptables -A FORWARD -i %i -j ACCEPT; iptables -A FORWARD -o %i -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
42+
WG_PRE_DOWN=echo WireGuard PreDown
43+
WG_POST_DOWN=iptables -D FORWARD -i %i -j ACCEPT; iptables -D FORWARD -o %i -j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE
44+
45+
#Service Specifications
46+
SERVICE_CONF_DIR=./erebrus
47+
CADDY_CONF_DIR=/etc/caddy
48+
CADDY_INTERFACE_NAME=Caddyfile
49+
50+
# AI Agent Specifications
51+
EREBRUS_DOMAIN=
52+
DOCKER_IMAGE_AGENT="ghcr.io/netsepio/cyrene"
53+
54+
#Peaq Integration
55+
CONTRACT_ADDRESS=0x291eC3328b56d5ECebdF993c3712a400Cb7569c3
56+
RPC_URL=https://evm.peaq.network
57+
NODE_ACCESS=

Dockerfile

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#LABEL Maintainer Punarv Name punarv@netsepio.com
2+
3+
FROM golang:alpine AS build-app
4+
RUN apk update && apk add --no-cache git
5+
WORKDIR /app
6+
COPY . .
7+
RUN go build -ldflags "-X main.version=1.1.1-alpha -X main.codeHash=$(git rev-parse HEAD)" -o erebrus .
8+
9+
FROM alpine:latest
10+
RUN apk update && apk add --no-cache git
11+
WORKDIR /app
12+
COPY --from=build-app /app/erebrus .
13+
COPY --from=build-app /app/webapp ./webapp
14+
COPY wg-watcher.sh .
15+
RUN chmod +x ./erebrus ./wg-watcher.sh
16+
RUN apk update && apk add --no-cache bash openresolv bind-tools wireguard-tools gettext inotify-tools iptables
17+
ENV LOAD_CONFIG_FILE=$LOAD_CONFIG_FILE RUNTYPE=$RUNTYPE SERVER=$SERVER HTTP_PORT=$HTTP_PORT GRPC_PORT=$GRPC_PORT GATEWAY_DOMAIN=$GATEWAY_DOMAIN
18+
ENV NODE_NAME=$NODE_NAME REGION=$REGION DOMAIN=$DOMAIN REGION_NAME=$REGION_NAME REGION_CODE=$REGION_CODE
19+
ENV WG_CONF_DIR=$WG_CONF_DIR WG_CLIENTS_DIR=$WG_CLIENTS_DIR WG_KEYS_DIR=$WG_KEYS_DIR WG_INTERFACE_NAME=$WG_INTERFACE_NAME
20+
ENV WG_ENDPOINT_HOST=$WG_ENDPOINT_HOST WG_ENDPOINT_PORT=$WG_ENDPOINT_PORT WG_IPv4_SUBNET=$WG_IPv4_SUBNET WG_IPv6_SUBNET=$WG_IPv6_SUBNET
21+
ENV WG_DNS=$WG_DNS WG_ALLOWED_IP_1=$WG_ALLOWED_IP_1 WG_ALLOWED_IP_2=$WG_ALLOWED_IP_2
22+
ENV WG_PRE_UP=$WG_PRE_UP WG_POST_UP=$WG_POST_UP WG_PRE_DOWN=$WG_PRE_DOWN WG_POST_DOWN=$WG_POST_DOWN
23+
ENV NODE_CONFIG=$NODE_CONFIG NODE_TYPE=$NODE_TYPE
24+
RUN echo $'#!/usr/bin/env bash\n\
25+
set -eo pipefail\n\
26+
/app/erebrus &\n\
27+
./wg-watcher.sh\n\
28+
sleep infinity' > /app/start.sh && chmod +x /app/start.sh
29+
ENTRYPOINT ["/app/start.sh"]

0 commit comments

Comments
 (0)