# Directories and files
CONF_DIR=$BASE_DIR/etc/$APP
CONF_DIRS=$CONF_DIR/conf.d
-#BASE_POLICY_ALL=/usr/share/$APP/all.policy
BASE_CONFIG_INI=$BASE_DIR/share/$APP/config.ini
-#EXEC_DIR=$BASE_DIR/var/lib/$APP
EXEC_DIR=.
DATA_DIR=$EXEC_DIR/data
CONF_RW=$EXEC_DIR/state
mkdir -p $DATA_DIR
# Merge config files
- printf "## Equinox configuration - Generated by /usr/sbin/nodectl ##\n\n" > $CONFIG_INI
+ printf "## Equinox configuration - Generated by argeo-cms ##\n\n" > $CONFIG_INI
cat $BASE_CONFIG_INI >> $CONFIG_INI
printf "\n##\n## $CONF_DIR/$APP.ini\n##\n\n" >> $CONFIG_INI
cat $CONF_DIR/$APP.ini >> $CONFIG_INI
+++ /dev/null
-#!/usr/bin/a2jjs\r
-load("share/argeo/cms.js");\r
-osgi.httpPort = 8080;\r
-//osgi.conf("argeo.node.useradmin.uris", "os:///");\r
-//osgi.clean = true;\r
-osgi.launch();\r
--- /dev/null
+// Run from base directory with:\r
+// ./bin/a2sh --startup ./share/argeo/cms.jsh ./bin/argeo-cms.jsh\r
+\r
+osgi.setHttpPort(7080);\r
+osgi.conf("argeo.node.useradmin.uris", "os:///");\r
+osgi.setClean(true);\r
+\r
+// LAUNCH\r
+osgi.launch();
\ No newline at end of file
#argeo.osgi.start.5.apps=org.argeo.suite.apps
# UI
-#argeo.osgi.start.6.apps=org.argeo.suite.apps.web,org.argeo.suite.workbench.rap
+#argeo.osgi.start.6.apps=org.argeo.suite.apps.web,org.argeo.suite.e4.rap
+++ /dev/null
-var System = Java.type("java.lang.System");
-var OsgiBuilder = Java.type("org.argeo.osgi.boot.OsgiBuilder");
-
-var osgi = new OsgiBuilder();
-// default bundles
-osgi.start(2, "org.eclipse.equinox.http.servlet");
-osgi.start(2, "org.eclipse.equinox.http.jetty");
-osgi.start(2, "org.eclipse.equinox.metatype");
-osgi.start(2, "org.eclipse.equinox.cm");
-osgi.start(2, "org.eclipse.equinox.ds");
-osgi.start(2, "org.eclipse.rap.rwt.osgi");
-osgi.start(3, "org.argeo.cms");
-osgi.start(4, "org.argeo.cms.e4.rap");
-// specific properties
-osgi.conf("org.eclipse.rap.workbenchAutostart", "false");
-osgi.conf("org.eclipse.equinox.http.jetty.autostart", "false");
-osgi.conf("org.osgi.framework.bootdelegation", "com.sun.jndi.ldap,"
- + "com.sun.jndi.ldap.sasl," + "com.sun.security.jgss,"
- + "com.sun.jndi.dns," + "com.sun.nio.file," + "com.sun.nio.sctp");
-
-var homeUri = java.nio.file.Paths
- .get(java.lang.System.getProperty("user.home")).toUri().toString();
-var execDirUri = java.nio.file.Paths.get(
- java.lang.System.getProperty("user.dir")).toUri().toString();
-if (typeof app !== 'undefined') {
- if (typeof appHome == 'undefined') {
- var appHome = homeUri + "/.a2/var/lib/" + app;
- }
- if (typeof appConf == 'undefined') {
- var appConf = homeUri + "/.a2/etc/" + app;
- }
- if (typeof policyFile == 'undefined') {
- var policyFile = "node.policy";
- }
- osgi.conf("osgi.configuration.area", appHome + "/state");
- osgi.conf("osgi.instance.area", appHome + "/data");
- // System.setProperty("java.security.manager", "");
- // System.setProperty("java.security.policy", appConf + "/" + policyFile);
- System.setProperty("log4j.configuration", appConf + "/log4j.properties");
-} else {
- osgi.conf("osgi.configuration.area", execDirUri + "/state");
- osgi.conf("osgi.instance.area", execDirUri + "/data");
- System.setProperty("log4j.configuration", execDirUri + "etc/argeo/log4j.properties");
-}
--- /dev/null
+import java.nio.file.*;
+import org.argeo.osgi.boot.*;
+
+OsgiBuilder osgi = new OsgiBuilder();
+
+// default bundles
+osgi.start(2, "org.eclipse.equinox.http.servlet");
+osgi.start(2, "org.eclipse.equinox.metatype");
+osgi.start(2, "org.eclipse.equinox.cm");
+osgi.start(2, "org.eclipse.equinox.ds");
+osgi.start(2, "org.eclipse.rap.rwt.osgi");
+osgi.start(3, "org.argeo.cms");
+osgi.start(4, "org.argeo.cms.e4.rap");
+
+// specific properties
+osgi.conf("org.eclipse.rap.workbenchAutostart", "false");
+osgi.conf("org.eclipse.equinox.http.jetty.autostart", "false");
+osgi.conf("org.osgi.framework.bootdelegation", "com.sun.jndi.ldap,"
+ + "com.sun.jndi.ldap.sasl," + "com.sun.security.jgss,"
+ + "com.sun.jndi.dns," + "com.sun.nio.file," + "com.sun.nio.sctp");
+
+String homeUri = Paths.get(System.getProperty("user.home")).toUri().toString();
+String execDirUri = Paths.get(System.getProperty("user.dir")).toUri().toString();
+
+osgi.conf("osgi.configuration.area", execDirUri + "/state");
+osgi.conf("osgi.instance.area", execDirUri + "/data");
+System.setProperty("log4j.configuration", execDirUri + "etc/argeo/log4j.properties");
com.sun.nio.file,\
com.sun.nio.sctp
-# Security manager
-#java.security.manager=
-#java.security.policy=file:/usr/share/node/all.policy
-
# Required properties
eclipse.ignoreApp=true
osgi.noShutdown=true
org.eclipse.equinox.http.jetty.autostart=false
-#org.eclipse.rap.workbenchAutostart=false
# Disable some warnings
nashorn.option.no.deprecation.warning=true
<profile>
<id>dist</id>
<dependencies>
+ <dependency>
+ <groupId>org.argeo.commons</groupId>
+ <artifactId>org.argeo.dep.cms.client</artifactId>
+ <version>2.1.88-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.argeo.commons</groupId>
+ <artifactId>org.argeo.dep.cms.node</artifactId>
+ <version>2.1.88-SNAPSHOT</version>
+ </dependency>
<dependency>
<groupId>org.argeo.commons</groupId>
<artifactId>org.argeo.dep.cms.e4.rap</artifactId>
<version>2.1.88-SNAPSHOT</version>
</dependency>
+ <dependency>
+ <groupId>org.argeo.commons</groupId>
+ <artifactId>org.argeo.dep.cms.sdk</artifactId>
+ <version>2.1.88-SNAPSHOT</version>
+ </dependency>
<dependency>
<groupId>org.argeo.commons</groupId>
<artifactId>osgi-boot</artifactId>
</sources>
</mapping>
</mappings>
- <!-- <preinstallScriptlet> -->
- <!-- <scriptFile>rpm/scripts/preinstall</scriptFile> -->
- <!-- </preinstallScriptlet> -->
<requires>
<require>argeo-cms-node</require>
<require>osgi-boot</require>
+++ /dev/null
-if [ $1 = "1" ];then
- APP=argeo
-
- # check if user exists
- /bin/id $APP 2>/dev/null
- if [ $? -ne 0 ];then
- echo Create user $APP...
- useradd --system --home-dir /var/lib/$APP --shell /bin/bash --user-group --create-home $APP
- else
- echo User $APP already exists
- fi
-
- mkdir -p /var/lib/$APP/{state,data,indexes}
- chown -R $APP.$APP /var/lib/$APP
-fi
\ No newline at end of file
+++ /dev/null
-grant {
- permission java.security.AllPermission;
-};
\ No newline at end of file
+++ /dev/null
-# Only Argeo OSGi Boot is explicitly started
-osgi.bundles=org.argeo.osgi.boot@start
-
-# Required standard bundles to start
-argeo.osgi.start.2.node=\
-org.eclipse.equinox.http.servlet,\
-org.eclipse.equinox.http.jetty,\
-org.eclipse.equinox.metatype,\
-org.eclipse.equinox.cm,\
-org.eclipse.equinox.ds,\
-org.eclipse.rap.rwt.osgi
-
-# Required CMS bundles to start
-argeo.osgi.start.3.node=\
-org.argeo.cms
-
-# Extension managers
-argeo.osgi.start.4.node=\
-org.eclipse.gemini.blueprint.extender,\
-org.argeo.cms.e4.rap
-
-# Packages provided by the OpenJDK JVM
-org.osgi.framework.bootdelegation=com.sun.jndi.ldap,\
-com.sun.jndi.ldap.sasl,\
-com.sun.security.jgss,\
-com.sun.jndi.dns,\
-com.sun.nio.file,\
-com.sun.nio.sctp
-
-# Security manager
-java.security.manager=
-java.security.policy=file:/usr/share/node/all.policy
-
-# Required properties
-eclipse.ignoreApp=true
-osgi.noShutdown=true
-org.eclipse.equinox.http.jetty.autostart=false
-org.eclipse.rap.workbenchAutostart=false
+++ /dev/null
-var System = Java.type("java.lang.System");
-var OsgiBuilder = Java.type("org.argeo.osgi.boot.OsgiBuilder");
-
-var osgi = new OsgiBuilder();
-// default bundles
-osgi.start(2, "org.eclipse.equinox.http.servlet");
-osgi.start(2, "org.eclipse.equinox.http.jetty");
-osgi.start(2, "org.eclipse.equinox.metatype");
-osgi.start(2, "org.eclipse.equinox.cm");
-osgi.start(2, "org.eclipse.rap.rwt.osgi");
-osgi.start(3, "org.argeo.cms");
-osgi.start(4, "org.eclipse.gemini.blueprint.extender");
-osgi.start(4, "org.eclipse.equinox.http.registry");
-// specific properties
-osgi.conf("org.eclipse.rap.workbenchAutostart", "false");
-osgi.conf("org.eclipse.equinox.http.jetty.autostart", "false");
-osgi.conf("org.osgi.framework.bootdelegation", "com.sun.jndi.ldap,"
- + "com.sun.jndi.ldap.sasl," + "com.sun.security.jgss,"
- + "com.sun.jndi.dns," + "com.sun.nio.file," + "com.sun.nio.sctp");
-
-var homeUri = java.nio.file.Paths
- .get(java.lang.System.getProperty("user.home")).toUri().toString();
-if (typeof app !== 'undefined') {
- if (typeof appHome == 'undefined') {
- var appHome = homeUri + "/.a2/var/lib/" + app;
- }
- if (typeof appConf == 'undefined') {
- var appConf = homeUri + "/.a2/etc/" + app;
- }
- if (typeof policyFile == 'undefined') {
- var policyFile = "node.policy";
- }
- osgi.conf("osgi.configuration.area", appHome + "/state");
- osgi.conf("osgi.instance.area", appHome + "/data");
- System.setProperty("java.security.manager", "");
- System.setProperty("java.security.policy", appConf + "/" + policyFile);
- System.setProperty("log4j.configuration", appConf + "/log4j.properties");
-}
-
-function openWorkbench() {
- osgi.spring("org.argeo.cms.ui.workbench.rap");
- var appUrl = "http://127.0.0.1:" + osgi.httpPort + "/ui/node";
- $EXEC("chrome --app=" + appUrl);
- // shutdown when the window is closed
- osgi.shutdown();
-}
\ No newline at end of file
+++ /dev/null
-#!/bin/sh
-BIN_DIR=`dirname $0`
-EQUINOX=$BIN_DIR/../share/osgi/boot/org.eclipse.osgi.jar
-OSGI_BOOT=$BIN_DIR/../share/osgi/boot/org.argeo.osgi.boot.jar
-
-/usr/bin/jjs -cp "$EQUINOX:$OSGI_BOOT" $*
--- /dev/null
+#!/bin/sh
+BIN_DIR=`dirname $0`
+EQUINOX=$BIN_DIR/../share/osgi/boot/org.eclipse.osgi.jar
+OSGI_BOOT=$BIN_DIR/../share/osgi/boot/org.argeo.osgi.boot.jar
+
+/usr/bin/jshell --class-path "$EQUINOX:$OSGI_BOOT" $*
<configuration>
<name>osgi-boot</name>
<mappings>
- <mapping>
- <directory>/etc/osgiboot</directory>
- <username>root</username>
- <groupname>root</groupname>
- <filemode>644</filemode>
- <configuration>noreplace</configuration>
- <directoryIncluded>false</directoryIncluded>
- <sources>
- <source>
- <location>src/main/rpm/etc/osgiboot</location>
- <includes>
- <include>*-settings.sh</include>
- </includes>
- </source>
- </sources>
- </mapping>
- <mapping>
- <directory>/etc/osgiboot</directory>
- <username>root</username>
- <groupname>root</groupname>
- <filemode>644</filemode>
- <directoryIncluded>false</directoryIncluded>
- <sources>
- <source>
- <location>src/main/rpm/etc/osgiboot</location>
- <includes>
- <include>*.policy</include>
- <include>*-functions.sh</include>
- </includes>
- </source>
- </sources>
- </mapping>
<mapping>
<directory>/usr/bin</directory>
<username>root</username>
<directoryIncluded>false</directoryIncluded>
<sources>
<source>
- <location>src/main/rpm/usr/sbin</location>
+ <location>rpm/usr/bin</location>
<includes>
<include>*</include>
</includes>
</source>
</sources>
</mapping>
- <mapping>
- <directory>/usr/sbin</directory>
- <username>root</username>
- <groupname>root</groupname>
- <filemode>755</filemode>
- <directoryIncluded>false</directoryIncluded>
- <sources>
- <source>
- <location>src/main/rpm/usr/sbin</location>
- <includes>
- <include>osgi-service</include>
- </includes>
- </source>
- </sources>
- </mapping>
<mapping>
<directory>/usr/share/osgi/boot</directory>
<username>root</username>
--- /dev/null
+#!/bin/sh
+
+export A2_HOME=$HOME/.a2
+if [ -d "$A2_HOME/share/osgi/boot" ]; then
+ PREFIX=$A2_HOME
+else
+ PREFIX=/usr
+fi
+
+EQUINOX=$PREFIX/share/osgi/boot/org.eclipse.osgi.jar
+OSGI_BOOT=$PREFIX/share/osgi/boot/org.argeo.osgi.boot.jar
+
+/usr/bin/jshell --class-path "$EQUINOX:$OSGI_BOOT" $*
+++ /dev/null
-grant {
- permission java.security.AllPermission;
-};
\ No newline at end of file
+++ /dev/null
-#!/bin/bash
-
-# Source function library.
-. /etc/rc.d/init.d/functions
-
-RETVAL=0
-
-osgi_service_start() {
- APP=$1
- # create log and run directories writable by the application user
- USER=$APP
- GROUP=$APP
- RUN_DIR=/var/run/$APP
- LOG_DIR=/var/log/$APP
- if [ ! -d $LOG_DIR ];then
- mkdir -m 0750 $LOG_DIR
- chown -R $USER.$GROUP $LOG_DIR
- fi
- if [ ! -d $RUN_DIR ];then
- mkdir -m 0750 $RUN_DIR
- chown -R $USER.$GROUP $RUN_DIR
- fi
-
- # call Argeo Commons OSGi utilities as the application user
- daemon --user $USER /usr/sbin/osgi-service $APP start
-
- RETVAL=$?
- #action $"Start $APP" /bin/true
- if [ $RETVAL -eq 0 ];then
- PID=`cat $RUN_DIR/$APP.pid`
- action $"Started $APP with pid $PID" /bin/true
- else
- action $"Could not start $APP" /bin/false
- fi
- return $RETVAL
-}
-
-osgi_service_stop() {
- APP=$1
- USER=$APP
- # call Argeo Commons OSGi utilities as the application user
- runuser -s /bin/bash $USER -c "/usr/sbin/osgi-service $APP stop"
- RETVAL=$?
- if [ $RETVAL -eq 0 ];then
- action $"Stopped $APP" /bin/true
- else
- action $"Could not stop $APP" /bin/false
- fi
- return $RETVAL
-}
-
-osgi_service_status() {
- APP=$1
- USER=$APP
- # call Argeo Commons OSGi utilities as the application user
- runuser -s /bin/bash $USER -c "/usr/sbin/osgi-service $APP status"
- RETVAL=$?
- return $RETVAL
-}
+++ /dev/null
-#JAVA_OPTS=-Xmx256m
\ No newline at end of file
+++ /dev/null
-#!/bin/sh
-
-export A2_HOME=$HOME/.a2
-if [ -d "$A2_HOME/share/osgi/boot" ]; then
- PREFIX=$A2_HOME
-else
- PREFIX=/usr
-fi
-
-EQUINOX=$PREFIX/share/osgi/boot/org.eclipse.osgi.jar
-OSGI_BOOT=$PREFIX/share/osgi/boot/org.argeo.osgi.boot.jar
-
-/usr/bin/jjs -cp "$EQUINOX:$OSGI_BOOT" $*
+++ /dev/null
-#!/bin/sh
-
-JVM=java
-. /etc/osgiboot/osgi-service-settings.sh
-
-APP=$1
-
-CONF_DIR=/etc/$APP
-if [ -f $CONF_DIR/settings.sh ];then
- . $CONF_DIR/settings.sh
-fi
-
-LIB_DIR=/usr/share/$APP/lib
-
-# read/write
-EXEC_DIR=/var/lib/$APP
-DATA_DIR=$EXEC_DIR/data
-CONF_RW=$EXEC_DIR/conf
-
-LOG_DIR=/var/log/$APP
-LOG_FILE=$LOG_DIR/$APP.log
-
-RUN_DIR=/var/run/$APP
-PID_FILE=$RUN_DIR/$APP.pid
-SHUTDOWN_FILE=$RUN_DIR/$APP.shutdown
-
-OSGI_INSTALL_AREA=/usr/share/osgi/boot
-OSGI_FRAMEWORK=$OSGI_INSTALL_AREA/org.eclipse.osgi.jar
-
-RETVAL=0
-
-start() {
- if [ -f $PID_FILE ];then
- PID=`cat $PID_FILE`
- kill -0 $PID &> /dev/null
- PID_EXISTS=$?
- if [ $PID_EXISTS -eq 0 ]; then
- echo $APP already running with pid $PID
- RETVAL=1
- return $RETVAL
- else
- echo Old $APP process with pid $PID is dead, removing $PID_FILE
- rm -f $PID_FILE
- fi
- fi
-
- if [ ! -f $CONF_RW/config.ini ]; then
- #echo osgi.configuration.cascaded=true > $CONF_RW/config.ini
- #echo osgi.sharedConfiguration.area=$CONF_DIR >> $CONF_RW/config.ini
- #echo osgi.sharedConfiguration.area.readOnly=true >> $CONF_RW/config.ini
- cp --preserve $CONF_DIR/config.ini $CONF_RW/config.ini
- fi
- touch $SHUTDOWN_FILE
- cd $EXEC_DIR
- $JVM \
- -Dargeo.osgi.shutdownFile="$SHUTDOWN_FILE" \
- -Dlog4j.configuration="file:$CONF_DIR/log4j.properties" \
- -Djava.security.manager= \
- -Djava.security.policy="file:/etc/osgiboot/all.policy" \
- $JAVA_OPTS -jar $OSGI_FRAMEWORK \
- -clean \
- -configuration "$CONF_RW" \
- -data "$DATA_DIR" \
- >> $LOG_FILE 2>&1 &
- # (above) stderr redirected to stdout, then stdout to log file
- # see http://tldp.org/LDP/abs/html/io-redirection.html
- PID=$!
- echo $PID > $PID_FILE
- #echo Started $APP with pid $PID
- return $RETVAL
-}
-
-stop() {
- if [ -f $PID_FILE ];then
- PID=`cat $PID_FILE`
- kill -0 $PID &> /dev/null
- PID_EXISTS=$?
- if [ $PID_EXISTS -ne 0 ]; then
- echo Dead $APP process with pid $PID, removing $PID_FILE
- rm -f $PID_FILE
- RETVAL=1
- return $RETVAL
- fi
- else
- echo $APP is not running
- RETVAL=1
- return $RETVAL
- fi
-
- # notifies application by removing the shutdown file
- rm -f $SHUTDOWN_FILE
-
- # wait 5 min for application to shutdown, then kill it
- TIMEOUT=$((5*60))
- BEGIN=$(date +%s)
- while kill -0 $PID &> /dev/null
- do
- sleep 1
- NOW=$(date +%s)
- DURATION=$(($NOW-$BEGIN))
- if [ $DURATION -gt $TIMEOUT ]; then
- kill -9 $PID
- echo Forcibly killed $APP with pid $PID
- RETVAL=1
- fi
- done
-
- # remove pid file
- rm -f $PID_FILE
- return $RETVAL
-
-# timeout is only available in EL6
-# timeout 5m sh << EOF
-#while kill -0 $PID &> /dev/null; do sleep 1; done
-#EOF
-# TIMEOUT_EXIT=$?
-# if [ $TIMEOUT_EXIT -eq 124 ];then
-# kill -9 $PID
-# RETVAL=1
-# echo Killed $APP with pid $PID
-# else
-# echo Stopped $APP with pid $PID
-# fi
-# rm -f $PID_FILE
-# return $RETVAL
-}
-
-status() {
- if [ -f $PID_FILE ];then
- PID=`cat $PID_FILE`
- else
- echo $APP is not running
- return $RETVAL
- fi
- kill -0 $PID &> /dev/null
- PID_EXISTS=$?
- if [ $PID_EXISTS -eq 0 ]; then
- echo $APP is running with pid $PID ...
- else
- echo No $APP process with pid $PID, removing $PID_FILE
- rm -f $PID_FILE
- fi
- return $RETVAL
-}
-
-# main
-case "$2" in
- start)
- start
- ;;
- stop)
- stop
- ;;
- status)
- status
- ;;
- *)
- echo $"Usage: $0 {start|stop|status}"
- exit 1
-esac
\ No newline at end of file