Seatunnel-2.3.3 自打包 docker部署(含web)

07-03 1319阅读

前言

此篇重点是,自己将源码编译后,将打包文件部署在docker里(也可以直接用官网的)

Seatunnel-2.3.3 自打包 docker部署(含web)
(图片来源网络,侵删)

如果也有人是希望,将自己打包的源码部署了,可以参考可乐的这篇文章,这篇文章详细介绍了2.3.3的serve和web的源码启动流程

Apache Seatunnel本地源码构建编译运行调试

前期准备

  1. docker环境
  2. seatunnel-2.3.3  二进制执行文件(apache-seatunnel-2.3.4-bin.tar.gz解压后的文件)
  3. seatunnel-web-1.0.0 二进制可执行文件
  4. cp /opt/seatunnel/apache-seatunnel-2.3.3/config/hazelcast-client.yaml /opt/seatunnel/apache-seatunnel-web-1.0.0-bin/conf/

4的命令不用执行,只要是给大家一个参考,记得吧hazelcast-client.yaml文件覆盖到二进制里面去,同时hazelcast-client.yaml的内容改一下,主要把127或者localhost改为本机宿主机ip

提示:  这里我就默认大家,已经解决了所有,可乐文章里的疑难杂症,也就是说,

源码是可以添加数据源,可以添加任务执行单表操作的。

如果!!! 不能保障!!!请先看可乐文章后,再阅读本篇,不然的话,真的会很痛苦,要不断编译,不断部署!!!

文件目录介绍

--docer-compose.yml

--seatunnel

        --Dockerfile

        --Dockerfile_web

        --apache-seatunnel-2.3.3

        --apache-seatunnel-web-1.0.0

文件内容

docker-compose.yml

version: '3'
services:
  seatunnel-serve:
    build:
        context: ./seatunnel/
        dockerfile: Dockerfile
    container_name: seatunnel_serve
    ports:
      - 5801:5801
    command: nohup sh bin/seatunnel-cluster.sh 2>&1 &
    volumes:
      - ./seatunnel/apache-seatunnel-2.3.3/:/opt/seatunnel/
    restart: always
    networks:
      - app
  seatunnel-web:
    build:
        context: ./seatunnel/
        dockerfile: Dockerfile_web
    volumes:
      - ./seatunnel/apache-seatunnel-web-1.0.0/:/opt/seatunnel_web/
    container_name: seatunnel_web
    entrypoint: /opt/seatunnel_web/bin/chmod-daemon.sh
    ports:
      - 8801:8801
    restart: always
    networks:
      - app
volumes:
  data:
networks:
  app:
    external: true

Dockerfile

这个其实也可以不用,但是有个小瑕疵没解决,先预留

#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
FROM openjdk:8
ENV SEATUNNEL_HOME="/opt/seatunnel"
RUN  mkdir -p SEATUNNEL_HOME/logs
WORKDIR /opt/seatunnel

Dockerfile_web

#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
FROM openjdk:8
user root
ENV SEATUNNEL_HOME="/opt/seatunnel_web"
COPY ./apache-seatunnel-web-1.0.0/ ${SEATUNNEL_HOME}/
RUN  mkdir -p SEATUNNEL_HOME/logs
RUN chmod +x /opt/seatunnel_web/bin/seatunnel-backend-daemon.sh
RUN chmod +x /opt/seatunnel_web/bin/chmod-daemon.sh
WORKDIR /opt/seatunnel_web
#CMD ["chmod"," +x", "bin/seatunnel-backend-daemon.sh"]
#CMD ["sh", "/opt/seatunnel_web/bin/seatunnel-backend-daemon.sh", "start"]
CMD ["tail"," -f", "nohup.out"]

chmod-daemon.sh

这里有个小瑕疵

 sh /opt/seatunnel_web/bin/seatunnel-backend-daemon.sh start权限问题一直没有解决

所以我在seatunnel-backend-daemon.sh打了echo,把参数都打印出来了,打印出来后直接贴到了这里,这个后期我解决了,我会上报解决方案

注意!!!chmod-daemon.sh会存在sh文件格式的问题

映射进去的时候可能是CRLF的格式,linux识别不来,所以在docker-compose里的entrypoint查找文件的时候,会报no such file or directory

注意文件格式是LF还是CRLF

LF   linux

CRLF  window

#!/bin/sh
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#echo test111111111
chmod 777 /opt/seatunnel_web/bin/seatunnel-backend-daemon.sh
echo 111111111111111111111111123
/usr/local/openjdk-8/bin/java -server -Xms1g -Xmx1g -Xmn512m -XX:+PrintGCDetails -Xloggc:gc.log -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=dump.hprof -Dseatunnel-web.logs.path=/opt/seatunnel_web/bin/../logs -cp /opt/seatunnel_web/bin/../conf:/opt/seatunnel_web/bin/../libs/*:/opt/seatunnel_web/bin/../datasource/* -Dspring.config.name=application.yml -Dspring.config.location=classpath:application.yml org.apache.seatunnel.app.SeatunnelApplication
# sh /opt/seatunnel_web/bin/seatunnel-backend-daemon.sh start

还有一种解决方案(这是可乐提供的解决方案,不过没有测试,先贴在这里)

sh 如果是在windows下直接打开复制过去的,会有让shell文件的格式有问题,镜像运行的时候报初始化脚本\r问题,所以需要在wsl进入centOs子系统中执行如下:
sed -i ‘s/\r$//’ filename
将xxxx.sh格式转为linux下的格式
VPS购买请点击我

文章版权声明:除非注明,否则均为主机测评原创文章,转载或复制请以超链接形式并注明出处。

目录[+]