Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
DaviPtrs committed Dec 2, 2024
2 parents 9cb6d98 + 09bfea5 commit 610b0cc
Show file tree
Hide file tree
Showing 20 changed files with 529 additions and 66 deletions.
198 changes: 132 additions & 66 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,31 @@ steps:
build_args: APP_NAME=commune-page

- name: deploy
image: digitalocean/doctl:latest
image: ghcr.io/renlabs-dev/devops-ci:latest
environment:
DO_CTL_TOKEN:
from_secret: DO_CTL_TOKEN
VAULT_ADDR:
from_secret: VAULT_ADDR
VAULT_ROLE_ID:
from_secret: VAULT_ROLE_ID
VAULT_SECRET_ID:
from_secret: VAULT_SECRET_ID
APP_NAME: commune-page
commands:
- apk add jq
- export PATH=$PATH:/app
# Download helm chart and authenticate to Kubernetes
- /apps/k8s_auth_w_approle.sh
- helm repo add renlabs https://charts.renlabs.dev/
- helm repo update
# Set auxiliary environment variables
- export COMMIT_SHORT_SHA=${DRONE_COMMIT_SHA:0:7}
- app_name=$( [ "$DRONE_BRANCH" = "main" ] && echo "commune-page" || echo "dev-commune-page" )
- app_id=$(doctl apps list -t $DO_CTL_TOKEN -o json | jq --arg name "$app_name" '.[] | select(.spec.name == $name) | .id' | tr -d '"')
- doctl apps spec get $app_id -t $DO_CTL_TOKEN > spec.yaml
- sed -i "s/\(tag:*\).*/\1 \"$COMMIT_SHORT_SHA\"/" spec.yaml
- doctl apps spec validate spec.yaml -t $DO_CTL_TOKEN --schema-only > /dev/null
- doctl apps update $app_id -t $DO_CTL_TOKEN --wait --spec spec.yaml
- env_name=$( [ "$DRONE_BRANCH" = "main" ] && echo "prod" || echo "dev" )
- release_name=$( [ "$env_name" = "prod" ] && echo "$APP_NAME" || echo "$env_name""-""$APP_NAME" )
# Install application chart
- >-
helm upgrade --install "$release_name" -n commune-"$env_name"-web-apps
-f values.yaml -f apps/"$APP_NAME"/values.yaml
-f apps/"$APP_NAME"/values."$env_name".yaml
--set deployment.image.tag="$COMMIT_SHORT_SHA"
--wait renlabs/application
trigger:
branch:
Expand Down Expand Up @@ -72,20 +83,31 @@ steps:
build_args: APP_NAME=commune-validator

- name: deploy
image: digitalocean/doctl:latest
image: ghcr.io/renlabs-dev/devops-ci:latest
environment:
DO_CTL_TOKEN:
from_secret: DO_CTL_TOKEN
VAULT_ADDR:
from_secret: VAULT_ADDR
VAULT_ROLE_ID:
from_secret: VAULT_ROLE_ID
VAULT_SECRET_ID:
from_secret: VAULT_SECRET_ID
APP_NAME: commune-validator
commands:
- apk add jq
- export PATH=$PATH:/app
# Download helm chart and authenticate to Kubernetes
- /apps/k8s_auth_w_approle.sh
- helm repo add renlabs https://charts.renlabs.dev/
- helm repo update
# Set auxiliary environment variables
- export COMMIT_SHORT_SHA=${DRONE_COMMIT_SHA:0:7}
- app_name=$( [ "$DRONE_BRANCH" = "main" ] && echo "community-validator" || echo "dev-community-validator" )
- app_id=$(doctl apps list -t $DO_CTL_TOKEN -o json | jq --arg name "$app_name" '.[] | select(.spec.name == $name) | .id' | tr -d '"')
- doctl apps spec get $app_id -t $DO_CTL_TOKEN > spec.yaml
- sed -i "s/\(tag:*\).*/\1 \"$COMMIT_SHORT_SHA\"/" spec.yaml
- doctl apps spec validate spec.yaml -t $DO_CTL_TOKEN --schema-only > /dev/null
- doctl apps update $app_id -t $DO_CTL_TOKEN --wait --spec spec.yaml
- env_name=$( [ "$DRONE_BRANCH" = "main" ] && echo "prod" || echo "dev" )
- release_name=$( [ "$env_name" = "prod" ] && echo "$APP_NAME" || echo "$env_name""-""$APP_NAME" )
# Install application chart
- >-
helm upgrade --install "$release_name" -n commune-"$env_name"-web-apps
-f values.yaml -f apps/"$APP_NAME"/values.yaml
-f apps/"$APP_NAME"/values."$env_name".yaml
--set deployment.image.tag="$COMMIT_SHORT_SHA"
--wait renlabs/application
trigger:
branch:
Expand Down Expand Up @@ -125,20 +147,31 @@ steps:
build_args: APP_NAME=commune-worker

- name: deploy
image: digitalocean/doctl:latest
image: ghcr.io/renlabs-dev/devops-ci:latest
environment:
DO_CTL_TOKEN:
from_secret: DO_CTL_TOKEN
VAULT_ADDR:
from_secret: VAULT_ADDR
VAULT_ROLE_ID:
from_secret: VAULT_ROLE_ID
VAULT_SECRET_ID:
from_secret: VAULT_SECRET_ID
APP_NAME: commune-worker
commands:
- apk add jq
- export PATH=$PATH:/app
# Download helm chart and authenticate to Kubernetes
- /apps/k8s_auth_w_approle.sh
- helm repo add renlabs https://charts.renlabs.dev/
- helm repo update
# Set auxiliary environment variables
- export COMMIT_SHORT_SHA=${DRONE_COMMIT_SHA:0:7}
- app_name=$( [ "$DRONE_BRANCH" = "main" ] && echo "commune-worker" || echo "dev-commune-worker" )
- app_id=$(doctl apps list -t $DO_CTL_TOKEN -o json | jq --arg name "$app_name" '.[] | select(.spec.name == $name) | .id' | tr -d '"')
- doctl apps spec get $app_id -t $DO_CTL_TOKEN > spec.yaml
- sed -i "s/\(tag:*\).*/\1 \"$COMMIT_SHORT_SHA\"/" spec.yaml
- doctl apps spec validate spec.yaml -t $DO_CTL_TOKEN --schema-only > /dev/null
- doctl apps update $app_id -t $DO_CTL_TOKEN --wait --spec spec.yaml
- env_name=$( [ "$DRONE_BRANCH" = "main" ] && echo "prod" || echo "dev" )
- release_name=$( [ "$env_name" = "prod" ] && echo "$APP_NAME" || echo "$env_name""-""$APP_NAME" )
# Install application chart
- >-
helm upgrade --install "$release_name" -n commune-"$env_name"-web-apps
-f values.yaml -f apps/"$APP_NAME"/values.yaml
-f apps/"$APP_NAME"/values."$env_name".yaml
--set deployment.image.tag="$COMMIT_SHORT_SHA"
--wait renlabs/application
trigger:
branch:
Expand Down Expand Up @@ -178,20 +211,31 @@ steps:
build_args: APP_NAME=commune-governance

- name: deploy
image: digitalocean/doctl:latest
image: ghcr.io/renlabs-dev/devops-ci:latest
environment:
DO_CTL_TOKEN:
from_secret: DO_CTL_TOKEN
VAULT_ADDR:
from_secret: VAULT_ADDR
VAULT_ROLE_ID:
from_secret: VAULT_ROLE_ID
VAULT_SECRET_ID:
from_secret: VAULT_SECRET_ID
APP_NAME: commune-governance
commands:
- apk add jq
- export PATH=$PATH:/app
# Download helm chart and authenticate to Kubernetes
- /apps/k8s_auth_w_approle.sh
- helm repo add renlabs https://charts.renlabs.dev/
- helm repo update
# Set auxiliary environment variables
- export COMMIT_SHORT_SHA=${DRONE_COMMIT_SHA:0:7}
- app_name=$( [ "$DRONE_BRANCH" = "main" ] && echo "commune-governance" || echo "dev-commune-governance" )
- app_id=$(doctl apps list -t $DO_CTL_TOKEN -o json | jq --arg name "$app_name" '.[] | select(.spec.name == $name) | .id' | tr -d '"')
- doctl apps spec get $app_id -t $DO_CTL_TOKEN > spec.yaml
- sed -i "s/\(tag:*\).*/\1 \"$COMMIT_SHORT_SHA\"/" spec.yaml
- doctl apps spec validate spec.yaml -t $DO_CTL_TOKEN --schema-only > /dev/null
- doctl apps update $app_id -t $DO_CTL_TOKEN --wait --spec spec.yaml
- env_name=$( [ "$DRONE_BRANCH" = "main" ] && echo "prod" || echo "dev" )
- release_name=$( [ "$env_name" = "prod" ] && echo "$APP_NAME" || echo "$env_name""-""$APP_NAME" )
# Install application chart
- >-
helm upgrade --install "$release_name" -n commune-"$env_name"-web-apps
-f values.yaml -f apps/"$APP_NAME"/values.yaml
-f apps/"$APP_NAME"/values."$env_name".yaml
--set deployment.image.tag="$COMMIT_SHORT_SHA"
--wait renlabs/application
trigger:
branch:
Expand Down Expand Up @@ -231,20 +275,31 @@ steps:
build_args: APP_NAME=commune-wallet

- name: deploy
image: digitalocean/doctl:latest
image: ghcr.io/renlabs-dev/devops-ci:latest
environment:
DO_CTL_TOKEN:
from_secret: DO_CTL_TOKEN
VAULT_ADDR:
from_secret: VAULT_ADDR
VAULT_ROLE_ID:
from_secret: VAULT_ROLE_ID
VAULT_SECRET_ID:
from_secret: VAULT_SECRET_ID
APP_NAME: commune-wallet
commands:
- apk add jq
- export PATH=$PATH:/app
# Download helm chart and authenticate to Kubernetes
- /apps/k8s_auth_w_approle.sh
- helm repo add renlabs https://charts.renlabs.dev/
- helm repo update
# Set auxiliary environment variables
- export COMMIT_SHORT_SHA=${DRONE_COMMIT_SHA:0:7}
- app_name=$( [ "$DRONE_BRANCH" = "main" ] && echo "commune-wallet" || echo "dev-commune-wallet" )
- app_id=$(doctl apps list -t $DO_CTL_TOKEN -o json | jq --arg name "$app_name" '.[] | select(.spec.name == $name) | .id' | tr -d '"')
- doctl apps spec get $app_id -t $DO_CTL_TOKEN > spec.yaml
- sed -i "s/\(tag:*\).*/\1 \"$COMMIT_SHORT_SHA\"/" spec.yaml
- doctl apps spec validate spec.yaml -t $DO_CTL_TOKEN --schema-only > /dev/null
- doctl apps update $app_id -t $DO_CTL_TOKEN --wait --spec spec.yaml
- env_name=$( [ "$DRONE_BRANCH" = "main" ] && echo "prod" || echo "dev" )
- release_name=$( [ "$env_name" = "prod" ] && echo "$APP_NAME" || echo "$env_name""-""$APP_NAME" )
# Install application chart
- >-
helm upgrade --install "$release_name" -n commune-"$env_name"-web-apps
-f values.yaml -f apps/"$APP_NAME"/values.yaml
-f apps/"$APP_NAME"/values."$env_name".yaml
--set deployment.image.tag="$COMMIT_SHORT_SHA"
--wait renlabs/application
trigger:
branch:
Expand Down Expand Up @@ -284,20 +339,31 @@ steps:
build_args: APP_NAME=commune-cache

- name: deploy
image: digitalocean/doctl:latest
image: ghcr.io/renlabs-dev/devops-ci:latest
environment:
DO_CTL_TOKEN:
from_secret: DO_CTL_TOKEN
VAULT_ADDR:
from_secret: VAULT_ADDR
VAULT_ROLE_ID:
from_secret: VAULT_ROLE_ID
VAULT_SECRET_ID:
from_secret: VAULT_SECRET_ID
APP_NAME: commune-cache
commands:
- apk add jq
- export PATH=$PATH:/app
# Download helm chart and authenticate to Kubernetes
- /apps/k8s_auth_w_approle.sh
- helm repo add renlabs https://charts.renlabs.dev/
- helm repo update
# Set auxiliary environment variables
- export COMMIT_SHORT_SHA=${DRONE_COMMIT_SHA:0:7}
- app_name=$( [ "$DRONE_BRANCH" = "main" ] && echo "commune-cache" || echo "dev-commune-cache" )
- app_id=$(doctl apps list -t $DO_CTL_TOKEN -o json | jq --arg name "$app_name" '.[] | select(.spec.name == $name) | .id' | tr -d '"')
- doctl apps spec get $app_id -t $DO_CTL_TOKEN > spec.yaml
- sed -i "s/\(tag:*\).*/\1 \"$COMMIT_SHORT_SHA\"/" spec.yaml
- doctl apps spec validate spec.yaml -t $DO_CTL_TOKEN --schema-only > /dev/null
- doctl apps update $app_id -t $DO_CTL_TOKEN --wait --spec spec.yaml
- env_name=$( [ "$DRONE_BRANCH" = "main" ] && echo "prod" || echo "dev" )
- release_name=$( [ "$env_name" = "prod" ] && echo "$APP_NAME" || echo "$env_name""-""$APP_NAME" )
# Install application chart
- >-
helm upgrade --install "$release_name" -n commune-"$env_name"-web-apps
-f values.yaml -f apps/"$APP_NAME"/values.yaml
-f apps/"$APP_NAME"/values."$env_name".yaml
--set deployment.image.tag="$COMMIT_SHORT_SHA"
--wait renlabs/application
trigger:
branch:
Expand Down
10 changes: 10 additions & 0 deletions apps/commune-cache/values.dev.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
environmentName: dev

wssApiEndpoint: wss://testnet.api.communeai.net

ingress:
hosts:
- host: dev.cache.communeai.org
paths:
- path: /
pathType: Prefix
10 changes: 10 additions & 0 deletions apps/commune-cache/values.prod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
environmentName: prod

wssApiEndpoint: wss://api.communeai.net

ingress:
hosts:
- host: cache.communeai.org
paths:
- path: /
pathType: Prefix
20 changes: 20 additions & 0 deletions apps/commune-cache/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
cacheUrl: ""

deployment:
image:
repository: ghcr.io/renlabs-dev/commune-cache

command: ["pnpm"]
args: ["tsx", "./src/index.ts"]

startupProbe:
httpGet:
path: /api/stake-out

readinessProbe:
httpGet:
path: /api/stake-out

livenessProbe:
httpGet:
path: /api/stake-out
11 changes: 11 additions & 0 deletions apps/commune-governance/values.dev.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
environmentName: dev

wssApiEndpoint: wss://testnet.api.communeai.net
cacheUrl: https://dev.cache.communeai.org

ingress:
hosts:
- host: dev.governance.communeai.org
paths:
- path: /
pathType: Prefix
11 changes: 11 additions & 0 deletions apps/commune-governance/values.prod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
environmentName: prod

wssApiEndpoint: wss://api.communeai.net
cacheUrl: https://cache.communeai.org

ingress:
hosts:
- host: governance.communeai.org
paths:
- path: /
pathType: Prefix
15 changes: 15 additions & 0 deletions apps/commune-governance/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
deployment:
image:
repository: ghcr.io/renlabs-dev/commune-governance

env:
JWT_SECRET:
valueFrom:
secretKeyRef:
name: '{{ .Values.environmentName }}-web-apps-secret'
key: jwt_secret
POSTGRES_URL:
valueFrom:
secretKeyRef:
name: '{{ .Values.environmentName }}-web-apps-secret'
key: community_validator_db_url
11 changes: 11 additions & 0 deletions apps/commune-page/values.dev.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
environmentName: dev

wssApiEndpoint: wss://testnet.api.communeai.net
cacheUrl: https://dev.cache.communeai.org

ingress:
hosts:
- host: dev.communeai.org
paths:
- path: /
pathType: Prefix
11 changes: 11 additions & 0 deletions apps/commune-page/values.prod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
environmentName: prod

wssApiEndpoint: wss://api.communeai.net
cacheUrl: https://cache.communeai.org

ingress:
hosts:
- host: communeai.org
paths:
- path: /
pathType: Prefix
3 changes: 3 additions & 0 deletions apps/commune-page/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
deployment:
image:
repository: ghcr.io/renlabs-dev/commune-page
11 changes: 11 additions & 0 deletions apps/commune-validator/values.dev.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
environmentName: dev

wssApiEndpoint: wss://testnet.api.communeai.net
cacheUrl: https://dev.cache.communeai.org

ingress:
hosts:
- host: dev.validator.communeai.org
paths:
- path: /
pathType: Prefix
11 changes: 11 additions & 0 deletions apps/commune-validator/values.prod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
environmentName: prod

wssApiEndpoint: wss://api.communeai.net
cacheUrl: https://cache.communeai.org

ingress:
hosts:
- host: validator.communeai.org
paths:
- path: /
pathType: Prefix
Loading

0 comments on commit 610b0cc

Please sign in to comment.