Centos 7下 sitewhere2.0 部署
前期准备 (需要安装git、jdk1.8,在此略过)1、安装Docker CE删除老版本,如果有或者不确定的话;sudo yum remove dockerdocker-clientdocker-client-latestdocker-commondocker-latestdocker-latest-logrotatedocker-logrotatedocker-...
前期准备 (需要安装git、jdk1.8,在此略过)
1、安装Docker CE
删除老版本,如果有或者不确定的话;
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
使用repository安装
先设置
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
sudo yum-config-manager
–add-repo
https://download.docker.com/linux/centos/docker-ce.repo
安装DOCKER CE
sudo yum install docker-ce
启动
systemctl start docker
测试,如果需要的话
sudo docker run hello-world
配置监听Docker守护程序 监听TCP 2375
vi /lib/systemd/system/docker.service
增加加黑部分
ExecStart=/usr/bin/dockerd -H tcp://0.0.0.0:2375 -H unix://var/run/docker.sock
重启服务
sudo systemctl daemon-reload
sudo systemctl restart docker
测试一下成功与否
curl http://localhost:2375/version
{“Platform”:{“Name”:""},“Components”:[{“Name”:“Engine”,“Version”:“18.06.1-ce”,“Details”:{“ApiVersion”:“1.38”,“Arch”:“amd64”,“BuildTime”:“2018-08-21T17:25:29.000000000+00:00”,“Experimental”:“false”,“GitCommit”:“e68fc7a”,“GoVersion”:“go1.10.3”,“KernelVersion”:“3.10.0-123.el7.x86_64”,“MinAPIVersion”:“1.12”,“Os”:“linux”}}],“Version”:“18.06.1-ce”,“ApiVersion”:“1.38”,“MinAPIVersion”:“1.12”,“GitCommit”:“e68fc7a”,“GoVersion”:“go1.10.3”,“Os”:“linux”,“Arch”:“amd64”,“KernelVersion”:“3.10.0-123.el7.x86_64”,“BuildTime”:“2018-08-21T17:25:29.000000000+00:00”}
2、安装Docker Compose
下载
sudo curl -L “https://github.com/docker/compose/releases/download/1.22.0/docker-compose-
(
u
n
a
m
e
−
s
)
−
(uname -s)-
(uname−s)−(uname -m)” -o /usr/local/bin/docker-compose
修改权限
sudo chmod +x /usr/local/bin/docker-compose
测试安装成功否
docker-compose --version
docker-compose version 1.22.0, build f46880fe
3、启用Swarm mode
docker swarm init
4、构建
安装gradle
cd /usr/local/
wget https://services.gradle.org/distributions/gradle-4.10.2-bin.zip
unzip gradle-4.10.2-bin.zip
vi /etc/profile
将如下代码追加到 profile 文件末尾:
GRADLE_HOME=/usr/local/gradle-4.10.2
export PATH=
G
R
A
D
L
E
H
O
M
E
/
b
i
n
:
{GRADLE_HOME}/bin:
GRADLEHOME/bin:{PATH}
重载/etc/profile这个文件
source /etc/profile
测试
gradle -version
生成gradlew
cd /usr/local/gradle-4.10.2
gradle wrapper
ln -s gradlew ./bin/gradlew
下载sitewhere
git clone https://github.com/sitewhere/sitewhere.git
cd sitewhere
git checkout --force sitewhere-2.0.rc2
执行Gradle构建脚本前先编辑gradle.properties,根据自己设置修改
dockerProtocol=tcp
dockerHostname=localhost (在本机所以不用ip或域名)
dockerPort=2375
dockerRepository=docker.io
registryUrl=https://index.docker.io/v1/
registryUsername=用户名
registryPassword=密码
registryEmail=邮箱
开始构建镜像
gradlew clean dockerImage
如果遇到Could not find tools.jar. Please check that /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.171-8.b10.el7_5.x86_64/jre contains a valid JDK installation
找下看有没
find / -name tools.jar
好吧,可能是阉割过的卸了重新安装
yum -y remove java-1.8.0-openjdk*
yum -y install java-1.8.0-openjdk*
没问题的话完工
docker images
应该可以看到构建镜像清单
REPOSITORY TAG IMAGE ID CREATED SIZE
sitewhere/service-web-rest 2.0.rc2 d4b81db1b475 About a minute ago 158MB
sitewhere/service-user-management 2.0.rc2 197fe55f3148 About a minute ago 133MB
sitewhere/service-tenant-management 2.0.rc2 72e3202d597b About a minute ago 132MB
sitewhere/service-streaming-media 2.0.rc2 66e2bf65e2df About a minute ago 136MB
sitewhere/service-schedule-management 2.0.rc2 8c14b495a4cb 2 minutes ago 134MB
sitewhere/service-rule-processing 2.0.rc2 740e19f15d91 2 minutes ago 135MB
sitewhere/service-outbound-connectors 2.0.rc2 31316561deb9 2 minutes ago 143MB
sitewhere/service-label-generation 2.0.rc2 3a6501e0c1fb 2 minutes ago 135MB
sitewhere/service-instance-management 2.0.rc2 4ea4a4330778 3 minutes ago 131MB
sitewhere/service-inbound-processing 2.0.rc2 9916102afc79 3 minutes ago 136MB
sitewhere/service-event-sources 2.0.rc2 9c0ed2e0709e 3 minutes ago 147MB
sitewhere/service-event-search 2.0.rc2 c87f85ca42cc 4 minutes ago 133MB
sitewhere/service-event-management 2.0.rc2 2ef01c3a7de5 4 minutes ago 140MB
sitewhere/service-device-state 2.0.rc2 dc0c8f14f856 5 minutes ago 137MB
sitewhere/service-device-registration 2.0.rc2 d7967388db5f 5 minutes ago 135MB
sitewhere/service-device-management 2.0.rc2 2d794b9b7762 5 minutes ago 137MB
sitewhere/service-command-delivery 2.0.rc2 108601dc07dd 5 minutes ago 137MB
sitewhere/service-batch-operations 2.0.rc2 7880c7832013 5 minutes ago 136MB
sitewhere/service-asset-management 2.0.rc2 f37a4fa00eb7 6 minutes ago 137MB
openjdk 8-jre-alpine 0fe3f0d1ee48 2 weeks ago 83MB
5、部署
下载
git clone https://github.com/sitewhere/sitewhere-recipes.git
先构建启动基础服务镜像
cd sitewhere-recipes/docker-compose/infrastructure_default
docker-compose up
再启用默认微服务
cd sitewhere-recipes/docker-compose/default
docker-compose up
全部做完没报错的话,下载sitewhere-admin-ui
输入用户名admin密码password ,IP地址然后登录
更多推荐
所有评论(0)