Skip to content

Commit

Permalink
Merge pull request #269 from UnUniFi/faucet-docker
Browse files Browse the repository at this point in the history
Faucet-docker
  • Loading branch information
Senna46 authored Aug 24, 2023
2 parents bd6efea + 06b096e commit f003c8f
Show file tree
Hide file tree
Showing 5 changed files with 119 additions and 65 deletions.
98 changes: 98 additions & 0 deletions projects/faucet/README-faucet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# Faucet for UnUniFi v3.2.2

## Docker

Edit .ununifi home directory

```dockerfile
# - ~/.ununifi:/root/.ununifi
- ~/.ununifi:/mnt/blockstorage/.ununifi
```

Edit faucet command

- denom
- port
- credit-amount
- max-credit

Set Faucet account

```bash
ununifid keys add faucet --recover --keyring-backend test
# enter the mnemonic
```

Launch

```bash
docker-compose build
docker-compose up -d
```

## nohup (NOT recommend)

Download Faucet

```bash
wget https://github.com/tendermint/faucet/releases/download/v0.0.3/faucet_0.0.3_linux_amd64.tar.gz
tar -xvf ./faucet_0.0.3_linux_amd64.tar.gz
```

Add nginx config

```nginx
server {
listen 8000;
listen [::]:8000;
server_name localhost;
charset UTF-8;
location / {
proxy_http_version 1.1;
proxy_pass http://localhost:7000;
if ($request_method = 'OPTIONS') {
add_header Access-Control-Allow-Origin '*';
add_header Access-Control-Allow-Methods 'GET, POST, PUT, DELETE';
add_header Access-Control-Allow-Headers 'Origin, Authorization, Accept, Content-Type';
# add_header Access-Control-Max-Age 3600;
add_header Content-Type 'text/plain charset=UTF-8';
add_header Content-Length 0;
return 204;
}
}
}
server {
listen 8002;
listen [::]:8002;
server_name localhost;
charset UTF-8;
location / {
proxy_http_version 1.1;
proxy_pass http://localhost:7002;
if ($request_method = 'OPTIONS') {
add_header Access-Control-Allow-Origin '*';
add_header Access-Control-Allow-Methods 'GET, POST, PUT, DELETE';
add_header Access-Control-Allow-Headers 'Origin, Authorization, Accept, Content-Type';
# add_header Access-Control-Max-Age 3600;
add_header Content-Type 'text/plain charset=UTF-8';
add_header Content-Length 0;
return 204;
}
}
}
```

Run via nohup
./run_bk.sh

```bash
#!/bin/bash
SCRIPT_DIR=$(cd $(dirname $0); pwd)
nohup $SCRIPT_DIR/faucet --cli-name ununifid --denoms ubtc --keyring-backend test --account-name faucet --port 7000 --credit-amount=100000 --max-credit=2000000 --home=/root/.ununifi > $SCRIPT_DIR/fauet1.log 2>&1 &
nohup $SCRIPT_DIR/faucet --cli-name ununifid --denoms uguu,uusdc --keyring-backend test --account-name faucet --port 7002 --credit-amount=20000000 --max-credit=2000000000 --home=/root/.ununifi > $SCRIPT_DIR/fauet2.log 2>&1 &
```
86 changes: 21 additions & 65 deletions projects/faucet/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
version: "3"
version: '3'

services:
faucet-ubtc:
container_name: faucet-ubtc
image: ghcr.io/tendermint/faucet
volumes:
- ~/faucet/ununifid:/usr/local/bin/ununifid
# ~/faucet/ununifid:/usr/local/bin/ununifid
- /mnt/blockstorage/.ununifi/cosmovisor/current/bin/ununifid:/usr/local/bin/ununifid
- ~/faucet/libwasmvm.so:/usr/lib/libwasmvm.so
- ~/faucet/ld-musl-x86_64.so.1:/usr/lib/ld-musl-x86_64.so.1
- ~/faucet/libgcc_s.so.1:/usr/lib/libgcc_s.so.1
- ~/faucet/ld-linux-x86-64.so.2:/usr/lib/ld-linux-x86-64.so.2
- ~/.ununifi:/root/.ununifi
command: faucet --cli-name ununifid --denoms ubtc --keyring-backend test --account-name faucet --port 7000 --credit-amount=100 --max-credit=99
# - ~/.ununifi:/root/.ununifi
- /mnt/blockstorage/.ununifi:/root/.ununifi
command: faucet --cli-name ununifid --denoms ubtc --keyring-backend test --account-name faucet --port 7000 --credit-amount=100000 --max-credit=2000000 --home=/root/.ununifi
# ports:
# - 7000:7000
network_mode: host
Expand All @@ -20,72 +22,26 @@ services:
container_name: faucet-uguu
image: ghcr.io/tendermint/faucet
volumes:
- ~/faucet/ununifid:/usr/local/bin/ununifid
# ~/faucet/ununifid:/usr/local/bin/ununifid
- /mnt/blockstorage/.ununifi/cosmovisor/current/bin/ununifid:/usr/local/bin/ununifid
- ~/faucet/libwasmvm.so:/usr/lib/libwasmvm.so
- ~/faucet/ld-musl-x86_64.so.1:/usr/lib/ld-musl-x86_64.so.1
- ~/faucet/libgcc_s.so.1:/usr/lib/libgcc_s.so.1
- ~/faucet/ld-linux-x86-64.so.2:/usr/lib/ld-linux-x86-64.so.2
- ~/.ununifi:/root/.ununifi
command: faucet --cli-name ununifid --denoms uguu --keyring-backend test --account-name faucet --port 7002 --credit-amount=2000000 --max-credit=1999999
# - ~/.ununifi:/root/.ununifi
- /mnt/blockstorage/.ununifi:/root/.ununifi
command: faucet --cli-name ununifid --denoms uguu,uusdc --keyring-backend test --account-name faucet --port 7002 --credit-amount=20000000 --max-credit=2000000000 --home=/root/.ununifi
# ports:
# - 7002:7002
network_mode: host
restart: always
faucet-ununifi:
container_name: faucet-jpu
image: ghcr.io/tendermint/faucet
volumes:
- ~/faucet/ununifid:/usr/local/bin/ununifid
- ~/faucet/libwasmvm.so:/usr/lib/libwasmvm.so
- ~/faucet/ld-musl-x86_64.so.1:/usr/lib/ld-musl-x86_64.so.1
- ~/faucet/libgcc_s.so.1:/usr/lib/libgcc_s.so.1
- ~/faucet/ld-linux-x86-64.so.2:/usr/lib/ld-linux-x86-64.so.2
- ~/.ununifi:/root/.ununifi
command: faucet --cli-name ununifid --denoms jpu --keyring-backend test --account-name faucet --port 7004 --credit-amount=10 --max-credit=9
# ports:
# - 7004:7004
network_mode: host
restart: always
faucet-ueth:
container_name: faucet-ueth
image: ghcr.io/tendermint/faucet
volumes:
- ~/faucet/ununifid:/usr/local/bin/ununifid
- ~/faucet/libwasmvm.so:/usr/lib/libwasmvm.so
- ~/faucet/ld-musl-x86_64.so.1:/usr/lib/ld-musl-x86_64.so.1
- ~/faucet/libgcc_s.so.1:/usr/lib/libgcc_s.so.1
- ~/faucet/ld-linux-x86-64.so.2:/usr/lib/ld-linux-x86-64.so.2
- ~/.ununifi:/root/.ununifi
command: faucet --cli-name ununifid --denoms ueth --keyring-backend test --account-name faucet --port 7006 --credit-amount=1000 --max-credit=999
# ports:
# - 7006:7006
network_mode: host
restart: always
faucet-euu:
container_name: faucet-euu
image: ghcr.io/tendermint/faucet
volumes:
- ~/faucet/ununifid:/usr/local/bin/ununifid
- ~/faucet/libwasmvm.so:/usr/lib/libwasmvm.so
- ~/faucet/ld-musl-x86_64.so.1:/usr/lib/ld-musl-x86_64.so.1
- ~/faucet/libgcc_s.so.1:/usr/lib/libgcc_s.so.1
- ~/faucet/ld-linux-x86-64.so.2:/usr/lib/ld-linux-x86-64.so.2
- ~/.ununifi:/root/.ununifi
command: faucet --cli-name ununifid --denoms euu --keyring-backend test --account-name faucet --port 7008 --credit-amount=10 --max-credit=9
# ports:
# - 7008:7008
network_mode: host
restart: always
nginx:
container_name: faucet-nginx
image: nginx
volumes:
- ~/faucet/nginx.conf:/etc/nginx/nginx.conf
# ports:
# - 8000:8000
# - 8002:8002
# - 8004:8004
# - 8006:8006
# - 8008:8008
network_mode: host
restart: always
# nginx:
# container_name: faucet-nginx
# image: nginx
# volumes:
# - ./nginx.conf:/etc/nginx/nginx.conf
# # ports:
# # - 8000:8000
# # - 8002:8002
# network_mode: host
# restart: always
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit f003c8f

Please sign in to comment.