diff --git a/.github/workflows/auto_check.yml b/.github/workflows/auto_check.yml new file mode 100644 index 0000000..409a3e5 --- /dev/null +++ b/.github/workflows/auto_check.yml @@ -0,0 +1,34 @@ +name: Update DAppNode package + +on: + schedule: + # * is a special character in YAML so you have to quote this string + # - cron: '00 */4 * * *' + - cron: '* * * * *' +jobs: + dappnodepackage-update: + name: Trigger the DAppNode Package update + runs-on: ubuntu-latest + env: + DISPATCH_REPO: dappnode/DAppNodePackage-geth + UPSTREAM_REPO: ethereum/go-ethereum + steps: + - uses: actions/checkout@v2 + - name: Get the tag + id: get_tag + run: | + UPSTREAM_TAG=$(curl https://api.github.com/repos/$UPSTREAM_REPO/tags | jq .[0].name | tr -d "\"" ) + DNP_UPSTREAM=$(cat dappnode_package.json | jq .upstreamVersion | tr -d "\"" ) + if [ $UPSTREAM_TAG != $DNP_UPSTREAM ];then + echo "::set-output name=trigger_update::true" + fi + echo ::set-output name=TAG::$UPSTREAM_TAG + + - name: Send dispatch event to the DAppNode Package repository + if: steps.get_tag.outputs.trigger_update == 'true' + run: | + curl -v -X POST -u "${{ secrets.PAT_GITHUB }}" \ + -H "Accept: application/vnd.github.everest-preview+json" \ + -H "Content-Type: application/json" \ + --data '{"event_type":"new_release", "client_payload": { "tag":"${{ steps.get_tag.outputs.TAG }}"}}' \ + https://api.github.com/repos/$DISPATCH_REPO/dispatches diff --git a/.github/workflows/dispatch_release.yml b/.github/workflows/dispatch_release.yml new file mode 100644 index 0000000..64acb74 --- /dev/null +++ b/.github/workflows/dispatch_release.yml @@ -0,0 +1,36 @@ +name: "Main" +on: + repository_dispatch: + pull_request: + push: + branches: + - "master" + - "v[0-9]+.[0-9]+.[0-9]+" + paths-ignore: + - "README.md" + +jobs: + build-test: + runs-on: ubuntu-16.04 + name: Build test + if: github.event_name != 'push' + steps: + - name: Checkout + uses: actions/checkout@v2 + - run: docker-compose build + + release: + name: Release + runs-on: ubuntu-latest + if: github.event_name == 'push' || github.event_name == 'repository_dispatch' + steps: + - uses: actions/checkout@v2 + - name: Setup node + uses: actions/setup-node@v1 + with: + node-version: "10.x" + - name: Publish + run: npx @dappnode/dappnodesdk publish patch --dappnode_team_preset + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + DEVELOPER_ADDRESS: "0xf35960302a07022aba880dffaec2fdd64d5bf1c1" diff --git a/.gitignore b/.gitignore index 2bd624b..9b98eb1 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ build_* +.env \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..196c130 --- /dev/null +++ b/README.md @@ -0,0 +1,69 @@ +# Görli testnet DAppNode package + +[![DAppNodeStore Available](https://img.shields.io/badge/DAppNodeStore-Available-brightgreen.svg)](http://my.dappnode/#/installer/geth.dnp.dappnode.eth) + + +[![Geth github](https://img.shields.io/badge/Geth-Github-blue.svg)](https://github.com/ethereum/go-ethereum) + +You can use this package without installing it in your DAppNode following these instructions: + +## Prerequisites + +- git + + Install [git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) commandline tool. + +- docker + + Install [docker](https://docs.docker.com/engine/installation). The community edition (docker-ce) will work. In Linux make sure you grant permissions to the current user to use docker by adding current user to docker group, `sudo usermod -aG docker $USER`. Once you update the users group, exit from the current terminal and open a new one to make effect. + +- docker-compose + + Install [docker-compose](https://docs.docker.com/compose/install) + +**Note**: Make sure you can run `git`, `docker ps`, `docker-compose` without any issue and without sudo command. + + +## Buidling + +`docker-compose build` + +## Running + +### Start + +`docker-compose up -d` + +### View logs + +`docker-compose logs -f` + +### Stop + +`docker-compose down` + +## Extra options + +You can edit the `docker-compose.yml` and add extra options, such as: +``` + - EXTRA_OPTS=--wsapi db,eth,net,ssh,miner,web3,personal,admin,txpool +``` + +## Connect using web3js + +If the package is running and you're connected to your dappnode you can use: +``` +var Web3 = require('web3'); +var web3 = new Web3('ws://my.geth.dappnode:8546') +web3.eth.getBlockNumber().then(console.log) +``` +In case you are running it locally: +``` +var Web3 = require('web3'); +var web3 = new Web3('ws://127.0.0.1:8546') +web3.eth.getBlockNumber().then(console.log) +``` + +## License + +This project is licensed under the GNU General Public License v3.0 - see the [LICENSE](LICENSE) file for details diff --git a/build/Dockerfile b/build/Dockerfile index 0f11e46..5e1b655 100644 --- a/build/Dockerfile +++ b/build/Dockerfile @@ -1,19 +1,16 @@ # Build Geth in a stock Go builder container -FROM golang:1.11-alpine as builder +FROM golang:1.14-alpine as builder -WORKDIR /usr/src/app +ARG UPSTREAM_VERSION -RUN apk add --no-cache make gcc musl-dev linux-headers git jq - -ARG COMMIT=cfbb969da803d4cc92e1a64fc1b3c06db299b564 - -RUN git clone https://github.com/ethereum/go-ethereum.git -RUN cd go-ethereum && git checkout $COMMIT && make geth +RUN apk add --no-cache make gcc musl-dev linux-headers git && \ + git clone -b ${UPSTREAM_VERSION} https://github.com/ethereum/go-ethereum.git && \ + cd go-ethereum && make geth # Pull Geth into a second stage deploy alpine container FROM alpine:latest RUN apk add --no-cache ca-certificates -COPY --from=builder /usr/src/app/go-ethereum/build/bin/geth /usr/local/bin/ +COPY --from=builder /go/go-ethereum/build/bin/geth /usr/local/bin -ENTRYPOINT geth --datadir /root/.ethereum/ethchain-geth --rpc --rpcaddr 0.0.0.0 --rpccorsdomain "*" --rpcvhosts "*" --ws --wsorigins "*" --wsaddr 0.0.0.0 $EXTRA_OPTS +ENTRYPOINT geth --rpc --rpcaddr 0.0.0.0 --rpccorsdomain "*" --rpcvhosts "*" --ws --wsorigins "*" --wsaddr 0.0.0.0 --syncmode ${SYNCMODE:-fast} --nousb $EXTRA_OPTS diff --git a/dappnode_package.json b/dappnode_package.json index 2a97c86..4150b55 100644 --- a/dappnode_package.json +++ b/dappnode_package.json @@ -1,30 +1,33 @@ { - "name": "ethchain-geth.public.dappnode.eth", - "version": "0.0.3", - "description": "Mainnet Geth", - "avatar": "/ipfs/QmTfnrUdZWaMgr2Zi1h1Z7zS5CbYtQZRs72yqKZQHj5fxT", + "name": "geth.dnp.dappnode.eth", + "version": "0.1.9", + "upstreamVersion": "v1.9.21", + "shortDescription": "Geth is the official Go implementation of the Ethereum protocol.", + "description": "Ethereum is a global, open-source platform for decentralized applications where you can write code that controls digital value, runs exactly as programmed, and is accessible anywhere in the world.", "type": "library", "chain": "ethereum", - "image": { - "path": "ethchain-geth.public.dappnode.eth_0.0.3.tar.xz", - "hash": "/ipfs/QmdQF3arvXiEkJ8DSR1auzCqxyhpmv1fGL1acTBQYyZvfr", - "size": 16184810, - "restart": "always", - "ports": [ - "61313:30303", - "61313:30303/udp", - "61314:30304" - ], - "volumes": [ - "ethchain-geth:/root/.ethereum/ethchain-geth" - ], - "environment": [ - "EXTRA_OPTS=--rpcapi eth,net,web3,txpool" - ] - }, - "author": "nanexcool", + "author": "DAppNode Association (https://github.com/dappnode)", + "contributors": [ + "Mariano Conti (nanexcool) (hhttps://github.com/nanexcool)", + "Eduardo Antuña (https://github.com/eduadiez)" + ], + "categories": [ + "Blockchain" + ], "license": "GLP-3.0", + "architectures": [ + "linux/amd64", + "linux/arm64" + ], "links": { - "endpoint": "http://my.ethchain-geth.public.dappnode.eth:8545" + "endpoint": "http://geth.dappnode:8545", + "homepage": "https://github.com/dappnode/DAppNodePackage-geth#readme" + }, + "repository": { + "type": "git", + "url": "https://github.com/dappnode/DAppNodePackage-geth.git" + }, + "bugs": { + "url": "https://github.com/dappnode/DAppNodePackage-geth/issues" } } \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 677b6e4..5bc55a6 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,17 +1,20 @@ version: '3.4' services: - ethchain-geth.public.dappnode.eth: - image: 'ethchain-geth.public.dappnode.eth:0.0.3' - build: ./build + geth.dnp.dappnode.eth: + image: 'geth.dnp.dappnode.eth:0.1.9' + build: + context: ./build + args: + UPSTREAM_VERSION: v1.9.21 volumes: - - 'ethchain-geth:/root/.ethereum/ethchain-geth' + - 'geth:/root/.ethereum' environment: - - EXTRA_OPTS= + - 'EXTRA_OPTS=--rpcapi eth,net,web3,txpool' + - SYNCMODE ports: - - '127.0.0.1:8546:8546' - - '127.0.0.1:8545:8545' - - '61313:30303' - - '61313:30303/udp' - - '61314:30304/udp' + - '30303' + - 30303/udp + - 30304/udp + restart: always volumes: - ethchain-geth: {} \ No newline at end of file + geth: {} diff --git a/geth-avatar.png b/geth-avatar.png new file mode 100644 index 0000000..27b1dff Binary files /dev/null and b/geth-avatar.png differ diff --git a/releases.json b/releases.json new file mode 100644 index 0000000..48986a9 --- /dev/null +++ b/releases.json @@ -0,0 +1,64 @@ +{ + "0.1.2": { + "hash": "/ipfs/QmZmT9gEw7YdXHh9Yx22sHZYtWri1f1SrQxBQs4ctKkSC2", + "type": "directory", + "uploadedTo": { + "dappnode": "Fri, 29 Nov 2019 21:53:08 GMT" + }, + "link": "http://my.dappnode/#/sdk/publish/r=geth.dnp.dappnode.eth&v=0.1.2&h=%2Fipfs%2FQmZmT9gEw7YdXHh9Yx22sHZYtWri1f1SrQxBQs4ctKkSC2" + }, + "0.1.3": { + "hash": "/ipfs/QmbrBkpBGmx79B5anoTQLhq8wnYPCiz69eNWwu4jiuMGFx", + "type": "directory", + "uploadedTo": { + "dappnode": "Fri, 03 Jan 2020 14:56:46 GMT" + }, + "link": "http://my.dappnode/#/sdk/publish/r=geth.dnp.dappnode.eth&v=0.1.3&h=%2Fipfs%2FQmbrBkpBGmx79B5anoTQLhq8wnYPCiz69eNWwu4jiuMGFx" + }, + "0.1.4": { + "hash": "/ipfs/QmNqDvqAyy3pN3PvymB6chM7S1FgYyive8LosVKUuaDdfd", + "type": "directory", + "uploadedTo": { + "dappnode": "Fri, 06 Mar 2020 14:06:12 GMT" + }, + "link": "http://my.dappnode/#/sdk/publish/r=geth.dnp.dappnode.eth&v=0.1.4&h=%2Fipfs%2FQmNqDvqAyy3pN3PvymB6chM7S1FgYyive8LosVKUuaDdfd" + }, + "0.1.5": { + "hash": "/ipfs/QmYSoV4pxNZmHckZHXKCLBXBeESWYdbrCgduGFwpWLzPoi", + "type": "directory", + "uploadedTo": { + "dappnode": "Fri, 17 Apr 2020 12:08:45 GMT" + }, + "link": "http://my.dappnode/#/sdk/publish/r=geth.dnp.dappnode.eth&v=0.1.5&h=%2Fipfs%2FQmYSoV4pxNZmHckZHXKCLBXBeESWYdbrCgduGFwpWLzPoi" + }, + "0.1.6": { + "hash": "/ipfs/QmazbxJNXNn5kUe3PHRiMpJtvf91o6SUM4uFphj9znuVt3", + "type": "directory", + "uploadedTo": { + "remote": "Thu, 14 May 2020 16:22:40 GMT" + }, + "link": "http://my.dappnode/#/sdk/publish/r=geth.dnp.dappnode.eth&v=0.1.6&h=%2Fipfs%2FQmazbxJNXNn5kUe3PHRiMpJtvf91o6SUM4uFphj9znuVt3" + }, + "0.1.7": { + "hash": "/ipfs/QmTujfYrQwWG7kRwQX4nBD7TmSDjjSfRkj4CdZW3rmDJLC", + "type": "directory", + "uploadedTo": { + "dappnode": "Fri, 07 Aug 2020 12:53:48 GMT" + }, + "link": "http://my.dappnode/#/sdk/publish/r=geth.dnp.dappnode.eth&v=0.1.7&h=%2Fipfs%2FQmd7jLvxVmUziFFVV9M6R4Svn7KGiM1VGg6kymbCknCgF1" + }, + "0.1.8": { + "hash": "/ipfs/QmUf1uzqZdXyKt4YB96nr1F9GtxUWnPu8hSs7WXJnoc5Cj", + "uploadedTo": { + "remote": "Fri, 07 Aug 2020 12:54:45 GMT" + }, + "link": "http://my.dappnode/#/sdk/publish/r=geth.dnp.dappnode.eth&v=0.1.8&h=%2Fipfs%2FQmUf1uzqZdXyKt4YB96nr1F9GtxUWnPu8hSs7WXJnoc5Cj" + }, + "0.1.9": { + "hash": "/ipfs/QmbpQoSXzPcBwm1LUeVMPosgsVUf772pN32xjDyxWnPEHT", + "uploadedTo": { + "remote": "Fri, 07 Aug 2020 13:19:24 GMT" + }, + "link": "http://my.dappnode/#/sdk/publish/r=geth.dnp.dappnode.eth&v=0.1.9&h=%2Fipfs%2FQmbpQoSXzPcBwm1LUeVMPosgsVUf772pN32xjDyxWnPEHT" + } +} \ No newline at end of file