Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: a single faucet #2

Closed
wants to merge 22 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
fc74724
rename module. update go.
steezeburger Jan 17, 2024
b44a5d3
upgrade go and node versions
steezeburger Jan 17, 2024
e5c0689
remove git funding page
steezeburger Jan 17, 2024
00d774b
improve github actions. use npm not yarn. add justfile.
steezeburger Jan 18, 2024
822b0c4
fix lint issue - just a simple string
steezeburger Jan 18, 2024
204ae85
go version stuff. rename workflow file
steezeburger Jan 18, 2024
f0844ff
upgrade checkout action
steezeburger Jan 18, 2024
b991c7d
optimize build workflow
steezeburger Jan 18, 2024
63affc5
remove cruft debug statement
steezeburger Jan 18, 2024
d818c0a
upgrade gomonkey to fix issue with breaking tests on macos m1
steezeburger Jan 18, 2024
8d258e0
spelling
steezeburger Jan 18, 2024
e34a474
dev tooling improvements
steezeburger Jan 18, 2024
67d4ea3
update README. just commands for docker stuff.
steezeburger Jan 18, 2024
254b949
remove wallet provider and priv key flags. add store. update request …
steezeburger Jan 18, 2024
446bee2
cleanup justfile and readme
steezeburger Jan 18, 2024
fa495fb
refactor routing to support a wildcard path at root for rollupName
steezeburger Jan 19, 2024
7da432a
refactor handleInfo and handleClaim to work with an address and rollu…
steezeburger Jan 19, 2024
47356a2
err msg and logging
steezeburger Jan 19, 2024
c6689cf
get private doc when trying to handle claim
steezeburger Jan 19, 2024
6bec3d8
fix comment
steezeburger Jan 22, 2024
7b75124
svelte code organization
steezeburger Jan 23, 2024
2f84bb1
feature: add root page that lists all rollups (#3)
steezeburger Jan 31, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions .github/FUNDING.yml

This file was deleted.

26 changes: 12 additions & 14 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,26 +21,25 @@ jobs:
runs-on: ubuntu-latest
steps:
# Checking out the repo
- uses: actions/checkout@v3
# Setting up Go
- uses: actions/setup-go@v4
- uses: actions/checkout@v4
- name: Log in to GitHub Container Registry
uses: docker/login-action@v2
with:
go-version: "^1.20.x" # The Go version to download (if necessary) and use.
- run: go version

registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_TOKEN }}
# https://github.com/docker/setup-qemu-action
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
# https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
- name: Log in to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Generate correct tabs and labels
- name: Docker metadata
id: metadata
Expand All @@ -61,8 +60,7 @@ jobs:
# https://github.com/docker/build-push-action/issues/820#issuecomment-1455687416
provenance: false
context: .
# It takes a long time to build the arm image right now, so we only build it on tags which is what we use for releases, or on merges to the default branch.
platforms: ${{ (contains(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/astria') && 'linux/amd64,linux/arm64' || 'linux/amd64' }}
platforms: 'linux/amd64,linux/arm64'
push: true
tags: ${{ steps.metadata.outputs.tags }}
labels: ${{ steps.metadata.outputs.labels }}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build
name: Lint, Test, Format

on:
push:
Expand All @@ -7,21 +7,21 @@ on:
branches: [astria]

jobs:
build:
server-test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v2
uses: actions/setup-go@v4
with:
go-version: 1.16
go-version: 1.21

- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: "14"
node-version: "18"

- name: Generate
run: go generate -x
Expand All @@ -32,29 +32,29 @@ jobs:
- name: Test
run: go test -v ./...

golangci:
server-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: 1.16
go-version: 1.21

- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: latest

prettier:
web-format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: actions/setup-node@v2
with:
node-version: "14"
node-version: "18"

- run: yarn install
- run: npm install
working-directory: web

- run: yarn prettier --check 'src/**/*.{css,html,js,svelte}'
- run: npm run prettier --check 'src/**/*.{css,html,js,svelte}'
working-directory: web
33 changes: 0 additions & 33 deletions .github/workflows/release.yml

This file was deleted.

4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,7 @@ password.txt

# binary
eth-faucet

# envs
.env
.env.local
44 changes: 0 additions & 44 deletions .goreleaser.yml

This file was deleted.

10 changes: 5 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
FROM node:lts-alpine as frontend
FROM node:18-alpine as frontend

WORKDIR /frontend-build

COPY web/package.json web/yarn.lock ./
RUN yarn install
COPY web/package.json web/package-lock.json ./
RUN npm install

COPY web ./
RUN yarn build
RUN npm run build

FROM golang:1.17-alpine as backend
FROM golang:1.21-alpine as backend

RUN apk add --no-cache gcc musl-dev linux-headers

Expand Down
70 changes: 17 additions & 53 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,70 +19,43 @@ The faucet is a web application with the goal of distributing small amounts of E

### Prerequisites

* Go (1.16 or later)
* Node.js
* Yarn
* Go (v1.21)
* [golangci-lint](https://golangci-lint.run/usage/install/)
* Node.js (v18)
* NPM
* [just](https://github.com/casey/just#installation)
* [mprocs](https://github.com/pvolok/mprocs#installation)
* [watchexec](https://github.com/watchexec/watchexec#install)

### Installation

1. Clone the repository and navigate to the app’s directory
```bash
git clone https://github.com/chainflag/eth-faucet.git
git clone https://github.com/astriaorg/eth-faucet.git
cd eth-faucet
```

2. Bundle Frontend web with Vite
2. Install front end app deps
```bash
go generate
```

3. Build Go project
```bash
go build -o eth-faucet
just web-install-deps
```

## Usage

**Use private key to fund users**

Run front end dev server and Go binary together with `mprocs`
```bash
./eth-faucet -httpport 8080 -wallet.provider http://localhost:8545 -wallet.privkey privkey
```

**Use keystore to fund users**

```bash
./eth-faucet -httpport 8080 -wallet.provider http://localhost:8545 -wallet.keyjson keystore -wallet.keypass password.txt
just run-watch
```

### Configuration

You can configure the funder by using environment variables instead of command-line flags as follows:
```bash
export WEB3_PROVIDER=https://some.rpc.endpoint
export PRIVATE_KEY=0x...
```

or

```bash
export WEB3_PROVIDER=https://some.rpc.endpoint
export KEYSTORE=path/to/keystore
echo "your keystore password" > `pwd`/password.txt
```

Then run the faucet application without the wallet command-line flags:
```bash
./eth-faucet -httpport 8080
```

**Optional Flags**

The following are the available command-line flags(excluding above wallet flags):

| Flag | Description | Default Value |
|-----------------|--------------------------------------------------|----------------|
| -httpport | Listener port to serve HTTP connection | 8080 |
| -httpport | Listener port to serve HTTP connection | 8089 |
| -proxycount | Count of reverse proxies in front of the server | 0 |
| -queuecap | Maximum transactions waiting to be sent | 100 |
| -faucet.amount | Number of Ethers to transfer per user request | 1 |
Expand All @@ -92,19 +65,10 @@ The following are the available command-line flags(excluding above wallet flags)
### Docker deployment

```bash
docker run -d -p 8080:8080 -e WEB3_PROVIDER=https://some.rpc.endpoint -e PRIVATE_KEY=0x... chainflag/eth-faucet:1.1.0
```

or

```bash
docker run -d -p 8080:8080 -e WEB3_PROVIDER=https://some.rpc.endpoint -e KEYSTORE=path/to/keystore -v `pwd`/keystore:/app/keystore -v `pwd`/password.txt:/app/password.txt chainflag/eth-faucet:1.1.0
```

#### Build the Docker image

```bash
docker buildx build -t ghcr.io/astriaorg/astria-faucet:0.0.1-local .
# might need to build image first
just docker-build
# run via Docker image
just docker-run
```

## License
Expand Down
Loading
Loading