diff --git a/.dappnode_profile b/.dappnode_profile new file mode 100755 index 00000000..baefcefe --- /dev/null +++ b/.dappnode_profile @@ -0,0 +1,53 @@ +#!/bin/bash + +# Script sourced by installer script `dappnode_install.sh` +# It is sourced to grab and download the core packages content from github and/or IPFS +# - Github: i.e `BIND_VERSION=0.2.11` +# - IPFS: i.e `DAPPMANAGER_VERSION=/ipfs/QmRe6V5vZYFv68WeX3vh2N9hVEeDnp8f7rmxP47xjGNrNF:0.2.71` This string will be splitted by the semicolon `:` +# - `/ipfs/QmRe6...` -> indicates the ipfs hash used to download the content +# - `0.2.71` -> indicates the version. It must be the one uploaded to such IPFS hash + +export BIND_VERSION="${BIND_VERSION:-0.2.11}" +export IPFS_VERSION="${IPFS_VERSION:-0.2.23}" +export VPN_VERSION="${VPN_VERSION:-0.2.10}" +export DAPPMANAGER_VERSION="${DAPPMANAGER_VERSION:-0.2.99}" +export WIFI_VERSION="${WIFI_VERSION:-0.2.9}" +export WIREGUARD_VERSION="${WIREGUARD_VERSION:-0.1.3}" +export HTTPS_VERSION="${HTTPS:-0.2.2}" + +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*)' +# Remove docker core containers. This does not remove named volumes +alias dappnode_down='docker compose $DNCORE_YMLS down' +# Return open-vpn credentials from a specific user. e.g: dappnode_get dappnode_admin +alias dappnode_openvpn_get='docker exec -i DAppNodeCore-vpn.dnp.dappnode.eth vpncli get' +# Return open-vpn admin credentials +alias dappnode_openvpn='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' +# Execute access_credentials.sh script to check for connectivity methods +alias dappnode_connect='/usr/bin/bash /usr/src/dappnode/scripts/dappnode_access_credentials.sh' +# Return all available commands +alias dappnode_help='echo -e "\n\tDAppNode commands available:\n\n\tdappnode_help\t\tprints out this message\n\n\tdappnode_wifi\t\tget wifi credentials (SSID and password)\n\n\tdappnode_openvpn\tget Open VPN credentials\n\n\tdappnode_wireguard\tget Wireguard VPN credentials (dappnode_wireguard --help for more info)\n\n\tdappnode_connect\tcheck connectivity methods available in DAppNode\n\n\tdappnode_status\t\tget status of dappnode containers\n\n\tdappnode_start\t\tstart dappnode containers\n\n\tdappnode_stop\t\tstop dappnode containers\n"' +# Compose alias for backward compatibility +if docker compose version >/dev/null 2>&1; then + alias docker-compose='docker compose' +fi + +return diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..3bd40ef1 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,7 @@ +LICENSE +*.md +.gitignore +.github +images +test +doc \ No newline at end of file diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 00000000..7e0d66f0 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1 @@ +* @dappnode/core diff --git a/.github/CODE_OF_CONDUCT.md b/.github/CODE_OF_CONDUCT.md new file mode 100644 index 00000000..0316c4a7 --- /dev/null +++ b/.github/CODE_OF_CONDUCT.md @@ -0,0 +1,46 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment include: + +- Using welcoming and inclusive language +- Being respectful of differing viewpoints and experiences +- Gracefully accepting constructive criticism +- Focusing on what is best for the community +- Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +- The use of sexualized language or imagery and unwelcome sexual attention or advances +- Trolling, insulting/derogatory comments, and personal or political attacks +- Public or private harassment +- Publishing others' private information, such as a physical or electronic address, without explicit permission +- Other conduct which could reasonably be considered inappropriate in a professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at [Element channel](https://app.element.io/#/room/#DAppNode:matrix.org). The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] + +[homepage]: http://contributor-covenant.org +[version]: http://contributor-covenant.org/version/1/4/ diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md new file mode 100644 index 00000000..f4fc6156 --- /dev/null +++ b/.github/CONTRIBUTING.md @@ -0,0 +1,57 @@ +# Contributing + +When bringing people on as contributors we prefer that they start with an issue tagged [good first issue](https://github.com/dappnode/DNP_BIND/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22). + +After a contributor has shown they're a good fit and have completed 1 or 2 issues labeled [good first issue](https://github.com/dappnode/DNP_BIND/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22) with pull requests that have been accepted feel free of moving on to other issues. We're thrilled to see new contributors. + +If you want to better understand how does the development process works, please refer to our [wiki pages](https://github.com/dappnode/DAppNode/wiki) + +## Setup + +In order to get the repositories setup before contributions refer to the [README.md](https://github.com/dappnode/DAppNode/blob/master/README.md) file. + +## Contribution Steps + +1. _Find a suitable issue_ + + If this is your first time look for an issue labeled [good first issue](https://github.com/dappnode/DNP_BIND/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22) otherwise look for issues labeled [help wanted](https://github.com/dappnode/DNP_BIND/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22) . If another issue jumps out at you please engage on the issue before starting it. + +2. _Assign yourself the issue_ + + Let us know you're working on it! We hate wasted labour so it's always helpful to know what our community contributors are working on. + +3. _Fork and clone [DAppNode](://github.com/dappnode/DAppNode)_ + + In general it's a good practice to fork into your own repository. We prefer if issues + are addressed in a branch with the issue number in it's name. + i.e. `29_this_is_an_issue` + +4. _Make contributions_ + + Make all the changes needed to address the given issue. + +5. _Add testing_ + + In general we aim for full test coverage. For this reason most issues completed should include full testing. If you think there should be an exception for your issue please reach out. + +6. _Run previous tests_ + + Make sure that the changes that you've made don't break anything! Ensure that running `npm test` and `npm eslint` doesn't throw any new and unexpected errors. + +7. _Push all your work_ + + At this point the issue should be addressed, new testing should be in place, and all old tests should be passing. + +8. _Create a Pull Request_ + + At this point you should either have a forked repository with your issue fixes and it is time to put in a PR. Make sure that your PR has something like `addresses #26` or `closes #26` The most important thing is that it has the relevant issue number referenced in the body of the PR. + +9. _Make noise!_ + + Get in our [Element](https://app.element.io/#/room/#DAppNode:matrix.org) and point to your new PR. Let us know you've tackled your first, third or 90th issue with us. We'll review it and everybody will get a warm feeling of accomplishment. + +10. _rinse, repeat_ + + Find another issue, get more involved, make noise in our Riot, or find issues we may have missed. You've completed your first step to becoming a contributor. **You're helping to Decentralize the FUTURE**! + +If you still have any further questions about contribution feel free to reach out to `@eduadiez:matrix.org`, `@yalormewn:matrix.org`, `@liondapp:matrix.org`, or just make noise in the `#DAppNode` channel on [Element](https://app.element.io/#/room/#DAppNode:matrix.org). diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 00000000..a765d828 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,42 @@ +--- +name: Bug report +about: Create a report to help us improve +title: +labels: +assignees: +--- + + + + +**Describe the bug** + + + +**To Reproduce** + + + +**Expected behavior** + + + +**Screenshots** + + + +**DAppNode version:** + + + +- Package version: +- OS: +- Browser + +**Additional context** + + diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 00000000..11bbebfd --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,26 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: "" +labels: "" +assignees: "" +--- + + + + +**Is your feature request related to a problem? Please describe.** + + + +**Describe the solution you'd like** + + + +**Describe alternatives you've considered** + + + +**Additional context** + + diff --git a/.github/ISSUE_TEMPLATE/pull_request.md b/.github/ISSUE_TEMPLATE/pull_request.md new file mode 100644 index 00000000..27bc45f5 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/pull_request.md @@ -0,0 +1,43 @@ +# Pull Request Template + +## Description + +Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change. + +Fixes # (issue) + +## Type of change + +Please delete options that are not relevant. + +- [ ] Bug fix (non-breaking change which fixes an issue) +- [ ] New feature (non-breaking change which adds functionality) +- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) +- [ ] This change requires a documentation update + +## How Has This Been Tested? + +Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration + +- [ ] ISO install +- [ ] Script install +- [ ] Other (please detail) + +**Test Configuration**: + +- DAppNode version: +- Hardware: +- Toolchain: +- SDK: + +## Checklist + +- [ ] My code follows the style guidelines of this project +- [ ] I have performed a self-review of my own code +- [ ] I have commented my code, particularly in hard-to-understand areas +- [ ] I have made corresponding changes to the documentation +- [ ] My changes generate no new warnings +- [ ] I have added tests that prove my fix is effective or that my feature works +- [ ] New and existing unit tests pass locally with my changes +- [ ] Any dependent changes have been merged and published in downstream modules +- [ ] I have checked my code and corrected any misspellings diff --git a/.github/stale.yml b/.github/stale.yml new file mode 100644 index 00000000..ba6578aa --- /dev/null +++ b/.github/stale.yml @@ -0,0 +1,34 @@ +# Config for https://github.com/apps/stale + +# Number of days of inactivity before an issue becomes stale +daysUntilStale: 60 + +# Number of days of inactivity before a stale issue is closed +daysUntilClose: 30 + +# Issues with these labels will never be considered stale +exemptLabels: + - pinned + - security + +# Set to true to ignore issues in a project (defaults to false) +exemptProjects: false + +# Set to true to ignore issues in a milestone (defaults to false) +exemptMilestones: true + +# Set to true to ignore issues with an assignee (defaults to false) +exemptAssignees: true + +# Label to use when marking as stale +staleLabel: bot:stale + +# Comment to post when marking an issue as stale. Set to `false` to disable +markComment: > + This issue has been automatically marked as stale because it has not had + recent activity. It will be closed if no further activity occurs. Thank you + for your contributions! + +# Comment to post when closing a stale Issue or Pull Request. +closeComment: > + This issue or pull request has been automatically been closed due to inactivity. diff --git a/.github/workflows/artifacts.yml b/.github/workflows/artifacts.yml new file mode 100644 index 00000000..e48a1e8f --- /dev/null +++ b/.github/workflows/artifacts.yml @@ -0,0 +1,163 @@ +name: Artifacts +on: + workflow_dispatch: + inputs: + core: + description: "Version of the Core. Must be prefixed 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 Package. Only numbers" + required: true + bind: + description: "Version of the Bind Package. Only numbers" + required: true + ipfs: + description: "Version of the IPFS Package. Only numbers" + required: true + https: + description: "Version of the HTTPS Package. Only numbers" + required: true + wireguard: + description: "Version of the Wireguard Package. Only numbers" + required: true + vpn: + description: "Version of the OpenVPN Package. 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 artifacts + 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@v4 + + # 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 + + # Debian ISO ATTENDED + - name: Build Debian attended + run: | + export BASE_OS=debian + export UNATTENDED=false + docker compose up --build + + - name: Check Debian ISO attended + run: | + ls -lrt images/Dappnode-debian-*.iso + + - name: Set Debian Dappnode attended ISO name + run: | + file=$(ls images/Dappnode-debian-*.iso) + attended_filename="${file/images\/Dappnode-/Dappnode-${CORE_VERSION}-}" + mv "$file" "$attended_filename" + + # Debian ISO UNATTENDED + - name: Build Debian unattended + run: | + export BASE_OS=debian + export UNATTENDED=true + docker compose up --build + + - name: Check Debian ISO unattended + run: | + ls -lrt images/Dappnode-debian-*.iso + + # Set new name for the release asset + - name: Set Dappnode unttended ISO name + run: | + file=$(ls images/Dappnode-debian-*.iso) + + core_filename="${file/images\/Dappnode-/Dappnode-${CORE_VERSION}-}" + unattended_filename="${core_filename/%.iso/-unattended.iso}" + + mv "$file" "$unattended_filename" + + # Ubuntu ISO ATTENDED + - name: Build Ubuntu attended + run: | + export BASE_OS=ubuntu + export UNATTENDED=false + docker compose up --build + + - name: Check Ubuntu ISO attended + run: | + ls -lrt images/Dappnode-ubuntu-*.iso + + - name: Set Ubuntu Dappnode attended ISO name + run: | + file=$(ls images/Dappnode-ubuntu-*.iso) + attended_filename="${file/images\/Dappnode-/Dappnode-${CORE_VERSION}-}" + mv "$file" "$attended_filename" + + # Ubuntu ISO UNATTENDED + - name: Build Ubuntu unattended + run: | + export BASE_OS=ubuntu + export UNATTENDED=true + docker compose up --build + + - name: Check Ubuntu ISO unattended + run: | + ls -lrt images/Dappnode-ubuntu-*.iso + + - name: Set Ubuntu Dappnode unattended ISO name + run: | + file=$(ls images/Dappnode-ubuntu-*.iso) + core_filename="${file/images\/Dappnode-/Dappnode-${CORE_VERSION}-}" + unattended_filename="${core_filename/%.iso/-unattended.iso}" + mv "$file" "$unattended_filename" + + - name: Create dappnode_profile.sh + run: | + cp .dappnode_profile dappnode_profile.sh + + # ARTIFACTS ASSETS + - name: Artifact + uses: actions/upload-artifact@v3 + with: + name: test-artifact + path: | + ./Dappnode-debian-*.iso + ./Dappnode-ubuntu-*.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 }} diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml new file mode 100644 index 00000000..58b25b85 --- /dev/null +++ b/.github/workflows/linter.yml @@ -0,0 +1,35 @@ +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@v4 + 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: super-linter/super-linter@v5 + env: + VALIDATE_ALL_CODEBASE: false + FILTER_REGEX_EXCLUDE: .github/* + DEFAULT_BRANCH: master + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..94223b52 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,251 @@ +name: Pre-release +on: + workflow_dispatch: + inputs: + core: + description: "Version of the Core. Must be prefixed 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 Package. Only numbers" + required: true + bind: + description: "Version of the Bind Package. Only numbers" + required: true + ipfs: + description: "Version of the IPFS Package. Only numbers" + required: true + https: + description: "Version of the HTTPS Package. Only numbers" + required: true + wireguard: + description: "Version of the Wireguard Package. Only numbers" + required: true + vpn: + description: "Version of the OpenVPN Package. Only numbers" + required: true + +jobs: + set-versions: + name: Set versions and check regex + runs-on: ubuntu-latest + outputs: + bind: ${{ steps.set_outputs.outputs.bind }} + ipfs: ${{ steps.set_outputs.outputs.ipfs }} + dappmanager: ${{ steps.set_outputs.outputs.dappmanager }} + wifi: ${{ steps.set_outputs.outputs.wifi }} + wireguard: ${{ steps.set_outputs.outputs.wireguard }} + https: ${{ steps.set_outputs.outputs.https }} + vpn: ${{ steps.set_outputs.outputs.vpn }} + core: ${{ steps.set_outputs.outputs.core }} + steps: + - name: Check versions regex + run: | + [[ "${{ github.event.inputs.bind }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] && [[ "${{ github.event.inputs.ipfs }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] && [[ "${{ github.event.inputs.dappmanager }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] && \ + [[ "${{ github.event.inputs.wifi }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] && [[ "${{ github.event.inputs.wireguard }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] && [[ "${{ github.event.inputs.https }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] && \ + [[ "${{ github.event.inputs.vpn }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] && [[ "${{ github.event.inputs.core }}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]] || { echo "versions introduced in wrong format"; exit 1; } + - name: Checkout + uses: actions/checkout@v4 + - name: Set new versions + run: | + sed -i -e "/BIND_VERSION/s/[0-9]*\.[0-9]*\.[0-9]*/"${{ github.event.inputs.bind }}"/" .dappnode_profile + sed -i -e "/IPFS_VERSION/s/[0-9]*\.[0-9]*\.[0-9]*/"${{ github.event.inputs.ipfs }}"/" .dappnode_profile + sed -i -e "/VPN_VERSION/s/[0-9]*\.[0-9]*\.[0-9]*/"${{ github.event.inputs.vpn }}"/" .dappnode_profile + sed -i -e "/DAPPMANAGER_VERSION/s/[0-9]*\.[0-9]*\.[0-9]*/"${{ github.event.inputs.dappmanager }}"/" .dappnode_profile + sed -i -e "/WIFI_VERSION/s/[0-9]*\.[0-9]*\.[0-9]*/"${{ github.event.inputs.wifi }}"/" .dappnode_profile + sed -i -e "/WIREGUARD_VERSION/s/[0-9]*\.[0-9]*\.[0-9]*/"${{ github.event.inputs.wireguard }}"/" .dappnode_profile + sed -i -e "/HTTPS_VERSION/s/[0-9]*\.[0-9]*\.[0-9]*/"${{ github.event.inputs.https }}"/" .dappnode_profile + cat .dappnode_profile + - name: Create dappnode_profile.sh + run: cp .dappnode_profile dappnode_profile.sh + - name: Upload dappnode_profile.sh + uses: actions/upload-artifact@v4 + with: + name: dappnode_profile + path: dappnode_profile.sh + - name: Set outputs + id: set_outputs + run: | + echo "core=${{ github.event.inputs.core }}" >> $GITHUB_OUTPUT + echo "bind=${{ github.event.inputs.bind }}" >> $GITHUB_OUTPUT + echo "ipfs=${{ github.event.inputs.ipfs }}" >> $GITHUB_OUTPUT + echo "dappmanager=${{ github.event.inputs.dappmanager }}" >> $GITHUB_OUTPUT + echo "wifi=${{ github.event.inputs.wifi }}" >> $GITHUB_OUTPUT + echo "wireguard=${{ github.event.inputs.wireguard }}" >> $GITHUB_OUTPUT + echo "https=${{ github.event.inputs.https }}" >> $GITHUB_OUTPUT + echo "vpn=${{ github.event.inputs.vpn }}" >> $GITHUB_OUTPUT + + build-debian-attended: + name: Build Debian attended ISO + runs-on: ubuntu-latest + needs: set-versions + steps: + - uses: actions/checkout@v4 + - name: Download dappnode_profile + uses: actions/download-artifact@v4 + with: + name: dappnode_profile + - name: Rename dappnode_profile.sh to .dappnode_profile + run: mv dappnode_profile.sh .dappnode_profile + - name: Build Debian attended + run: | + export BASE_OS=debian + export UNATTENDED=false + docker compose up --build + - name: Set Debian Dappnode attended ISO name + run: | + file=$(ls images/Dappnode-debian-*.iso) + filename=$(basename "$file") + core_filename="Dappnode-${{ needs.set-versions.outputs.core }}-debian-${filename#Dappnode-debian-}" + attended_filename="${core_filename/%.iso/-attended.iso}" + sudo cp "$file" "images/$attended_filename" + - name: Upload Debian attended ISO + uses: actions/upload-artifact@v4 + with: + name: debian-attended-iso + path: images/*-attended.iso + - name: Get SHA-256 Debian attended + run: | + file=$(find images/ -type f -name '*-attended.iso') + shasum -a 256 $file > SHASUM_DEBIAN_ATTENDED.txt + - name: Upload Debian attended SHA256 + uses: actions/upload-artifact@v4 + with: + name: debian-attended-sha + path: SHASUM_DEBIAN_ATTENDED.txt + + build-debian-unattended: + name: Build Debian unattended ISO + runs-on: ubuntu-latest + needs: set-versions + steps: + - uses: actions/checkout@v4 + - name: Download dappnode_profile + uses: actions/download-artifact@v4 + with: + name: dappnode_profile + - name: Rename dappnode_profile.sh to .dappnode_profile + run: mv dappnode_profile.sh .dappnode_profile + - name: Build Debian unattended + run: | + export BASE_OS=debian + export UNATTENDED=true + docker compose build + docker compose up + - name: Set Debian Dappnode unattended ISO name + run: | + file=$(ls images/Dappnode-debian-*.iso) + filename=$(basename "$file") + core_filename="Dappnode-${{ needs.set-versions.outputs.core }}-debian-${filename#Dappnode-debian-}" + unattended_filename="${core_filename/%.iso/-unattended.iso}" + sudo cp "$file" "images/$unattended_filename" + - name: Upload Debian unattended ISO + uses: actions/upload-artifact@v4 + with: + name: debian-unattended-iso + path: images/*-unattended.iso + - name: Get SHA-256 Debian unattended + run: | + file=$(find images/ -type f -name '*-unattended.iso') + shasum -a 256 $file > SHASUM_DEBIAN_UNATTENDED.txt + - name: Upload Debian unattended SHA256 + uses: actions/upload-artifact@v4 + with: + name: debian-unattended-sha + path: SHASUM_DEBIAN_UNATTENDED.txt + + build-ubuntu-unattended: + name: Build Ubuntu unattended ISO + runs-on: ubuntu-latest + needs: set-versions + steps: + - uses: actions/checkout@v4 + - name: Download dappnode_profile + uses: actions/download-artifact@v4 + with: + name: dappnode_profile + - name: Rename dappnode_profile.sh to .dappnode_profile + run: mv dappnode_profile.sh .dappnode_profile + - name: Build Ubuntu unattended + run: | + export BASE_OS=ubuntu + export UNATTENDED=true + docker compose up --build + - name: Set Ubuntu Dappnode unattended ISO name + run: | + file=$(ls images/Dappnode-ubuntu-*.iso) + filename=$(basename "$file") + core_filename="Dappnode-${{ needs.set-versions.outputs.core }}-ubuntu-${filename#Dappnode-ubuntu-}" + unattended_filename="${core_filename/%.iso/-unattended.iso}" + sudo cp "$file" "images/$unattended_filename" + - name: Get SHA-256 Ubuntu unattended + run: | + file=$(find images/ -type f -name '*-ubuntu-*-unattended.iso') + shasum -a 256 $file > SHASUM_UBUNTU_UNATTENDED.txt + - name: Upload Ubuntu unattended ISO and SHA256 to SSH + uses: appleboy/scp-action@v0.1.7 + with: + host: ${{ secrets.ISO_SSH_HOST }} + username: ${{ secrets.ISO_SSH_USER }} + key: ${{ secrets.ISO_SSH_PRIVATE_KEY }} + port: ${{ secrets.SSH_PORT }} + source: SHASUM_UBUNTU_UNATTENDED.txt,images/*-ubuntu-*-unattended.iso + target: ${{ secrets.ISO_SSH_PATH }} + overwrite: true + - name: Upload Ubuntu unattended SHA256 as artifact + uses: actions/upload-artifact@v4 + with: + name: ubuntu-unattended-sha + path: SHASUM_UBUNTU_UNATTENDED.txt + + release: + name: Combine, release, and upload + runs-on: ubuntu-latest + needs: + - set-versions + - build-debian-attended + - build-debian-unattended + - build-ubuntu-unattended + steps: + - uses: actions/checkout@v4 + - name: Download all artifacts + uses: actions/download-artifact@v4 + with: + path: ./artifacts + - name: Move ISOs and SHAs + run: | + mkdir -p images + mv artifacts/debian-attended-iso/* images/ + mv artifacts/debian-unattended-iso/* images/ + mv artifacts/debian-attended-sha/* . + mv artifacts/debian-unattended-sha/* . + mv artifacts/ubuntu-unattended-sha/* . + mv artifacts/dappnode_profile/* . + - name: Write release content + run: | + SHASUM_DEBIAN_ATTENDED=$(cat SHASUM_DEBIAN_ATTENDED.txt) + SHASUM_DEBIAN_UNATTENDED=$(cat SHASUM_DEBIAN_UNATTENDED.txt) + SHASUM_UBUNTU_UNATTENDED=$(cat SHASUM_UBUNTU_UNATTENDED.txt) + echo -en "# Versions\n| Package | Version |\n|---|---|\nbind.dnp.dappnode.eth|${{ needs.set-versions.outputs.bind }}|\n|ipfs.dnp.dappnode.eth|${{ needs.set-versions.outputs.ipfs }}|\n|vpn.dnp.dappnode.eth |${{ needs.set-versions.outputs.vpn }}|\n|dappmanager.dnp.dappnode.eth|${{ needs.set-versions.outputs.dappmanager }}|\n|wifi.dnp.dappnode.eth|${{ needs.set-versions.outputs.wifi }}|\n|https.dnp.dappnode.eth|${{ needs.set-versions.outputs.https }}|\n|wireguard.dnp.dappnode.eth|${{ needs.set-versions.outputs.wireguard }}|\n# Changes\nChanges implemented in release ${{ needs.set-versions.outputs.core }}\n# Debian Attended version\nInstall and customize DAppNode using the attended ISO: **DAppNode-${{ needs.set-versions.outputs.core }}-debian-bookworm-amd64.iso**\n\n## ISO SHA-256 Checksum\n```\nshasum -a 256 DAppNode-${{ needs.set-versions.outputs.core }}-debian-bookworm-amd64.iso\n$SHASUM_DEBIAN_ATTENDED\n```\n# Debian Unattended version\nInstall DAppNode easily using the unattended ISO: **DAppNode-${{ needs.set-versions.outputs.core }}-debian-bookworm-amd64-unattended.iso**\nDo a reboot right after the installation\n:warning: **Warning**: This ISO will install Dappnode automatically, deleting all existing partitions on the disk\n\n## ISO SHA-256 Checksum\n```\nshasum -a 256 DAppNode-${{ needs.set-versions.outputs.core }}-debian-bookworm-amd64-unattended.iso\n$SHASUM_DEBIAN_UNATTENDED\n```\n# Ubuntu Unattended version\nInstall DAppNode easily using the unattended ISO: **DAppNode-${{ needs.set-versions.outputs.core }}-ubuntu-bookworm-amd64-unattended.iso**\n\n## ISO SHA-256 Checksum\n```\nshasum -a 256 DAppNode-${{ needs.set-versions.outputs.core }}-ubuntu-bookworm-amd64-unattended.iso\n$SHASUM_UBUNTU_UNATTENDED\n```\nUploaded at https://ubuntu.iso.dappnode.io\n# DAppNode for Raspberry Pi 4 64bit\n[Instructions](https://github.com/dappnode/DAppNode/wiki/DAppNodeARM-Installation-Guide)\n\ndefault login data:\n - **__user__**: dappnode\n - **__password__**: dappnodepi" > CHANGELOG.md + cat CHANGELOG.md + - name: Print images directory + run: | + echo "Images directory content:" + ls -lrt images/ + - name: Create pre-release + uses: softprops/action-gh-release@v2 + with: + tag_name: ${{ needs.set-versions.outputs.core }} + prerelease: true + files: | + ./images/Dappnode-*-debian-*-attended.iso + ./images/Dappnode-*-debian-*-unattended.iso + ./scripts/dappnode_install*.sh + ./scripts/dappnode_uninstall*.sh + ./scripts/dappnode_access_credentials*.sh + dappnode_profile.sh + body_path: CHANGELOG.md + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..d7c85e1b --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,66 @@ +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@v4 + - name: Setup Test Environment + run: | + sudo /bin/bash ./test/environment_setup.sh + - name: Install Prerequisites + 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 Debian and Ubuntu ISO + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + # Create Debian ISO + - name: create Debian ISO + run: | + export BASE_OS=debian + export UNATTENDED=true + docker compose up --build + ls images/ + + # Verify Debian ISO creation + - name: verify Debian ISO + run: | + ls -lrt images/Dappnode-debian-*.iso + + # Create Ubuntu ISO + - name: create Ubuntu ISO + run: | + export BASE_OS=ubuntu + export UNATTENDED=true + docker compose up --build + ls images/ + + # Verify Ubuntu ISO creation + - name: verify Ubuntu ISO + run: | + ls -lrt images/Dappnode-ubuntu-*.iso diff --git a/.github/workflows/validate_autoinstall.yml b/.github/workflows/validate_autoinstall.yml new file mode 100644 index 00000000..45b71ac0 --- /dev/null +++ b/.github/workflows/validate_autoinstall.yml @@ -0,0 +1,42 @@ +name: Validate Ubuntu autoinstall YAML Files + +on: + push: + pull_request: + +jobs: + validate: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install check-jsonschema yamllint yq + + - name: Lint attended autoinstall.yaml + run: yamllint -c .yamllint iso/preseeds/ubuntu/autoinstall.yaml + + - name: Lint unattended autoinstall.yaml + run: yamllint -c .yamllint iso/preseeds/ubuntu/autoinstall_unattended.yaml + + - name: Download JSON schema + run: curl -o schema.json https://raw.githubusercontent.com/canonical/subiquity/main/autoinstall-schema.json + + - name: Extract autoinstall properties from YAML files + run: | + yq '.autoinstall' iso/preseeds/ubuntu/autoinstall.yaml > attended.yaml + yq '.autoinstall' iso/preseeds/ubuntu/autoinstall_unattended.yaml > unattended.yaml + + - name: Validate attended autoinstall.yaml + run: | + check-jsonschema --schemafile schema.json attended.yaml + + - name: Validate unattended autoinstall.yaml + run: | + check-jsonschema --schemafile schema.json unattended.yaml diff --git a/.gitignore b/.gitignore index 9e3a5f25..ed3c1e18 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -docs/_build \ No newline at end of file +docs/_build +images \ No newline at end of file diff --git a/.yamllint b/.yamllint new file mode 100644 index 00000000..c9b624e1 --- /dev/null +++ b/.yamllint @@ -0,0 +1,6 @@ +# .yamllint +extends: default + +rules: + line-length: + max: 150 \ No newline at end of file diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index 887d3a92..0316c4a7 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -8,19 +8,19 @@ In the interest of fostering an open and welcoming environment, we as contributo Examples of behavior that contributes to creating a positive environment include: -* Using welcoming and inclusive language -* Being respectful of differing viewpoints and experiences -* Gracefully accepting constructive criticism -* Focusing on what is best for the community -* Showing empathy towards other community members +- Using welcoming and inclusive language +- Being respectful of differing viewpoints and experiences +- Gracefully accepting constructive criticism +- Focusing on what is best for the community +- Showing empathy towards other community members Examples of unacceptable behavior by participants include: -* The use of sexualized language or imagery and unwelcome sexual attention or advances -* Trolling, insulting/derogatory comments, and personal or political attacks -* Public or private harassment -* Publishing others' private information, such as a physical or electronic address, without explicit permission -* Other conduct which could reasonably be considered inappropriate in a professional setting +- The use of sexualized language or imagery and unwelcome sexual attention or advances +- Trolling, insulting/derogatory comments, and personal or political attacks +- Public or private harassment +- Publishing others' private information, such as a physical or electronic address, without explicit permission +- Other conduct which could reasonably be considered inappropriate in a professional setting ## Our Responsibilities @@ -34,7 +34,7 @@ This Code of Conduct applies both within project spaces and in public spaces whe ## Enforcement -Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at [Riot channel](https://riot.im/app/#/room/#dappnode:matrix.org). The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. +Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at [Element channel](https://app.element.io/#/room/#DAppNode:matrix.org). The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 096997e7..f4fc6156 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,54 +1,57 @@ -# Contributing -When bringing people on as contributors we prefer that they start with an issue tagged [good first issue](https://github.com/dappnode/DNP_BIND/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22). After a contributor has shown they're a good fit and have completed 1 or 2 issues labeled [good first issue](https://github.com/dappnode/DNP_BIND/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22) with pull requests that have been accepted feel free of moving on to other issues. We're thrilled to see new contributors. - -If you want to better understand how does the development process works, please refer to our [wiki pages](https://github.com/dappnode/DAppNode/wiki) - -## Setup -In order to get the repositories setup before contributions refer to the [README.md](https://github.com/dappnode/DAppNode/blob/master/README.md) file. - -## Contribution Steps - -1. *Find a suitable issue* - - If this is your first time look for an issue labeled [good first issue](https://github.com/dappnode/DNP_BIND/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22) otherwise look for issues labeled [help wanted](https://github.com/dappnode/DNP_BIND/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22) . If another issue jumps out at you please engage on the issue before starting it. - -2. *Assign yourself the issue* - - Let us know you're working on it! We hate wasted labour so it's always helpful to know what our community contributors are working on. - -3. *Fork and clone [DAppNode](://github.com/dappnode/DAppNode)* - - In general it's a good practice to fork into your own repository. We prefer if issues - are addressed in a branch with the issue number in it's name. - i.e. `29_this_is_an_issue` - -4. *Make contributions* - - Make all the changes needed to address the given issue. - -5. *Add testing* - - In general we aim for full test coverage. For this reason most issues completed should include full testing. If you think there should be an exception for your issue please reach out. - -6. *Run previous tests* - - Make sure that the changes that you've made don't break anything! Ensure that running `npm test` and `npm eslint` doesn't throw any new and unexpected errors. - -7. *Push all your work* - - At this point the issue should be addressed, new testing should be in place, and all old tests should be passing. - -8. *Create a Pull Request* - - At this point you should either have a forked repository with your issue fixes and it is time to put in a PR. Make sure that your PR has something like `addresses #26` or `closes #26` The most important thing is that it has the relevant issue number referenced in the body of the PR. - -9. *Make noise!* - - Get in our [Riot](https://riot.im/app/#/room/#dappnode:matrix.org) and point to your new PR. Let us know you've tackled your first, third or 90th issue with us. We'll review it and everybody will get a warm feeling of accomplishment. - -10. *rinse, repeat* - - Find another issue, get more involved, make noise in our Riot, or find issues we may have missed. You've completed your first step to becoming a contributor. **You're helping to Decentralize the FUTURE**! - - -If you still have any further questions about contribution feel free to reach out to `@eduadiez:matrix.org`, `@yalormewn:matrix.org`, `@liondapp:matrix.org`, or just make noise in the `#DAppNode` channel on [Riot](https://riot.im/app/#/room/#DAppNode:matrix.org). +# Contributing + +When bringing people on as contributors we prefer that they start with an issue tagged [good first issue](https://github.com/dappnode/DNP_BIND/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22). + +After a contributor has shown they're a good fit and have completed 1 or 2 issues labeled [good first issue](https://github.com/dappnode/DNP_BIND/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22) with pull requests that have been accepted feel free of moving on to other issues. We're thrilled to see new contributors. + +If you want to better understand how does the development process works, please refer to our [wiki pages](https://github.com/dappnode/DAppNode/wiki) + +## Setup + +In order to get the repositories setup before contributions refer to the [README.md](https://github.com/dappnode/DAppNode/blob/master/README.md) file. + +## Contribution Steps + +1. _Find a suitable issue_ + + If this is your first time look for an issue labeled [good first issue](https://github.com/dappnode/DNP_BIND/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22) otherwise look for issues labeled [help wanted](https://github.com/dappnode/DNP_BIND/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22) . If another issue jumps out at you please engage on the issue before starting it. + +2. _Assign yourself the issue_ + + Let us know you're working on it! We hate wasted labour so it's always helpful to know what our community contributors are working on. + +3. _Fork and clone [DAppNode](://github.com/dappnode/DAppNode)_ + + In general it's a good practice to fork into your own repository. We prefer if issues + are addressed in a branch with the issue number in it's name. + i.e. `29_this_is_an_issue` + +4. _Make contributions_ + + Make all the changes needed to address the given issue. + +5. _Add testing_ + + In general we aim for full test coverage. For this reason most issues completed should include full testing. If you think there should be an exception for your issue please reach out. + +6. _Run previous tests_ + + Make sure that the changes that you've made don't break anything! Ensure that running `npm test` and `npm eslint` doesn't throw any new and unexpected errors. + +7. _Push all your work_ + + At this point the issue should be addressed, new testing should be in place, and all old tests should be passing. + +8. _Create a Pull Request_ + + At this point you should either have a forked repository with your issue fixes and it is time to put in a PR. Make sure that your PR has something like `addresses #26` or `closes #26` The most important thing is that it has the relevant issue number referenced in the body of the PR. + +9. _Make noise!_ + + Get in our [Element](https://app.element.io/#/room/#DAppNode:matrix.org) and point to your new PR. Let us know you've tackled your first, third or 90th issue with us. We'll review it and everybody will get a warm feeling of accomplishment. + +10. _rinse, repeat_ + + Find another issue, get more involved, make noise in our Riot, or find issues we may have missed. You've completed your first step to becoming a contributor. **You're helping to Decentralize the FUTURE**! + +If you still have any further questions about contribution feel free to reach out to `@eduadiez:matrix.org`, `@yalormewn:matrix.org`, `@liondapp:matrix.org`, or just make noise in the `#DAppNode` channel on [Element](https://app.element.io/#/room/#DAppNode:matrix.org). diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..a09836ef --- /dev/null +++ b/Dockerfile @@ -0,0 +1,10 @@ +FROM docker:dind + +# Install required packages +RUN apk update && \ + apk add --no-cache xorriso git xz curl ca-certificates iptables cpio bash perl-utils + +WORKDIR /usr/src/app +COPY . . + +CMD ["/usr/src/app/iso/scripts/generate_ISO.sh"] diff --git a/README.md b/README.md index 70e733a0..89817f1c 100644 --- a/README.md +++ b/README.md @@ -1,110 +1,233 @@ # DAppNode [![Website dappnode.io](https://img.shields.io/badge/Website-dappnode.io-brightgreen.svg)](https://dappnode.io/) -[![Documentation Wiki](https://img.shields.io/badge/Documentation-Wiki-brightgreen.svg)](https://github.com/dappnode/DAppNode/wiki) -[![GIVETH Campaign](https://img.shields.io/badge/GIVETH-Campaign-1e083c.svg)](https://alpha.giveth.io/campaigns/OcKJryNwjeidMXi9) -[![RIOT DAppNode](https://img.shields.io/badge/RIOT-DAppNode-blue.svg)](https://riot.im/app/#/room/#DAppNode:matrix.org) +[![Documentation Wiki](https://img.shields.io/badge/Documentation-Wiki-brightgreen.svg)](https://docs.dappnode.io) +[![GIVETH Campaign](https://img.shields.io/badge/GIVETH-Campaign-1e083c.svg)](https://beta.giveth.io/campaigns/5b44b198647f33526e67c262) ![GitHub All Releases](https://img.shields.io/github/downloads/dappnode/DAppNode/total.svg) +[![GitPOAP Badge](https://public-api.gitpoap.io/v1/repo/dappnode/DAppNode/badge)](https://www.gitpoap.io/gh/dappnode/DAppNode) [![Twitter Follow](https://img.shields.io/twitter/follow/espadrine.svg?style=social&label=Follow)](https://twitter.com/DAppNODE?lang=es) +[![Discord](https://img.shields.io/discord/747647430450741309?logo=discord&style=plastic)](https://discord.gg/dappnode) -[![](https://github.com/dappnode/DAppNode/raw/master/doc/DAppNodeLogoWide.png)](https://github.com/dappnode/DAppNode/wiki/DAppNode-Installation-Guide) + +

- - + +

-
+

+ + + +


-What happens when you want to use a Decentralized P2P network, but securing your own nodes takes a lot of time and effort? +## Infrastructure for the decentralized world + +DAppNode is empowering people by creating a simple, transparent system for hosting P2P clients for DApps, Cryptocurrencies, VPNs, IPFS and more + +- Read about our purpose and mission on [Our Website](https://dappnode.com/) +- Join our community and find support on [Our Discord](https://discord.gg/dappnode) +- Check out what we are up to on [Our Medium](https://medium.com/dappnode) +- Share your ideas and find how to guides on [Our Forum](https://discourse.dappnode.io/) + +## Discover DAppNode + +DAppNode lowers the barrier of entry for non tech-savvy participants. It allows you to deploy, update, and manage P2P clients and nodes without leaving your browser. No terminal or command line interface. + +

+ + + +

+ +## Develop with DAppNode + +DAppNode modular architecture allows any team to or project to publish a dockerized application to the DAppNode packages eco-system. Benefit from an enthusiastic crypto savvy user based and offer a user interface-only experience to lower onboarding friction. + +Check out the [DAppNodeSDK](https://github.com/dappnode/DAppNodeSDK) to learn how to get started. + +_Note: packages are published to Ethereum mainnet and incur costs. Given the current high gas prices the DAppNode team is willing to subsidize gas costs for packages of great interest to users._ + +## Packages eco-system + +The community and core team members have created many useful packages for users. Checkout the [**package explorer**](https://explorer.dappnode.io) to browse an up-to-date list of all packages and their versions. + +

+ + + +

+ +### Champions + +Champions are community members that are in charge of maintaining packages: keeping them updated and working. All packages in this list without a champion are actively looking for a champion. Join our [DAppNode Discord **#champion-process**](https://discord.gg/dappnode) to suggest a package to be championed and/or offer to be a champion for a project you care about! + +| Package | Champion | +| ---------------------------------------------------------------------------------------- | ---------------- | +| [Avalanche](https://github.com/Colm3na/DAppNodePackage-avalanche) | Wimel | +| [ARTIS-sigma1](https://github.com/lab10-coop/DAppNodePackage-ARTIS-sigma1) | - | +| [Bee](https://github.com/dappnode/DAppNodePackage-bee) | @tropicar | +| [Bitcoin](https://github.com/dappnode/DAppNodePackage-bitcoin) | @Pol-Lanski | +| [Block-explorer](https://github.com/dappnode/DappnodePackage-block-explorer) | - | +| [Cosmos](https://github.com/Colm3na/DAppNodePackage-cosmos) | Wimel | +| [DMS](https://github.com/dappnode/DAppNodePackage-DMS) | @eduadiez | +| [Eth2stats-client](https://github.com/dappnode/DAppNodePackage-eth2stats-client) | - | +| [Ethereum Classic](https://github.com/dappnode/DAppNodePackage-ethereum-classic) | - | +| [Ethereum Optimism](https://github.com/dappnode/DAppNodePackage-ethereum-optimism) | - | +| [Exporter](https://github.com/dappnode/DAppNodePackage-exporter) | @eduadiez | +| [Geth](https://github.com/dappnode/DAppNodePackage-geth) | @pablomendezroyo | +| [Goerli Geth](https://github.com/dappnode/DAppNodePackage-goerli-geth) | @pablomendezroyo | +| [HTTPs Portal](https://github.com/dappnode/DAppNodePackage-https-portal) | @3alpha | +| [Ipfs Cluster](https://github.com/dappnode/DAppNodePackage-ipfs-cluster) | @dapplion | +| [Ipfs Pinner](https://github.com/dappnode/DAppNodePackage-ipfs-pinner) | @dapplion | +| [Kovan](https://github.com/dappnode/DAppNodePackage-kovan) | @pablomendezroyo | +| [LightningNetwork](https://github.com/dappnode/DAppNodePackage-LightningNetwork) | @pablomendezroyo | +| [Matrix](https://github.com/dappnode/DAppNodePackage-matrix) | - | +| [Metrics Tools](https://github.com/dappnode/DAppNodePackage-metrics-tools) | @eduadiez | +| [Monero](https://github.com/dappnode/DAppNodePackage-monero) | @pablomendezroyo | +| [Nethermind](https://github.com/dappnode/DAppNodePackage-nethermind) | @pablomendezroyo | +| [Openethereum](https://github.com/dappnode/DAppNodePackage-openethereum) | @pablomendezroyo | +| [Owncloud](https://github.com/dappnode/DAppNodePackage-owncloud) | @tropicar | +| Polkadot Kusama | - | +| [Prysm](https://github.com/dappnode/DAppNodePackage-prysm) | @pablomendezroyo | +| [Prysm Pyrmont](https://github.com/dappnode/DAppNodePackage-prysm-pyrmont) | @pablomendezroyo | +| [Raiden](https://github.com/dappnode/DAppNodePackage-raiden) | @eduadiez | +| [Raiden Testnet](https://github.com/dappnode/DAppnodePackage-raiden-testnet) | @eduadiez | +| [Rinkeby](https://github.com/dappnode/DAppNodePackage-rinkeby) | @pablomendezroyo | +| [Ropsten](https://github.com/dappnode/DAppNodePackage-ropsten) | @pablomendezroyo | +| [Storj](https://github.com/dappnode/DAppNodePackage-storj) | @pablomendezroyo | +| [Tornado Cash Relayer](https://github.com/dappnode/DAppNodePackage-Tornado-Cash-Relayer) | - | +| [Trustlines](https://github.com/dappnode/DAppNodePackage-trustlines) | - | +| [Turbo-geth](https://github.com/dappnode/DAppNodePackage-turbo-geth) | @gnidan | +| [Vipnode](https://github.com/dappnode/DAppNodePackage-vipnode) | - | +| [Wireguard](https://github.com/dappnode/DAppNodePackage-wireguard) | @3alpha | +| [ZCash](https://github.com/dappnode/DAppNodePackage-zcash) | - | + +## Core packages + +- [DNP_DAPPMANAGER](https://github.com/dappnode/DNP_DAPPMANAGER) +- [DNP_VPN](https://github.com/dappnode/DNP_VPN) +- [DNP_IPFS](https://github.com/dappnode/DNP_IPFS) +- [DNP_BIND](https://github.com/dappnode/DNP_BIND) +- [DNP_WIREGUARD](https://github.com/dappnode/DNP_WIREGUARD) +- [DNP_HTTPS](https://github.com/dappnode/DNP_HTTPS) + +## Get DAppNode + +Get your DAppNode and start contributing to decentralization by running your own nodes. + +[Install DAppNode on your host machine](https://docs.dappnode.io/docs/user/install/overview) or buy your DAppNode with all the stuff configured and prepared to be used in [DAppNode shop](https://dappnode.com/en-us/collections/frontpage) + +### Install DAppNode with ISO + +DAppNode ISO available is in: [latest DAppNode release](https://github.com/dappnode/DAppNode/releases). + +Install DAppNode on your host machine by burning DAppNode ISO to a DVD or creating a bootable USB. Follow the tutorial of your operating system below and come back when you are finished: + +- [MacOS](https://tutorials.ubuntu.com/tutorial/tutorial-create-a-usb-stick-on-macos) +- [Windows](https://tutorials.ubuntu.com/tutorial/tutorial-create-a-usb-stick-on-windows) +- [Ubuntu](https://tutorials.ubuntu.com/tutorial/tutorial-create-a-usb-stick-on-ubuntu) + +**Developers**: DAppNode ISO could be generated following these steps: + +```bash +git clone https://github.com/dappnode/DAppNode.git +cd DAppNode +docker compose build +docker compose up +``` + +DAppNode iso will be generated inside images folder, to verify it: + +```bash +ls -lrt images/DAppNode-* +``` + +_Note_: ISO could be generated as unattended/attended by editing the env var available in the docker-compose.yml file + +### Install DAppNode with scripts + +Scripts are available in: [latest DAppNode release](https://github.com/dappnode/DAppNode/releases). -You have a decentralization bottleneck at the entry point, which is where we are now in the blockchain space :-( +DAppNode could be also installed on a host machine with an OS already running on it. DAppNode has been developed and configured to be run on Debian host machines. Therefore, it should work on Debian or Debian based (like Ubuntu) host machines. Minimum recommended Debian version is 11. -1. At no point in the last 2 years has there been more than 13,000 Bitcoin nodes online and that number got as low as [5500](https://bitnodes.earn.com/dashboard/?days=730) - -2. MetaMask and MyEtherWallet/MyCrypto are the primary wallets used on Ethereum and most users are using these wallets’ default nodes… This is a huge centralizing force in Ethereum. +**1. Prerequisites** -3. The people who do run their own node end up [having to spend a lot of time troubleshooting](https://www.reddit.com/r/ethereum/comments/83a34l/centralization_in_ethereum_infura_metamask/), keeping it updated and synced without the ability to easily share their node (and efforts) with family and friends. +Before installing DAppNode with the script option, make sure you fulfill the requirements by running the following script: +```bash +sudo wget -O - https://prerequisites.dappnode.io | sudo bash +``` -DAppNode will address these issues by creating a simple, easy, self-empowering system made specifically for hosting P2P clients for DApps, Cryptocurrencies, VPNs, IPFS, and more. +**2. Script installation** -Members of the [WHG](https://motherboard.vice.com/en_us/article/qvp5b3/how-ethereum-coders-hacked-back-to-rescue-dollar208-million-in-ethereum?lipi=urn%253Ali%253Apage%253Ad_flagship3_profile_view_base_treasury%253B7v09na8XQqySEuI%252FPn%252Bx5Q%253D%253D) have spent countless hours developing DAppNode because they believe it to be the most important and pertinent censorship resistant tool that is to be built to help bring the decentralized world everyone wants for themselves, and their friends and family. +Once you make sure you have the requirements, install DAPpNode with the installation script: -The Desired Final User Story: -====== +```bash +sudo wget -O - https://installer.dappnode.io | sudo bash +``` -1. Vojtech has several cryptocurrencies he follows and is ready to stop using his laptop to run clients, but doesn’t want to have to pay a monthly subscription in fiat to some company he doesn’t trust with his private keys. +**3. Uninstall DAppNode** -2. He hears about DAppNode and decides to buy the top of the line DAppNode Server preloaded from one of the many certified independent vendors (though he could buy his own server and install the software himself). +Uninstall DAppNode from your host machine by running the following command: -3. The DAppNode Server is delivered to his front door, and when Vojtech opens the box he finds a 2 step instruction card: First, plug in the Server. Second, go to dappnode.org/initialize +```bash +wget -qO - https://uninstaller.dappnode.io | sudo bash +``` -4. On this website there will be an extremely simple and short walk-thru for Vojtech to set up his credentials and choose which clients to deploy. +**4. Update DAppNode from scripts** -5. By just checking a few boxes Vojtech deployed his own VPN; his own local instance of MyCrypto.com; Ethereum, Bitcoin, Monero and Dogecoin Full nodes; a ZenCash Secure Node and DASH Master Node; he joined the IPFS Consortium and deployed a TrueBit Verifier and Livepeer node; and hosted Giveth, Swarm City, Aragon, Colony, and Decentraland Helper DApps to support these projects and to ensure that his interaction with these DApps cannot be censored and are fully trustless. +To update DAppNode to the latest version using script: -6. Vojtech then tells his friends and family that he is the admin for his own DAppNode and he is able to give them a link that sets them up with their own credentials and access to his DAppNode, and Vojtech can deploy any other DApps that him or his friends and family want to have hosted with a couple clicks. He has become the trusted gateway to the decentralized world for his entire community. +```bash +sudo wget -O - https://installer.dappnode.io | sudo UPDATE=true bash +``` -7. Vojtech ends up being able to pay off the cost of his DAppNode in 2 months with the profits made from his ZenCash, Swarm City, DASH and TrueBit Nodes. He also canceled his VPN and all of his Digital Ocean accounts because now he has his own server that he can host all of his services on. Without even trying, Vojtech has a couple extra hundred dollars a month because he is running DAppNode on his own personal server. +## Releases +Create releases manually with Github actions, the Github action to run is: **Pre-release**. The requirements are: -We have been working on this project mostly part time since October of last year and have a fully functional Proof of Concept, and are very close to having an MVP version that we would be proud to show off. We expect to partner with hardware manufacturers once we have a few more iterations of the software completed. +- Introduce the core packages versions +- There must exist the corresponding core package release for the specified version -We are developing in an invitingly open source manner and once the software is completed anyone can use their own hardware and run DAppNode on it. +The release will contain: -We are open to receive funding to help pay the developers working hard on the software. All funds raised are transparently accounted for using Giveth's DApp. +- Assets: + - Scripts: `dappnode_access_credentials.sh`, `dappnode_install.sh`, `dappnode_uninstall.sh`, `dappnode_install_pre.sh`, `dappnode_profile.sh` + - ISOs: `DAppNode-vX-debian-bullseye-amd64-unattended.iso`, `DAppNode-vX-debian-bullseye-amd64-unattended.iso` +- Release body: + - Table with core packages versions + - Changes section + - SHASUMs for unattended and attended ISOs + - Default credentials +## Testing with artifacts -Team members -====== +Generate ISOs and test them by running the Github action: **Artifacts**. This action will generate an artifacts with the same assets as the release, useful for testing purposes. -* **Adviser & Instigator:** Jordi Baylina -* **Project Lead:** Eduadiez -* **Front-End Lead:** DAppLion -* **Communication Lead:** Yalor -* **Adviser:** Griff Green +## Versioning -Where the DAppers play -====== -[DAppNode](https://dappnode.io/) +We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/dappnode/DAppNode/tags). -[Riot](https://riot.im/app/#/room/#dappnode:matrix.org) +## Team members -[Github](https://github.com/dappnode/DAppNode/wiki/DAppNode-Installation-Guide) +Members of the [White Hat Group (WHG)](https://motherboard.vice.com/en_us/article/qvp5b3/how-ethereum-coders-hacked-back-to-rescue-dollar208-million-in-ethereum) have spent countless hours bootstrapping and developing DAppNode in 2017. Currently, the project is maintained by a growing multi-disciplinary team: -**Benefits of DAppNode** -====== +- **Adviser & Instigator:** Jordi Baylina +- **Project Lead:** Eduadiez +- **Developer Lead:** dapplion +- **Ecosystem Development** Pol Lanski +- **Developer:** Pablo +- **Developer:** Carlos +- **Adviser:** Griff Green -* Easy set up -* Trustless system -* Invitingly Open Source -* Free up space on your Devices -* Great for proof of stake mining -* You can browse `.eth` domains like the normal web -* You take control of your Nodes -* Encourages people to have their own server -* Perfect for projects that reward you for hosting, (Filecoin, Mysterium, etc) -* Can facilitate a P2P economy -* Host any P2P networking protocols -* DApp teams can develop packages their users can run 24x7 -* Never trust a hosting provider with your private keys again! -* One click node deployment (Full Nodes, DApps) -* Censorship resistance (run your own VPN) -* 1 DAppNode can support an entire Community -* DAppNode will build communities and decrease centralization -* DAppNode is the most important piece of infrastructure for our decencentralized future -* Considering all of the incentive structures to to run nodes, most DAppNode Admins will be make a profit maintaining their own DAppNode +## License -# Core repos +This project is licensed under the GNU General Public License v3.0 - see the [LICENSE](LICENSE) file for details -* [DNP_VPN](https://github.com/dappnode/DNP_VPN) -* [DNP_ADMIN](https://github.com/dappnode/DNP_ADMIN) -* [DNP_IPFS](https://github.com/dappnode/DNP_IPFS) -* [DNP_ETHCHAIN](https://github.com/dappnode/DNP_ETHCHAIN) -* [DNP_DAPPMANAGER](https://github.com/dappnode/DNP_DAPPMANAGER) -* [DNP_ETHFORWARD](https://github.com/dappnode/DNP_ETHFORWARD) -* [DNP_BIND](https://github.com/dappnode/DNP_BIND) +## Copyright +Copyright © (2018-2023) [The DAppNode Association](https://dappnode.com) diff --git a/doc/DAppNodeAdminUI-demo.png b/doc/DAppNodeAdminUI-demo.png new file mode 100644 index 00000000..512387c8 Binary files /dev/null and b/doc/DAppNodeAdminUI-demo.png differ diff --git a/doc/DAppNodeExplorer.png b/doc/DAppNodeExplorer.png new file mode 100644 index 00000000..8d5a190e Binary files /dev/null and b/doc/DAppNodeExplorer.png differ diff --git a/doc/DAppNodeLogoWide-outlined.png b/doc/DAppNodeLogoWide-outlined.png new file mode 100644 index 00000000..8645bde6 Binary files /dev/null and b/doc/DAppNodeLogoWide-outlined.png differ diff --git a/doc/DAppNodeLogoWide-white-samethickness.png b/doc/DAppNodeLogoWide-white-samethickness.png new file mode 100644 index 00000000..2ab23874 Binary files /dev/null and b/doc/DAppNodeLogoWide-white-samethickness.png differ diff --git a/doc/DAppNodePackage-bitcoin/install.gif b/doc/DAppNodePackage-bitcoin/install.gif new file mode 100644 index 00000000..734b1c70 Binary files /dev/null and b/doc/DAppNodePackage-bitcoin/install.gif differ diff --git a/doc/DE686960-C68E-43A5-96E9-A6B4B8B0C244.png b/doc/DE686960-C68E-43A5-96E9-A6B4B8B0C244.png new file mode 100644 index 00000000..a78b71fa Binary files /dev/null and b/doc/DE686960-C68E-43A5-96E9-A6B4B8B0C244.png differ diff --git a/doc/DappnodeInstallButton_new-color.png b/doc/DappnodeInstallButton_new-color.png new file mode 100644 index 00000000..51ccefd3 Binary files /dev/null and b/doc/DappnodeInstallButton_new-color.png differ diff --git a/doc/backupscreen.jpg b/doc/backupscreen.jpg new file mode 100644 index 00000000..a16f5727 Binary files /dev/null and b/doc/backupscreen.jpg differ diff --git a/doc/do-not-install-dappnode-on-your-laptop.png b/doc/do-not-install-dappnode-on-your-laptop.png new file mode 100644 index 00000000..6364ec95 Binary files /dev/null and b/doc/do-not-install-dappnode-on-your-laptop.png differ diff --git a/doc/index.html b/doc/index.html deleted file mode 100644 index a37ce230..00000000 --- a/doc/index.html +++ /dev/null @@ -1,334 +0,0 @@ - - - - - - - Public UI - - - - - -
-
-
-

DAppNode

-
- -
-
- - -
-

Setup your DAppNode VPN

-
- -
-
-
-
-
-
-
- -
-
-
- - -
- - - - diff --git a/doc/openvpn/android1.jpg b/doc/openvpn/android1.jpg new file mode 100644 index 00000000..9cc6972f Binary files /dev/null and b/doc/openvpn/android1.jpg differ diff --git a/doc/openvpn/android2.jpg b/doc/openvpn/android2.jpg new file mode 100644 index 00000000..7dfb2ab0 Binary files /dev/null and b/doc/openvpn/android2.jpg differ diff --git a/doc/openvpn/android3.jpg b/doc/openvpn/android3.jpg new file mode 100644 index 00000000..eb5d6923 Binary files /dev/null and b/doc/openvpn/android3.jpg differ diff --git a/doc/openvpn/android4.jpg b/doc/openvpn/android4.jpg new file mode 100644 index 00000000..b1379a1c Binary files /dev/null and b/doc/openvpn/android4.jpg differ diff --git a/doc/openvpn/android5.jpg b/doc/openvpn/android5.jpg new file mode 100644 index 00000000..2dc617fe Binary files /dev/null and b/doc/openvpn/android5.jpg differ diff --git a/doc/openvpn/android6.jpg b/doc/openvpn/android6.jpg new file mode 100644 index 00000000..3e2b5cdf Binary files /dev/null and b/doc/openvpn/android6.jpg differ diff --git a/doc/openvpn/android7.jpg b/doc/openvpn/android7.jpg new file mode 100644 index 00000000..af675583 Binary files /dev/null and b/doc/openvpn/android7.jpg differ diff --git a/doc/openvpn/ios1.png b/doc/openvpn/ios1.png new file mode 100644 index 00000000..f228fbc1 Binary files /dev/null and b/doc/openvpn/ios1.png differ diff --git a/doc/openvpn/ios10.png b/doc/openvpn/ios10.png new file mode 100644 index 00000000..613a964c Binary files /dev/null and b/doc/openvpn/ios10.png differ diff --git a/doc/openvpn/ios4.png b/doc/openvpn/ios4.png new file mode 100644 index 00000000..b43d5de0 Binary files /dev/null and b/doc/openvpn/ios4.png differ diff --git a/doc/openvpn/ios5.png b/doc/openvpn/ios5.png new file mode 100644 index 00000000..79df0048 Binary files /dev/null and b/doc/openvpn/ios5.png differ diff --git a/doc/openvpn/ios6.png b/doc/openvpn/ios6.png new file mode 100644 index 00000000..20bddd4d Binary files /dev/null and b/doc/openvpn/ios6.png differ diff --git a/doc/openvpn/ios7.png b/doc/openvpn/ios7.png new file mode 100644 index 00000000..f0888755 Binary files /dev/null and b/doc/openvpn/ios7.png differ diff --git a/doc/openvpn/ios8.png b/doc/openvpn/ios8.png new file mode 100644 index 00000000..98d285a6 Binary files /dev/null and b/doc/openvpn/ios8.png differ diff --git a/doc/openvpn/ios9.png b/doc/openvpn/ios9.png new file mode 100644 index 00000000..f638b4ab Binary files /dev/null and b/doc/openvpn/ios9.png differ diff --git a/doc/openvpn/mac1.png b/doc/openvpn/mac1.png new file mode 100644 index 00000000..8cc4af2e Binary files /dev/null and b/doc/openvpn/mac1.png differ diff --git a/doc/openvpn/mac2.png b/doc/openvpn/mac2.png new file mode 100644 index 00000000..4d71cc40 Binary files /dev/null and b/doc/openvpn/mac2.png differ diff --git a/doc/openvpn/mac3.png b/doc/openvpn/mac3.png new file mode 100644 index 00000000..e5508cb4 Binary files /dev/null and b/doc/openvpn/mac3.png differ diff --git a/doc/openvpn/mac4.png b/doc/openvpn/mac4.png new file mode 100644 index 00000000..e96bbb37 Binary files /dev/null and b/doc/openvpn/mac4.png differ diff --git a/doc/openvpn/mac5.png b/doc/openvpn/mac5.png new file mode 100644 index 00000000..5657db2e Binary files /dev/null and b/doc/openvpn/mac5.png differ diff --git a/doc/openvpn/mac6.png b/doc/openvpn/mac6.png new file mode 100644 index 00000000..376d1d02 Binary files /dev/null and b/doc/openvpn/mac6.png differ diff --git a/doc/openvpn/mac7.png b/doc/openvpn/mac7.png new file mode 100644 index 00000000..31c1e00a Binary files /dev/null and b/doc/openvpn/mac7.png differ diff --git a/doc/openvpn/mac8.png b/doc/openvpn/mac8.png new file mode 100644 index 00000000..a48ef59f Binary files /dev/null and b/doc/openvpn/mac8.png differ diff --git a/doc/openvpn/ubuntu1.png b/doc/openvpn/ubuntu1.png new file mode 100644 index 00000000..cf868052 Binary files /dev/null and b/doc/openvpn/ubuntu1.png differ diff --git a/doc/openvpn/ubuntu2.png b/doc/openvpn/ubuntu2.png new file mode 100644 index 00000000..95ed63a6 Binary files /dev/null and b/doc/openvpn/ubuntu2.png differ diff --git a/doc/openvpn/ubuntu3.png b/doc/openvpn/ubuntu3.png new file mode 100644 index 00000000..76897e64 Binary files /dev/null and b/doc/openvpn/ubuntu3.png differ diff --git a/doc/openvpn/ubuntu4.png b/doc/openvpn/ubuntu4.png new file mode 100644 index 00000000..79d7d290 Binary files /dev/null and b/doc/openvpn/ubuntu4.png differ diff --git a/doc/openvpn/ubuntu5.png b/doc/openvpn/ubuntu5.png new file mode 100644 index 00000000..ce11c46e Binary files /dev/null and b/doc/openvpn/ubuntu5.png differ diff --git a/doc/openvpn/ubuntu6.png b/doc/openvpn/ubuntu6.png new file mode 100644 index 00000000..141ecbca Binary files /dev/null and b/doc/openvpn/ubuntu6.png differ diff --git a/doc/openvpn/windows1.png b/doc/openvpn/windows1.png new file mode 100644 index 00000000..c7108848 Binary files /dev/null and b/doc/openvpn/windows1.png differ diff --git a/doc/openvpn/windows2.png b/doc/openvpn/windows2.png new file mode 100644 index 00000000..48fea773 Binary files /dev/null and b/doc/openvpn/windows2.png differ diff --git a/doc/openvpn/windows3.png b/doc/openvpn/windows3.png new file mode 100644 index 00000000..1eca217b Binary files /dev/null and b/doc/openvpn/windows3.png differ diff --git a/doc/openvpn/windows4.png b/doc/openvpn/windows4.png new file mode 100644 index 00000000..395988a8 Binary files /dev/null and b/doc/openvpn/windows4.png differ diff --git a/doc/openvpn/windows5.png b/doc/openvpn/windows5.png new file mode 100644 index 00000000..06ecdb85 Binary files /dev/null and b/doc/openvpn/windows5.png differ diff --git a/doc/openvpn/windows6.png b/doc/openvpn/windows6.png new file mode 100644 index 00000000..737193df Binary files /dev/null and b/doc/openvpn/windows6.png differ diff --git a/doc/openvpn/windows7.png b/doc/openvpn/windows7.png new file mode 100644 index 00000000..0be015d9 Binary files /dev/null and b/doc/openvpn/windows7.png differ diff --git a/doc/openvpn/windows8.png b/doc/openvpn/windows8.png new file mode 100644 index 00000000..3cd8e736 Binary files /dev/null and b/doc/openvpn/windows8.png differ diff --git a/doc/openvpn/windows9.png b/doc/openvpn/windows9.png new file mode 100644 index 00000000..b114e4de Binary files /dev/null and b/doc/openvpn/windows9.png differ diff --git a/doc/restorescreen.jpg b/doc/restorescreen.jpg new file mode 100644 index 00000000..a13a2d05 Binary files /dev/null and b/doc/restorescreen.jpg differ diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..b358db40 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,14 @@ +version: "3.4" + +services: + dappnode_installer: + build: . + privileged: true + environment: + - BUILD=false # In case you want to re-generate a all the images, not recommended + - CLEAN=true # it remove the images directory + - UNATTENDED=${UNATTENDED} # UNATTENDED version + - BASE_OS=${BASE_OS} # Base OS version (debian or ubuntu) + volumes: + - ./images:/images + - "/var/run/docker.sock:/var/run/docker.sock" diff --git a/docs/Makefile b/docs/Makefile deleted file mode 100644 index 0303db5c..00000000 --- a/docs/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -# Minimal makefile for Sphinx documentation -# - -# You can set these variables from the command line. -SPHINXOPTS = -SPHINXBUILD = sphinx-build -SPHINXPROJ = DAppNode -SOURCEDIR = . -BUILDDIR = _build - -# Put it first so that "make" without argument is like "make help". -help: - @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) - -.PHONY: help Makefile - -# Catch-all target: route all unknown targets to Sphinx using the new -# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). -%: Makefile - @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) \ No newline at end of file diff --git a/docs/conf.py b/docs/conf.py deleted file mode 100644 index c89619eb..00000000 --- a/docs/conf.py +++ /dev/null @@ -1,154 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Configuration file for the Sphinx documentation builder. -# -# This file does only contain a selection of the most common options. For a -# full list see the documentation: -# http://www.sphinx-doc.org/en/master/config - -# -- Path setup -------------------------------------------------------------- - -# If extensions (or modules to document with autodoc) are in another directory, -# add these directories to sys.path here. If the directory is relative to the -# documentation root, use os.path.abspath to make it absolute, like shown here. -# -# import os -# import sys -# sys.path.insert(0, os.path.abspath('.')) - - -# -- Project information ----------------------------------------------------- - -project = u'DAppNode' -copyright = u'2018, DAppNode' -author = u'DAppNode' - -# The short X.Y version -version = u'' -# The full version, including alpha/beta/rc tags -release = u'' - - -# -- General configuration --------------------------------------------------- - -# If your documentation needs a minimal Sphinx version, state it here. -# -# needs_sphinx = '1.0' - -# Add any Sphinx extension module names here, as strings. They can be -# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom -# ones. -extensions = [ -] - -# Add any paths that contain templates here, relative to this directory. -templates_path = ['_templates'] - -# The suffix(es) of source filenames. -# You can specify multiple suffix as a list of string: -# -# source_suffix = ['.rst', '.md'] -source_suffix = '.rst' - -# The master toctree document. -master_doc = 'index' - -# The language for content autogenerated by Sphinx. Refer to documentation -# for a list of supported languages. -# -# This is also used if you do content translation via gettext catalogs. -# Usually you set "language" from the command line for these cases. -language = None - -# List of patterns, relative to source directory, that match files and -# directories to ignore when looking for source files. -# This pattern also affects html_static_path and html_extra_path . -exclude_patterns = [u'_build', 'Thumbs.db', '.DS_Store'] - -# The name of the Pygments (syntax highlighting) style to use. -pygments_style = 'sphinx' - - -# -- Options for HTML output ------------------------------------------------- - -# The theme to use for HTML and HTML Help pages. See the documentation for -# a list of builtin themes. -html_theme = 'sphinx_rtd_theme' - -# Theme options are theme-specific and customize the look and feel of a theme -# further. For a list of options available for each theme, see the -# documentation. -# -# html_theme_options = {} - -# Add any paths that contain custom static files (such as style sheets) here, -# relative to this directory. They are copied after the builtin static files, -# so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ['_static'] - -# Custom sidebar templates, must be a dictionary that maps document names -# to template names. -# -# The default sidebars (for documents that don't match any pattern) are -# defined by theme itself. Builtin themes are using these templates by -# default: ``['localtoc.html', 'relations.html', 'sourcelink.html', -# 'searchbox.html']``. -# -# html_sidebars = {} - - -# -- Options for HTMLHelp output --------------------------------------------- - -# Output file base name for HTML help builder. -htmlhelp_basename = 'DAppNodedoc' - - -# -- Options for LaTeX output ------------------------------------------------ - -latex_elements = { - # The paper size ('letterpaper' or 'a4paper'). - # - # 'papersize': 'letterpaper', - - # The font size ('10pt', '11pt' or '12pt'). - # - # 'pointsize': '10pt', - - # Additional stuff for the LaTeX preamble. - # - # 'preamble': '', - - # Latex figure (float) alignment - # - # 'figure_align': 'htbp', -} - -# Grouping the document tree into LaTeX files. List of tuples -# (source start file, target name, title, -# author, documentclass [howto, manual, or own class]). -latex_documents = [ - (master_doc, 'DAppNode.tex', u'DAppNode Documentation', - u'jbaylina GriffGreen eduadiez dapplion YalorMewn', 'manual'), -] - - -# -- Options for manual page output ------------------------------------------ - -# One entry per manual page. List of tuples -# (source start file, name, description, authors, manual section). -man_pages = [ - (master_doc, 'dappnode', u'DAppNode Documentation', - [author], 1) -] - - -# -- Options for Texinfo output ---------------------------------------------- - -# Grouping the document tree into Texinfo files. List of tuples -# (source start file, target name, title, author, -# dir menu entry, description, category) -texinfo_documents = [ - (master_doc, 'DAppNode', u'DAppNode Documentation', - author, 'DAppNode', 'One line description of project.', - 'Miscellaneous'), -] \ No newline at end of file diff --git a/docs/contributing.rst b/docs/contributing.rst deleted file mode 100644 index 930b5bb5..00000000 --- a/docs/contributing.rst +++ /dev/null @@ -1,110 +0,0 @@ -############ -Contributing -############ - -Help is always appreciated! - -In particular, we need help in the following areas: - -* Improving the documentation -* Fixing and responding to `DAppNode's GitHub issues - `_, especially those tagged as - `up-for-grabs `_ which are - meant as introductory issues for external contributors. - - -How to Contribute -================= - -When bringing people on as contributors we prefer that they start with an issue tagged [good first issue](https://github.com/dappnode/DNP_BIND/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22). After a contributor has shown they're a good fit and have completed 1 or 2 issues labeled [good first issue](https://github.com/dappnode/DNP_BIND/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22) with pull requests that have been accepted feel free of moving on to other issues. We're thrilled to see new contributors. - -If you want to better understand how does the development process works, please refer to our [wiki pages](https://github.com/dappnode/DAppNode/wiki) - -In order to get the repositories setup before contributions refer to the [README.md](https://github.com/dappnode/DAppNode/blob/master/README.md) file. - -1. *Find a suitable issue* - - If this is your first time look for an issue labeled [good first issue](https://github.com/dappnode/DNP_BIND/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22) otherwise look for issues labeled [help wanted](https://github.com/dappnode/DNP_BIND/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22) . If another issue jumps out at you please engage on the issue before starting it. - -2. *Assign yourself the issue* - - Let us know you're working on it! We hate wasted labour so it's always helpful to know what our community contributors are working on. - -3. *Fork and clone [DAppNode](://github.com/dappnode/DAppNode)* - - In general it's a good practice to fork into your own repository. We prefer if issues - are addressed in a branch with the issue number in it's name. - i.e. `29_this_is_an_issue` - -4. *Make contributions* - - Make all the changes needed to address the given issue. - -5. *Add testing* - - In general we aim for full test coverage. For this reason most issues completed should include full testing. If you think there should be an exception for your issue please reach out. - -6. *Run previous tests* - - Make sure that the changes that you've made don't break anything! Ensure that running `npm test` and `npm eslint` doesn't throw any new and unexpected errors. - -7. *Push all your work* - - At this point the issue should be addressed, new testing should be in place, and all old tests should be passing. - -8. *Create a Pull Request* - - At this point you should either have a forked repository with your issue fixes and it is time to put in a PR. Make sure that your PR has something like `addresses #26` or `closes #26` The most important thing is that it has the relevant issue number referenced in the body of the PR. - -9. *Make noise!* - - Get in our [Riot](https://riot.im/app/#/room/#dappnode:matrix.org) and point to your new PR. Let us know you've tackled your first, third or 90th issue with us. We'll review it and everybody will get a warm feeling of accomplishment. - -10. *rinse, repeat* - - Find another issue, get more involved, make noise in our Riot, or find issues we may have missed. You've completed your first step to becoming a contributor. **You're helping to Decentralize the FUTURE**! - - -If you still have any further questions about contribution feel free to reach out to `@eduadiez:matrix.org`, `@yalormewn:matrix.org`, `@liondapp:matrix.org`, or just make noise in the `#DAppNode` channel on [Riot](https://riot.im/app/#/room/#DAppNode:matrix.org). - - -How to Report Issues -==================== - -To report an issue, please use the -`GitHub issues tracker `_. When -reporting issues, please mention the following details: - -* Which version of Solidity you are using -* What was the source code (if applicable) -* Which platform are you running on -* How to reproduce the issue -* What was the result of the issue -* What the expected behaviour is - -Reducing the source code that caused the issue to a bare minimum is always -very helpful and sometimes even clarifies a misunderstanding. - - -Workflow for Pull Requests -========================== - -In order to contribute, please fork off of the ``develop`` branch and make your -changes there. Your commit messages should detail *why* you made your change -in addition to *what* you did (unless it is a tiny change). - -If you need to pull in any changes from ``develop`` after making your fork (for -example, to resolve potential merge conflicts), please avoid using ``git merge`` -and instead, ``git rebase`` your branch. - -Additionally, if you are writing a new feature, please ensure you write appropriate -Boost test cases and place them under ``test/``. - -New features and bugfixes should be added to the ``Changelog.md`` file: please -follow the style of previous entries, when applicable. - -Please note that this project is released with a `Contributor Code of Conduct -`_. -By participating in this project you agree to abide by its terms. - -Thank you for your help! \ No newline at end of file diff --git a/docs/dappnode-by-example.rst b/docs/dappnode-by-example.rst deleted file mode 100644 index 4c3ffd85..00000000 --- a/docs/dappnode-by-example.rst +++ /dev/null @@ -1,38 +0,0 @@ -.. index:: ! examples - -.. _dappnode-by-example: - -################### -DAppNode by Example -################### - -Examples to describe its functionality and purpose - - -******************************** -Accessing decentralized websites -******************************** - - -What is a decentralized website? -################################ - -A decentralized website is not controlled by a central entity, rather by its users. It is unstoppable and uncensorable, therefore it doesn't rely on any centralized service. - -To navigate to decentralized websites using human readable names (i.e. decentral.eth) you need: -- IPFS to store the website contents -- ENS (or similar) to point users to the hash of the website contents - -================= =============================== =================================== -Step Centralized Decentralized -================= =============================== =================================== -Resolve domain Use a DNS (i.e. google's) Use ENS, an ethereum smart contract -Get the website GET request to the server's IP Get the hash's content from IPFS -================= =============================== =================================== - -.. image:: images/dappnode-dweb.png - - -***************************************** -Using DApps without centralized providers -***************************************** \ No newline at end of file diff --git a/docs/dappnode-core.rst b/docs/dappnode-core.rst deleted file mode 100644 index ca90275f..00000000 --- a/docs/dappnode-core.rst +++ /dev/null @@ -1,184 +0,0 @@ -.. index:: ! core - -.. _dappnode-core: - -############# -DAppNode Core -############# - -**** -BIND -**** - -Local DAppNode DNS. Links each package docker IP to a name in the format of my.[package-name].dnp.dappnode.eth. I also redirects .eth domains to the ethforward. All rules can be consulted at `eth.hosts `_. - -It runs the native linux bind package with with a configuration specified at `named.conf `_. It attempts resolution and otherwise forwards to the Google Public DNS 8.8.8.8 / 8.8.4.4. - -*** -VPN -*** - -Provides a basic VPN for users to consume dappnode's services. - -It runs a `xl2tpd `_ process alongside a nodejs app, both controlled by a supervisord process. The nodejs app connects with the WAMP to manage VPN users directly editing the `/etc/ppp/chap-secrets `_ file, which holds the users credentials. - -The user IP is static and set when that user is created. The static IP is used by the WAMP for authentication to allow only admin users to perform certain actions. Currently there are three types of users: - -- 172.33.10.1: Super admin. It is created when DAppNode is installed and can never be deleted -- 172.33.10.x: Admin user. -- 172.33.100.x: Non-admin user. - -VPN procedures -************** - - -.. code-block:: javascript - - domain: .vpn.dnp.dappnode.eth - - -================= ====== ================================= -event kwargs result -================= ====== ================================= -addDevice id {} -removeDevice id {} -toggleAdmin id {} -listDevices ~ [{ deviceObject }] | -getParams ~ {param: paramValue, ...} -statusUPnP ~ {openPorts, UPnP, msg} | -statusExternalIp ~ {externalIpResolves, INT_IP, ...} -================= ====== ================================= - - -.. code-block:: javascript - - deviceObject = { - name: 'string', - password: 'string', - ip: 'string' - } - - -******** -ETHCHAIN -******** - -Local full mainnet ethereum node. Right now it uses parity, but we are testing Geth against Parity to take a decision based on each client's efficiency, memory usage, time to use among other parameters. - -********** -ETHFORWARD -********** - -Resolves .eth domains by intercepting outgoing requests, calling ENS, and redirecting to the local IPFS node. - -It is a nodejs http proxy server, which also returns custom 404 pages if the content is not found or available or if the chain is still not synced. - -**** -IPFS -**** - -Local IFPS node. Its gateaway is available at: - -.. code-block:: javascript - - host: my.ipfs.dnp.dappnode.eth - port: 5001 - protocol: http - - -**** -WAMP -**** - -Handles inter-package communications. Restricts certain operations to only admin users. - -We are using `crossbar.io `_ and its javascript client `autobahn.js `_. Please refer to their documentation for more details. - -WAMP response specifications - -.. code-block:: javascript - - { - success: - message: - result: - } - - // Success example - - { - success: true - message: 'Listing 2 devices' - result: [{...}, {...}] - } - - // Error example - - { - success: false - message: 'Error: could not list devices' - } - - -*********** -DAPPMANAGER -*********** - -Installs and manages DAppNode packages (DNPs). It's a Nodejs app whos procedures are only consumed by the ADMIN, and depends on IPFS and ETHCHAIN to function. - - -DAPPMANAGER procedures -********************** - - -.. code-block:: javascript - - domain: .dappmanager.dnp.dappnode.eth - - -===================== ========================== ========================== -event kwargs result -===================== ========================== ========================== -installPacakge id {} -removePackage id, deleteVolumes {} -togglePackage id, timeout {} -restartPackage id {} -restartPackageVolumes id {} -updatePackageEnv id, envs, restart, isCore {} -logPackage id, options {id, logs} -fetchPackageVersions id [{ versionObject }] -fetchPackageData id {manifest, avatar} -listPackages ~ [{ pkgDataObject }] -fetchDirectory ~ [{name, status}] -===================== ========================== ========================== - - -.. code-block:: javascript - - pkgDataObject = { - id: '927623894...', (string) - isDNP: true, (boolean) - created: date (string), - image: imageName, (string) - name: otpweb.dnp.dappnode.eth, (string) - shortName: otpweb, (string) - version: '0.0.4', (string) - ports: listOfPorts, (string) - state: 'exited', (string) - running: true, (boolean) - ... - envs: envVariables (object) - } - - versionObject = { - version: '0.0.4', (string) - manifest: manifest (object) - } - - -***** -ADMIN -***** - -Handles admin users <-> DAppNode interactions, such as managing packages or VPN users. It is a NGINX process that serves a single-page React app that consumes RPCs of the DAPPMANAGER and the VPN. - diff --git a/docs/frequently-asked-questions.rst b/docs/frequently-asked-questions.rst deleted file mode 100644 index 77b98815..00000000 --- a/docs/frequently-asked-questions.rst +++ /dev/null @@ -1,28 +0,0 @@ -########################### -Frequently Asked Questions -########################### - - -*************** -Basic Questions -*************** - -Sample question? -================ - -Sample answer. - -****************** -Advanced Questions -****************** - -Sample question? -================ - -Sample answer. - -More Questions? -=============== - -If you have more questions or your question is not answered here, please talk to us on -`riot `_ or file an `issue `_. \ No newline at end of file diff --git a/docs/images/dappnode-dweb.png b/docs/images/dappnode-dweb.png deleted file mode 100644 index 5064c8a2..00000000 Binary files a/docs/images/dappnode-dweb.png and /dev/null differ diff --git a/docs/index.rst b/docs/index.rst deleted file mode 100644 index b1e8cfbe..00000000 --- a/docs/index.rst +++ /dev/null @@ -1,39 +0,0 @@ -.. DAppNode documentation master file, created by - sphinx-quickstart on Mon Aug 20 14:54:26 2018. - You can adapt this file completely to your liking, but it should at least - contain the root `toctree` directive. - -Welcome to DAppNode's documentation! -==================================== - -.. toctree:: - :maxdepth: 2 - :caption: Contents: - - -.. image:: https://github.com/dappnode/DAppNode/raw/master/doc/DAppNodeLogoWide.png - :target: https://github.com/dappnode/DAppNode/wiki/DAppNode-Installation-Guide - - - -Contents -======== - -.. toctree:: - :maxdepth: 2 - - introduction-to-dappnode.rst - install-dappnode.rst - dappnode-by-example.rst - dappnode-core.rst - security-considerations.rst - contributing.rst - frequently-asked-questions.rst - - -Indices and tables -================== - -* :ref:`genindex` -* :ref:`modindex` -* :ref:`search` \ No newline at end of file diff --git a/docs/install-dappnode.rst b/docs/install-dappnode.rst deleted file mode 100644 index b404f707..00000000 --- a/docs/install-dappnode.rst +++ /dev/null @@ -1,16 +0,0 @@ -.. index:: ! installing - -.. _installing-dappnode: - -################### -Install DAppNode -################### - -| - -.. image:: https://github.com/dappnode/DAppNode/raw/master/doc/DappnodeInstall.png - :width: 300 px - :align: center - :target: https://github.com/dappnode/DAppNode/wiki/DAppNode-Installation-Guide - -| diff --git a/docs/introduction-to-dappnode.rst b/docs/introduction-to-dappnode.rst deleted file mode 100644 index aab20b5b..00000000 --- a/docs/introduction-to-dappnode.rst +++ /dev/null @@ -1,94 +0,0 @@ -.. index:: introduction, ballot - -.. _introduction: - -################### -Introduction to DAppNode -################### - -What happens when you want to use a Decentralized P2P network, but securing your own nodes takes a lot of time and effort? - -You have a decentralization bottleneck at the entry point, which is where we are now in the blockchain space :-( - -1. At no point in the last 2 years has there been more than 13,000 Bitcoin nodes online and that number got as low as [5500](https://bitnodes.earn.com/dashboard/?days=730) - -2. MetaMask and MyEtherWallet/MyCrypto are the primary wallets used on Ethereum and most users are using these wallets’ default nodes… This is a huge centralizing force in Ethereum. - -3. The people who do run their own node end up [having to spend a lot of time troubleshooting](https://www.reddit.com/r/ethereum/comments/83a34l/centralization_in_ethereum_infura_metamask/), keeping it updated and synced without the ability to easily share their node (and efforts) with family and friends. - -DAppNode will address these issues by creating a simple, easy, self-empowering system made specifically for hosting P2P clients for DApps, Cryptocurrencies, VPNs, IPFS, and more. - -Members of the [WHG](https://motherboard.vice.com/en_us/article/qvp5b3/how-ethereum-coders-hacked-back-to-rescue-dollar208-million-in-ethereum?lipi=urn%253Ali%253Apage%253Ad_flagship3_profile_view_base_treasury%253B7v09na8XQqySEuI%252FPn%252Bx5Q%253D%253D) have spent countless hours developing DAppNode because they believe it to be the most important and pertinent censorship resistant tool that is to be built to help bring the decentralized world everyone wants for themselves, and their friends and family. - - -**************************** -The Desired Final User Story -**************************** - -1. Vojtech has several cryptocurrencies he follows and is ready to stop using his laptop to run clients, but doesn’t want to have to pay a monthly subscription in fiat to some company he doesn’t trust with his private keys. - -2. He hears about DAppNode and decides to buy the top of the line DAppNode Server preloaded from one of the many certified independent vendors (though he could buy his own server and install the software himself). - -3. The DAppNode Server is delivered to his front door, and when Vojtech opens the box he finds a 2 step instruction card: First, plug in the Server. Second, go to dappnode.org/initialize - -4. On this website there will be an extremely simple and short walk-thru for Vojtech to set up his credentials and choose which clients to deploy. - -5. By just checking a few boxes Vojtech deployed his own VPN; his own local instance of MyCrypto.com; Ethereum, Bitcoin, Monero and Dogecoin Full nodes; a ZenCash Secure Node and DASH Master Node; he joined the IPFS Consortium and deployed a TrueBit Verifier and Livepeer node; and hosted Giveth, Swarm City, Aragon, Colony, and Decentraland Helper DApps to support these projects and to ensure that his interaction with these DApps cannot be censored and are fully trustless. - -6. Vojtech then tells his friends and family that he is the admin for his own DAppNode and he is able to give them a link that sets them up with their own credentials and access to his DAppNode, and Vojtech can deploy any other DApps that him or his friends and family want to have hosted with a couple clicks. He has become the trusted gateway to the decentralized world for his entire community. - -7. Vojtech ends up being able to pay off the cost of his DAppNode in 2 months with the profits made from his ZenCash, Swarm City, DASH and TrueBit Nodes. He also canceled his VPN and all of his Digital Ocean accounts because now he has his own server that he can host all of his services on. Without even trying, Vojtech has a couple extra hundred dollars a month because he is running DAppNode on his own personal server. - - -We have been working on this project mostly part time since October of last year and have a fully functional Proof of Concept, and are very close to having an MVP version that we would be proud to show off. We expect to partner with hardware manufacturers once we have a few more iterations of the software completed. - -We are developing in an invitingly open source manner and once the software is completed anyone can use their own hardware and run DAppNode on it. - -We are open to receive funding to help pay the developers working hard on the software. All funds raised are transparently accounted for using Giveth's DApp. - - -******************** -Benefits of DAppNode -******************** - -* Easy set up -* Trustless system -* Invitingly Open Source -* Free up space on your Devices -* Great for proof of stake mining -* You can browse `.eth` domains like the normal web -* You take control of your Nodes -* Encourages people to have their own server -* Perfect for projects that reward you for hosting, (Filecoin, Mysterium, etc) -* Can facilitate a P2P economy -* Host any P2P networking protocols -* DApp teams can develop packages their users can run 24x7 -* Never trust a hosting provider with your private keys again! -* One click node deployment (Full Nodes, DApps) -* Censorship resistance (run your own VPN) -* 1 DAppNode can support an entire Community -* DAppNode will build communities and decrease centralization -* DAppNode is the most important piece of infrastructure for our decencentralized future -* Considering all of the incentive structures to to run nodes, most DAppNode Admins will be make a profit maintaining their own DAppNode - - -************ -Team members -************ - -* **Adviser & Instigator:** Jordi Baylina -* **Project Lead:** Eduadiez -* **Front-End Lead:** DAppLion -* **Communication Lead:** Yalor -* **Adviser:** Griff Green - - -********************** -Where the DAppers play -********************** - -[DAppNode](https://dappnode.io/) - -[Riot](https://riot.im/app/#/room/#dappnode:matrix.org) - -[Github](https://github.com/dappnode/DAppNode/wiki/DAppNode-Installation-Guide) diff --git a/docs/make.bat b/docs/make.bat deleted file mode 100644 index c538f249..00000000 --- a/docs/make.bat +++ /dev/null @@ -1,36 +0,0 @@ -@ECHO OFF - -pushd %~dp0 - -REM Command file for Sphinx documentation - -if "%SPHINXBUILD%" == "" ( - set SPHINXBUILD=sphinx-build -) -set SOURCEDIR=. -set BUILDDIR=_build -set SPHINXPROJ=DAppNode - -if "%1" == "" goto help - -%SPHINXBUILD% >NUL 2>NUL -if errorlevel 9009 ( - echo. - echo.The 'sphinx-build' command was not found. Make sure you have Sphinx - echo.installed, then set the SPHINXBUILD environment variable to point - echo.to the full path of the 'sphinx-build' executable. Alternatively you - echo.may add the Sphinx directory to PATH. - echo. - echo.If you don't have Sphinx installed, grab it from - echo.http://sphinx-doc.org/ - exit /b 1 -) - -%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% -goto end - -:help -%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% - -:end -popd diff --git a/docs/security-considerations.rst b/docs/security-considerations.rst deleted file mode 100644 index 338cd793..00000000 --- a/docs/security-considerations.rst +++ /dev/null @@ -1,9 +0,0 @@ -.. index:: ! security - -.. _security-considerations: - -####################### -Security Considerations -####################### - -Security considerations. \ No newline at end of file diff --git a/funding.json b/funding.json new file mode 100644 index 00000000..f01a2642 --- /dev/null +++ b/funding.json @@ -0,0 +1,5 @@ +{ + "opRetro": { + "projectId": "0xf839a585342327848d4541a6fcc315404e879537a60a1370f2cd45a94283a1ba" + } +} diff --git a/installer_instructions/INSTALLER.md b/installer_instructions/INSTALLER.md new file mode 100644 index 00000000..626dadb0 --- /dev/null +++ b/installer_instructions/INSTALLER.md @@ -0,0 +1,46 @@ +## Installer instructions + +DAppNode releases are triggered through the [DNP_CORE](https://github.com/dappnode/DNP_CORE) package, when new core packages are released the DNP_CORE [dependencies](https://github.com/dappnode/DNP_CORE/blob/fc0891669870407f3673a8a6273df780efadd902/dappnode_package.json#L23) are updated with the new versions. Within core packages there are **mandatory** core packages and **non-mandatory** core packages. Both of them are part of the system packages category and perform critical action in DAppNode, such as connectivity methods, IPFS hash server for packages hashes, DNS resolver for dappnode domains and more. + +- Mandatory: [BIND](https://github.com/dappnode/DNP_BIND), [DAPPMANAGER](https://github.com/dappnode/DNP_DAPPMANAGER), [IPFS](https://github.com/dappnode/DNP_IPFS) and [WIFI](https://github.com/dappnode/DNP_WIFI) +- Non-mandatory: [WIREGUARD](https://github.com/dappnode/DNP_WIREGUARD), [HTTPS](https://github.com/dappnode/DNP_HTTPS) and [VPN](https://github.com/dappnode/DNP_VPN) + +The installer is the repository in charge of generating all the **installation assets** for a DAppNode core specific release. + +### Release assets + +DAppNode can be installed in multiple ways, check out the [docs](https://docs.dappnode.io/user/quick-start/Core/installation) for more information. The assets generated in each release are used to update all the installation methods used to install DAppNode. + +i.e + +``` + DAppNode-v0.2.51-debian-bullseye-amd64-unattended.iso 922 MB + DAppNode-v0.2.51-debian-bullseye-amd64.iso 922 MB + dappnode_access_credentials.sh 3.96 KB + dappnode_install.sh 12.7 KB + dappnode_install_pre.sh 8.74 KB + dappnode_profile.sh 2.51 KB + dappnode_uninstall.sh 2.2 KB + Source code (zip) + Source code (tar.gz) +``` + +### What is installed by default? + +By default either script and ISO installs the following core packages (see [ref](https://github.com/dappnode/DAppNode/blob/bdf4bf52a8c18b864a91bec6d625f8de206a2074/iso/scripts/download_core.sh#L17)): DAPPMANAGER, HTTPS, WIFI, WIREGUARD, IPFS and BIND. + +Depending on a few prerequisites, such as HTTPS ports being in use or there is no Kernel driver for Wireguard; the HTTPS package may not be installed and the Wireguard package may be substituted by the VPN (OpenVPN) package. + +### How to generate a new DAppNode release? + +There is a manually triggered CI Workflow in the repository actions, to generate a new DAppNode release. This CI requires manual input to be triggered and takes as inputs the versions of the core packages used to generate the release. It is mandatory that these inputted core package versions exist in their corresponding repositories in each of their releases' sections. + +The release action will generate all the assets required as well as the release-changelog.md used to display all the information in a release, excluding the changelog that will be required to introduced manually by editing the release generated + +1. Trigger release + + ![](trigger-release.png) + +2. Set inputs for the release + + ![](inputs-release.png) diff --git a/installer_instructions/inputs-release.png b/installer_instructions/inputs-release.png new file mode 100644 index 00000000..8283207f Binary files /dev/null and b/installer_instructions/inputs-release.png differ diff --git a/installer_instructions/trigger-release.png b/installer_instructions/trigger-release.png new file mode 100644 index 00000000..59451a8c Binary files /dev/null and b/installer_instructions/trigger-release.png differ diff --git a/iso/boot/grub.cfg b/iso/boot/grub.cfg new file mode 100644 index 00000000..9cb7b70d --- /dev/null +++ b/iso/boot/grub.cfg @@ -0,0 +1,94 @@ +if loadfont $prefix/font.pf2 ; then + set gfxmode=800x600 + insmod efi_gop + insmod efi_uga + insmod video_bochs + insmod video_cirrus + insmod gfxterm + insmod png + terminal_output gfxterm +fi + +set timeout=6 + +if background_image /isolinux/splash.png; then + set color_normal=light-gray/black + set color_highlight=white/black +else + set menu_color_normal=cyan/blue + set menu_color_highlight=white/blue +fi + +insmod play +play 960 440 1 0 4 440 1 +set theme=/boot/grub/theme/1 +# menuentry --hotkey=g 'Graphical install' { +# set background_color=black +# linux /install.amd/vmlinuz vga=788 --- quiet +# initrd /install.amd/gtk/initrd.gz +# } +menuentry --hotkey=i 'Press [Enter] to Install DAppNode' { + set background_color=black + linux /install.amd/vmlinuz vga=788 FRONTEND_BACKGROUND=dark --- quiet + initrd /install.amd/initrd.gz +} +# submenu --hotkey=a 'Advanced options ...' { +# set menu_color_normal=cyan/blue +# set menu_color_highlight=white/blue +# set theme=/boot/grub/theme/1-1 +# menuentry '... Graphical expert install' { +# set background_color=black +# linux /install.amd/vmlinuz priority=low vga=788 --- +# initrd /install.amd/gtk/initrd.gz +# } +# menuentry '... Graphical rescue mode' { +# set background_color=black +# linux /install.amd/vmlinuz vga=788 rescue/enable=true --- quiet +# initrd /install.amd/gtk/initrd.gz +# } +# menuentry '... Graphical automated install' { +# set background_color=black +# linux /install.amd/vmlinuz auto=true priority=critical vga=788 --- quiet +# initrd /install.amd/gtk/initrd.gz +# } +# menuentry --hotkey=x '... Expert install' { +# set background_color=black +# linux /install.amd/vmlinuz priority=low vga=788 --- +# initrd /install.amd/initrd.gz +# } +# menuentry --hotkey=r '... Rescue mode' { +# set background_color=black +# linux /install.amd/vmlinuz vga=788 rescue/enable=true --- quiet +# initrd /install.amd/initrd.gz +# } +# menuentry --hotkey=a '... Automated install' { +# set background_color=black +# linux /install.amd/vmlinuz auto=true priority=critical vga=788 --- quiet +# initrd /install.amd/initrd.gz +# } +# submenu --hotkey=s '... Speech-enabled advanced options ...' { +# set menu_color_normal=cyan/blue +# set menu_color_highlight=white/blue +# set theme=/boot/grub/theme/1-1-1 +# menuentry --hotkey=x '... Expert speech install' { +# set background_color=black +# linux /install.amd/vmlinuz priority=low vga=788 speakup.synth=soft --- +# initrd /install.amd/gtk/initrd.gz +# } +# menuentry --hotkey=r '... Rescue speech mode' { +# set background_color=black +# linux /install.amd/vmlinuz vga=788 rescue/enable=true speakup.synth=soft --- quiet +# initrd /install.amd/gtk/initrd.gz +# } +# menuentry --hotkey=a '... Automated speech install' { +# set background_color=black +# linux /install.amd/vmlinuz auto=true priority=critical vga=788 speakup.synth=soft --- quiet +# initrd /install.amd/gtk/initrd.gz +# } +# } +# } +# menuentry --hotkey=s 'Install with speech synthesis' { +# set background_color=black +# linux /install.amd/vmlinuz vga=788 speakup.synth=soft --- quiet +# initrd /install.amd/gtk/initrd.gz +# } diff --git a/iso/boot/isolinux.cfg b/iso/boot/isolinux.cfg new file mode 100644 index 00000000..403d5b04 --- /dev/null +++ b/iso/boot/isolinux.cfg @@ -0,0 +1,7 @@ +# D-I config version 2.0 +# search path for the c32 support libraries (libcom32, libutil etc.) +path +include menu.cfg +default vesamenu.c32 +prompt 0 +timeout 50 diff --git a/iso/boot/menu.cfg b/iso/boot/menu.cfg new file mode 100644 index 00000000..3f78b1cc --- /dev/null +++ b/iso/boot/menu.cfg @@ -0,0 +1,16 @@ +menu hshift 7 +menu width 61 + +menu title DappNode installer boot menu +include stdmenu.cfg +;include gtk.cfg +include txt.cfg + +label help + menu label ^Help + text help + Display help screens; type 'menu' at boot prompt to return to this menu + endtext + config prompt.cfg +;include spkgtk.cfg +;include spk.cfg diff --git a/iso/boot/splash.pcx b/iso/boot/splash.pcx new file mode 100644 index 00000000..718dc672 Binary files /dev/null and b/iso/boot/splash.pcx differ diff --git a/iso/boot/splash.png b/iso/boot/splash.png new file mode 100644 index 00000000..a6f4196e Binary files /dev/null and b/iso/boot/splash.png differ diff --git a/iso/boot/theme_1 b/iso/boot/theme_1 new file mode 100644 index 00000000..aa9ae5e4 --- /dev/null +++ b/iso/boot/theme_1 @@ -0,0 +1,41 @@ +title-color: "white" +title-text: "DAppNode Installer" +title-font: "Sans Regular 16" +desktop-color: "black" +desktop-image: "/isolinux/splash.png" +message-color: "white" +message-bg-color: "black" +terminal-font: "Sans Regular 12" + ++ boot_menu { + left = 18% + width = 50% + top = 200 + height = 200 + item_font = "Sans Regular 12" + item_color = #d3d3d3 + selected_item_color = "white" + item_height = 20 + item_padding = 15 + item_spacing = 5 +} + ++ vbox { + top = 100%-60 + left = 10% + + hbox { + top = 0 + left = 20% + + label {text = "Enter: " font = "Sans 10" color = "white" align = "left"} + + label {text = "Select " font = "Sans 10" color = "#d3d3d3" align = "left"} + } + + hbox { + top = 0 + left = 20% + + label {text = "E: " font = "Sans 10" color = "white" align = "left"} + + label {text = "Edit Selection " font = "Sans 10" color = "#d3d3d3" align = "left"} + + label {text = " " font = "Sans 10" color = "white" align = "left"} + + label {text = "C: " font = "Sans 10" color = "white" align = "left"} + + label {text = "GRUB Command line" font = "Sans 10" color = "#d3d3d3" align = "left"} + } +} diff --git a/iso/boot/txt.cfg b/iso/boot/txt.cfg new file mode 100644 index 00000000..c3c5a656 --- /dev/null +++ b/iso/boot/txt.cfg @@ -0,0 +1,4 @@ +label install + menu label ^Install + kernel /install.amd/vmlinuz + append vga=788 initrd=/install.amd/initrd.gz FRONTEND_BACKGROUND=dark --- quiet diff --git a/iso/boot/ubuntu/grub.cfg b/iso/boot/ubuntu/grub.cfg new file mode 100644 index 00000000..88c8305b --- /dev/null +++ b/iso/boot/ubuntu/grub.cfg @@ -0,0 +1,21 @@ +if loadfont unicode ; then + set gfxmode=800x600 + insmod efi_gop + insmod efi_uga + insmod video_bochs + insmod video_cirrus + insmod gfxterm + insmod png + terminal_output gfxterm +fi + +set timeout=6 + +set theme=/boot/grub/themes/dappnode/theme.txt + +menuentry "Install Dappnode (over Ubuntu Server)" { + set background_color=black + set gfxpayload=keep # Maintain the graphical resolution through the booting + linux /casper/vmlinuz autoinstall vga=788 FRONTEND_BACKGROUND=dark --- # Added autoinstall to make it unattended + initrd /casper/initrd +} \ No newline at end of file diff --git a/iso/boot/ubuntu/themes/dappnode/splash.png b/iso/boot/ubuntu/themes/dappnode/splash.png new file mode 100644 index 00000000..236fa034 Binary files /dev/null and b/iso/boot/ubuntu/themes/dappnode/splash.png differ diff --git a/iso/boot/ubuntu/themes/dappnode/theme.txt b/iso/boot/ubuntu/themes/dappnode/theme.txt new file mode 100644 index 00000000..f096526d --- /dev/null +++ b/iso/boot/ubuntu/themes/dappnode/theme.txt @@ -0,0 +1,41 @@ +title-color: "white" +title-text: "Dappnode Installer" +title-font: "Sans Regular 16" +desktop-color: "black" +desktop-image: "/boot/grub/themes/dappnode/splash.png" +message-color: "white" +message-bg-color: "black" +terminal-font: "Sans Regular 12" + ++ boot_menu { + left = 18% + width = 50% + top = 200 + height = 200 + item_font = "Sans Regular 12" + item_color = #d3d3d3 + selected_item_color = "white" + item_height = 20 + item_padding = 15 + item_spacing = 5 +} + ++ vbox { + top = 100%-60 + left = 10% + + hbox { + top = 0 + left = 20% + + label {text = "Enter: " font = "Sans 10" color = "white" align = "left"} + + label {text = "Select " font = "Sans 10" color = "#d3d3d3" align = "left"} + } + + hbox { + top = 0 + left = 20% + + label {text = "E: " font = "Sans 10" color = "white" align = "left"} + + label {text = "Edit Selection " font = "Sans 10" color = "#d3d3d3" align = "left"} + + label {text = " " font = "Sans 10" color = "white" align = "left"} + + label {text = "C: " font = "Sans 10" color = "white" align = "left"} + + label {text = "GRUB Command line" font = "Sans 10" color = "#d3d3d3" align = "left"} + } +} diff --git a/iso/extra_dpkg/liblockfile1_1.14-1.1_amd64.deb b/iso/extra_dpkg/liblockfile1_1.14-1.1_amd64.deb new file mode 100644 index 00000000..8f76c47b Binary files /dev/null and b/iso/extra_dpkg/liblockfile1_1.14-1.1_amd64.deb differ diff --git a/iso/extra_dpkg/lockfile-progs_0.1.18_amd64.deb b/iso/extra_dpkg/lockfile-progs_0.1.18_amd64.deb new file mode 100644 index 00000000..ca6c5319 Binary files /dev/null and b/iso/extra_dpkg/lockfile-progs_0.1.18_amd64.deb differ diff --git a/iso/extra_dpkg/usbmount_0.0.24_all.deb b/iso/extra_dpkg/usbmount_0.0.24_all.deb new file mode 100644 index 00000000..695fa1d7 Binary files /dev/null and b/iso/extra_dpkg/usbmount_0.0.24_all.deb differ diff --git a/iso/preseeds/preseed.cfg b/iso/preseeds/preseed.cfg new file mode 100644 index 00000000..761f5075 --- /dev/null +++ b/iso/preseeds/preseed.cfg @@ -0,0 +1,44 @@ +# Preseed-example: https://www.debian.org/releases/stable/example-preseed.txt +# Buster preseed example: https://www.debian.org/releases/buster/example-preseed.txt +# Bullseye preseed example: https://www.debian.org/releases/testing/example-preseed.txt +# Bookworm preseed example: https://www.debian.org/releases/bookworm/example-preseed.txt +### Network configuration +d-i hw-detect/load_firmware boolean true +d-i netcfg/choose_interface select auto +d-i netcfg/link_wait_timeout string 20 +d-i netcfg/get_hostname string dappnode +d-i netcfg/get_hostname seen false +d-i netcfg/hostname seen false +d-i passwd/user-fullname string DAppNode User +d-i netcfg/get_domain string '' +d-i netcfg/get_domain seen true + +### Account setup +d-i passwd/username string dappnode +d-i passwd/username seen false + +### Package selection +tasksel tasksel/first multiselect standard +d-i pkgsel/include string openssh-server vim sudo iw iwd wpasupplicant intel-microcode iucode-tool build-essential linux-headers-$(uname -r) firmware-iwlwifi avahi-utils iptables +d-i apt-setup/use_mirror boolean false +d-i mirror/country string manual +d-i mirror/http/hostname string deb.debian.org +d-i mirror/http/directory string /debian +d-i mirror/http/proxy string +d-i apt-setup/local0/repository string http://deb.debian.org/debian/ bookworm main contrib non-free-firmware +d-i apt-setup/cdrom/set-first boolean false +d-i apt-setup/cdrom/set-next boolean false +d-i apt-setup/cdrom/set-failed boolean false +d-i apt-setup/disable-cdrom-entries boolean true +popularity-contest popularity-contest/participate boolean false + +### Preseeding other packages +d-i preseed/late_command string \ + in-target mkdir -p /usr/src/dappnode; \ + cp -ar /cdrom/dappnode/* /target/usr/src/dappnode/; \ + cp -a /cdrom/dappnode/scripts/rc.local /target/etc/rc.local; \ + in-target chmod +x /usr/src/dappnode/scripts/dappnode_install_pre.sh; \ + in-target chmod +x /usr/src/dappnode/scripts/static_ip.sh; \ + in-target gpasswd -a $(getent passwd "1000" | cut -d: -f1) sudo; \ + /target/usr/src/dappnode/scripts/static_ip.sh; \ + in-target /usr/src/dappnode/scripts/dappnode_install_pre.sh UPDATE diff --git a/iso/preseeds/preseed_unattended.cfg b/iso/preseeds/preseed_unattended.cfg new file mode 100644 index 00000000..be31dba6 --- /dev/null +++ b/iso/preseeds/preseed_unattended.cfg @@ -0,0 +1,83 @@ +# Preseed-example: https://www.debian.org/releases/stable/example-preseed.txt +# Buster preseed example: https://www.debian.org/releases/buster/example-preseed.txt +# Bullseye preseed example: https://www.debian.org/releases/testing/example-preseed.txt +# Bookworm preseed example: https://www.debian.org/releases/bookworm/example-preseed.txt +### Localization +d-i debian-installer/locale string en_US.UTF-8 +d-i debian-installer/keymap select us +d-i keymap select us +d-i keyboard-configuration/xkb-keymap select us + +### Network configuration +d-i hw-detect/load_firmware boolean true # Non-free hardware needed ? +d-i netcfg/choose_interface select auto +d-i netcfg/link_wait_timeout string 20 +d-i netcfg/get_hostname string dappnode +d-i netcfg/hostname seen true +d-i netcfg/get_domain string dappnode.eth +d-i netcfg/get_domain seen true + +### Account setup +d-i passwd/root-login boolean false +d-i passwd/user-fullname string DAppNode +d-i passwd/username string dappnode +# Use `mkpasswd -m sha-512` to generate the hash +# Using "dappnode.s0" as default +d-i passwd/user-password-crypted password $6$insecur3$rnEv9Amdjn3ctXxPYOlzj/cwvLT43GjWzkPECIHNqd8Vvza5bMG8QqMwEIBKYqnj609D.4ngi4qlmt29dLE.71 +# d-i passwd/root-password-crypted password $6$insecur3$rnEv9Amdjn3ctXxPYOlzj/cwvLT43GjWzkPECIHNqd8Vvza5bMG8QqMwEIBKYqnj609D.4ngi4qlmt29dLE.71 + +### Clock and time zone setup +d-i clock-setup/utc boolean true +d-i time/zone string UTC +d-i clock-setup/ntp boolean true + +### Partitioning +d-i partman/early_command string sh /cdrom/dappnode/scripts/check-disks.sh +d-i partman-auto/purge_lvm_from_device boolean true +d-i partman-auto/method string lvm +d-i partman-auto-lvm/new_vg_name string rootvg +d-i partman-auto-lvm/guided_size string max +d-i partman-lvm/device_remove_lvm boolean true +d-i partman-md/device_remove_md boolean true +d-i partman-lvm/confirm boolean true +d-i partman-lvm/confirm_nooverwrite boolean true +d-i partman-auto/choose_recipe select atomic +d-i partman-partitioning/confirm_write_new_label boolean true +d-i partman/choose_partition select finish +d-i partman/confirm boolean true +d-i partman/confirm_nooverwrite boolean true +d-i partman/mount_style select uuid +d-i partman-efi/non_efi_system boolean true + +### Boot loader installation +d-i grub-installer/only_debian boolean true +d-i grub-installer/with_other_os boolean true +d-i grub-installer/bootdev string default + +### Package selection +tasksel tasksel/first multiselect standard +d-i pkgsel/include string openssh-server vim sudo build-essential linux-headers-$(uname -r) iw iwd wpasupplicant intel-microcode iucode-tool firmware-misc-nonfree firmware-iwlwifi avahi-utils iptables +d-i apt-setup/use_mirror boolean false +d-i mirror/country string manual +d-i mirror/http/hostname string deb.debian.org +d-i mirror/http/directory string /debian +d-i mirror/http/proxy string +d-i apt-setup/local0/repository string http://deb.debian.org/debian/ bookworm main contrib non-free-firmware +d-i apt-setup/cdrom/set-first boolean false +d-i apt-setup/cdrom/set-next boolean false +d-i apt-setup/cdrom/set-failed boolean false +d-i apt-setup/disable-cdrom-entries boolean true +popularity-contest popularity-contest/participate boolean false +d-i pkgsel/upgrade select none + +### Preseeding other packages +d-i preseed/late_command string \ + in-target mkdir -p /usr/src/dappnode; \ + sort -u /etc/network/devhotplug > /target/usr/src/dappnode/hotplug; \ + cp -a /etc/network/interfaces /target/etc/network/interfaces; \ + cp -ar /cdrom/dappnode/* /target/usr/src/dappnode/; \ + cp -a /cdrom/dappnode/scripts/rc.local /target/etc/rc.local; \ + in-target chmod +x /usr/src/dappnode/scripts/dappnode_install_pre.sh; \ + in-target touch /usr/src/dappnode/.firstboot; \ + in-target /usr/src/dappnode/scripts/dappnode_install_pre.sh UPDATE +d-i finish-install/reboot_in_progress note diff --git a/iso/preseeds/ubuntu/autoinstall.yaml b/iso/preseeds/ubuntu/autoinstall.yaml new file mode 100644 index 00000000..4fb3eadc --- /dev/null +++ b/iso/preseeds/ubuntu/autoinstall.yaml @@ -0,0 +1,30 @@ +# cloud-config +--- +autoinstall: + version: 1 + interactive-sections: + - identity + - keyboard + - locale + - network + - storage + - timezone + - ssh + + packages: + - linux-generic + - wpasupplicant + - intel-microcode + - iucode-tool + - iptables + + late-commands: + - "curtin in-target --target=/target -- apt-get update" + - "curtin in-target --target=/target -- apt-get install -y chrony build-essential iw iwd avahi-utils" + - "mkdir -p /target/usr/src/dappnode" + - "cp -ar /cdrom/dappnode/* /target/usr/src/dappnode/" + - "cp -a /cdrom/dappnode/scripts/rc.local /target/etc/rc.local" + - "chmod +x /target/usr/src/dappnode/scripts/dappnode_install_pre.sh" + - "touch /target/usr/src/dappnode/.firstboot" + - "cp -ar /etc/netplan/* /target/etc/netplan/" # Necessary for prerequisites + - "curtin in-target --target=/target -- /usr/src/dappnode/scripts/dappnode_install_pre.sh UPDATE" diff --git a/iso/preseeds/ubuntu/autoinstall_unattended.yaml b/iso/preseeds/ubuntu/autoinstall_unattended.yaml new file mode 100644 index 00000000..0e4fd24e --- /dev/null +++ b/iso/preseeds/ubuntu/autoinstall_unattended.yaml @@ -0,0 +1,45 @@ +# cloud-config +--- +autoinstall: + version: 1 + + locale: en_US.UTF-8 + + keyboard: + layout: us + + # network left as default (DHCP in interfaces named en* or eth*) + storage: + layout: + name: lvm + sizing-policy: all + + identity: + hostname: dappnode + username: dappnode + password: "$6$insecur3$rnEv9Amdjn3ctXxPYOlzj/cwvLT43GjWzkPECIHNqd8Vvza5bMG8QqMwEIBKYqnj609D.4ngi4qlmt29dLE.71" + + ssh: + install-server: true + # By default, the password is allowed if no authorized keys are provided + + packages: + - linux-generic + - wpasupplicant + - intel-microcode + - iucode-tool + - iptables + + timezone: UTC + + late-commands: + - "curtin in-target --target=/target -- apt-get update" + - "curtin in-target --target=/target -- apt-get install -y chrony build-essential iw iwd avahi-utils" + - "mkdir -p /target/usr/src/dappnode" + - "cp -ar /cdrom/dappnode/* /target/usr/src/dappnode/" + - "cp -a /cdrom/dappnode/scripts/rc.local /target/etc/rc.local" + - "chmod +x /target/usr/src/dappnode/scripts/dappnode_install_pre.sh" + - "touch /target/usr/src/dappnode/.firstboot" + - "cp -ar /etc/netplan/* /target/etc/netplan/" # Necessary for prerequisites + - "curtin in-target --target=/target -- /usr/src/dappnode/scripts/dappnode_install_pre.sh UPDATE" + # TODO: Handle /etc/network/interfaces and /etc/network/devhotplug diff --git a/iso/scripts/common_iso_generation.sh b/iso/scripts/common_iso_generation.sh new file mode 100644 index 00000000..1cd65a0c --- /dev/null +++ b/iso/scripts/common_iso_generation.sh @@ -0,0 +1,75 @@ +#!/bin/bash + +WORKDIR="/usr/src/app" +ISO_BUILD_PATH="${WORKDIR}/dappnode-iso" +DAPPNODE_ISO_PREFIX="Dappnode-" + +download_iso() { + local iso_path=$1 + local iso_name=$2 + local iso_url=$3 + + echo "[INFO] Downloading base ISO image: ${iso_name}..." + if [ ! -f "${iso_path}" ]; then + wget "${iso_url}" -O "${iso_path}" + fi + echo "[INFO] Download complete!" +} + +verify_download() { + local iso_path=$1 + local expected_shasum=$2 + + echo "[INFO] Verifying download..." + [[ "$(shasum -a 256 ${iso_path})" != "$expected_shasum" ]] && { + echo "[ERROR] Wrong shasum for ${iso_path}" + exit 1 + } + echo "[INFO] Verification complete!" +} + +clean_old_files() { + local iso_extraction_dir=$1 + local base_iso_prefix=$2 + + echo "[INFO] Cleaning old files..." + rm -rf "${iso_extraction_dir}º" + rm -rf "${base_iso_prefix}*" +} + +extract_iso() { + local iso_path=$1 + local extraction_target_dir=$2 + + echo "[INFO] Extracting the ISO..." + osirrox -indev "${iso_path}" -extract / "${extraction_target_dir}" +} + +# Using a 512-byte block size to ensure the entire Master Boot Record (MBR) is captured. +# The MBR contains boot code, the partition table, and a boot signature, all essential for creating bootable media. +# This ensures that the new ISO being created is bootable under different system setups +prepare_boot_process() { + local iso_path=$1 + local mbr_output_path=$2 + local block_size=512 + + echo "[INFO] Obtaining the MBR for hybrid ISO..." + dd if="${iso_path}" bs=${block_size} count=1 of="${mbr_output_path}" +} + +add_dappnode_files_to_iso_build() { + local iso_build_path=$1 + local workdir=$2 + + echo "[INFO] Creating necessary directories and copying files..." + mkdir -p ${iso_build_path}/dappnode + cp -r ${workdir}/scripts ${iso_build_path}/dappnode + cp -r ${workdir}/dappnode/* ${iso_build_path}/dappnode +} + +# TODO: Is this ok for Ubuntu? Check what this is for +handle_checksums() { + echo "Fix md5 sum..." + # shellcheck disable=SC2046 + md5sum $(find ! -name "md5sum.txt" ! -path "./isolinux/*" -type f) >md5sum.txt +} diff --git a/iso/scripts/download_core.sh b/iso/scripts/download_core.sh new file mode 100755 index 00000000..378a8087 --- /dev/null +++ b/iso/scripts/download_core.sh @@ -0,0 +1,76 @@ +#!/bin/bash + +set -e + +sed '1,/^\#\!ISOBUILD/!d' /usr/src/app/.dappnode_profile >/tmp/vars.sh +# shellcheck disable=SC1091 +source /tmp/vars.sh + +DAPPNODE_CORE_DIR="/images" +DAPPNODE_HASH_FILE="${DAPPNODE_CORE_DIR}/packages-content-hash.csv" +CONTENT_HASH_PKGS=(besu geth nethermind erigon prysm teku lighthouse lodestar nimbus) +IPFS_ENDPOINT=${IPFS_ENDPOINT:-"http://ipfs.io"} + +SWGET="wget -q -O-" +WGET="wget" + +components=(BIND IPFS WIREGUARD DAPPMANAGER WIFI HTTPS) + +# The indirect variable expansion used in ${!ver##*:} allows us to use versions like 'dev:development' +# If such variable with 'dev:'' suffix is used, then the component is built from specified branch or commit. +for comp in "${components[@]}"; do + ver="${comp}_VERSION" + DOWNLOAD_URL="https://github.com/dappnode/DNP_${comp}/releases/download/v${!ver}" + if [[ ${!ver} == /ipfs/* ]]; then + DOWNLOAD_URL="${IPFS_ENDPOINT}/api/v0/cat?arg=${!ver%:*}" + fi + + eval "${comp}_URL=\"${DOWNLOAD_URL}/${comp,,}.dnp.dappnode.eth_${!ver##*:}_linux-amd64.txz\"" + eval "${comp}_YML=\"${DOWNLOAD_URL}/docker-compose.yml\"" + eval "${comp}_MANIFEST=\"${DOWNLOAD_URL}/dappnode_package.json\"" + eval "${comp}_YML_FILE=\"${DAPPNODE_CORE_DIR}/docker-compose-${comp,,}.yml\"" + eval "${comp}_FILE=\"${DAPPNODE_CORE_DIR}/${comp,,}.dnp.dappnode.eth_${!ver##*:}_linux-amd64.txz\"" + eval "${comp}_MANIFEST_FILE=\"${DAPPNODE_CORE_DIR}/dappnode_package-${comp,,}.json\"" +done + +dappnode_core_download() { + for comp in "${components[@]}"; do + ver="${comp}_VERSION" + if [[ ${!ver} != dev:* ]]; then + # Download DAppNode Core Images if it's needed + eval "[ -f \$${comp}_FILE ] || $WGET -O \$${comp}_FILE \$${comp}_URL" + # Download DAppNode Core docker-compose yml files if it's needed + eval "[ -f \$${comp}_YML_FILE ] || $WGET -O \$${comp}_YML_FILE \$${comp}_YML" + # Download DAppNode Core manifest files if it's needed + eval "[ -f \$${comp}_MANIFEST_FILE ] || $WGET -O \$${comp}_MANIFEST_FILE \$${comp}_MANIFEST" + fi + done +} + +grabContentHashes() { + rm -f $DAPPNODE_HASH_FILE + for comp in "${CONTENT_HASH_PKGS[@]}"; do + echo "Grabbing ${comp}" + CONTENT_HASH=$(eval "${SWGET}" https://github.com/dappnode/DAppNodePackage-"${comp}"/releases/latest/download/content-hash) + if [ -z "$CONTENT_HASH" ]; then + echo "ERROR! Failed to find content hash of ${comp}." + exit 1 + fi + echo "${comp}.dnp.dappnode.eth,${CONTENT_HASH}" >>${DAPPNODE_HASH_FILE} + done +} + +echo -e "\e[32mDownloading DAppNode Core...\e[0m" +dappnode_core_download + +echo -e "\e[32mGrabbing latest content hashes...\e[0m" +grabContentHashes + +mkdir -p /usr/src/app/dappnode/DNCORE + +echo -e "\e[32mCopying files...\e[0m" +cp /images/*.txz /usr/src/app/dappnode/DNCORE +cp /images/*.yml /usr/src/app/dappnode/DNCORE +cp /images/*.json /usr/src/app/dappnode/DNCORE +cp ${DAPPNODE_HASH_FILE} /usr/src/app/dappnode/DNCORE +cp /usr/src/app/.dappnode_profile /usr/src/app/dappnode/DNCORE diff --git a/iso/scripts/generate_ISO.sh b/iso/scripts/generate_ISO.sh new file mode 100755 index 00000000..bf241775 --- /dev/null +++ b/iso/scripts/generate_ISO.sh @@ -0,0 +1,29 @@ +#!/bin/sh +set -e + +dockerd & +sleep 5 + +if [ "$CLEAN" = true ]; then + rm -f /images/DAppNode*.iso + rm -f /images/*.tar.xz + rm -f /images/*.yml + rm -f /images/*.json + rm -f /images/*.txz +fi + +if [ "$BUILD" = true ]; then + /usr/src/app/iso/scripts/generate_docker_images.sh +else + /usr/src/app/iso/scripts/download_core.sh +fi + +#file generated to detectd ISO installation +mkdir -p /usr/src/app/dappnode +touch /usr/src/app/dappnode/iso_install.log + +if [ "$BASE_OS" = "ubuntu" ]; then + /usr/src/app/iso/scripts/generate_dappnode_iso_ubuntu.sh +else + /usr/src/app/iso/scripts/generate_dappnode_iso_debian.sh +fi diff --git a/iso/scripts/generate_dappnode_iso_debian.sh b/iso/scripts/generate_dappnode_iso_debian.sh new file mode 100755 index 00000000..201e0082 --- /dev/null +++ b/iso/scripts/generate_dappnode_iso_debian.sh @@ -0,0 +1,98 @@ +#!/bin/bash +set -e + +SCRIPTS_DIR=$(dirname "${BASH_SOURCE[0]}") + +source ${SCRIPTS_DIR}/common_iso_generation.sh + +# Source = https://cdimage.debian.org/mirror/cdimage/archive/12.11.0/amd64/iso-cd/debian-12.11.0-amd64-netinst.iso +BASE_ISO_NAME="debian-12.11.0-amd64-netinst.iso" +BASE_ISO_PATH="/images/${BASE_ISO_NAME}" +BASE_ISO_URL="https://cdimage.debian.org/mirror/cdimage/archive/12.11.0/amd64/iso-cd/${BASE_ISO_NAME}" +BASE_ISO_SHASUM="30ca12a15cae6a1033e03ad59eb7f66a6d5a258dcf27acd115c2bd42d22640e8 ${BASE_ISO_PATH}" + +DAPPNODE_ISO_NAME="${DAPPNODE_ISO_PREFIX}${BASE_ISO_NAME}" +DAPPNODE_ISO_PATH="/images/${DAPPNODE_ISO_NAME}" + +customize_debian_preseed() { + local iso_build_path=$1 + local workdir=$2 + + echo "[INFO] Customizing preseed..." + + local tmp_initrd="/tmp/makeinitrd" + local install_dir="${iso_build_path}/install.amd" + local preseeds_dir="${workdir}/iso/preseeds" + + rm -rf "${tmp_initrd}" + mkdir -p "${tmp_initrd}" + + local preseed_name="preseed.cfg" + [[ $UNATTENDED == *"true"* ]] && preseed_name="preseed_unattended.cfg" + + local preseed_file="${preseeds_dir}/${preseed_name}" + + if [ ! -f "${preseed_file}" ]; then + echo "[ERROR] Preseed file not found: ${preseed_file}" + exit 1 + fi + + # Extract the initrd into a temporary directory + gunzip -c "${install_dir}/initrd.gz" | cpio -idum -D "${tmp_initrd}" || { + echo "[ERROR] Could not decompress and extract initrd" + exit 1 + } + + # Add the preseed file to the initrd + cp "${preseed_file}" "${tmp_initrd}/preseed.cfg" || { + echo "[ERROR] Could not copy preseed file" + exit 1 + } + + # Recreate (and recompress) the initrd + (cd "${tmp_initrd}" && find . -print0 | cpio -0 -ov -H newc | gzip >"${install_dir}/initrd.gz") || { + echo "[ERROR] Could not create new initrd" + exit 1 + } + + echo "[INFO] Preseed customization complete." +} + +configure_boot_menu() { + local iso_build_path=$1 + local workdir=$2 + + local boot_dir="${workdir}/iso/boot" + + echo "[INFO] Configuring the boot menu for Dappnode..." + cp ${boot_dir}/grub.cfg ${iso_build_path}/boot/grub/grub.cfg + cp ${boot_dir}/theme_1 ${iso_build_path}/boot/grub/theme/1 + cp ${boot_dir}/isolinux.cfg ${iso_build_path}/isolinux/isolinux.cfg + cp ${boot_dir}/menu.cfg ${iso_build_path}/isolinux/menu.cfg + cp ${boot_dir}/txt.cfg ${iso_build_path}/isolinux/txt.cfg + cp ${boot_dir}/splash.png ${iso_build_path}/isolinux/splash.png +} + +generate_debian_iso() { + local mbr_path=$1 + local iso_output_path=$2 + local iso_build_path=$3 + + echo "[INFO] Generating new ISO..." + + xorriso -as mkisofs -isohybrid-mbr ${mbr_path} \ + -c /isolinux/boot.cat -b /isolinux/isolinux.bin -no-emul-boot -boot-load-size 4 \ + -boot-info-table -eltorito-alt-boot -e /boot/grub/efi.img -no-emul-boot \ + -isohybrid-gpt-basdat -o "${iso_output_path}" ${iso_build_path} +} + +download_iso "${BASE_ISO_PATH}" "${BASE_ISO_NAME}" "${BASE_ISO_URL}" +verify_download "${BASE_ISO_PATH}" "${BASE_ISO_SHASUM}" +clean_old_files "${ISO_BUILD_PATH}" "${DAPPNODE_ISO_PREFIX}" +extract_iso "${BASE_ISO_PATH}" "${ISO_BUILD_PATH}" +prepare_boot_process "${BASE_ISO_PATH}" "${ISO_BUILD_PATH}/isolinux/isohdpfx.bin" +add_dappnode_files_to_iso_build "${ISO_BUILD_PATH}" "${WORKDIR}" +customize_debian_preseed "${ISO_BUILD_PATH}" "${WORKDIR}" +configure_boot_menu "${ISO_BUILD_PATH}" "${WORKDIR}" +handle_checksums # TODO: Check if it fits both ubuntu and debian +generate_debian_iso "${ISO_BUILD_PATH}/isolinux/isohdpfx.bin" "${DAPPNODE_ISO_PATH}" "${ISO_BUILD_PATH}" diff --git a/iso/scripts/generate_dappnode_iso_ubuntu.sh b/iso/scripts/generate_dappnode_iso_ubuntu.sh new file mode 100755 index 00000000..c1c1a270 --- /dev/null +++ b/iso/scripts/generate_dappnode_iso_ubuntu.sh @@ -0,0 +1,74 @@ +#!/bin/bash +set -e + +SCRIPTS_DIR=$(dirname "${BASH_SOURCE[0]}") + +source ${SCRIPTS_DIR}/common_iso_generation.sh + +BASE_ISO_NAME=ubuntu-24.04.3-live-server-amd64.iso +BASE_ISO_PATH="/images/${BASE_ISO_NAME}" +BASE_ISO_URL="https://releases.ubuntu.com/24.04/${BASE_ISO_NAME}" +BASE_ISO_SHASUM="c3514bf0056180d09376462a7a1b4f213c1d6e8ea67fae5c25099c6fd3d8274b ${BASE_ISO_PATH}" + +DAPPNODE_ISO_NAME="${DAPPNODE_ISO_PREFIX}${BASE_ISO_NAME}" +DAPPNODE_ISO_PATH="/images/${DAPPNODE_ISO_NAME}" + +get_efi_partition() { + local base_iso_path=$1 + local dest_efi_path=$2 + local block_size=512 + + local efi_start=$(fdisk -l ${base_iso_path} | grep 'Appended2' | awk '{print $2}') + local efi_end=$(fdisk -l ${base_iso_path} | grep 'Appended2' | awk '{print $3}') + local efi_size=$(expr ${efi_end} - ${efi_start} + 1) + + echo "[INFO] Obtaining the EFI partition image from ${efi_start} with size ${efi_size}..." + dd if=${base_iso_path} bs=${block_size} skip="$efi_start" count="$efi_size" of=${dest_efi_path} +} + +add_ubuntu_autoinstall() { + local preseeds_dir=$1 + local iso_build_path=$2 + + echo "[INFO] Adding preseed..." + if [[ $UNATTENDED == *"true"* ]]; then + cp ${preseeds_dir}/autoinstall_unattended.yaml ${iso_build_path}/autoinstall.yaml + else + cp ${preseeds_dir}/autoinstall.yaml ${iso_build_path}/autoinstall.yaml + fi +} + +configure_boot_menu() { + echo "[INFO] Configuring the boot menu for Dappnode..." + cp -r /usr/src/app/iso/boot/ubuntu/* ${ISO_BUILD_PATH}/boot/grub/ +} + +generate_ubuntu_iso() { + local mbr_path=$1 + local efi_path=$2 + local iso_output_path=$3 + local iso_build_path=$4 + + echo "[INFO] Creating the new Ubuntu ISO..." + mkisofs \ + -rational-rock -joliet -joliet-long -full-iso9660-filenames \ + -iso-level 3 -partition_offset 16 --grub2-mbr ${mbr_path} \ + --mbr-force-bootable -append_partition 2 0xEF ${efi_path} \ + -appended_part_as_gpt \ + -eltorito-catalog /boot.catalog \ + -eltorito-boot /boot/grub/i386-pc/eltorito.img -no-emul-boot -boot-load-size 4 \ + -boot-info-table --grub2-boot-info -eltorito-alt-boot --efi-boot '--interval:appended_partition_2:all::' -no-emul-boot \ + -o ${iso_output_path} ${iso_build_path} +} + +download_iso "${BASE_ISO_PATH}" "${BASE_ISO_NAME}" "${BASE_ISO_URL}" +verify_download "${BASE_ISO_PATH}" "${BASE_ISO_SHASUM}" +clean_old_files "${ISO_BUILD_PATH}" "${DAPPNODE_ISO_PREFIX}" +extract_iso "${BASE_ISO_PATH}" "${ISO_BUILD_PATH}" +prepare_boot_process "${BASE_ISO_PATH}" "${ISO_BUILD_PATH}/mbr" +get_efi_partition "${BASE_ISO_PATH}" "${ISO_BUILD_PATH}/efi" +add_dappnode_files_to_iso_build "${ISO_BUILD_PATH}" "${WORKDIR}" +add_ubuntu_autoinstall "/usr/src/app/iso/preseeds/ubuntu" "${ISO_BUILD_PATH}" +configure_boot_menu +handle_checksums +generate_ubuntu_iso "${ISO_BUILD_PATH}/mbr" "${ISO_BUILD_PATH}/efi" "${DAPPNODE_ISO_PATH}" "${ISO_BUILD_PATH}" diff --git a/iso/scripts/generate_docker_images.sh b/iso/scripts/generate_docker_images.sh new file mode 100755 index 00000000..bac8c9ae --- /dev/null +++ b/iso/scripts/generate_docker_images.sh @@ -0,0 +1,56 @@ +#!/bin/bash + +# shellcheck disable=SC1091 +source /usr/src/app/.dappnode_profile + +echo "Cleaning previous files" +rm -rf ./DNP_* + +# Curl github release with version + +echo "Downloading source code & building DNP_WIREGUARD..." +curl -LJO https://github.com/dappnode/DNP_WIREGUARD/archive/refs/tags/"v${WIREGUARD_VERSION}.tar.gz" || { echo "Failed to download DNP_WIREGUARD"; exit 1; } +mkdir DNP_WIREGUARD +tar -xzf "DNP_WIREGUARD-${WIREGUARD_VERSION}.tar.gz" -C ./DNP_WIREGUARD --strip-components=1 || { echo "Failed to extract DNP_WIREGUARD"; exit 1; } +docker compose -f ./DNP_WIREGUARD/docker-compose.yml build || { echo "Failed to build DNP_WIREGUARD"; exit 1; } +docker save wireguard.dnp.dappnode.eth:"${WIREGUARD_VERSION}" | xz -e9vT0 >/images/wireguard.dnp.dappnode.eth_"${WIREGUARD_VERSION}"_linux-amd64.txz || { echo "Failed to save DNP_WIREGUARD"; exit 1; } + +echo "Downloading source code & building DNP_HTTPS..." +curl -LJO https://github.com/dappnode/DNP_HTTPS/archive/refs/tags/"v${HTTPS_VERSION}.tar.gz" || { echo "Failed to download DNP_HTTPS"; exit 1; } +mkdir DNP_HTTPS +tar -xzf "DNP_HTTPS-${HTTPS_VERSION}.tar.gz" -C ./DNP_HTTPS --strip-components=1 || { echo "Failed to extract DNP_HTTPS"; exit 1; } +docker compose -f ./DNP_HTTPS/docker-compose.yml build || { echo "Failed to build DNP_HTTPS"; exit 1; } +docker save https.dnp.dappnode.eth: "${HTTPS_VERSION}" | xz -e9vT0 >/images/https.dnp.dappnode.eth_"${HTTPS_VERSION}"_linux-amd64.txz || { echo "Failed to save DNP_HTTPS"; exit 1; } + +echo "Downloading source code & building DNP_IPFS..." +curl -LJO https://github.com/dappnode/DNP_IPFS/archive/refs/tags/"v${IPFS_VERSION}.tar.gz" || { echo "Failed to download DNP_IPFS"; exit 1; } +mkdir DNP_IPFS +tar -xzf "DNP_IPFS-${IPFS_VERSION}.tar.gz" -C ./DNP_IPFS --strip-components=1 || { echo "Failed to extract DNP_IPFS"; exit 1; } +docker compose -f ./DNP_IPFS/docker-compose.yml build || { echo "Failed to build DNP_IPFS"; exit 1; } +docker save ipfs.dnp.dappnode.eth:"${IPFS_VERSION}" | xz -e9vT0 >/images/ipfs.dnp.dappnode.eth_"${IPFS_VERSION}"_linux-amd64.txz || { echo "Failed to save DNP_IPFS"; exit 1; } + +echo "Downloading source code & building DNP_BIND..." +curl -LJO https://github.com/dappnode/DNP_BIND/archive/refs/tags/"v${BIND_VERSION}.tar.gz" || { echo "Failed to download DNP_BIND"; exit 1; } +mkdir DNP_BIND +tar -xzf "DNP_BIND-${BIND_VERSION}.tar.gz" -C ./DNP_BIND --strip-components=1 || { echo "Failed to extract DNP_BIND"; exit 1; } +docker compose -f ./DNP_BIND/docker-compose.yml build || { echo "Failed to build DNP_BIND"; exit 1; } +docker save bind.dnp.dappnode.eth:"${BIND_VERSION}" | xz -e9vT0 >/images/bind.dnp.dappnode.eth_"${BIND_VERSION}"_linux-amd64.txz || { echo "Failed to save DNP_BIND"; exit 1; } + +echo "Downloading source code & building DNP_DAPPMANAGER..." +curl -LJO https://github.com/dappnode/DNP_DAPPMANAGER/archive/refs/tags/"v${DAPPMANAGER_VERSION}.tar.gz" || { echo "Failed to download DNP_DAPPMANAGER"; exit 1; } +mkdir DNP_DAPPMANAGER +tar -xzf "DNP_DAPPMANAGER-${DAPPMANAGER_VERSION}.tar.gz" -C ./DNP_DAPPMANAGER --strip-components=1 || { echo "Failed to extract DNP_DAPPMANAGER"; exit 1; } +docker compose -f ./DNP_DAPPMANAGER/docker-compose.yml build || { echo "Failed to build DNP_DAPPMANAGER"; exit 1; } +docker save dappmanager.dnp.dappnode.eth:"${DAPPMANAGER_VERSION}" | xz -e9vT0 >/images/dappmanager.dnp.dappnode.eth_"${DAPPMANAGER_VERSION}"_linux-amd64.txz || { echo "Failed to save DNP_DAPPMANAGER"; exit 1; } + +echo "Downloading source code & building DNP_WIFI..." +curl -LJO https://github.com/dappnode/DNP_WIFI/archive/refs/tags/"v${WIFI_VERSION}.tar.gz" || { echo "Failed to download DNP_WIFI"; exit 1; } +mkdir DNP_WIFI +tar -xzf "DNP_WIFI-${WIFI_VERSION}.tar.gz" -C ./DNP_WIFI --strip-components=1 || { echo "Failed to extract DNP_WIFI"; exit 1; } +docker compose -f ./DNP_WIFI/docker-compose.yml build || { echo "Failed to build DNP_WIFI"; exit 1; } +docker save wifi.dnp.dappnode.eth:"${WIFI_VERSION}" | xz -e9vT0 >/images/wifi.dnp.dappnode.eth_"${WIFI_VERSION}"_linux-amd64.txz || { echo "Failed to save DNP_WIFI"; exit 1; } + +echo "Coping dappnode_all_docker_images_linux-amd64.txz to dappnode dir..." +cp /images/* /usr/src/app/dappnode/ + +echo "Finished!" diff --git a/iso/scripts/prepare_snapshot.sh b/iso/scripts/prepare_snapshot.sh new file mode 100644 index 00000000..067a283f --- /dev/null +++ b/iso/scripts/prepare_snapshot.sh @@ -0,0 +1,47 @@ +#!/bin/bash + +DAPPNODE_INSTALL_SCRIPT_URL=$1 +if [ -z "$DAPPNODE_INSTALL_SCRIPT_URL" ]; then + echo "Must supply one argument, DAPPNODE_INSTALL_SCRIPT_URL" + echo "Example: https://raw.githubusercontent.com/dappnode/DAppNode_Installer/monolithic/build/utils/scripts/dappnode_install.sh" + exit 1 +fi + +wget -qO - https://prerequisites.dappnode.io | sudo bash + +mkdir -p /usr/src/dappnode/scripts/ + +wget "$DAPPNODE_INSTALL_SCRIPT_URL" -O /usr/src/dappnode/scripts/dappnode_install.sh + +chmod +x /usr/src/dappnode/scripts/dappnode_install.sh + +touch /usr/src/dappnode/.firstboot + +cat </etc/rc.local +#!/bin/sh -e +/usr/src/dappnode/scripts/dappnode_install.sh +exit 0 +EOF + +chmod +x /etc/rc.local + +cat </etc/systemd/system/rc-local.service +[Unit] + Description=/etc/rc.local Compatibility + ConditionPathExists=/etc/rc.local +[Service] + Type=forking + ExecStart=/etc/rc.local start + TimeoutSec=0 + StandardOutput=tty + RemainAfterExit=yes + SysVStartPriority=99 +[Install] + WantedBy=multi-user.target +EOF + +systemctl enable rc-local + +UPDATE=true /usr/src/dappnode/scripts/dappnode_install.sh + +rm /usr/src/dappnode/.firstboot \ No newline at end of file diff --git a/iso/sgx/enable_sgx b/iso/sgx/enable_sgx new file mode 100755 index 00000000..67d6aa33 Binary files /dev/null and b/iso/sgx/enable_sgx differ diff --git a/iso/sgx/sgx_linux_x64_driver.bin b/iso/sgx/sgx_linux_x64_driver.bin new file mode 100755 index 00000000..eca7109c Binary files /dev/null and b/iso/sgx/sgx_linux_x64_driver.bin differ diff --git a/roadmap.md b/roadmap.md deleted file mode 100644 index defab3b2..00000000 --- a/roadmap.md +++ /dev/null @@ -1,41 +0,0 @@ -# DAppNode Roadmap - -The following roadmap covers the core development of DAppNode, accounting for the next 26 weeks of development work needed to continue the project. Take into account the core functionality has already been built and the MVP is live and currently onboarding users at dappnode.io. - - -_June 15th - July 15th_ -* ~~Launch MVP version~~ -* ~~Apply for a Grant~~ -* Support 10 DAppNode user installs -* On board 4 Decentralized websites -* Create entry portal -* Bug fixing/ user support - -#### #1 SDK for DApps -- Define specification for DPNs (DAppNode Packages) -- Outline methodology for creating DPNs -- Develop SDK tools to automate and assist the methodology - - - -#### #2 Improvement of DAppNode core -- Reducing package size. -- Improvement to installer, documentation, easiser to complete process. -- Creating robust installation guide for potential errors. -- Reducing friction for install, faster chain syncing. -- Hosting DAppNode core in IPFS. - - - -#### #3 Documentation -- Technical (Developer specific) -- Non technical (blog posts, promotional, general applications) - - - -#### + Stretch Goal - - New Admin.UI - - Creating pre-loaded DAppNode USB's for free distribution. - - - diff --git a/scheme/Dappnode_scheme.png b/scheme/Dappnode_scheme.png deleted file mode 100644 index 1dd22675..00000000 Binary files a/scheme/Dappnode_scheme.png and /dev/null differ diff --git a/scheme/Dappnode_scheme.xml b/scheme/Dappnode_scheme.xml deleted file mode 100644 index c1d915ee..00000000 --- a/scheme/Dappnode_scheme.xml +++ /dev/null @@ -1 +0,0 @@ -7Vltc9o4EP41zNx9SAfbmJePBEjCTAsM9Nrrp4wsL7YmwvLJIsD9+kq2DJZtEuYCtNcUPmDtSrvy7rOPXmg4g9X2nqM4/MR8oA276W8bzrBh25bVa8ofJdllkk7PygQBJ77udBAsyL+ghXpcsCY+JEZHwRgVJDaFmEURYGHIEOdsY3ZbMmp6jVEAFcECI1qVfiW+CDNp1+4c5A9AgjD3bLV7mcZD+CngbB1pfw3bWaafTL1CuS39okmIfLYpiJxRwxlwxkT2tNoOgKrY5mHLxt0d0e7nzSESpwzIRzwjuoZ8ym0qx97Ganpip0PS/met5nRLSQQ3oX73vuwiDbgHtXwK1O9wMpjOR7kp6T/ONf/JfDMdKPMYiZskRYvSdeNt1XNuP4lRdHjRvBeHZE3Fo8eMkU2BPBL5sDX63lhGH4qiwNBDVPW+2CUCVrI34ziERHAkGJfNP3yGn4DfYLaKWQJ/FiKTTdScvMcvJXlzKo7F+zVXtuHETmsEVHIsqd6ERMAiRlhpN5JTpCwUK6rV+ypRjYCiRJW3woQMJ8H6eUkoHTAqw60cOD6C7hKrwYKzJyho2rgL3nI/qWKx5NUAXMC2INLFcw9sBYLvZBettZu6kDXR2R3d3hxoo5UXe1igDDunSKSpKtjbPpSrfNAVW1+97aPFqyolj/14MX28hwg0Fl9IV3GUaakGH6cU41/eOhLrlBcTmWy7Keei6D2bDWHRK86LszwbgIqgKYKpBKClq761AEo/ZwJQyzUAZHWrALLqANQ+A346FfyMo0QgSuEFnLwJEJPZpwIaSNnbu4VBy/2BMOjW0EgpzBD5fbWvki2sYqUiV4ysfHO++1tF8IObN7/lui0Rmcp2dfObjvXRyCVszTGYexSBeAD5a2ci8I19XDW8hfC5NdHLZRyopKNnc/dXF1LtYcZIWgQ6e07bXAUst5SV7HX0qOJ2rGTI7paWE6dkKItBxVCa4f1rn5T03rWS3jlb0js/VdL3y/r/KOlWdbs/nMweR58f7qbzr/358EK0/wFkQuRxkK0QidLQJ4w+/9y8v1zauHb/6Le9tnuu5d8yc78H1TV437Jr0XA7nryAg7rjypuwMZwsTkfECeel9wEUp3VNoDjHaGPw0B9PLkQaM8SJ2F3yeHIuI2ilcBR5SXz8PDUSIXBYq7sBjzL8hMOUCt85/5UX0VbvmrBu1cJ6Np9+GS/G08l4cv8aD177fuksiMUcfJkygmiSLsqbiDKkzmMJ8GciMfSbg+vB2v2RHOzWgvXL7AX6PftaPZ4lgKWy4PU3SEyQOG5pN3/Nk7xVvRFUIBnP7hYXWqQz0ycyx6+f/TJFXHc/X73PS7M/WXzuf/w4mv+SixmKY0qwvkw++Ubx3dJT+bLhkhsu2Tz8k5ndVhz+LnZG3wE= \ No newline at end of file diff --git a/scripts/check-disks.sh b/scripts/check-disks.sh new file mode 100755 index 00000000..d7385c41 --- /dev/null +++ b/scripts/check-disks.sh @@ -0,0 +1,15 @@ +#!/bin/sh +# +# This is run by d-i before the partman step (e.g. d-i partman/early_command) + +USBDEV=$(list-devices usb-partition | sed "s/\(.*\)./\1/" | sort -u | head -1 ); +if [ -z "${USBDEV}" ]; then + DEVICE=$(list-devices disk) +else + DEVICE=$(list-devices disk | grep -v "${USBDEV}") +fi +for DISK in ${DEVICE}; do + DISKS="${DISKS} ${DISK}"; +done; +DISKS=$(echo "${DISKS}" | sed "s/^ //g"); +debconf-set partman-auto/disk "$DISKS"; \ No newline at end of file diff --git a/scripts/dappnode_access_credentials.sh b/scripts/dappnode_access_credentials.sh new file mode 100755 index 00000000..f9c614df --- /dev/null +++ b/scripts/dappnode_access_credentials.sh @@ -0,0 +1,110 @@ +#!/bin/bash + +# This script will iterate over the access methods in dappnode +# and return the credentials for each service available + +############# +#0.VARIABLES# +############# +# Containers +DAPPMANAGER_CONTAINER="DAppNodeCore-dappmanager.dnp.dappnode.eth" +WIFI_CONTAINER="DAppNodeCore-wifi.dnp.dappnode.eth" +WIREGUARD_CONTAINER="DAppNodeCore-api.wireguard.dnp.dappnode.eth" +OPENVPN_CONTAINER="DAppNodeCore-vpn.dnp.dappnode.eth" +HTTPS_CONTAINER="DAppNodeCore-https.dnp.dappnode.eth" +# Credentials +WIREGUARD_GET_CREDS="docker exec -i $WIREGUARD_CONTAINER getWireguardCredentials" +OPENVPN_GET_CREDS="docker exec -i $OPENVPN_CONTAINER getAdminCredentials" +WIFI_GET_CREDS=$(grep 'SSID\|WPA_PASSPHRASE' /usr/src/dappnode/DNCORE/docker-compose-wifi.yml) +# Endpoints +AVAHI_ENDPOINT="dappnode.local" +DAPPNODE_ADMINUI_URL="http://my.dappnode" +DAPPNODE_ADMINUI_LOCAL_URL="http://${AVAHI_ENDPOINT}" +DAPPNODE_WELCOME_URL="http://welcome.dappnode.io" + +############# +#1.FUNCTIONS# +############# + +function dappnode_startup_check () { + echo -ne "Checking DAppNode connectivity methods (press ctrl+c to stop)...\n" + n=0 + until [ "$n" -ge 8 ] + do + [ "$(docker inspect -f '{{.State.Running}}' ${DAPPMANAGER_CONTAINER} 2> /dev/null)" = "true" ] && break + n=$((n+1)) + echo -n "." + sleep 4 + done +} + +# $1 Connection method $2 Credentials +function create_connection_message () { + echo -e "\e[32mConnect to DAppNode through $1 using the following credentials:\e[0m\n$2\n\nAccess your DAppNode at \e[4m$DAPPNODE_ADMINUI_URL\e\n\n[0mDiscover more ways to connect to your DAppNode at \e[4m$DAPPNODE_WELCOME_URL\e[0m" +} + +function wifi_connection () { + # NOTE: network interface may be in use by host => $(cat /sys/class/net/${INTERFACE}/operstate)" !== "up") + # NOTE: wifi has a delay up to 1 min + # wifi container running + [ "$(docker inspect -f '{{.State.Running}}' ${WIFI_CONTAINER} 2> /dev/null)" = "true" ] && \ + # Check interface variable is set + [ -n "$(docker exec -it $WIFI_CONTAINER iw dev | grep 'Interface' | awk 'NR==1{print $2}')" ] && \ + create_connection_message "Wi-Fi" "$WIFI_GET_CREDS" || \ + echo -e "\e[33mWifi not detected\e[0m" +} + +function avahi_connection () { + # shellcheck disable=SC2143 + avahi-resolve -n $AVAHI_ENDPOINT > /dev/null 2>&1 && \ + # Https container exists + [ "$(docker ps -a | grep ${HTTPS_CONTAINER})" ] && \ + # Https container running + [ "$(docker inspect -f '{{.State.Running}}' ${HTTPS_CONTAINER})" = "true" ] && \ + # Https env variable LOCAL_PROXYING="true" + [ "$(docker exec -i ${HTTPS_CONTAINER} sh -c 'echo "$LOCAL_PROXYING"')" = "true" ] && \ + # avahi-daemon running => systemctl is-active avahi-daemon RETURNS "active" or "inactive" + [ "$(systemctl is-active avahi-daemon)" = "active" ] && \ + echo -e "\n\e[32mConnect to DAppNode through Local Proxying.\e[0m\n\nVisit \e[4m$DAPPNODE_ADMINUI_LOCAL_URL\e\n\n[0mCheck out all the access methods available to connect to your DAppNode at \e[4m$DAPPNODE_WELCOME_URL\e[0m\n" || \ + echo -e "\e[33mLocal Proxy not detected\e[0m" +} + +function wireguard_connection () { + # wireguard container exists + # shellcheck disable=SC2143 + [ "$(docker ps -a | grep ${WIREGUARD_CONTAINER})" ] && \ + # wireguard container running + [ "$(docker inspect -f '{{.State.Running}}' ${WIREGUARD_CONTAINER})" = "true" ] && \ + create_connection_message "Wireguard" "$($WIREGUARD_GET_CREDS)" || \ + echo -e "\e[33mWireguard not detected\e[0m" +} + +function openvpn_connection () { + # openvpn container exists + # shellcheck disable=SC2143 + [ "$(docker ps -a | grep ${OPENVPN_CONTAINER})" ] && \ + # openvpn container running + [ "$(docker inspect -f '{{.State.Running}}' ${OPENVPN_CONTAINER})" = "true" ] && \ + create_connection_message "Open-VPN" "$($OPENVPN_GET_CREDS)" || \ + echo -e "\e[33mOpen VPN not detected\e[0m" +} + +function line_separator () { + echo "=====================" +} + +######## +#2.MAIN# +######## + +dappnode_startup_check +line_separator +wifi_connection +line_separator +avahi_connection +line_separator +wireguard_connection +line_separator +openvpn_connection + +exit 0 diff --git a/scripts/dappnode_install.sh b/scripts/dappnode_install.sh new file mode 100755 index 00000000..fc58ff17 --- /dev/null +++ b/scripts/dappnode_install.sh @@ -0,0 +1,434 @@ +#!/bin/bash + +############# +# VARIABLES # +############# +# Dirs +DAPPNODE_DIR="/usr/src/dappnode" +DAPPNODE_CORE_DIR="${DAPPNODE_DIR}/DNCORE" +LOGS_DIR="$DAPPNODE_DIR/logs" +# Files +CONTENT_HASH_FILE="${DAPPNODE_CORE_DIR}/packages-content-hash.csv" +LOGFILE="${LOGS_DIR}/dappnode_install.log" +MOTD_FILE="/etc/motd" +UPDATE_MOTD_DIR="/etc/update-motd.d" +DAPPNODE_PROFILE="${DAPPNODE_CORE_DIR}/.dappnode_profile" +# Get URLs +PROFILE_BRANCH=${PROFILE_BRANCH:-"master"} +IPFS_ENDPOINT=${IPFS_ENDPOINT:-"http://ipfs.io"} +# PROFILE_URL env is used to fetch the core packages versions that will be used to build the release in script install method +PROFILE_URL=${PROFILE_URL:-"https://github.com/dappnode/DAppNode/releases/latest/download/dappnode_profile.sh"} +DAPPNODE_ACCESS_CREDENTIALS="${DAPPNODE_DIR}/scripts/dappnode_access_credentials.sh" +DAPPNODE_ACCESS_CREDENTIALS_URL="https://github.com/dappnode/DAppNode/releases/latest/download/dappnode_access_credentials.sh" +WGET="wget -q --show-progress --progress=bar:force" +SWGET="wget -q -O-" +# Other +CONTENT_HASH_PKGS=(geth besu nethermind erigon prysm teku lighthouse nimbus lodestar) +ARCH=$(dpkg --print-architecture) +WELCOME_MESSAGE="\nChoose a way to connect to your DAppNode, then go to \e[1mhttp://my.dappnode\e[0m\n\n\e[1m- Wifi\e[0m\t\tScan and connect to DAppNodeWIFI. Get wifi credentials with \e[32mdappnode_wifi\e[0m\n\n\e[1m- Local Proxy\e[0m\tConnect to the same router as your DAppNode. Then go to \e[1mhttp://dappnode.local\e[0m\n\n\e[1m- Wireguard\e[0m\tDownload Wireguard app on your device. Get your dappnode wireguard credentials with \e[32mdappnode_wireguard\e[0m\n\n\e[1m- Open VPN\e[0m\tDownload OPen VPN app on your device. Get your openVPN creds with \e[32mdappnode_openvpn\e[0m\n\n\nTo see a full list of commands available execute \e[32mdappnode_help\e[0m\n" + +# Clean if update +if [ "$UPDATE" = true ]; then + echo "Cleaning for update..." + rm -rf $LOGFILE + rm -rf ${DAPPNODE_CORE_DIR}/docker-compose-*.yml + rm -rf ${DAPPNODE_CORE_DIR}/dappnode_package-*.json + rm -rf ${DAPPNODE_CORE_DIR}/*.tar.xz + rm -rf ${DAPPNODE_CORE_DIR}/*.txz + rm -rf ${DAPPNODE_CORE_DIR}/.dappnode_profile + rm -rf ${CONTENT_HASH_FILE} +fi + +# Create necessary directories +mkdir -p $DAPPNODE_DIR +mkdir -p $DAPPNODE_CORE_DIR +mkdir -p "${DAPPNODE_DIR}/scripts" +mkdir -p "${DAPPNODE_CORE_DIR}/scripts" +mkdir -p "${DAPPNODE_DIR}/config" +mkdir -p $LOGS_DIR + +# TEMPORARY: think a way to integrate flags instead of use files to detect installation type +is_iso_install() { + # Check old and new location of iso_install.log + if [ -f "${DAPPNODE_DIR}/iso_install.log" ] || [ -f "${DAPPNODE_DIR}/logs/iso_install.log" ]; then + IS_ISO_INSTALL=true + else + IS_ISO_INSTALL=false + fi +} + +# Check if port 80 is in use (necessary for HTTPS) +# Returns IS_PORT_USED=true only if port 80 or 443 is used by something OTHER than our HTTPS container +is_port_used() { + # Check if port 80 or 443 is in use at all + local port80_used port443_used + lsof -i -P -n | grep ":80 (LISTEN)" &>/dev/null && port80_used=true || port80_used=false + lsof -i -P -n | grep ":443 (LISTEN)" &>/dev/null && port443_used=true || port443_used=false + + if [ "$port80_used" = false ] && [ "$port443_used" = false ]; then + IS_PORT_USED=false + return + fi + + # If either port is in use, check if it's our HTTPS container + if docker ps --format '{{.Names}}' 2>/dev/null | grep -q "^DAppNodeCore-https.dnp.dappnode.eth$"; then + # Port 80 or 443 is used by our HTTPS container, so we consider it "not used" for package determination + IS_PORT_USED=false + else + # Port 80 or 443 is used by something else + IS_PORT_USED=true + fi +} + +# Determine packages to be installed +determine_packages() { + is_iso_install + is_port_used + if [ "$IS_ISO_INSTALL" == "false" ]; then + if [ "$IS_PORT_USED" == "true" ]; then + PKGS=(BIND IPFS VPN WIREGUARD DAPPMANAGER WIFI) + else + PKGS=(HTTPS BIND IPFS WIREGUARD DAPPMANAGER WIFI) + fi + else + if [ "$IS_PORT_USED" == "true" ]; then + PKGS=(BIND IPFS WIREGUARD DAPPMANAGER WIFI) + else + PKGS=(HTTPS BIND IPFS WIREGUARD DAPPMANAGER WIFI) + fi + fi + echo -e "\e[32mPackages to be installed: ${PKGS[*]}\e[0m" 2>&1 | tee -a $LOGFILE +} + +function valid_ip() { + local ip=$1 + local stat=1 + + if [[ $ip =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then + OIFS=$IFS + IFS='.' + ip=("$ip") + IFS=$OIFS + [[ ${ip[0]} -le 255 && ${ip[1]} -le 255 && + ${ip[2]} -le 255 && ${ip[3]} -le 255 ]] + stat=$? + fi + return $stat +} + +if [[ -n "$STATIC_IP" ]]; then + if valid_ip "$STATIC_IP"; then + echo "$STATIC_IP" >${DAPPNODE_DIR}/config/static_ip + else + echo "The static IP provided: ${STATIC_IP} is not valid." + exit 1 + fi +fi + +# Loads profile, if not exists it means it is script install so the versions will be fetched from the latest profile +[ -f $DAPPNODE_PROFILE ] || ${WGET} -O ${DAPPNODE_PROFILE} ${PROFILE_URL} +# shellcheck disable=SC1090 +source "${DAPPNODE_PROFILE}" + +# The indirect variable expansion used in ${!ver##*:} allows us to use versions like 'dev:development' +# If such variable with 'dev:'' suffix is used, then the component is built from specified branch or commit. +# you can also specify an IPFS version like /ipfs/QmWg8P2b9JKQ8thAVz49J8SbJbCoi2MwkHnUqMtpzDTtxR:0.2.7, it's important +# to include the exact version also in the IPFS hash format since it's needed to be able to download it +determine_packages +for comp in "${PKGS[@]}"; do + ver="${comp}_VERSION" + DOWNLOAD_URL="https://github.com/dappnode/DNP_${comp}/releases/download/v${!ver}" + if [[ ${!ver} == /ipfs/* ]]; then + DOWNLOAD_URL="${IPFS_ENDPOINT}/api/v0/cat?arg=${!ver%:*}" + fi + eval "${comp}_URL=\"${DOWNLOAD_URL}/${comp,,}.dnp.dappnode.eth_${!ver##*:}_linux-${ARCH}.txz\"" + eval "${comp}_YML=\"${DOWNLOAD_URL}/docker-compose.yml\"" + eval "${comp}_MANIFEST=\"${DOWNLOAD_URL}/dappnode_package.json\"" + eval "${comp}_YML_FILE=\"${DAPPNODE_CORE_DIR}/docker-compose-${comp,,}.yml\"" + eval "${comp}_FILE=\"${DAPPNODE_CORE_DIR}/${comp,,}.dnp.dappnode.eth_${!ver##*:}_linux-${ARCH}.txz\"" + eval "${comp}_MANIFEST_FILE=\"${DAPPNODE_CORE_DIR}/dappnode_package-${comp,,}.json\"" +done + +dappnode_core_build() { + for comp in "${PKGS[@]}"; do + ver="${comp}_VERSION" + if [[ ${!ver} == dev:* ]]; then + echo "Cloning & building DNP_${comp}..." + if ! dpkg -s git >/dev/null 2>&1; then + apt-get install -y git + fi + TMPDIR=$(mktemp -d) + pushd "$TMPDIR" || { + echo "Error on pushd" + exit 1 + } + git clone -b "${!ver##*:}" https://github.com/dappnode/DNP_"${comp}" + # Change version in YAML to the custom one + DOCKER_VER=$(echo "${!ver##*:}" | sed 's/\//_/g') + sed -i "s~^\(\s*image\s*:\s*\).*~\1${comp,,}.dnp.dappnode.eth:${DOCKER_VER}~" DNP_"${comp}"/docker-compose.yml + docker compose -f ./DNP_"${comp}"/docker-compose.yml build + cp ./DNP_"${comp}"/docker-compose.yml "${DAPPNODE_CORE_DIR}"/docker-compose-"${comp,,}".yml + cp ./DNP_"${comp}"/dappnode_package.json "${DAPPNODE_CORE_DIR}"/dappnode_package-"${comp,,}".json + rm -r ./DNP_"${comp}" + popd || { + echo "Error on popd" + exit 1 + } + fi + done +} + +dappnode_core_download() { + for comp in "${PKGS[@]}"; do + ver="${comp}_VERSION" + if [[ ${!ver} != dev:* ]]; then + # Download DAppNode Core Images if it's needed + echo "Downloading ${comp} tar..." + eval "[ -f \$${comp}_FILE ] || $WGET -O \$${comp}_FILE \$${comp}_URL || exit 1" + # Download DAppNode Core docker-compose yml files if it's needed + echo "Downloading ${comp} yml..." + eval "[ -f \$${comp}_YML_FILE ] || $WGET -O \$${comp}_YML_FILE \$${comp}_YML || exit 1" + # Download DAppNode Core manifest files if it's needed + echo "Downloading ${comp} manifest..." + eval "[ -f \$${comp}_MANIFEST_FILE ] || $WGET -O \$${comp}_MANIFEST_FILE \$${comp}_MANIFEST || exit 1" + fi + done +} + +dappnode_core_load() { + for comp in "${PKGS[@]}"; do + ver="${comp}_VERSION" + if [[ ${!ver} != dev:* ]]; then + eval "[ ! -z \$(docker images -q ${comp,,}.dnp.dappnode.eth:${!ver##*:}) ] || docker load -i \$${comp}_FILE 2>&1 | tee -a \$LOGFILE" + fi + done +} + +customMotd() { + + generateMotdText + + if [ -d "${UPDATE_MOTD_DIR}" ]; then + # Ubuntu configuration + modifyMotdGeneration + fi +} + +# Debian distros use /etc/motd plain text file +generateMotdText() { + # Check and create the MOTD file if it does not exist + if [ ! -f "${MOTD_FILE}" ]; then + touch "${MOTD_FILE}" + fi + + # Write the ASCII art and welcome message as plain text + cat <<'EOF' >"${MOTD_FILE}" + ___ _ + | \ __ _ _ __ _ __ _ _ ___ __| |___ + | |) / _` | '_ \ '_ \ ' \/ _ \/ _` / -_) + |___/\__,_| .__/ .__/_||_\___/\__,_\___| + |_| |_| +EOF + echo -e "$WELCOME_MESSAGE" >>"${MOTD_FILE}" +} + +# Ubuntu distros use /etc/update-motd.d/ to generate the motd +modifyMotdGeneration() { + disabled_motd_dir="${UPDATE_MOTD_DIR}/disabled" + + mkdir -p "${disabled_motd_dir}" + + # Move all the files in /etc/update-motd.d/ to /etc/update-motd.d/disabled/ + # Except for the files listed in "files_to_keep" + files_to_keep="00-header 50-landscape-sysinfo 98-reboot-required" + for file in ${UPDATE_MOTD_DIR}/*; do + base_file=$(basename "${file}") + if [ -f "${file}" ] && ! echo "${files_to_keep}" | grep -qw "${base_file}"; then + mv "${file}" "${disabled_motd_dir}/" + fi + done +} + +addSwap() { + # Is swap enabled? + IS_SWAP=$(swapon --show | wc -l) + + # if not then create it + if [ "$IS_SWAP" -eq 0 ]; then + echo -e '\e[32mSwap not found. Adding swapfile.\e[0m' + #RAM=$(awk '/MemTotal/ {print $2}' /proc/meminfo) + #SWAP=$(($RAM * 2)) + SWAP=8388608 + fallocate -l ${SWAP}k /swapfile + chmod 600 /swapfile + mkswap /swapfile + swapon /swapfile + echo '/swapfile none swap defaults 0 0' >>/etc/fstab + else + echo -e '\e[32mSwap found. No changes made.\e[0m' + fi +} + +dappnode_start() { + echo -e "\e[32mDAppNode starting...\e[0m" 2>&1 | tee -a $LOGFILE + # shellcheck disable=SC1090 + source "${DAPPNODE_PROFILE}" >/dev/null 2>&1 + + # Execute `compose-up` independently + # To execute `compose-up` against more than 1 compose, composes files must share compose file version (e.g 3.5) + for comp in "${DNCORE_YMLS_ARRAY[@]}"; do + docker compose -f "$comp" up -d 2>&1 | tee -a $LOGFILE + echo "${comp} started" 2>&1 | tee -a $LOGFILE + done + echo -e "\e[32mDAppNode started\e[0m" 2>&1 | tee -a $LOGFILE + + # Show credentials to the user on login + USER=$(grep 1000 /etc/passwd | cut -f 1 -d:) + [ -n "$USER" ] && USER_HOME=/home/$USER || USER_HOME=/root + + # Add profile sourcing to both .profile and .bashrc for maximum compatibility + for config_file in .profile .bashrc; do + CONFIG_PATH="$USER_HOME/$config_file" + + # Create config file if it doesn't exist + [ ! -f "$CONFIG_PATH" ] && touch "$CONFIG_PATH" + + # Add profile sourcing if not already present + if ! grep -q "${DAPPNODE_PROFILE}" "$CONFIG_PATH"; then + echo "######## DAPPNODE PROFILE ########" >>"$CONFIG_PATH" + echo -e "source ${DAPPNODE_PROFILE}\n" >>"$CONFIG_PATH" + fi + done + + # Remove return from profile + sed -i '/return/d' $DAPPNODE_PROFILE | tee -a $LOGFILE + + # Download access_credentials script + [ -f $DAPPNODE_ACCESS_CREDENTIALS ] || ${WGET} -O ${DAPPNODE_ACCESS_CREDENTIALS} ${DAPPNODE_ACCESS_CREDENTIALS_URL} + + # Delete dappnode_install.sh execution from rc.local if exists, and is not the unattended firstboot + if [ -f "/etc/rc.local" ] && [ ! -f "/usr/src/dappnode/.firstboot" ]; then + sed -i '/\/usr\/src\/dappnode\/scripts\/dappnode_install.sh/d' /etc/rc.local 2>&1 | tee -a $LOGFILE + fi + + # Display help message to the user + echo -e "Execute \e[32mdappnode_help\e[0m to see a full list with commands available" +} + +installExtraDpkg() { + if [ -d "/usr/src/dappnode/extra_dpkg" ]; then + dpkg -i /usr/src/dappnode/iso/extra_dpkg/*.deb 2>&1 | tee -a $LOGFILE + fi +} + +grabContentHashes() { + if [ ! -f "${CONTENT_HASH_FILE}" ]; then + for comp in "${CONTENT_HASH_PKGS[@]}"; do + CONTENT_HASH=$(eval "${SWGET}" https://github.com/dappnode/DAppNodePackage-"${comp}"/releases/latest/download/content-hash) + if [ -z "$CONTENT_HASH" ]; then + echo "ERROR! Failed to find content hash of ${comp}." 2>&1 | tee -a $LOGFILE + exit 1 + fi + echo "${comp}.dnp.dappnode.eth,${CONTENT_HASH}" >>${CONTENT_HASH_FILE} + done + fi +} + +# /sgx will only be installed on ISO's dappnode not on standalone script +installSgx() { + if [ -d "/usr/src/dappnode/iso/sgx" ]; then + # from sgx_linux_x64_driver_2.5.0_2605efa.bin + /usr/src/dappnode/iso/sgx/sgx_linux_x64_driver.bin 2>&1 | tee -a $LOGFILE + /usr/src/dappnode/iso/sgx/enable_sgx 2>&1 | tee -a $LOGFILE + fi +} + +# /extra_dpkg will only be installed on ISO's dappnode not on standalone script +installExtraDpkg() { + if [ -d "/usr/src/dappnode/iso/extra_dpkg" ]; then + dpkg -i /usr/src/dappnode/extra_dpkg/*.deb 2>&1 | tee -a $LOGFILE + fi +} + +# The main user needs to be added to the docker group to be able to run docker commands without sudo +# Explained in: https://docs.docker.com/engine/install/linux-postinstall/ +addUserToDockerGroup() { + # UID is provided to the first regular user created in the system + USER=$(grep 1000 "/etc/passwd" | cut -f 1 -d:) + + # If USER is not found, warn the user and return + if [ -z "$USER" ]; then + echo -e "\e[33mWARN: Default user not found. Could not add it to the docker group.\e[0m" 2>&1 | tee -a $LOGFILE + return + fi + + if groups "$USER" | grep &>/dev/null '\bdocker\b'; then + echo -e "\e[32mUser $USER is already in the docker group\e[0m" 2>&1 | tee -a $LOGFILE + return + fi + + # This step is already done in the dappnode_install_pre.sh script, + # but it's not working in the Ubuntu ISO because the late-commands in the autoinstall.yaml + # file are executed before the user is created. + usermod -aG docker "$USER" + echo -e "\e[32mUser $USER added to the docker group\e[0m" 2>&1 | tee -a $LOGFILE +} + +############################################## +#### SCRIPT START #### +############################################## + +echo -e "\e[32m\n##############################################\e[0m" 2>&1 | tee -a $LOGFILE +echo -e "\e[32m#### DAPPNODE INSTALLER ####\e[0m" 2>&1 | tee -a $LOGFILE +echo -e "\e[32m##############################################\e[0m" 2>&1 | tee -a $LOGFILE + +echo -e "\e[32mCreating swap memory...\e[0m" 2>&1 | tee -a $LOGFILE +addSwap + +echo -e "\e[32mCustomizing login...\e[0m" 2>&1 | tee -a $LOGFILE +customMotd + +echo -e "\e[32mInstalling extra packages...\e[0m" 2>&1 | tee -a $LOGFILE +installExtraDpkg + +echo -e "\e[32mGrabbing latest content hashes...\e[0m" 2>&1 | tee -a $LOGFILE +grabContentHashes + +if [ "$ARCH" == "amd64" ]; then + echo -e "\e[32mInstalling SGX modules...\e[0m" 2>&1 | tee -a $LOGFILE + installSgx + + echo -e "\e[32mInstalling extra packages...\e[0m" 2>&1 | tee -a $LOGFILE + installExtraDpkg # TODO: Why is this being called twice? +fi + +echo -e "\e[32mAdding user to docker group...\e[0m" 2>&1 | tee -a $LOGFILE +addUserToDockerGroup + +echo -e "\e[32mCreating dncore_network if needed...\e[0m" 2>&1 | tee -a $LOGFILE +docker network create --driver bridge --subnet 172.33.0.0/16 dncore_network 2>&1 | tee -a $LOGFILE + +echo -e "\e[32mBuilding DAppNode Core if needed...\e[0m" 2>&1 | tee -a $LOGFILE +dappnode_core_build + +echo -e "\e[32mDownloading DAppNode Core...\e[0m" 2>&1 | tee -a $LOGFILE +dappnode_core_download + +echo -e "\e[32mLoading DAppNode Core...\e[0m" 2>&1 | tee -a $LOGFILE +dappnode_core_load + +if [ ! -f "/usr/src/dappnode/.firstboot" ]; then + echo -e "\e[32mDAppNode installed\e[0m" 2>&1 | tee -a $LOGFILE + dappnode_start +fi + +# Run test in interactive terminal +if [ -f "/usr/src/dappnode/.firstboot" ]; then + # ensure openvt is installed prior to using it + apt-get update + apt-get install -y kbd + openvt -s -w -- sudo -u root /usr/src/dappnode/scripts/dappnode_test_install.sh + exit 0 +fi + +exit 0 diff --git a/scripts/dappnode_install_pre.sh b/scripts/dappnode_install_pre.sh new file mode 100755 index 00000000..d6cf4739 --- /dev/null +++ b/scripts/dappnode_install_pre.sh @@ -0,0 +1,191 @@ +#!/bin/bash + +# Execute script with flag UPDATE to update the host: ./dappnode_install_pre.sh UPDATE + +DAPPNODE_DIR="/usr/src/dappnode" +LOGS_DIR="$DAPPNODE_DIR/logs" +lsb_dist="$(. /etc/os-release && echo "$ID")" + +detect_installation_type() { + if [ -f "${DAPPNODE_DIR}/iso_install.log" ]; then + LOG_FILE="${LOGS_DIR}/iso_install.log" + rm -f "${DAPPNODE_DIR}/iso_install.log" + ISO_INSTALLATION=true + else + LOG_FILE="${LOGS_DIR}/install.log" + ISO_INSTALLATION=false + fi +} + +add_docker_repo() { + apt-get update -y + apt-get remove -y docker docker-engine docker.io containerd runc | tee -a $LOG_FILE + + # Add Docker GPG key + apt-get install -y ca-certificates curl lsb-release | tee -a $LOG_FILE + install -m 0755 -d /etc/apt/keyrings + curl -fsSL "https://download.docker.com/linux/${lsb_dist}/gpg" -o /etc/apt/keyrings/docker.asc + chmod a+r /etc/apt/keyrings/docker.gpg + + # Add the repository to APT sources + echo \ + "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/$lsb_dist $(lsb_release -cs) stable" | + tee /etc/apt/sources.list.d/docker.list >/dev/null + + apt-get update -y +} + +# DOCKER INSTALLATION +install_docker() { + apt-get update -y + apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin | tee -a $LOG_FILE + + # Ensure xz is installed + [ -f "/usr/bin/xz" ] || (apt-get install -y xz-utils) + + # Not working in Ubuntu ISO because the user is not created before executing late-commands + USER=$(grep 1000 "/etc/passwd" | cut -f 1 -d:) + [ -z "$USER" ] || usermod -aG docker "$USER" + + # Disable check if ISO installation since it is not possible to check in this way + if [ "$ISO_INSTALLATION" = "false" ]; then + # Validate the installation of docker + if docker -v; then + echo -e "\e[32m \n\n Verified docker installation \n\n \e[0m" 2>&1 | tee -a $LOG_FILE + else + echo -e "\e[31m \n\n ERROR: docker is not installed \n\n Please re-install it \n\n \e[0m" 2>&1 | tee -a $LOG_FILE + exit 1 + fi + fi +} + +# DOCKER-COMPOSE FOR LEGACY SCRIPTS, SHOULD BE REMOVED EVENTUALLY +alias_docker_compose() { + cat >/usr/local/bin/docker-compose </dev/null 2>&1; then + echo -e "\e[32m \n\n Verified wiregurd-dkms installation \n\n \e[0m" 2>&1 | tee -a $LOG_FILE + else + echo -e "\e[31m \n\n WARNING: wireguard kernel module is not installed, Wireguard DAppNode package might not work! \n\n \e[0m" 2>&1 | tee -a $LOG_FILE + fi +} + +# LSOF INSTALLATION: used to scan host port 80 in use, https package installation will deppend on it +install_lsof() { + apt-get update -y + apt-get install lsof -y | tee -a $LOG_FILE + if lsof -v >/dev/null 2>&1; then + echo -e "\e[32m \n\n Verified lsof installation \n\n \e[0m" 2>&1 | tee -a $LOG_FILE + else + echo -e "\e[31m \n\n WARNING: lsof not installed, HTTPS DAppNode package might not be installed! \n\n \e[0m" 2>&1 | tee -a $LOG_FILE + fi +} + +# IPTABLES INSTALLATION: mandatory for docker, on bullseye is not installed by default +install_iptables() { + apt-get update -y + apt-get install iptables -y | tee -a $LOG_FILE + if iptables -v >/dev/null 2>&1; then + echo -e "\e[32m \n\n Verified iptables installation \n\n \e[0m" 2>&1 | tee -a $LOG_FILE + else + echo -e "\e[31m \n\n WARNING: iptables not installed, Docker may not work! \n\n \e[0m" 2>&1 | tee -a $LOG_FILE + fi +} + +# HOST UPDATE +host_update() { + apt-get update 2>&1 | tee -a $LOG_FILE + apt-get -y upgrade 2>&1 | tee -a $LOG_FILE +} + +check_ubuntu_connectivity() { + { netplan get | grep "dhcp4: true" &>/dev/null; } || { + echo "Interfaces not found" + exit 1 + } +} + +check_debian_connectivity() { + { [ -f /etc/network/interfaces ] && grep "iface en.* inet dhcp" /etc/network/interfaces &>/dev/null; } || { + echo "Interfaces not found" + exit 1 + } +} + +add_debian_missing_interfaces() { + # shellcheck disable=SC2013 + for IFACE in $(grep "en.*" /usr/src/dappnode/hotplug); do + # shellcheck disable=SC2143 + if [[ $(grep -L "$IFACE" /etc/network/interfaces) ]]; then + { + echo "# $IFACE" + echo "allow-hotplug $IFACE" + echo "iface $IFACE inet dhcp" + } >>/etc/network/interfaces + fi + done +} + +############################################## +#### SCRIPT START #### +############################################## + +detect_installation_type + +# Ensure paths exist +mkdir -p $DAPPNODE_DIR +mkdir -p $LOGS_DIR + +touch $LOG_FILE + +# Only update && upgrade host if needed +if [ "$1" == "UPDATE" ]; then + echo -e "\e[32m \n\n Updating && upgrading host \n\n \e[0m" 2>&1 | tee -a $LOG_FILE + host_update 2>&1 | tee -a $LOG_FILE +fi + +if find /etc/apt/ -name "*.list" -print0 | xargs --null cat | grep -q "https://download.docker.com/linux/$lsb_dist"; then + echo -e "\e[32m \n\n docker repo is already added \n\n \e[0m" 2>&1 | tee -a $LOG_FILE +else + add_docker_repo | tee -a $LOG_FILE +fi + +# Only install docker if needed +if docker -v >/dev/null 2>&1; then + echo -e "\e[32m \n\n docker is already installed \n\n \e[0m" 2>&1 | tee -a $LOG_FILE +else + install_docker 2>&1 | tee -a $LOG_FILE +fi + +# Only install wireguard-dkms if needed +if modprobe wireguard >/dev/null 2>&1; then + echo -e "\e[32m \n\n wireguard-dkms is already installed \n\n \e[0m" 2>&1 | tee -a $LOG_FILE +else + install_wireguard_dkms 2>&1 | tee -a $LOG_FILE +fi + +# Only install lsof if needed +if lsof -v >/dev/null 2>&1; then + echo -e "\e[32m \n\n lsof is already installed \n\n \e[0m" 2>&1 | tee -a $LOG_FILE +else + install_lsof 2>&1 | tee -a $LOG_FILE +fi + +## Add or Update Network Configuration Based on OS +if [ "$lsb_dist" = "ubuntu" ]; then + check_ubuntu_connectivity +else + check_debian_connectivity + add_debian_missing_interfaces +fi diff --git a/scripts/dappnode_test_install.sh b/scripts/dappnode_test_install.sh new file mode 100755 index 00000000..4d5d704d --- /dev/null +++ b/scripts/dappnode_test_install.sh @@ -0,0 +1,66 @@ +#!/bin/bash + +HOME=${HOME:-/home/dappnode} +DAPPNODE_DIR="/usr/src/dappnode" + +error_exit() { + echo -e "\e[31m Error on installation!!! \n \e[0m" + read -r -p "Check installation source. Press enter to continue" + exit 1 +} +SERIAL=$(dmidecode -s system-serial-number) +echo "DAppNode Installation Test" +date +echo "Serial: ${SERIAL}" +echo "################################" + +# TEMPORARY: think a way to integrate flags instead of use files to detect installation type +detect_installation_type() { + # Check for old and new location of iso_install.log + if [ -f "${DAPPNODE_DIR}/iso_install.log" ] || [ -f "${DAPPNODE_DIR}/logs/iso_install.log" ]; then + components=(BIND IPFS WIREGUARD DAPPMANAGER WIFI HTTPS) + fi +} + +components=(BIND IPFS VPN DAPPMANAGER WIFI) +detect_installation_type +if ping -c 1 -q google.com >&/dev/null; then + echo -e "\e[32m Connectivity OK\n \e[0m" +else + error_exit +fi + +if docker -v >/dev/null 2>&1; then + echo -e "\e[32m Docker installed ok\e[0m" +else + error_exit +fi + +if docker compose -v >/dev/null 2>&1; then + echo -e "\e[32m docker compose installed ok\e[0m" +else + error_exit +fi + +for comp in "${components[@]}"; do + if docker images | grep "${comp,,}" >/dev/null 2>&1; then + echo -e "\e[32m ${comp} docker image loaded ok\e[0m" + else + echo -e "\e[31m ${comp} docker image not loaded ok!\e[0m" + error_exit + fi +done + +echo -e "\e[32m docker image versions:\e[0m" +docker images | grep dappnode | awk '{print $1, $2}' + +echo -e "\e[32m doing docker image integrity test...\e[0m" +imgs=$(docker images | grep dappnode | awk '{print $3}') + +for img in $imgs; do + # shellcheck disable=SC2028 + docker save "$img" >/dev/null && echo -ne "\e[32mImage $img OK\n\e[0m" || echo "\e[31mImage $img Corrupted!\n\e[0m" +done + +rm -f /usr/src/dappnode/.firstboot +read -r -p "Test completed successfully. Press enter to continue" diff --git a/scripts/dappnode_uninstall.sh b/scripts/dappnode_uninstall.sh new file mode 100755 index 00000000..66bc9f35 --- /dev/null +++ b/scripts/dappnode_uninstall.sh @@ -0,0 +1,80 @@ +#!/usr/bin/env bash +DAPPNODE_DIR="/usr/src/dappnode" +DAPPNODE_CORE_DIR="${DAPPNODE_DIR}/DNCORE" +PROFILE_FILE="${DAPPNODE_CORE_DIR}/.dappnode_profile" +input=$1 # Allow to call script with argument (must be Y/N) + +[ -f $PROFILE_FILE ] || ( + echo "Error: DAppNode profile does not exist." + exit 1 +) + +uninstall() { + echo -e "\e[32mUninstalling DAppNode\e[0m" + # shellcheck disable=SC1090 + source "${PROFILE_FILE}" &>/dev/null + + DAPPNODE_CONTAINERS="$(docker ps -a --format '{{.Names}}' | grep DAppNode)" + echo -e "\e[32mRemoving DAppNode containers: \e[0m\n${DAPPNODE_CONTAINERS}" + for container in $DAPPNODE_CONTAINERS; do + # Stop DAppNode container + docker stop "$container" &>/dev/null + # Remove DAppNode container + docker rm "$container" &>/dev/null + done + + DAPPNODE_IMAGES="$(docker image ls -a | grep "dappnode")" + echo -e "\e[32mRemoving DAppNode images: \e[0m\n${DAPPNODE_IMAGES}" + for image in $DAPPNODE_IMAGES; do + # Remove DAppNode images + docker image rm "$image" &>/dev/null + done + + DAPPNODE_VOLUMES="$(docker volume ls | grep "dappnode\|dncore")" + echo -e "\e[32mRemoving DAppNode volumes: \e[0m\n${DAPPNODE_VOLUMES}" + for volume in $DAPPNODE_VOLUMES; do + # Remove DAppNode volumes + docker volume rm "$volume" &>/dev/null + done + + # Remove dncore_network + echo -e "\e[32mRemoving docker dncore_network\e[0m" + docker network remove dncore_network || echo "dncore_network already removed" + + # Remove dir + echo -e "\e[32mRemoving DAppNode directory\e[0m" + rm -rf /usr/src/dappnode + + # Remove profile file references from shell config files + USER=$(grep 1000 /etc/passwd | cut -f 1 -d:) + [ -n "$USER" ] && USER_HOME=/home/$USER || USER_HOME=/root + + for config_file in .profile .bashrc; do + CONFIG_PATH="$USER_HOME/$config_file" + if [ -f "$CONFIG_PATH" ]; then + sed -i '/######## DAPPNODE PROFILE ########/d' "$CONFIG_PATH" + sed -i '/.*dappnode_profile/d' "$CONFIG_PATH" + fi + done + + echo -e "\e[32mDAppNode uninstalled!\e[0m" +} + +if [ $# -eq 0 ]; then + read -r -p "WARNING: This script will uninstall and delete all DAppNode +containers and volumes. Are You Sure? [Y/n] " input <&2 +fi + + +case $input in +[yY][eE][sS] | [yY]) + uninstall + ;; +[nN][oO] | [nN]) + echo "Ok." + ;; +*) + echo "Invalid input. Exiting..." + exit 1 + ;; +esac diff --git a/scripts/rc.local b/scripts/rc.local new file mode 100755 index 00000000..ef5afe8a --- /dev/null +++ b/scripts/rc.local @@ -0,0 +1,16 @@ +#!/bin/sh -e +# +# rc.local +# +# This script is executed at the end of each multiuser runlevel. +# Make sure that the script will "exit 0" on success or any other +# value on error. +# +# In order to enable or disable this script just change the execution +# bits. +# +# By default this script does nothing. + +/usr/src/dappnode/scripts/dappnode_install.sh + +exit 0 \ No newline at end of file diff --git a/scripts/static_ip.sh b/scripts/static_ip.sh new file mode 100755 index 00000000..b0d73974 --- /dev/null +++ b/scripts/static_ip.sh @@ -0,0 +1,80 @@ +#!/bin/bash +# This is a debconf-compatible script +# shellcheck disable=SC1091 +. /usr/share/debconf/confmodule + +valid_ip () { + # shellcheck disable=SC3043 + local ip=$1 + + if [[ -z $ip ]]; then + return 0 + fi + + if expr "$ip" : '[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*$' >/dev/null; then + for i in 1 2 3 4; do + if [ "$(echo "$ip" | cut -d. -f$i)" -gt 255 ]; then + return 1 + fi + done + return 0 + else + return 1 + fi +} + +# Create the template file +cat > /tmp/ip.template <<'!EOF!' +Template: ip-question/ask +Type: string +Description: If your public IP is dynamic, or you don't know, leave this field blank and continue. + DAppNode needs to know the public IP of your node. + +Template: ip-question/title +Type: text +Description: Your public IP. + +Template: ip-question/finished +Type: text +Description: Finished. +!EOF! + +cat > /tmp/ip_fail.template <<'!EOF!' +Template: ip-fail/ask +Type: note +Description: This is not a valid IP. + +Template: ip-fail/title +Type: text +Description: Wrong IP +!EOF! + +db_dialog () { + debconf-loadtemplate ip-question /tmp/ip.template + db_settitle ip-question/title + db_input critical ip-question/ask + db_go + db_get ip-question/ask + + if valid_ip "$RET"; then + mkdir -p /target/usr/src/dappnode/config + echo "$RET" > /target/usr/src/dappnode/config/static_ip + else + debconf-loadtemplate ip-fail /tmp/ip_fail.template + db_settitle ip-fail/title + db_input critical ip-fail/ask + db_go + db_get ip-fail/ask + # Ask again until done + db_dialog + fi + db_settitle ip-question/title +} + +db_restore () { + debconf-loadtemplate ip-question /tmp/ip.template + db_settitle ip-question/restore +} + +db_dialog +db_restore \ No newline at end of file diff --git a/team.md b/team.md deleted file mode 100644 index 72821c86..00000000 --- a/team.md +++ /dev/null @@ -1,34 +0,0 @@ -# Instigator/Technical Adviser - Jordi Baylina - -Over 30 years of experience as a developer, and 3 years researching Ethereum blockchain. Telecommunication Engineering BS by UPC and MBA by IESE. One of the strongest Solidity developers in the world and a high impact contributor in the Ethereum community. Co-founder of the White Hat Group which played a major role in rescuing funds from TheDAO and Parity Multisig Hacks, and author of the MiniMe token contract, the elliptic curves solidity library as well as numerous other established contracts in the space. Currently working towards formalizing the ERC-777 token standard. the latest standardization work he launched. Well respected auditor, most notably leading teams to audit the MakerDAO Stable Coin system and aragonOS. -- Email | -- GitHub | [@jbaylina](https://github.com/jbaylina) - - - # Strategic Advisor - Griff Green - -Griff started his career as a blockchain revolutionary in 2013, when he began educating on Bitcoin, coordinating meetups, and creating online Ethereum educational content. After serving as the Community Organizer on Slock.it, he co-founded the White Hat Group in 2016, which secured the at-risk funds (~$100 million USD at the time) from the DAO hack and also helped secure $210 million dollars worth of crypto assets in the Parity Multisig Hack one year later. In 2016, Griff founded Giveth to use smart contracts to radically empower individuals and communities to affect real change. He is a well connected and respected person in the Ethereum community space. Holds a Masters Degree in Digital Currency and is a frequent contributor to many projects and security audits in the space. -- Email | -- GitHub | [@GriffGreen](https://github.com/GriffGreen) - - -# Project Lead - Eduardo Antuña - -An Ethereum DevOps and Solidity developer with an established history of work on software engineering during the last eight years. Frequent Giveth contributor and currently member of the Swarm City development team. -- Email | -- GitHub | [@eduadiez ](https://github.com/eduadiez) - - -# SDK Lead - DappLion - -A multidisciplinary developer with experience in scientific modeling research, statistic analysis and full stack applications. Versatile in javascript and docker Lion is working as an open source contributor for Giveth.io and full time on DAppNode. -- Email | -- GitHub | [@dapplion](https://github.com/dapplion) - - -# Communication - Yalor Mewn - -A project management and communication specialist with a strong focus on holistic team coordination, productivity and time managment within small teams. Yalor started as an open source contributor in 2016, He is now focused fully on the Ethereum ecosystem and supporting the education of incoming open source contributors. - -- Email | -- GitHub | [@YalorMewn](https://github.com/YalorMewn) diff --git a/test/environment_setup.sh b/test/environment_setup.sh new file mode 100755 index 00000000..5670ee4f --- /dev/null +++ b/test/environment_setup.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +######################### +#dappnode_install_pre.sh# +######################### + +# Docker should be uninstalled +# apt-get purge docker-ce docker-ce-cli containerd.io ==> NOT able to uninstall docker on github host + +# Create necessary folder +mkdir -p /etc/network/ +echo "iface en.x inet dhcp" >> /etc/network/interfaces + +########################## +#dappnode_test_install.sh# +########################## + +## Not able to do ping inside github host \ No newline at end of file