一、docker部署
本文以Ubuntu20.04系统为例安装:
1.卸载旧版本的docker
#apt-get remove docker docker-engine docker.io containerd runc
2.安装docker依赖
安装docker依赖
Docker在Ubuntu上依赖一些软件包。执行以下命令来安装这些依赖:
apt-get install ca-certificates curl gnupg lsb-release
添加Docker官方GPG密钥
执行以下命令来添加Docker官方的GPG密钥:
curl -fsSL http://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
root@libai-virtual-machine:~/fisco/nodes/127.0.0.1# curl -fsSL http://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
OK
添加Docker软件源
sudo add-apt-repository "deb [arch=amd64] http://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"
Get:2 http://mirrors.aliyun.com/docker-ce/linux/ubuntu focal InRelease [57.7 kB]
Get:4 https://download.docker.com/linux/ubuntu focal InRelease [57.7 kB]
Hit:1 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal InRelease
Hit:3 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates InRelease
Get:6 http://mirrors.aliyun.com/docker-ce/linux/ubuntu focal/stable amd64 Packages [33.8 kB]
Hit:5 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-backports InRelease
Get:7 https://download.docker.com/linux/ubuntu focal/stable amd64 Packages [33.8 kB]
Hit:8 http://security.ubuntu.com/ubuntu focal-security InRelease
Fetched 183 kB in 1s (231 kB/s)
Reading package lists... Done
安装docker
apt-get install docker-ce docker-ce-cli containerd.io
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
docker-buildx-plugin docker-ce-rootless-extras docker-compose-plugin git
git-man liberror-perl pigz slirp4netns
Suggested packages:
aufs-tools cgroupfs-mount | cgroup-lite git-daemon-run
| git-daemon-sysvinit git-doc git-el git-email git-gui gitk gitweb git-cvs
git-mediawiki git-svn
The following NEW packages will be installed:
containerd.io docker-buildx-plugin docker-ce docker-ce-cli
docker-ce-rootless-extras docker-compose-plugin git git-man liberror-perl
pigz slirp4netns
0 upgraded, 11 newly installed, 0 to remove and 247 not upgraded.
Need to get 119 MB of archives.
After this operation, 448 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://mirrors.aliyun.com/docker-ce/linux/ubuntu focal/stable amd64 containerd.io amd64 1.6.25-1 [28.7 MB]
Get:2 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/universe amd64 pigz amd64 2.4-1 [57.4 kB]
Get:3 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/main amd64 liberror-perl all 0.17029-1 [26.5 kB]
Get:4 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/main amd64 git-man all 1:2.25.1-1ubuntu3.11 [887 kB]
Get:5 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/main amd64 git amd64 1:2.25.1-1ubuntu3.11 [4,605 kB]
Get:6 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/universe amd64 slirp4netns amd64 0.4.3-1 [74.3 kB]
Get:7 http://mirrors.aliyun.com/docker-ce/linux/ubuntu focal/stable amd64 docker-buildx-plugin amd64 0.11.2-1~ubuntu.20.04~focal [28.2 MB]
Get:8 http://mirrors.aliyun.com/docker-ce/linux/ubuntu focal/stable amd64 docker-ce-cli amd64 5:24.0.7-1~ubuntu.20.04~focal [13.3 MB]
Get:9 http://mirrors.aliyun.com/docker-ce/linux/ubuntu focal/stable amd64 docker-ce amd64 5:24.0.7-1~ubuntu.20.04~focal [22.6 MB]
Get:10 http://mirrors.aliyun.com/docker-ce/linux/ubuntu focal/stable amd64 docker-ce-rootless-extras amd64 5:24.0.7-1~ubuntu.20.04~focal [9,037 kB]
Get:11 http://mirrors.aliyun.com/docker-ce/linux/ubuntu focal/stable amd64 docker-compose-plugin amd64 2.21.0-1~ubuntu.20.04~focal [11.9 MB]
Fetched 119 MB in 14s (8,300 kB/s)
Selecting previously unselected package pigz.
(Reading database ... 181197 files and directories currently installed.)
Preparing to unpack .../00-pigz_2.4-1_amd64.deb ...
Unpacking pigz (2.4-1) ...
Selecting previously unselected package containerd.io.
Preparing to unpack .../01-containerd.io_1.6.25-1_amd64.deb ...
Unpacking containerd.io (1.6.25-1) ...
Selecting previously unselected package docker-buildx-plugin.
Preparing to unpack .../02-docker-buildx-plugin_0.11.2-1~ubuntu.20.04~focal_amd64.deb ...
Unpacking docker-buildx-plugin (0.11.2-1~ubuntu.20.04~focal) ...
Selecting previously unselected package docker-ce-cli.
Preparing to unpack .../03-docker-ce-cli_5%3a24.0.7-1~ubuntu.20.04~focal_amd64.deb ...
Unpacking docker-ce-cli (5:24.0.7-1~ubuntu.20.04~focal) ...
Selecting previously unselected package docker-ce.
Preparing to unpack .../04-docker-ce_5%3a24.0.7-1~ubuntu.20.04~focal_amd64.deb ...
Unpacking docker-ce (5:24.0.7-1~ubuntu.20.04~focal) ...
Selecting previously unselected package docker-ce-rootless-extras.
Preparing to unpack .../05-docker-ce-rootless-extras_5%3a24.0.7-1~ubuntu.20.04~focal_amd64.deb ...
Unpacking docker-ce-rootless-extras (5:24.0.7-1~ubuntu.20.04~focal) ...
Selecting previously unselected package docker-compose-plugin.
Preparing to unpack .../06-docker-compose-plugin_2.21.0-1~ubuntu.20.04~focal_amd64.deb ...
Unpacking docker-compose-plugin (2.21.0-1~ubuntu.20.04~focal) ...
Selecting previously unselected package liberror-perl.
Preparing to unpack .../07-liberror-perl_0.17029-1_all.deb ...
Unpacking liberror-perl (0.17029-1) ...
Selecting previously unselected package git-man.
Preparing to unpack .../08-git-man_1%3a2.25.1-1ubuntu3.11_all.deb ...
Unpacking git-man (1:2.25.1-1ubuntu3.11) ...
Selecting previously unselected package git.
Preparing to unpack .../09-git_1%3a2.25.1-1ubuntu3.11_amd64.deb ...
Unpacking git (1:2.25.1-1ubuntu3.11) ...
Selecting previously unselected package slirp4netns.
Preparing to unpack .../10-slirp4netns_0.4.3-1_amd64.deb ...
Unpacking slirp4netns (0.4.3-1) ...
Setting up slirp4netns (0.4.3-1) ...
Setting up liberror-perl (0.17029-1) ...
Setting up docker-buildx-plugin (0.11.2-1~ubuntu.20.04~focal) ...
Setting up containerd.io (1.6.25-1) ...
Created symlink /etc/systemd/system/multi-user.target.wants/containerd.service → /lib/systemd/system/containerd.service.
Setting up docker-compose-plugin (2.21.0-1~ubuntu.20.04~focal) ...
Setting up docker-ce-cli (5:24.0.7-1~ubuntu.20.04~focal) ...
Setting up pigz (2.4-1) ...
Setting up git-man (1:2.25.1-1ubuntu3.11) ...
Setting up docker-ce-rootless-extras (5:24.0.7-1~ubuntu.20.04~focal) ...
Setting up docker-ce (5:24.0.7-1~ubuntu.20.04~focal) ...
Created symlink /etc/systemd/system/multi-user.target.wants/docker.service → /lib/systemd/system/docker.service.
Created symlink /etc/systemd/system/sockets.target.wants/docker.socket → /lib/systemd/system/docker.socket.
Setting up git (1:2.25.1-1ubuntu3.11) ...
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for systemd (245.4-4ubuntu3.20) ...
配置用户组
sudo usermod -aG docker $USER
重启生效
root@libai-virtual-machine:~/fisco/nodes/127.0.0.1# systemctl start docker
配置工具
root@libai-virtual-machine:~/fisco/nodes/127.0.0.1# apt-get -y install apt-transport-https ca-certificates curl software-properties-common
Reading package lists... Done
Building dependency tree
Reading state information... Done
ca-certificates is already the newest version (20230311ubuntu0.20.04.1).
ca-certificates set to manually installed.
curl is already the newest version (7.68.0-1ubuntu2.20).
apt-transport-https is already the newest version (2.0.10).
The following additional packages will be installed:
python3-software-properties software-properties-gtk
The following packages will be upgraded:
python3-software-properties software-properties-common
software-properties-gtk
3 upgraded, 0 newly installed, 0 to remove and 244 not upgraded.
Need to get 101 kB of archives.
After this operation, 0 B of additional disk space will be used.
Get:1 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/main amd64 software-properties-common all 0.99.9.12 [10.4 kB]
Get:2 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/main amd64 software-properties-gtk all 0.99.9.12 [69.1 kB]
Get:3 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/main amd64 python3-software-properties all 0.99.9.12 [21.7 kB]
Fetched 101 kB in 1s (197 kB/s)
(Reading database ... 182386 files and directories currently installed.)
Preparing to unpack .../software-properties-common_0.99.9.12_all.deb ...
Unpacking software-properties-common (0.99.9.12) over (0.99.9.11) ...
Preparing to unpack .../software-properties-gtk_0.99.9.12_all.deb ...
Unpacking software-properties-gtk (0.99.9.12) over (0.99.9.11) ...
Preparing to unpack .../python3-software-properties_0.99.9.12_all.deb ...
Unpacking python3-software-properties (0.99.9.12) over (0.99.9.11) ...
Setting up python3-software-properties (0.99.9.12) ...
Setting up software-properties-common (0.99.9.12) ...
Setting up software-properties-gtk (0.99.9.12) ...
Processing triggers for dbus (1.12.16-2ubuntu2.3) ...
Processing triggers for shared-mime-info (1.15-1) ...
Processing triggers for desktop-file-utils (0.24-1ubuntu3) ...
Processing triggers for mime-support (3.64ubuntu1) ...
Processing triggers for hicolor-icon-theme (0.17-2) ...
Processing triggers for gnome-menus (3.36.0-1ubuntu1) ...
Processing triggers for libglib2.0-0:amd64 (2.64.6-1~ubuntu20.04.4) ...
Processing triggers for man-db (2.9.1-1) ...
重启并验证是否成功
systemctl start docker
sudo docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
719385e32844: Pull complete
Digest: sha256:c79d06dfdfd3d3eb04cafd0dc2bacab0992ebc243e083cabe208bac4dd7759e0
Status: Downloaded newer image for hello-world:latest
Hello from Docker!
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(amd64)
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/get-started/
查看docker version
sudo docker version
Client: Docker Engine - Community
Version: 24.0.7
API version: 1.43
Go version: go1.20.10
Git commit: afdd53b
Built: Thu Oct 26 09:08:01 2023
OS/Arch: linux/amd64
Context: default
Server: Docker Engine - Community
Engine:
Version: 24.0.7
API version: 1.43 (minimum version 1.12)
Go version: go1.20.10
Git commit: 311b9ff
Built: Thu Oct 26 09:08:01 2023
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.6.25
GitCommit: d8f198a4ed8892c764191ef7b3b06d8a2eeb5c7f
runc:
Version: 1.1.10
GitCommit: v1.1.10-0-g18a0cb0
docker-init:
Version: 0.19.0
GitCommit: de40ad0
查看镜像
sudo docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
hello-world latest 9c7a54a9a43c 7 months ago 13.3kB
新建/修改Docker镜像源配置
以阿里云的镜像源为例
mkdir -p /etc/docker
# 创建/修改daemon.json配置文件
vi /etc/docker/daemon.json
# 配置内容如下:
{
"registry-mirrors": ["https://419bd6w5.mirror.aliyuncs.com"]
}
systemctl daemon-reload
systemctl restart docker.service
安装检查Docker-Compose
依赖 curl 进行下载
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
修改执行权限
sudo chmod +x /usr/local/bin/docker-compose
将文件copy到 /usr/bin/目录下
sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
检测安装是否成功
$ docker-compose --version
docker-compose version 1.29.2, build 5becea4c
二、python,mysql安装
1、安装 python 3.8
sudo apt update
sudo apt install software-properties-common
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt install python3.8
2、安装 pymysql
sudo apt-get install -y python3-pip
sudo pip3 install PyMySQL
3、安装 mysql
apt install mysql-server
4、配置 mysql 账户
cat /etc/mysql/debian.cnf
// 记住这里的用户名和密码
// 使用此处的用户名和密码登录 Mysql
mysql -u debian-sys-maint -p
修改 root 用户 的密码为 123456
use mysql;
update user set authentication_string='' where user='root';
ALTER user 'root'@'localhost' IDENTIFIED BY '123456';
再创建一个新用户 test ,用于后续的 webase
create user 'test'@'localhost' IDENTIFIED BY '123456';
GRANT ALL PRIVILEGES ON *.* TO 'test'@'localhost';
Flush privileges;
三、docker一键部署
拉取部署脚本
获取部署安装包:
wget https://osp-1257653870.cos.ap-guangzhou.myqcloud.com/WeBASE/releases/download/v1.5.3/webase-deploy.zip
解压安装包:
unzip webase-deploy.zip
进入目录:
cd webase-deploy
拉取镜像
python3 deploy.py pullDockerAll
# 部署并启动所有服务(重新安装时需要先停止服务再重新安装,避免端口占用)
$ python3 deploy.py installDockerAll
============================================================
_ _ ______ ___ _____ _____
| | | | | ___ \/ _ \/ ___| ___|
| | | | ___| |_/ / /_\ \ `--.| |__
| |/\| |/ _ | ___ | _ |`--. | __|
\ /\ | __| |_/ | | | /\__/ | |___
\/ \/ \___\____/\_| |_\____/\____/
============================================================
============== checking envrionment ==============
check git...
check finished sucessfully.
check openssl...
check finished sucessfully.
check curl...
check finished sucessfully.
check wget...
check finished sucessfully.
check dos2unix...
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
dos2unix
0 upgraded, 1 newly installed, 0 to remove and 229 not upgraded.
Need to get 374 kB of archives.
After this operation, 1,342 kB of additional disk space will be used.
Get:1 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/universe amd64 dos2unix amd64 7.4.0-2 [374 kB]
Fetched 374 kB in 1s (431 kB/s)
Selecting previously unselected package dos2unix.
(Reading database ... 188858 files and directories currently installed.)
Preparing to unpack .../dos2unix_7.4.0-2_amd64.deb ...
Unpacking dos2unix (7.4.0-2) ...
Setting up dos2unix (7.4.0-2) ...
Processing triggers for man-db (2.9.1-1) ...
check finished sucessfully.
check Docker...
Try to start Docker...
check finished sucessfully.
check docker-compose...
check finished sucessfully.
check config webase v1.5.3 and fisco version 2.8.0...
check finished sucessfully.
check host free memory and cpu core...
[WARN]Free memory 203(M) may be NOT ENOUGH for node count [2] and webase
[WARN]Recommend webase with 2G memory at least, and one node equipped with one core of CPU and 1G memory(linear increase with node count).
check FISCO-BCOS node port...
check finished sucessfully.
check WeBASE-Web port...
check finished sucessfully.
check WeBASE-Node-Manager port...
check finished sucessfully.
check WeBASE-Sign port...
check finished sucessfully.
check WeBASE-Front port...
check finished sucessfully.
============== checking mysql ==============
use [mysql in docker], skip check mysql
============== mysql available ==============
============== envrionment available ==============
============================================================
============== starting deploy ==============
============================================================
============== Installing FISCO-BCOS ==============
wget https://osp-1257653870.cos.ap-guangzhou.myqcloud.com/FISCO-BCOS/FISCO-BCOS/releases/v2.8.0/build_chain.sh && chmod u+x build_chain.sh
--2023-12-01 10:36:48-- https://osp-1257653870.cos.ap-guangzhou.myqcloud.com/FISCO-BCOS/FISCO-BCOS/releases/v2.8.0/build_chain.sh
Resolving osp-1257653870.cos.ap-guangzhou.myqcloud.com (osp-1257653870.cos.ap-guangzhou.myqcloud.com)... 112.49.57.187, 112.49.57.186, 112.49.57.178, ...
Connecting to osp-1257653870.cos.ap-guangzhou.myqcloud.com (osp-1257653870.cos.ap-guangzhou.myqcloud.com)|112.49.57.187|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 67784 (66K) [text/x-sh]
Saving to: ‘build_chain.sh’
build_chain.sh 100%[==================>] 66.20K --.-KB/s in 0.07s
2023-12-01 10:36:49 (964 KB/s) - ‘build_chain.sh’ saved [67784/67784]
[WARN] jsonrpc_listen_ip linstens 0.0.0.0 is unsafe.
==============================================================
Generating CA key...
==============================================================
Generating keys and certificates ...
Processing IP=127.0.0.1 Total=2 Agency=agencyA Groups=1,2
==============================================================
Generating configuration files ...
Processing IP=127.0.0.1 Total=2 Agency=agencyA Groups=1,2
==============================================================
Group:1 has 2 nodes
Group:2 has 2 nodes
==============================================================
[INFO] Docker tag : latest
[INFO] IP List File : nodeconf
[INFO] Start Port : 30300 20200 8545
[INFO] Server IP : 127.0.0.1:2
[INFO] Output Dir : /root/fisco/nodes/127.0.0.1/webase-deploy/nodes
[INFO] CA Path : /root/fisco/nodes/127.0.0.1/webase-deploy/nodes/cert/
==============================================================
[INFO] Execute the download_console.sh script in directory named by IP to get FISCO-BCOS console.
e.g. bash /root/fisco/nodes/127.0.0.1/webase-deploy/nodes/127.0.0.1/download_console.sh -f
==============================================================
[INFO] All completed. Files in /root/fisco/nodes/127.0.0.1/webase-deploy/nodes
============== Starting FISCO-BCOS ==============
try to start node0
try to start node1
Unable to find image 'fiscoorg/fiscobcos:v2.8.0' locally
Unable to find image 'fiscoorg/fiscobcos:v2.8.0' locally
v2.8.0: Pulling from fiscoorg/fiscobcos
4bbfd2c87b75: Pull complete
d2e110be24e1: Pull complete
889a7173dcfe: Pull complete
4be91040c2d7: Pull complete
6aeeeaf6c6fe: Pull complete
Digest: sha256:ac37bc2d79b48426c92b20486fe5c94a4fed1c240b195896f5bc29f48b4010b6
Status: Downloaded newer image for fiscoorg/fiscobcos:v2.8.0
1b3934c118bb114a8f5e3dd953ccc86b9ac7449c0dbb5d06302034151a616a34
node1 start successfully
v2.8.0: Pulling from fiscoorg/fiscobcos
Digest: sha256:ac37bc2d79b48426c92b20486fe5c94a4fed1c240b195896f5bc29f48b4010b6
Status: Image is up to date for fiscoorg/fiscobcos:v2.8.0
a8b173e5311da73a96147fab0bce69eb041ad5cd16433485165eaf64e910db2d
node0 start successfully
============== FISCO-BCOS Started ==============
configure nginx.conf file of webase-web
end nginx configuration
update mysql configuration in yaml
using [mysql in docker] mode
end mysql configuration in yaml
update webase-sign configuration in yaml
end webase-sign configuration in yaml
update webase-front configuration in yaml
end webase-front configuration in yaml
update webase-node-mgr configuration in yaml
end webase-node-mgr configuration in yaml
update webase-web configuration in yaml
end webase-web configuration in yaml
check database if exist in [docker mysql]
end check mysql databases
start docker container success!
============================================================
============== deploy has completed ==============
============================================================
============== webase-web version v1.5.3 ========
============== webase-node-mgr version v1.5.3 ========
============== webase-sign version v1.5.3 ========
============== webase-front version v1.5.3 ========
============================================================
======= check logs by [docker-compose -f docker/docker-compose.yaml logs -f]
一键部署完成后,打开浏览器(Chrome Safari或Firefox)访问
http://{deployIP}:{webPort}
示例:http://localhost:5000
(获取WeBASE管理平台默认账号和密码,并初始化系统配置)
默认账号为admin,默认密码为Abcd1234。
添加节点前置WeBASE-Front到WeBASE管理平台;一键部署时,节点前置与节点管理服务默认是同机部署,添加前置则填写IP为127.0.0.1
,默认端口为5002
。
检查节点前置是否启动,文章来源:https://www.toymoban.com/news/detail-761175.html
文章来源地址https://www.toymoban.com/news/detail-761175.html
到了这里,关于fiscobcos docker一键部署全流程(含docker安装)的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!