From 8fb55f55841fd99a9020b7be1023a96bcced7610 Mon Sep 17 00:00:00 2001 From: Senna46 <29295263+Senna46@users.noreply.github.com> Date: Thu, 24 Aug 2023 18:43:46 +0900 Subject: [PATCH 1/5] feat: docker --- projects/faucet/docker-compose.yml | 60 ++++-------------------------- 1 file changed, 7 insertions(+), 53 deletions(-) diff --git a/projects/faucet/docker-compose.yml b/projects/faucet/docker-compose.yml index 1d80bb8..89dc904 100644 --- a/projects/faucet/docker-compose.yml +++ b/projects/faucet/docker-compose.yml @@ -1,4 +1,4 @@ -version: "3" +version: '3' services: faucet-ubtc: @@ -10,8 +10,9 @@ services: - ~/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 + - ~/.ununifi:/mnt/blockstorage/.ununifi + command: faucet --cli-name ununifid --denoms ubtc --keyring-backend test --account-name faucet --port 7000 --credit-amount=100000 --max-credit=2000000 # ports: # - 7000:7000 network_mode: host @@ -25,57 +26,13 @@ services: - ~/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 + - ~/.ununifi:/mnt/blockstorage/.ununifi + command: faucet --cli-name ununifid --denoms uguu,uusdc --keyring-backend test --account-name faucet --port 7002 --credit-amount=20000000 --max-credit=2000000000 # 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 @@ -84,8 +41,5 @@ services: # ports: # - 8000:8000 # - 8002:8002 - # - 8004:8004 - # - 8006:8006 - # - 8008:8008 network_mode: host restart: always From 336faa2516b7420e7442b91a7e26d82957859781 Mon Sep 17 00:00:00 2001 From: Senna46 <29295263+Senna46@users.noreply.github.com> Date: Thu, 24 Aug 2023 18:43:54 +0900 Subject: [PATCH 2/5] feat: document --- projects/faucet/README.md | 98 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 projects/faucet/README.md diff --git a/projects/faucet/README.md b/projects/faucet/README.md new file mode 100644 index 0000000..8401566 --- /dev/null +++ b/projects/faucet/README.md @@ -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 & +``` From a7aedaa0889862401e461ea1d055f61115e5a259 Mon Sep 17 00:00:00 2001 From: Senna46 <29295263+Senna46@users.noreply.github.com> Date: Thu, 24 Aug 2023 20:06:37 +0900 Subject: [PATCH 3/5] fix: conflict --- projects/faucet/{README.md => README-faucet.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename projects/faucet/{README.md => README-faucet.md} (100%) diff --git a/projects/faucet/README.md b/projects/faucet/README-faucet.md similarity index 100% rename from projects/faucet/README.md rename to projects/faucet/README-faucet.md From 03b7a243affa31e289a787f88c2584a85ff22f19 Mon Sep 17 00:00:00 2001 From: Senna46 <29295263+Senna46@users.noreply.github.com> Date: Thu, 24 Aug 2023 20:54:49 +0900 Subject: [PATCH 4/5] fix: old script --- projects/faucet/{ => old}/deploy.sh | 0 projects/faucet/{ => old}/lanch.sh | 0 projects/faucet/{ => old}/nginx.conf | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename projects/faucet/{ => old}/deploy.sh (100%) rename projects/faucet/{ => old}/lanch.sh (100%) rename projects/faucet/{ => old}/nginx.conf (100%) diff --git a/projects/faucet/deploy.sh b/projects/faucet/old/deploy.sh similarity index 100% rename from projects/faucet/deploy.sh rename to projects/faucet/old/deploy.sh diff --git a/projects/faucet/lanch.sh b/projects/faucet/old/lanch.sh similarity index 100% rename from projects/faucet/lanch.sh rename to projects/faucet/old/lanch.sh diff --git a/projects/faucet/nginx.conf b/projects/faucet/old/nginx.conf similarity index 100% rename from projects/faucet/nginx.conf rename to projects/faucet/old/nginx.conf From 06b096e97ce5f1cb0d42ad4deed6909cc1f2f1a2 Mon Sep 17 00:00:00 2001 From: Senna46 <29295263+Senna46@users.noreply.github.com> Date: Thu, 24 Aug 2023 20:54:59 +0900 Subject: [PATCH 5/5] fix: docker file --- projects/faucet/docker-compose.yml | 34 ++++++++++++++++-------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/projects/faucet/docker-compose.yml b/projects/faucet/docker-compose.yml index 89dc904..44dfaa6 100644 --- a/projects/faucet/docker-compose.yml +++ b/projects/faucet/docker-compose.yml @@ -5,14 +5,15 @@ services: 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 - - ~/.ununifi:/mnt/blockstorage/.ununifi - command: faucet --cli-name ununifid --denoms ubtc --keyring-backend test --account-name faucet --port 7000 --credit-amount=100000 --max-credit=2000000 + - /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 @@ -21,25 +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 - - ~/.ununifi:/mnt/blockstorage/.ununifi - command: faucet --cli-name ununifid --denoms uguu,uusdc --keyring-backend test --account-name faucet --port 7002 --credit-amount=20000000 --max-credit=2000000000 + - /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 - nginx: - container_name: faucet-nginx - image: nginx - volumes: - - ~/faucet/nginx.conf:/etc/nginx/nginx.conf - # ports: - # - 8000:8000 - # - 8002:8002 - 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