You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2017/10/18 23:26:05 UTC

[sling-launchpad-debian] 09/15: SLING-4863 Use new launchpad rather than crankstart in the Debian packaging

This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-launchpad-debian.git

commit a04e9a845f263cbc66df6561d3bc13792dfeb282
Author: Tomasz Rekawek <to...@apache.org>
AuthorDate: Mon Jul 20 18:55:55 2015 +0000

    SLING-4863 Use new launchpad rather than crankstart in the Debian packaging
    
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1691995 13f79535-47bb-0310-9956-ffa450edef68
---
 README.md                                     |  25 +----
 pom.xml                                       | 134 ++++----------------------
 src/deb/control/control                       |   2 +-
 src/deb/control/prerm                         |   1 -
 src/root_fs/etc/default/sling                 |  41 ++++----
 src/root_fs/etc/init.d/sling                  |  35 +------
 src/root_fs/etc/logrotate.d/sling             |   4 +-
 src/root_fs/opt/sling/scripts/sling-common.sh |   4 +-
 8 files changed, 57 insertions(+), 189 deletions(-)

diff --git a/README.md b/README.md
index a002268..c5e4014 100644
--- a/README.md
+++ b/README.md
@@ -9,31 +9,16 @@ config and run
 	"service sling start"
 
 Components used are:
-* [Sling crankstart](https://github.com/apache/sling/tree/trunk/contrib/crankstart)
-* [Sling-s3](https://github.com/apache/sling/tree/trunk/contrib/sling-s3)
+* [Sling launchpad](https://github.com/apache/sling/tree/trunk/launchpad/builder)
 
-Supported run modes are:
+For the list of supported run modes see the official [launchpad documentation](https://sling.apache.org/documentation/the-sling-engine/the-sling-launchpad.html).
 
-    crank           - tar files for nodes and data
-    crank-s3        - tar files for nodes, s3 for data
-    crank-mongo     - mongo for nodes and data
-    crank-s3-mongo  - mongo for nodes, s3 for data
-
-Each of these are supported by building crank files using the sling-s3 module to aggregate configuration templates into usable configurations.
+Important locations:
 
 * SLING_EXEC=/opt/sling - Location for all binaries & scripts.
-* SLING_CFG=/etc/sling - Tree of config file templates from which final.crantstart files are built. Editing any of these config templates triggers a rebuild of the target/crank\* files.
-* SLING_DEFAULTS=/etc/default/sling - Defaults file for location & path setup and to override any of the crank settings.
+* SLING_DEFAULTS=/etc/default/sling - Defaults file for location & path setup and to override any of the launchpad settings.
 * SLING_DATA=/var/lib/sling - Local sling data dir.
 * SLING_LOG_DIR=/var/log/sling - Sling log data.
 
-Additional bundles can be loaded in any of the defined runmodes by creating packages containing the crankstart config and dependent jars:
-/etc/sling/crank\*/\*.txt             - crankstart commands required
-/opt/sling/contrib.<package-name>   - additional bundle dependencies
-
-At start time, all /etc/sling/crank*/*.txt files are concatenated as defined by the /etc/sling/Makefile and sling is started with the runmode defined in /etc/default/sling. The init script link all the jars into one repo folder.
-
 TODO:
-* Support clustered configurations.
-
-
+* Support clustered configurations.
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 60f88a8..6b40b60 100644
--- a/pom.xml
+++ b/pom.xml
@@ -46,83 +46,13 @@ under the License.
             jdeb plugin version for debian package
         -->
         <jdeb.version>1.4</jdeb.version>
+        <launchpad.version>8-SNAPSHOT</launchpad.version>
         <slingInstallDir>/opt/sling</slingInstallDir>
         <slingConfigDir>/etc/sling</slingConfigDir>
-        <slingS3Dir>${basedir/../../sling-s3}</slingS3Dir>
     </properties>
     <build>
         <plugins>
             <plugin>
-                <!-- Copy sling-s3 info local workdir -->
-                <artifactId>maven-resources-plugin</artifactId>
-                <executions>
-                    <execution>
-                        <id>copy-sling-s3</id>
-                        <phase>generate-sources</phase>
-                        <goals>
-                            <goal>copy-resources</goal>
-                        </goals>
-                        <configuration>
-                            <outputDirectory>${project.build.directory}/${slingConfigDir}</outputDirectory>
-                            <overwrite>true</overwrite>
-                            <resources>
-                                <resource>
-                                    <directory>${slingS3Dir}</directory>
-                                </resource>
-                            </resources>
-                        </configuration>
-                    </execution>
-                </executions>
-            </plugin>
-            <plugin>
-                <!-- Use exec plugin to call make sling-s3 targets -->
-                <groupId>org.codehaus.mojo</groupId>
-                <artifactId>exec-maven-plugin</artifactId>
-                <version>1.2.1</version>
-                <executions>
-                    <execution>
-                        <!-- make all in the Maven compile phase -->
-                        <id>fix-exec-permissions</id>
-                        <phase>process-sources</phase>
-                        <goals>
-                            <goal>exec</goal>
-                        </goals>
-                        <configuration>
-                            <workingDirectory>${project.build.directory}/${slingConfigDir}</workingDirectory>
-                            <executable>chmod</executable>
-                            <arguments>
-                                <argument>-R</argument>
-                                <argument>775</argument>
-                                <argument>scripts</argument>
-                            </arguments>
-                        </configuration>
-                    </execution>
-                    <execution>
-                        <!-- make all in the Maven compile phase -->
-                        <id>build-config</id>
-                        <phase>generate-resources</phase>
-                        <goals>
-                            <goal>exec</goal>
-                        </goals>
-                        <configuration>
-                        	<environmentVariables>
-                            <OUTPUT>
-                              ${project.build.directory}/contrib
-                            </OUTPUT>
-                          </environmentVariables>
-                          <workingDirectory>${project.build.directory}/${slingConfigDir}</workingDirectory>
-                          <executable>make</executable>
-                          <arguments>
-                              <argument>update-bundles</argument>
-                              <argument>install-deps</argument>
-                              <argument>all</argument>
-                          </arguments>
-                        </configuration>
-                    </execution>
-                </executions>
-            </plugin>
-
-            <plugin>
                 <artifactId>jdeb</artifactId>
                 <groupId>org.vafer</groupId>
                 <version>${jdeb.version}</version>
@@ -148,57 +78,25 @@ under the License.
                                         <prefix>/etc</prefix>
                                     </mapper>
                                 </data>
-                                <!-- all other root_fs -->
-                                <data>
-                                    <src>${project.basedir}/src/root_fs/</src>
-                                    <type>directory</type>
-                                    <excludes>**/.svn/,**/etc/default/,**/etc/logrotate.d/</excludes>
-                                    <mapper>
-                                        <filemode>775</filemode>
-                                        <type>perm</type>
-                                        <prefix>/</prefix>
-                                    </mapper>
-                                </data>
-                                <!-- etc/sling/crank-*.d/ conf files -->
-                                <data>
-                                    <src>${project.build.directory}/${slingConfigDir}</src>
-                                    <type>directory</type>
-                                    <conffile>true</conffile>
-                                    <excludes>**/.svn/,**/contrib/,**/scripts/,**/target/</excludes>
-                                    <mapper>
-                                        <type>perm</type>
-                                        <prefix>${slingConfigDir}</prefix>
-                                    </mapper>
-                                </data>
-                                <!-- crank target files, etc - non-conf files, as they are generated -->
+                                <!-- opt/sling - jar files -->
                                 <data>
-                                    <src>${project.build.directory}/${slingConfigDir}</src>
+                                    <src>${project.build.directory}/opt/sling</src>
                                     <type>directory</type>
-                                    <includes>**/target/*</includes>
+                                    <conffile>false</conffile>
                                     <mapper>
-                                        <filemode>775</filemode>
                                         <type>perm</type>
-                                        <prefix>${slingConfigDir}</prefix>
+                                        <prefix>/opt/sling</prefix>
                                     </mapper>
                                 </data>
-                                <!-- sling-s3 scripts & other binaries -->
+                                <!-- all other root_fs -->
                                 <data>
-                                    <src>${project.build.directory}/${slingConfigDir}</src>
+                                    <src>${project.basedir}/src/root_fs/</src>
                                     <type>directory</type>
-                                    <includes>**/contrib/*,**/scripts/*</includes>
+                                    <excludes>**/.svn/,**/etc/default/,**/etc/logrotate.d/</excludes>
                                     <mapper>
                                         <filemode>775</filemode>
                                         <type>perm</type>
-                                        <prefix>${slingInstallDir}</prefix>
-                                    </mapper>
-                                </data>
-                                <!-- dependencies -->
-                                <data>
-                                    <src>${project.build.directory}/contrib</src>
-                                    <type>directory</type>
-                                    <mapper>
-                                        <type>perm</type>
-                                        <prefix>${slingInstallDir}/contrib</prefix>
+                                        <prefix>/</prefix>
                                     </mapper>
                                 </data>
                             </dataSet>
@@ -211,13 +109,21 @@ under the License.
                 <artifactId>maven-dependency-plugin</artifactId>
                 <executions>
                     <execution>
-                        <id>copy-dependencies</id>
+                        <id>copy</id>
                         <goals>
-                            <goal>copy-dependencies</goal>
+                            <goal>copy</goal>
                         </goals>
                         <phase>process-resources</phase>
                         <configuration>
-                            <outputDirectory>${project.build.directory}</outputDirectory>
+                            <artifactItems>
+                                <artifactItem>
+                                    <groupId>org.apache.sling</groupId>
+                                    <artifactId>org.apache.sling.launchpad</artifactId>
+                                    <version>${launchpad.version}</version>
+                                    <destFileName>org.apache.sling.launchpad.jar</destFileName>
+                                </artifactItem>
+                            </artifactItems>
+                            <outputDirectory>${project.build.directory}/opt/sling</outputDirectory>
                             <excludeTransitive>true</excludeTransitive>
                             <overWriteReleases>false</overWriteReleases>
                             <overWriteSnapshots>false</overWriteSnapshots>
diff --git a/src/deb/control/control b/src/deb/control/control
index 058b5ed..70d8b25 100644
--- a/src/deb/control/control
+++ b/src/deb/control/control
@@ -4,6 +4,6 @@ Section: misc
 Priority: optional
 Architecture: all
 Maintainer: Bruce Edge <br...@nextissuemedia.com>
-Depends: oracle-java7-installer, make
+Depends: oracle-java7-installer
 Description: [[description]]
 Distribution: development
diff --git a/src/deb/control/prerm b/src/deb/control/prerm
index e6be54d..4ab85c8 100644
--- a/src/deb/control/prerm
+++ b/src/deb/control/prerm
@@ -33,7 +33,6 @@ if [ remove = "$1" ]; then
     echo Purging sling generated files
     [ "$DEBUG" ] && set -x
     [ "${SLING_EXEC}" ] 		&& [ -d ${SLING_EXEC} ] 	&& rm -rf ${SLING_EXEC}
-    [ -d ${SLING_CFG}/target ] 								&& rm -rf ${SLING_CFG}/target
     [ "${SLING_LOG_DIR}" ] 		&& [ -d ${SLING_LOG_DIR} ]	&& rm -rf ${SLING_LOG_DIR}
     # Purge deletes data as well
     rm -f $0
diff --git a/src/root_fs/etc/default/sling b/src/root_fs/etc/default/sling
index bf5262c..1be3625 100644
--- a/src/root_fs/etc/default/sling
+++ b/src/root_fs/etc/default/sling
@@ -23,7 +23,7 @@ SLING_GROUP=sling
 
 # sling defaults
 # Note, init script uses :
-# $JAVA_ARGS $JAVA_DEBUG_ARGS -jar $SLING_JAR $SLING_DEFAULT_ARGS
+# $JAVA_ARGS $JAVA_DEBUG_ARGS -jar $SLING_JAR $SLING_ARGS
 
 #
 # All configuration items are setup in /etc/sling/*
@@ -40,44 +40,47 @@ SLING_GROUP=sling
 # of storage configurations before running for the first time
 #
 # Runtime startup mode options:
-# 	crank 			- tar files for nodes and data
-# 	crank-s3 		- tar files for nodes, s3 for data
-#	crank-mongo 	- mongo for nodes and data
-#	crank-s3-mongo 	- mongo for nodes, s3 for data
 #
-#	key:
-#	node store - for node properties and tree structure
-#	data store - for binaries
+# - jackrabbit:    configures and starts up an Apache Jackrabbit 2.x
+#                  JCR repository implementation
+# - oak:           configures and starts up an Apache Jackrabbit Oak
+#                  repository implementation with a SegmentNodeStore
+#                  (TarMK) implementation
+# - oak,oak_mongo: configures and starts up an Apache Jackrabbit Oak
+#                  repository implementation with a DocumentNodeStore
+#                  implementation connected to a MongoDB database. The
+#                  default configuration points to a MongoDB instance
+#                  at mongodb://localhost:27017 and a database named
+#                  sling.
 #
-RUNMODE=""
+RUNMODE="oak"
 #
 ##########################################################################
 
 #
-# Base locations - override default settings in crankfiles.
+# Base locations
 #
 SLING_EXEC=/opt/sling
-SLING_CFG=/etc/sling
 SLING_DEFAULTS=/etc/default/sling
 SLING_DATA=/var/lib/sling
 SLING_LOG_DIR=/var/log/sling
 
 START_LOG_FILE=$SLING_LOG_DIR/startup.log
 SLING_SCRIPTS=${SLING_EXEC}/scripts
-CRANKSTART_ENV=${SLING_SCRIPTS}/crankstart.sh
 
 # Bump RAM allowance
 JAVA_ARGS="-Xmx384M "
 
 # Uncomment for debugging:
-JAVA_ARGS+=" -agentlib:jdwp=transport=dt_socket,address=30303,server=y,suspend=n"
+# JAVA_ARGS+=" -agentlib:jdwp=transport=dt_socket,address=30303,server=y,suspend=n"
 
-#
-# crank file overrides
-#
-JAVA_ARGS+=" -Dport=8090"
-JAVA_ARGS+=" -Dsling.home=${SLING_DATA}"
-JAVA_ARGS+=" -Dlog.file=/var/log/sling/sling.log"
+# Sling arguments, description on https://sling.apache.org/documentation/the-sling-engine/the-sling-launchpad.html
+
+SLING_ARGS=" -p 8090"
+SLING_ARGS+=" -c ${SLING_DATA}"
+SLING_ARGS+=" -f /var/log/sling/sling.log"
+SLING_ARGS+=" -Dsling.run.modes=$RUNMODE"
+SLING_ARGS+=" -Dsling.fileinstall.dir=$SLING_DATA/install"
 
 # Allow gogo shell to run in noninteractive env:
 # From: http://apache-felix.18485.x6.nabble.com/Gogo-shell-on-standard-input-output-streams-td4845969.html#a4845970
diff --git a/src/root_fs/etc/init.d/sling b/src/root_fs/etc/init.d/sling
index 77ff556..68c7744 100644
--- a/src/root_fs/etc/init.d/sling
+++ b/src/root_fs/etc/init.d/sling
@@ -40,18 +40,13 @@ fi
 
 PID=/var/run/sling.pid
 DAEMON=$(which java)
+NAME="sling"
 
 function usage () {
 	log_warning_msg "Purpose: Stop/Start sling"
 	log_warning_msg "Usage  : $0 { stop | start | restart }"
 }
 
-function rebuild_config () {
-	log_progress_msg "Rebuild configuration"
-	cd ${SLING_CFG}
-	make -e target/${RUNMODE}.txt
-}
-
 function stop () {
 	killproc -p $PID $DAEMON TERM
 }
@@ -65,28 +60,7 @@ function start () {
 
 	check_sling_permissions
 
-	# Get MVN_OPTS from crankstart env file.
-	if [ -r $CRANKSTART_ENV ] ; then
-		# Other packages can use ${SLING_EXEC}.${artifactId}
-		# for dependencies to avoid name collisions.
-		# All will be aggregated here to provide a fully
-		# populated local repo.
-		M2REPO=${SLING_EXEC}/repo
-		rm -rf ${M2REPO}
-		install -d --owner=sling --group=sling  ${M2REPO}
-		for f in ${SLING_EXEC}/contrib* ; do
-			sudo -u sling -s cp -sRf $f/* ${M2REPO}
-		done
-		. $CRANKSTART_ENV
-	else
-		log_failure_msg "Missing $CRANKSTART_ENV file, cannot read crankstart env settings."
-		exit -1
-	fi
-	CRANKSTART_JAR=${SLING_EXEC}/contrib/crankstart.jar
-
-	# Update crankstart file if needed
-	log_daemon_msg "Starting sling serices"
-	rebuild_config
+	SLING_JAR=${SLING_EXEC}/org.apache.sling.launchpad.jar
 
 	log_progress_msg "Start sling daemon"
 	if start-stop-daemon --start \
@@ -98,12 +72,13 @@ function start () {
 		--verbose \
 		--no-close \
 		--exec $(which java) \
+		--name "$NAME" \
 		--start \
 		-- \
 		${JAVA_ARGS} \
 		${MVN_OPTS} \
-		-jar ${CRANKSTART_JAR} \
-		${SLING_CFG}/target/${RUNMODE}.txt \
+		-jar ${SLING_JAR} \
+		${SLING_ARGS} \
 		>$START_LOG_FILE 2>&1
 	then
 		sleep 3
diff --git a/src/root_fs/etc/logrotate.d/sling b/src/root_fs/etc/logrotate.d/sling
index 09bbb5e..9149f54 100644
--- a/src/root_fs/etc/logrotate.d/sling
+++ b/src/root_fs/etc/logrotate.d/sling
@@ -1,4 +1,4 @@
-/var/log/sling/startup.log {
+/var/log/sling/*.log {
   rotate
   size 10M
   copytruncate
@@ -6,4 +6,4 @@
   compress
   missingok
   notifempty
-}
+}
\ No newline at end of file
diff --git a/src/root_fs/opt/sling/scripts/sling-common.sh b/src/root_fs/opt/sling/scripts/sling-common.sh
index ff4ccb9..54ebaeb 100644
--- a/src/root_fs/opt/sling/scripts/sling-common.sh
+++ b/src/root_fs/opt/sling/scripts/sling-common.sh
@@ -36,13 +36,13 @@ else
 	exit -1
 fi
 
-# Make sure premissions & directoreis are OK.
+# Make sure premissions & directories are OK.
 # $1 = force sets all permissions
 function check_sling_permissions() {
 
 	chmod +x /etc/init.d/sling
 
-	for d in SLING_DATA SLING_EXEC SLING_CFG SLING_LOG_DIR ; do
+	for d in SLING_DATA SLING_EXEC SLING_LOG_DIR ; do
 		eval n=\$$d
 		if [ ! "${n}" ] ; then
 			log_failure_msg "Missing $d"

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.