首页 币圈百科 正文

swarm挖矿程序单节点部署脚本(docker)

扫码手机浏览

以下脚本适用于redhat(centos)系列的linux,不适用于ubuntu系列。
 
step1、自动化安装docker+docker-compose的脚本(如果您已安装docker及docker-compose,此步骤不用执行,可直接执行step2步骤)
#!/bin/bash

function removeDocker () {
   sudo yum remove docker \
            docker-client \
            docker-client-latest \
            docker-common \
            docker-latest \
            docker-latest-logrotate \
            docker-logrotate \
            docker-selinux \
            docker-engine-selinux \ 
            docker-engine
}
echo "卸载Docker旧版本"
removeDocker
echo "卸载Docker旧版本成功"

function installYum () {
    sudo yum install -y yum-utils \
          device-mapper-persistent-data \
          lvm2
}
echo "开始安装yum..."
installYum
echo "安装yum成功"

function yumConfig () {
    sudo yum-config-manager \
    --add-repo \
    https://mirrors.ustc.edu.cn/docker-ce/linux/centos/docker-ce.repo
}

echo "开始配置国内镜像源..."
yumConfig
echo "配置国内镜像源成功"

function installDocker () {
    sudo yum makecache fast 
    sudo yum install docker-ce -y
}

echo "开始安装Docker..."
installDocker
echo "Docker安装成功"

function startDocker () {
   sudo systemctl enable docker
   sudo systemctl start docker
}

echo "启动Docker..."
startDocker
echo "Docker启动成功"

function installDockerCompose () {
    sudo yum install curl -y
    sudo curl -L https://hub.fastgit.org/docker/compose/releases/download/1.17.1/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
    sudo chmod +x /usr/local/bin/docker-compose
}

echo "开始安装Docker-Compose..."
installDockerCompose
echo "Docker-Compose安装成功"
echo "congratulations!!!你的人品太好了,Docker安装配置成功,请开始你的表演吧!!!"
用法:复制以上脚本到windows下保存为installDocker.sh格式的文件,上传到centos7的任意目录,执行命令:

sh installDokcer.sh


等待安装成功。
 
step2、自动部署并安装swarm挖矿程序的脚本(centos7++)
#!/bin/bash
 
function createDcokerDir () {
    sudo mkdir /usr/local/docker
    sudo mkdir /usr/local/docker/bee-node1
}
 
echo "创建Dcoker目录"
createDcokerDir
echo "创建Docker目录成功,路径为/usr/local/docker"
 
function createDockerComposeDotYml () {
    sudo touch /usr/local/docker/bee-node1/docker-compose.yml
    cat <<EOF >/usr/local/docker/bee-node1/docker-compose.yml
version: "3"
services:
  clef-1:
    image: ethersphere/clef:0.4.9
    restart: unless-stopped
    environment:
      - CLEF_CHAINID
    volumes:
      - clef-1:/app/data
    command: full
 
  bee-1:
    image: ethersphere/bee:beta
    restart: unless-stopped
    environment:
      - BEE_API_ADDR
      - BEE_BOOTNODE
      - BEE_BOOTNODE_MODE
      - BEE_CLEF_SIGNER_ENABLE
      - BEE_CLEF_SIGNER_ENDPOINT=http://clef-1:8550
      - BEE_CONFIG
      - BEE_CORS_ALLOWED_ORIGINS
      - BEE_DATA_DIR
      - BEE_DB_CAPACITY
      - BEE_DB_OPEN_FILES_LIMIT
      - BEE_DB_BLOCK_CACHE_CAPACITY
      - BEE_DB_WRITE_BUFFER_SIZE
      - BEE_DB_DISABLE_SEEKS_COMPACTION
      - BEE_DEBUG_API_ADDR
      - BEE_DEBUG_API_ENABLE
      - BEE_GATEWAY_MODE
      - BEE_GLOBAL_PINNING_ENABLE
      - BEE_NAT_ADDR
      - BEE_NETWORK_ID
      - BEE_P2P_ADDR
      - BEE_P2P_QUIC_ENABLE
      - BEE_P2P_WS_ENABLE
      - BEE_PASSWORD
      - BEE_PASSWORD_FILE
      - BEE_PAYMENT_EARLY
      - BEE_PAYMENT_THRESHOLD
      - BEE_PAYMENT_TOLERANCE
      - BEE_RESOLVER_OPTIONS
      - BEE_STANDALONE
      - BEE_SWAP_ENABLE
      - BEE_SWAP_ENDPOINT
      - BEE_SWAP_FACTORY_ADDRESS
      - BEE_SWAP_INITIAL_DEPOSIT
      - BEE_TRACING_ENABLE
      - BEE_TRACING_ENDPOINT
      - BEE_TRACING_SERVICE_NAME
      - BEE_VERBOSITY
      - BEE_WELCOME_MESSAGE
    ports:
      - "${API_ADDR:-1633}${BEE_API_ADDR:-:1633}"
      - "${P2P_ADDR:-1634}${BEE_P2P_ADDR:-:1634}"
      - "${DEBUG_API_ADDR:-127.0.0.1:1635}${BEE_DEBUG_API_ADDR:-:1635}"
    volumes:
      - bee-1:/home/bee/.bee
    command: start
    depends_on:
      - clef-1
volumes:
  clef-1:
  bee-1:
EOF
}
 
echo "创建docker-compose.yml文件"
createDockerComposeDotYml
echo "docker-compose.yml创建成功"
 
function createDockerComposeDotEnv () {
    sudo touch /usr/local/docker/bee-node1/.env
    cat <<EOF >/usr/local/docker/bee-node1/.env
# Copy this file to .env, then update it with your own settings
 
### CLEF
 
## chain id to use for signing (1=mainnet, 3=ropsten, 4=rinkeby, 5=goerli) (default: 12345)
CLEF_CHAINID=5
 
### BEE
 
## HTTP API listen address (default :1633)
# BEE_API_ADDR=:1633
## initial nodes to connect to (default [/dnsaddr/bootnode.ethswarm.org])
# BEE_BOOTNODE=[/dnsaddr/bootnode.ethswarm.org]
## cause the node to always accept incoming connections
# BEE_BOOTNODE_MODE=false
## enable clef signer
BEE_CLEF_SIGNER_ENABLE=true
## clef signer endpoint
BEE_CLEF_SIGNER_ENDPOINT=http://clef-1:8550
## config file (default is /home/<user>/.bee.yaml)
# BEE_CONFIG=/home/bee/.bee.yaml
## origins with CORS headers enabled
# BEE_CORS_ALLOWED_ORIGINS=[]
## data directory (default /home/<user>/.bee)
# BEE_DATA_DIR=/home/bee/.bee
## db capacity in chunks, multiply by 4096 to get approximate capacity in bytes
# BEE_DB_CAPACITY=5000000
## number of open files allowed by database
# BEE_DB_OPEN_FILES_LIMIT=200
## size of block cache of the database in bytes
# BEE_DB_BLOCK_CACHE_CAPACITY=33554432
## size of the database write buffer in bytes
# BEE_DB_WRITE_BUFFER_SIZE=33554432
## disables db compactions triggered by seeks
# BEE_DB_DISABLE_SEEKS_COMPACTION=false
## debug HTTP API listen address (default :1635)
# BEE_DEBUG_API_ADDR=:1635
## enable debug HTTP API
BEE_DEBUG_API_ENABLE=true
## disable a set of sensitive features in the api
# BEE_GATEWAY_MODE=false
## enable global pinning
# BEE_GLOBAL_PINNING_ENABLE=false
## NAT exposed address
# BEE_NAT_ADDR=
## ID of the Swarm network (default 1)
# BEE_NETWORK_ID=1
## P2P listen address (default :1634)
# BEE_P2P_ADDR=:1634
## enable P2P QUIC protocol
# BEE_P2P_QUIC_ENABLE=false
## enable P2P WebSocket transport
# BEE_P2P_WS_ENABLE=false
## password for decrypting keys
 BEE_PASSWORD=my-password
## path to a file that contains password for decrypting keys
# BEE_PASSWORD_FILE=
## amount in BZZ below the peers payment threshold when we initiate settlement (default 10000)
# BEE_PAYMENT_EARLY=10000
## threshold in BZZ where you expect to get paid from your peers (default 100000)
# BEE_PAYMENT_THRESHOLD=100000
## excess debt above payment threshold in BZZ where you disconnect from your peer (default 10000)
# BEE_PAYMENT_TOLERANCE=10000
## ENS compatible API endpoint for a TLD and with contract address, can be repeated, format [tld:][contract-addr@]url
# BEE_RESOLVER_OPTIONS=[]
## whether we want the node to start with no listen addresses for p2p
# BEE_STANDALONE=false
## enable swap (default true)
# BEE_SWAP_ENABLE=true
## swap ethereum blockchain endpoint (default http://localhost:8545)
 BEE_SWAP_ENDPOINT=https://rpc.slock.it/goerli
## swap factory address
# BEE_SWAP_FACTORY_ADDRESS=
## initial deposit if deploying a new chequebook (default 100000000)
# BEE_SWAP_INITIAL_DEPOSIT=100000000
## enable tracing
# BEE_TRACING_ENABLE=false
## endpoint to send tracing data (default 127.0.0.1:6831)
# BEE_TRACING_ENDPOINT=127.0.0.1:6831
## service name identifier for tracing (default bee)
# BEE_TRACING_SERVICE_NAME=bee
## log verbosity level 0=silent, 1=error, 2=warn, 3=info, 4=debug, 5=trace (default info)
# BEE_VERBOSITY=info
## send a welcome message string during handshakes
# BEE_WELCOME_MESSAGE=
EOF
}
 
echo "创建.env文件"
createDockerComposeDotEnv
echo "创建.env文件成功"
 
function startSwarmApp () {
    cd /usr/local/docker/bee-node1/
    docker-compose up -d
}
 
echo "正在启动Swarm程序(第一次启动可能比较慢)..."
startSwarmApp
echo "启动Swarm程序成功!"

用法:复制以上脚本到windows系统下保存为installSwarmApp.sh格式的文件,上传到centos7的任意目录,执行命令:
sh installSwarmApp.sh
 
等待部署成功。
 
docker-compose.yml会部署在
/usr/local/docker/bee-node1/ 目录,进到此目录下可进行相关操作

加密货币投资有风险请谨慎!

本文由网友投稿,不代表本站观点和立场,版权归原作者所有,本站所有文章不代表任何投资观点!如发现本站文章存在内容、版权或其它问题,烦请联系,我们将及时删除。

评论列表
  • 长期看好

  • 比特币月线趋势转空,以太坊周线趋势转空,空就完了。比特币4.2如果撑不住,下跌空间就继续打开

  • V神捐SHIB币后,印度最大加密交易所WazirX宣布上架SHIB币

  • 赌性太强没啥好说,十年交易经验还不能敬畏市场,该反省的是自己,而不是市场。

  • 比特币不存在牛市和熊市,因为比特币不是股票。

  • 我吸,已经借高利贷