Skip to content

Commit

Permalink
Merge pull request #270 from UnUniFi/develop
Browse files Browse the repository at this point in the history
merge Develop
  • Loading branch information
Senna46 authored Apr 11, 2024
2 parents 2fb8cc5 + 8b01f5d commit 4e7bdb5
Show file tree
Hide file tree
Showing 30 changed files with 851 additions and 70 deletions.
49 changes: 49 additions & 0 deletions develop/env/Docker/v3.2.0/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
FROM ubuntu:20.04

RUN apt update -y && apt upgrade -y && \
apt install -y sudo curl git jq wget vim make build-essential


ENV GO_VERSION 1.20
RUN wget -O go.tgz https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz && \
tar -C /usr/local -xzf go.tgz && \
rm go.tgz
ENV PATH $PATH:/usr/local/go/bin

RUN echo 'PATH=$PATH:/usr/local/go/bin' >> $HOME/.bashrc && \
echo 'PATH=$PATH:~/go/bin' >> $HOME/.bashrc

# RUN curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash - && sudo apt-get install -y nodejs

RUN useradd -m docker && echo "docker:docker" | chpasswd && adduser docker sudo

WORKDIR $HOME

ENV CHAIN_REPO https://github.com/UnUniFi/chain
ENV CHAIN_REPO_BRANCHE=v3.2.0
ENV TARGET=ununifid
ENV TARGET_HOME=.ununifi
ENV CHAIN_ID=test

ENV DAEMON_NAME=$TARGET
ENV DAEMON_HOME=/root/$TARGET_HOME
ENV DAEMON_ALLOW_DOWNLOAD_BINARIES=true
ENV DAEMON_LOG_BUFFER_SIZE=512
ENV DAEMON_RESTART_AFTER_UPGRADE=true
ENV UNSAFE_SKIP_BACKUP=true



RUN git clone $CHAIN_REPO chain_repo && \
cd chain_repo && \
git checkout $CHAIN_REPO_BRANCHE && \
make install

RUN go install github.com/cosmos/cosmos-sdk/cosmovisor/cmd/cosmovisor@v1.0.0
RUN mkdir -p $DAEMON_HOME/cosmovisor && \
mkdir -p $DAEMON_HOME/cosmovisor/genesis && \
mkdir -p $DAEMON_HOME/cosmovisor/genesis/bin && \
mkdir -p $DAEMON_HOME/cosmovisor/upgrades && \
cp ~/go/bin/$DAEMON_NAME $DAEMON_HOME/cosmovisor/genesis/bin

CMD ["bash"]
49 changes: 49 additions & 0 deletions develop/env/Docker/v3.2.1/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
FROM ubuntu:20.04

RUN apt update -y && apt upgrade -y && \
apt install -y sudo curl git jq wget vim make build-essential


ENV GO_VERSION 1.20
RUN wget -O go.tgz https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz && \
tar -C /usr/local -xzf go.tgz && \
rm go.tgz
ENV PATH $PATH:/usr/local/go/bin

RUN echo 'PATH=$PATH:/usr/local/go/bin' >> $HOME/.bashrc && \
echo 'PATH=$PATH:~/go/bin' >> $HOME/.bashrc

# RUN curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash - && sudo apt-get install -y nodejs

RUN useradd -m docker && echo "docker:docker" | chpasswd && adduser docker sudo

WORKDIR $HOME

ENV CHAIN_REPO https://github.com/UnUniFi/chain
ENV CHAIN_REPO_BRANCHE=v3.2.1
ENV TARGET=ununifid
ENV TARGET_HOME=.ununifi
ENV CHAIN_ID=test

ENV DAEMON_NAME=$TARGET
ENV DAEMON_HOME=/root/$TARGET_HOME
ENV DAEMON_ALLOW_DOWNLOAD_BINARIES=true
ENV DAEMON_LOG_BUFFER_SIZE=512
ENV DAEMON_RESTART_AFTER_UPGRADE=true
ENV UNSAFE_SKIP_BACKUP=true



RUN git clone $CHAIN_REPO chain_repo && \
cd chain_repo && \
git checkout $CHAIN_REPO_BRANCHE && \
make install

RUN go install github.com/cosmos/cosmos-sdk/cosmovisor/cmd/cosmovisor@v1.0.0
RUN mkdir -p $DAEMON_HOME/cosmovisor && \
mkdir -p $DAEMON_HOME/cosmovisor/genesis && \
mkdir -p $DAEMON_HOME/cosmovisor/genesis/bin && \
mkdir -p $DAEMON_HOME/cosmovisor/upgrades && \
cp ~/go/bin/$DAEMON_NAME $DAEMON_HOME/cosmovisor/genesis/bin

CMD ["bash"]
49 changes: 49 additions & 0 deletions develop/env/Docker/v3.2.2/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
FROM ubuntu:20.04

RUN apt update -y && apt upgrade -y && \
apt install -y sudo curl git jq wget vim make build-essential


ENV GO_VERSION 1.20
RUN wget -O go.tgz https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz && \
tar -C /usr/local -xzf go.tgz && \
rm go.tgz
ENV PATH $PATH:/usr/local/go/bin

RUN echo 'PATH=$PATH:/usr/local/go/bin' >> $HOME/.bashrc && \
echo 'PATH=$PATH:~/go/bin' >> $HOME/.bashrc

# RUN curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash - && sudo apt-get install -y nodejs

RUN useradd -m docker && echo "docker:docker" | chpasswd && adduser docker sudo

WORKDIR $HOME

ENV CHAIN_REPO https://github.com/UnUniFi/chain
ENV CHAIN_REPO_BRANCHE=v3.2.2-query
ENV TARGET=ununifid
ENV TARGET_HOME=.ununifi
ENV CHAIN_ID=test

ENV DAEMON_NAME=$TARGET
ENV DAEMON_HOME=/root/$TARGET_HOME
ENV DAEMON_ALLOW_DOWNLOAD_BINARIES=true
ENV DAEMON_LOG_BUFFER_SIZE=512
ENV DAEMON_RESTART_AFTER_UPGRADE=true
ENV UNSAFE_SKIP_BACKUP=true



RUN git clone $CHAIN_REPO chain_repo && \
cd chain_repo && \
git checkout $CHAIN_REPO_BRANCHE && \
make install

RUN go install github.com/cosmos/cosmos-sdk/cosmovisor/cmd/cosmovisor@v1.0.0
RUN mkdir -p $DAEMON_HOME/cosmovisor && \
mkdir -p $DAEMON_HOME/cosmovisor/genesis && \
mkdir -p $DAEMON_HOME/cosmovisor/genesis/bin && \
mkdir -p $DAEMON_HOME/cosmovisor/upgrades && \
cp ~/go/bin/$DAEMON_NAME $DAEMON_HOME/cosmovisor/genesis/bin

CMD ["bash"]
49 changes: 49 additions & 0 deletions develop/env/Docker/v4.0.0/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
FROM ubuntu:20.04

RUN apt update -y && apt upgrade -y && \
apt install -y sudo curl git jq wget vim make build-essential


ENV GO_VERSION 1.20
RUN wget -O go.tgz https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz && \
tar -C /usr/local -xzf go.tgz && \
rm go.tgz
ENV PATH $PATH:/usr/local/go/bin

RUN echo 'PATH=$PATH:/usr/local/go/bin' >> $HOME/.bashrc && \
echo 'PATH=$PATH:~/go/bin' >> $HOME/.bashrc

# RUN curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash - && sudo apt-get install -y nodejs

RUN useradd -m docker && echo "docker:docker" | chpasswd && adduser docker sudo

WORKDIR $HOME

ENV CHAIN_REPO https://github.com/UnUniFi/chain
ENV CHAIN_REPO_BRANCHE=v4.0.0
ENV TARGET=ununifid
ENV TARGET_HOME=.ununifi
ENV CHAIN_ID=test

ENV DAEMON_NAME=$TARGET
ENV DAEMON_HOME=/root/$TARGET_HOME
ENV DAEMON_ALLOW_DOWNLOAD_BINARIES=true
ENV DAEMON_LOG_BUFFER_SIZE=512
ENV DAEMON_RESTART_AFTER_UPGRADE=true
ENV UNSAFE_SKIP_BACKUP=true



RUN git clone $CHAIN_REPO chain_repo && \
cd chain_repo && \
git checkout $CHAIN_REPO_BRANCHE && \
make install

RUN go install github.com/cosmos/cosmos-sdk/cosmovisor/cmd/cosmovisor@v1.0.0
RUN mkdir -p $DAEMON_HOME/cosmovisor && \
mkdir -p $DAEMON_HOME/cosmovisor/genesis && \
mkdir -p $DAEMON_HOME/cosmovisor/genesis/bin && \
mkdir -p $DAEMON_HOME/cosmovisor/upgrades && \
cp ~/go/bin/$DAEMON_NAME $DAEMON_HOME/cosmovisor/genesis/bin

CMD ["bash"]
49 changes: 49 additions & 0 deletions develop/env/Docker/v4.0.1/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
FROM ubuntu:20.04

RUN apt update -y && apt upgrade -y && \
apt install -y sudo curl git jq wget vim make build-essential


ENV GO_VERSION 1.20
RUN wget -O go.tgz https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz && \
tar -C /usr/local -xzf go.tgz && \
rm go.tgz
ENV PATH $PATH:/usr/local/go/bin

RUN echo 'PATH=$PATH:/usr/local/go/bin' >> $HOME/.bashrc && \
echo 'PATH=$PATH:~/go/bin' >> $HOME/.bashrc

# RUN curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash - && sudo apt-get install -y nodejs

RUN useradd -m docker && echo "docker:docker" | chpasswd && adduser docker sudo

WORKDIR $HOME

ENV CHAIN_REPO https://github.com/UnUniFi/chain
ENV CHAIN_REPO_BRANCHE=v4.0.1
ENV TARGET=ununifid
ENV TARGET_HOME=.ununifi
ENV CHAIN_ID=test

ENV DAEMON_NAME=$TARGET
ENV DAEMON_HOME=/root/$TARGET_HOME
ENV DAEMON_ALLOW_DOWNLOAD_BINARIES=true
ENV DAEMON_LOG_BUFFER_SIZE=512
ENV DAEMON_RESTART_AFTER_UPGRADE=true
ENV UNSAFE_SKIP_BACKUP=true



RUN git clone $CHAIN_REPO chain_repo && \
cd chain_repo && \
git checkout $CHAIN_REPO_BRANCHE && \
make install

RUN go install github.com/cosmos/cosmos-sdk/cosmovisor/cmd/cosmovisor@v1.0.0
RUN mkdir -p $DAEMON_HOME/cosmovisor && \
mkdir -p $DAEMON_HOME/cosmovisor/genesis && \
mkdir -p $DAEMON_HOME/cosmovisor/genesis/bin && \
mkdir -p $DAEMON_HOME/cosmovisor/upgrades && \
cp ~/go/bin/$DAEMON_NAME $DAEMON_HOME/cosmovisor/genesis/bin

CMD ["bash"]
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ services:
ununifid:
container_name: ununifid
build:
context: develop/env/Docker/v3.1.0
context: develop/env/Docker/v4.0.1
dockerfile: Dockerfile
volumes:
- .:/utils
Expand Down
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 &
```
Loading

0 comments on commit 4e7bdb5

Please sign in to comment.