-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[Feature] Add RPM generation support #9181
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,6 +32,11 @@ | |
<properties> | ||
<!-- disable mvn deploy to central maven repo by default --> | ||
<maven.deploy.skip>true</maven.deploy.skip> | ||
<rpm.build.disable>true</rpm.build.disable> | ||
<rpm.release.number>1</rpm.release.number> | ||
<rpm.stack.version>${project.version}-${rpm.release.number}</rpm.stack.version> | ||
<rpm.stack.root>/usr/bigtop</rpm.stack.root> | ||
<rpm.version>${project.version}-${rpm.release.number}</rpm.version> | ||
</properties> | ||
|
||
<build> | ||
|
@@ -68,6 +73,112 @@ | |
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-antrun-plugin</artifactId> | ||
<version>1.8</version> | ||
<executions> | ||
<execution> | ||
<id>postinstall_script</id> | ||
<goals> | ||
<goal>run</goal> | ||
</goals> | ||
<phase>generate-resources</phase> | ||
<configuration> | ||
<target> | ||
<echo append="false" file="${project.build.directory}/postinstall.sh">#!/bin/sh | ||
mkdir -p ${rpm.stack.root}/current | ||
ln -sfn ${rpm.stack.root}/${rpm.version}/seatunnel ${rpm.stack.root}/current | ||
chmod 755 ${rpm.stack.root}/${rpm.version}/seatunnel/bin/*.sh | ||
chmod 755 /etc/seatunnel/conf/*.sh</echo> | ||
</target> | ||
</configuration> | ||
</execution> | ||
<execution> | ||
<id>postremove_script</id> | ||
<goals> | ||
<goal>run</goal> | ||
</goals> | ||
<phase>generate-resources</phase> | ||
<configuration> | ||
<target> | ||
<echo append="false" file="${project.build.directory}/postremove.sh">#!/bin/sh | ||
rm -rf ${rpm.stack.root}/current/seatunnel | ||
rm -rf ${rpm.stack.root}/${rpm.version}</echo> | ||
</target> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.codehaus.mojo</groupId> | ||
<artifactId>rpm-maven-plugin</artifactId> | ||
<version>2.3.0</version> | ||
<executions> | ||
<execution> | ||
<id>generate-rpm</id> | ||
<goals> | ||
<goal>rpm</goal> | ||
</goals> | ||
<phase>package</phase> | ||
<configuration> | ||
<group>Development</group> | ||
<name>seatunnel</name> | ||
<version>${project.version}</version> | ||
<release>${rpm.release.number}</release> | ||
<needarch>x86_64</needarch> | ||
<group>Application/Java</group> | ||
<defaultFilemode>644</defaultFilemode> | ||
<defaultDirmode>755</defaultDirmode> | ||
<defaultUsername>root</defaultUsername> | ||
<defaultGroupname>root</defaultGroupname> | ||
<autoRequires>false</autoRequires> | ||
<disabled>${rpm.build.disable}</disabled> | ||
<mappings> | ||
<mapping> | ||
<directory>${rpm.stack.root}/${rpm.version}/seatunnel/</directory> | ||
<sources> | ||
<source> | ||
<location>${project.build.directory}/apache-seatunnel-${project.version}-bin/apache-seatunnel-${project.version}/</location> | ||
<excludes> | ||
<exclude>config/**</exclude> | ||
</excludes> | ||
</source> | ||
</sources> | ||
</mapping> | ||
<mapping> | ||
<directory>/etc/seatunnel/conf/</directory> | ||
<sources> | ||
<source> | ||
<location>${project.build.directory}/apache-seatunnel-${project.version}-bin/apache-seatunnel-${project.version}/config/</location> | ||
</source> | ||
</sources> | ||
</mapping> | ||
<mapping> | ||
<directory>/usr/sbin</directory> | ||
<filemode>755</filemode> | ||
<username>root</username> | ||
<groupname>root</groupname> | ||
<directoryIncluded>false</directoryIncluded> | ||
<sources> | ||
<source> | ||
<location>${project.basedir}/sbin/seatunnel</location> | ||
</source> | ||
</sources> | ||
</mapping> | ||
</mappings> | ||
<postinstallScriptlet> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should we have a preInstallScriptlet, /usr/bigtop, which is defined as an rpm root, may not be present,
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. During the installation of the RPM, if the rpm.stack.root directory (which is configurable but defaults to /usr/bigtop) does not exist, the yum install command will create it and then copy the necessary files and folders into it. Since we access the rpm.stack.root after the installation, it is guaranteed that the stack root will always be present. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thanks for the clarification, if we can accommodate in RPM installation guide, it would be helpulf, -Drpm.stack.root=/usr/ There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure, I will add the documentation later as part of resolving task #9196 |
||
<scriptFile>${project.build.directory}/postinstall.sh</scriptFile> | ||
<fileEncoding>utf-8</fileEncoding> | ||
</postinstallScriptlet> | ||
<postremoveScriptlet> | ||
<scriptFile>${project.build.directory}/postremove.sh</scriptFile> | ||
<fileEncoding>utf-8</fileEncoding> | ||
</postremoveScriptlet> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#!/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. | ||
# | ||
set - | ||
|
||
if [ -f "/etc/seatunnel/conf/seatunnel-env.sh" ]; then | ||
. "/etc/seatunnel/conf/seatunnel-env.sh" | ||
echo "Using /etc/seatunnel/conf/seatunnel-env.sh." | ||
else | ||
echo "File /etc/seatunnel/conf/seatunnel-env.sh does not exist." | ||
exit 1 | ||
fi | ||
if [ -z "${APP_DIR}" ]; then | ||
echo "APP_DIR is not set. It must be set in seatunnel-env.sh" | ||
exit 1 | ||
fi | ||
BIN_DIR="${APP_DIR}/bin" | ||
|
||
start() { | ||
echo "starting seatunnel" | ||
. "${BIN_DIR}/seatunnel-cluster.sh" -d | ||
echo "seatunnel started" | ||
} | ||
|
||
stop() { | ||
echo "stopping seatunnel..." | ||
. "${BIN_DIR}/stop-seatunnel-cluster.sh" | ||
echo "seatunnel stopped" | ||
} | ||
|
||
status() { | ||
if jcmd | grep -q -i 'org.apache.seatunnel.core.starter.seatunnel.SeaTunnelServer'; then | ||
echo "seatunnel is running" | ||
else | ||
echo "seatunnel is not running" | ||
fi | ||
} | ||
|
||
case "$1" in | ||
"start") start ;; | ||
"stop") stop ;; | ||
"status") status ;; | ||
*) echo "Usage: seatunnel {start|stop|status}"; exit 1 ;; | ||
esac |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some question: