Skip to content

Commit

Permalink
first version auto-deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
holisticode committed Nov 19, 2020
1 parent eaf43a7 commit 41348f1
Show file tree
Hide file tree
Showing 4 changed files with 213 additions and 0 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/deploy-internal.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Deploy automatically to internal testnet

name: deploy-internal

# Controls when the action will run.
on:
push:
branch:
- 'deploy-internal' # Triggers on every push to the `deploy-internal` branch

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-18.04

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2

# Runs a single command using the runners shell
- name: Build the avalanchego binaries
run: ./scripts/build.sh

- name: Install aws cli
run: sudo apt-get install awscli

- name: Get the commit id
id: get_version
run: echo ::set-output name=VERSION::${git rev-parse --short "$GITHUB_SHA"}
shell: bash

- name: Create debian package structure
run: ./.github/workflows/build-deb-pkg.sh
env:
AWS_ACCESS_KEY_ID: ${{ secrets.INTERNAL_BUILDS_ID}}
AWS_SECRET_ACCESS_KEY: ${{ secrets.INTERNAL_BUILDS_KEY}}
TAG: ${{ steps.get_version.outputs.VERSION }}
BUCKET: ${{ secrets.INTERNAL_BUILDS_BUCKET }}

- name: Run ansible deployment playbook
run: ansible-playbook --private-key ${{ secrets.DEPLOY_USER }} -l ${{ secrets.INVENTORY }} play-deploy-internal.yml
env:
AWS_ACCESS_KEY_ID: ${{ secrets.INTERNAL_BUILDS_ID}}
AWS_SECRET_ACCESS_KEY: ${{ secrets.INTERNAL_BUILDS_KEY}}
BUCKET: ${{ secrets.INTERNAL_BUILDS_BUCKET }}
DEB_FILE: avalanchego-linux_${{ steps.get_version.outputs.VERSION }}.deb
65 changes: 65 additions & 0 deletions .github/workflows/play-deploy-internal.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
---
- hosts: all
gather_facts: no
remote_user: ubuntu

tasks:
- name: create releases directories
file:
path: /home/ubuntu/releases
state: directory
owner: ubuntu
group: ubuntu
mode: '0755'

- name: upload latest .deb build
s3:
bucket: {{ BUCKET }}
object: /linux/deb/{{ DEB_FILE }}
dest: /home/ubuntu/releases
mode: get

- name: install deb file
become: yes
command: dpkg -i /home/ubuntu/releases/{{ DEB_FILE }}

- name: copy systemd script
become: yes
copy:
src: tmpl/avalanchego.service
dest: /etc/systemd/system/avalanchego.service
owner: root
group: root
mode: 0755

- name: create conf dir
become: yes
file:
path: /etc/avalanchego
state: directory
owner: root
group: root
mode: '0755'

- name: copy config file
become: yes
copy:
src: tmpl/conf.json
dest: /etc/avalanchego/conf.json
owner: root
group: root
mode: 0755
notify:
- Restart Avalanche service

handlers:
- name: Reload systemd
become: true
systemd:
daemon_reload: yes

- name: Restart Avalanche service
become: true
service:
name: "avalanche"
state: restarted
21 changes: 21 additions & 0 deletions .github/workflows/tmpl/avalanchego.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# {{ ansible_managed }}

[Unit]
Description=Avalanche Go node implementation
Documentation=https://docs.avax.network/
After=network.target
StartLimitIntervalSec=0

[Service]
Type=simple
WorkingDirectory=/home/ubuntu
Restart=always
RestartSec=1
User=ubuntu
LimitNOFILE=16384
StandardOutput=null
StandardError=null
ExecStart=/usr/local/bin/avalanchego --config-file /etc/avalanchego/conf.json

[Install]
WantedBy=multi-user.target
78 changes: 78 additions & 0 deletions .github/workflows/tmpl/conf.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
{
"api-admin-enabled": true,
"api-auth-password": "",
"api-auth-required": false,
"api-health-enabled": true,
"api-info-enabled": true,
"api-ipcs-enabled": false,
"api-keystore-enabled": false,
"api-metrics-enabled": true,
"assertions-enabled": true,
"benchlist-duration": "1h",
"benchlist-fail-threshold": 10,
"benchlist-min-failing-duration": "5m",
"benchlist-peer-summary-enabled": false,
"bootstrap-ids": "default",
"bootstrap-ips": "default",
"config-file": "default",
"conn-meter-max-conns": 5,
"conn-meter-reset-duration": "0s",
"consensus-gossip-frequency": "10s",
"consensus-shutdown-timeout": "5s",
"coreth-config": "default",
"creation-tx-fee": 1000000,
"db-dir": "default",
"db-enabled": true,
"dynamic-public-ip": "",
"dynamic-update-duration": "5m",
"fd-limit": 32768,
"http-host": "",
"http-port": 21000,
"http-tls-cert-file": "",
"http-tls-enabled": false,
"http-tls-key-file": "",
"ipcs-chain-ids": "",
"ipcs-path": "default",
"log-dir": "",
"log-display-highlight": "auto",
"log-display-level": "",
"log-level": "debug",
"max-non-staker-pending-msgs": 20,
"max-stake-duration": "8760h",
"max-validator-stake": 3000000000000000,
"min-delegation-fee": 5000000,
"min-delegator-stake": 1000000000,
"min-stake-duration": "24h",
"min-validator-stake": 1000000000,
"network-id": "fuji",
"network-initial-timeout": "5s",
"network-maximum-timeout": "10s",
"network-minimum-timeout": "500ms",
"network-timeout-increase": "60ms",
"network-timeout-reduction": "12ms",
"p2p-tls-enabled": true,
"plugin-dir": "default",
"public-ip": "",
"signature-verification-enabled": true,
"snow-avalanche-batch-size": 30,
"snow-avalanche-num-parents": 5,
"snow-concurrent-repolls": 4,
"snow-quorum-size": 14,
"snow-rogue-commit-threshold": 30,
"snow-sample-size": 20,
"snow-virtuous-commit-threshold": 15,
"stake-minting-period": "8760h",
"staker-cpu-reserved": 0.375,
"staker-msg-reserved": 0.375,
"staking-disabled-weight": 1,
"staking-enabled": true,
"staking-port": 21001,
"staking-tls-cert-file": "default",
"staking-tls-key-file": "default",
"tx-fee": 1000000,
"uptime-requirement": 0.6,
"version": false,
"whitelisted-subnets": "",
"xput-server-enabled": false,
"xput-server-port": 21002
}

0 comments on commit 41348f1

Please sign in to comment.