Skip to content

Commit

Permalink
Merge installer in DAppNode
Browse files Browse the repository at this point in the history
  • Loading branch information
pablomendezroyo committed Jul 14, 2021
1 parent 8be2afd commit c5dfcfe
Show file tree
Hide file tree
Showing 52 changed files with 1,933 additions and 561 deletions.
36 changes: 36 additions & 0 deletions .dappnode_profile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash

export BIND_VERSION="${BIND_VERSION:-0.2.6}"
export IPFS_VERSION="${IPFS_VERSION:-0.2.14}"
export VPN_VERSION="${VPN_VERSION:-0.2.8}"
export DAPPMANAGER_VERSION="${DAPPMANAGER_VERSION:-0.2.42}"
export WIFI_VERSION="${WIFI_VERSION:-0.2.7}"
export WIREGUARD_VERSION="${WIREGUARD_VERSION:-0.1.0}"
export HTTPS_VERSION="${HTTPS:-0.1.1}"

export DAPPNODE_DIR="/usr/src/dappnode"
export DAPPNODE_CORE_DIR="${DAPPNODE_DIR}/DNCORE"

#!ISOBUILD Do not modify, variables above imported for ISO build
DNCORE_YMLS=$(find $DAPPNODE_CORE_DIR -name "docker-compose-*.yml" -printf "-f %p ")
# shellcheck disable=SC2207
# shellcheck disable=SC2034
DNCORE_YMLS_ARRAY=($(find /usr/src/dappnode/DNCORE -name "docker-compose-*.yml" | sort))

# Returns docker core containers status
alias dappnode_status='docker-compose $DNCORE_YMLS ps'
# Stop docker core containers
alias dappnode_stop='docker-compose $DNCORE_YMLS stop && docker stop $(docker container ls -a -q -f name=DAppNode*)'
# Start docker core containers
alias dappnode_start='docker-compose $DNCORE_YMLS up -d && docker start $(docker container ls -a -q -f name=DAppNode*)'
# Return open-vpn credentials from a specific user. e.g: dappnode_get dappnode_admin
alias dappnode_get='docker exec -i DAppNodeCore-vpn.dnp.dappnode.eth vpncli get'
# Return open-vpn admin credentials
alias dappnode_connect='docker exec -i DAppNodeCore-vpn.dnp.dappnode.eth getAdminCredentials'
# Return wifi credentials (ssid and password)
alias dappnode_wifi='cat /usr/src/dappnode/DNCORE/docker-compose-wifi.yml | grep "SSID\|WPA_PASSPHRASE"'
# Return remote credentials in plain text. OPTIONS:
# --qr (QR format). --local (local creds for NAT loopback issues)
alias dappnode_wireguard='docker exec -i DAppNodeCore-api.wireguard.dnp.dappnode.eth getWireguardCredentials'

return
7 changes: 7 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
LICENSE
*.md
.gitignore
.github
images
test
doc
7 changes: 7 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# These owners will be the default owners for everything in the repo. Unless a later match takes precedence,
# They will be requested for review when someone opens a pull request.
* @dapplion @eduadiez @pablomendezroyo @3alpha @Tropicar

# Order is important; the last matching pattern takes the most precedence. When someone opens a pull request that only
# modifies md files, only md owners and not the global owner(s) will be requested for a review.
*.md @Pol-Lanski @dapplion @eduadiez @pablomendezroyo @3alpha @Tropicar
5 changes: 0 additions & 5 deletions .github/ISSUE_TEMPLATE.md

This file was deleted.

42 changes: 42 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
name: Bug report
about: Create a report to help us improve
title:
labels:
assignees:
---

<!--NOTE: -->
<!--- General questions should go to the discord chat instead of the issue tracker.-->

**Describe the bug**

<!--A clear and concise description of what the bug is.-->

**To Reproduce**

<!--Steps to reproduce the behavior:
1. Install version X
2. Set this configuration option
3. Do this action
4. See error-->

**Expected behavior**

<!--A clear and concise description of what you expected to happen.-->

**Screenshots**

<!--If applicable, add screenshots to help explain your problem.-->

**DAppNode version:**

<!--Print the DAppNode versions and info found in http://my.dappnode/#/support/report -->

- Package version: <!-- v0.1.14, upstream: prysm-1.0.0-beta -->
- OS: <!-- Ubuntu, Debian, DAppNode Mini, DAppNode Advance -->
- Browser <!-- If applicable: Brave, Firefox, Chrome, Safari -->

**Additional context**

<!--Add any other context about the problem here.-->
26 changes: 26 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
name: Feature request
about: Suggest an idea for this project
title: ""
labels: ""
assignees: ""
---

<!--NOTE: -->
<!--- General questions should go to the discord chat instead of the issue tracker.-->

**Is your feature request related to a problem? Please describe.**

<!--A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]-->

**Describe the solution you'd like**

<!--A clear and concise description of what you want to happen.-->

**Describe alternatives you've considered**

<!--A clear and concise description of any alternative solutions or features you've considered.-->

**Additional context**

<!--Add any other context or screenshots about the feature request here.-->
File renamed without changes.
124 changes: 124 additions & 0 deletions .github/workflows/artifacts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
name: Artifacts
on:
workflow_dispatch:
inputs:
core:
description: "Version of the core. Must go with v (e.g v0.2.47)"
required: true
dappmanager:
description: "Version of the dappmanager. Only numbers"
required: true
wifi:
description: "Version of the wifi. Only numbers"
required: true
bind:
description: "Version of the bind. Only numbers"
required: true
ipfs:
description: "Version of the ipfs. Only numbers"
required: true
https:
description: "Version of the https. Only numbers"
required: true
wireguard:
description: "Version of the wireguard. Only numbers"
required: true
vpn:
description: "Version of the vpn. Only numbers"
required: true

env:
BIND_VERSION: ${{ github.event.inputs.bind }}
IPFS_VERSION: ${{ github.event.inputs.ipfs }}
DAPPMANAGER_VERSION: ${{ github.event.inputs.dappmanager }}
WIFI_VERSION: ${{ github.event.inputs.wifi }}
WIREGUARD_VERSION: ${{ github.event.inputs.wireguard }}
HTTPS_VERSION: ${{ github.event.inputs.https }}
VPN_VERSION: ${{ github.event.inputs.vpn }}
CORE_VERSION: ${{ github.event.inputs.core }}

jobs:
pre-release:
name: create pre release
runs-on: ubuntu-latest
defaults:
run:
shell: bash

steps:
# Regex for versions introduced
- name: Check versions regex
run: |
[[ $BIND_VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] && [[ $IPFS_VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] && [[ $DAPPMANAGER_VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] && \
[[ $WIFI_VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] && [[ $WIREGUARD_VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] && [[ $HTTPS_VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] && \
[[ $VPN_VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] && [[ $CORE_VERSION =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]] || { echo "versions introduced in wrong format"; exit 1; }
- name: Checkout
uses: actions/checkout@v2.3.1

# Edit the profile with the new versions introduced
- name: Set new versions
run: |
sed -i -e "/BIND_VERSION/s/[0-9]*\.[0-9]*\.[0-9]*/"${BIND_VERSION}"/" .dappnode_profile
sed -i -e "/IPFS_VERSION/s/[0-9]*\.[0-9]*\.[0-9]*/"${IPFS_VERSION}"/" .dappnode_profile
sed -i -e "/VPN_VERSION/s/[0-9]*\.[0-9]*\.[0-9]*/"${VPN_VERSION}"/" .dappnode_profile
sed -i -e "/DAPPMANAGER_VERSION/s/[0-9]*\.[0-9]*\.[0-9]*/"${DAPPMANAGER_VERSION}"/" .dappnode_profile
sed -i -e "/WIFI_VERSION/s/[0-9]*\.[0-9]*\.[0-9]*/"${WIFI_VERSION}"/" .dappnode_profile
sed -i -e "/WIREGUARD_VERSION/s/[0-9]*\.[0-9]*\.[0-9]*/"${WIREGUARD_VERSION}"/" .dappnode_profile
sed -i -e "/HTTPS_VERSION/s/[0-9]*\.[0-9]*\.[0-9]*/"${HTTPS_VERSION}"/" .dappnode_profile
cat .dappnode_profile
# ISO ATTENDED
- name: Build attended
run: |
sed -i -e "/UNATTENDED/s/true/false/" docker-compose.yml
docker-compose build
docker-compose up
# Verify ISO attended created
- name: Check iso attended
run: |
ls -lrt images/DAppNode-debian-bullseye-amd64.iso
# Set new name for the release asset
- name: Set DAppNode attended ISO name
run: |
cp ./images/DAppNode-debian-bullseye-amd64.iso DAppNode-${CORE_VERSION}-debian-bullseye-amd64.iso
# ISO UNATTENDED
- name: Build unattended
run: |
sed -i -e "/UNATTENDED/s/false/true/" docker-compose.yml
docker-compose build
docker-compose up
# Verify ISO unattended was created
- name: Check iso unattended
run: |
ls -lrt images/DAppNode-debian-bullseye-amd64.iso
# Set new name for the release asset
- name: Set DAppNode unttended ISO name
run: |
cp ./images/DAppNode-debian-bullseye-amd64.iso DAppNode-${CORE_VERSION}-debian-bullseye-amd64-unattended.iso
- name: Create dappnode_profile.sh
run: |
cp .dappnode_profile dappnode_profile.sh
# ARTIFACTS ASSETS
- name: Artifact
uses: actions/upload-artifact@v2
with:
name: test-artifact
path: |
./DAppNode-*-amd64.iso
./DAppNode-*-amd64-unattended.iso
./scripts/dappnode_install.sh
./scripts/dappnode_install_pre.sh
./scripts/dappnode_uninstall.sh
./scripts/dappnode_access_credentials.sh
dappnode_profile.sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34 changes: 34 additions & 0 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Lint Code Base

#
# Documentation:
# https://help.github.com/en/articles/workflow-syntax-for-github-actions
#
on:
workflow_dispatch:
push:
branches-ignore:
- "master"
pull_request:
branches:
- "master"

jobs:
build:
name: Lint Code Base
runs-on: ubuntu-latest
continue-on-error: true

steps:
- name: Checkout Code
uses: actions/checkout@v2
with:
# Full git history is needed to get a proper list of changed files within `super-linter`
fetch-depth: 0

- name: Lint Code Base
uses: github/super-linter@v3
env:
VALIDATE_ALL_CODEBASE: false
DEFAULT_BRANCH: master
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6 changes: 2 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,8 @@ jobs:
[[ $WIFI_VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] && [[ $WIREGUARD_VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] && [[ $HTTPS_VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] && \
[[ $VPN_VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] && [[ $CORE_VERSION =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]] || { echo "versions introduced in wrong format"; exit 1; }
- name: Check out installer
uses: actions/checkout@master
with:
repository: dappnode/DAppNode_Installer
- name: Checkout
uses: actions/checkout@v2.3.1

# Edit the profile with the new versions introduced
- name: Set new versions
Expand Down
48 changes: 48 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Scripts
on:
workflow_dispatch:
push:
branches-ignore: [master]
pull_request:
branches: [master]

jobs:
scripts:
name: test scripts
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2.3.1
- name: setup test environment
run: |
sudo /bin/bash ./test/environment_setup.sh
- name: install prerrequisites
run: |
sudo /bin/bash ./scripts/dappnode_install_pre.sh UPDATE
- name: Install DAppNode
run: |
sudo /bin/bash ./scripts/dappnode_install.sh
- name: Show installation logs
run: |
cat /usr/src/dappnode/logs/install.log
cat /usr/src/dappnode/logs/dappnode_install.log
- name: Uninstall DAppNode
run: |
sudo /bin/bash ./scripts/dappnode_uninstall.sh y
iso:
name: test ISO
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2.3.1
- name: create iso
run: |
docker-compose build
docker-compose up
ls images/
- name: verify image
run: |
ls -lrt images/DAppNode-debian-bullseye-amd64.iso
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
docs/_build
docs/_build
images
Loading

0 comments on commit c5dfcfe

Please sign in to comment.