From: mbaudier Date: Mon, 6 Nov 2017 15:27:32 +0000 (+0100) Subject: Improve node RPM packaging X-Git-Tag: argeo-commons-2.1.70~38 X-Git-Url: https://git.argeo.org/?p=lgpl%2Fargeo-commons.git;a=commitdiff_plain;h=bf345b84989cc9a2984bba4390ebdb349701ed8e Improve node RPM packaging --- diff --git a/demo/argeo_node_rap.properties b/demo/argeo_node_rap.properties index 5255b320a..d7149b966 100644 --- a/demo/argeo_node_rap.properties +++ b/demo/argeo_node_rap.properties @@ -21,7 +21,7 @@ org.eclipse.equinox.http.registry,\ java.security.manager= java.security.policy=file:../../all.policy -argeo.node.repo.type=localfs +argeo.node.repo.type=h2 #argeo.node.useradmin.uris=ldap://uid=admin,ou=system:secret@localhost:10389/dc=example,dc=com #argeo.node.useradmin.uris=ldap://uid=admin,ou=system:secret@localhost:10389\ diff --git a/dist/argeo-node/pom.xml b/dist/argeo-node/pom.xml index da4e22949..ecb37395e 100644 --- a/dist/argeo-node/pom.xml +++ b/dist/argeo-node/pom.xml @@ -40,6 +40,23 @@ + + /etc/node/conf.d + root + node + 640 + noreplace + false + + + rpm/etc/node/conf.d + + *.ini + *.txt + + + + /usr/lib/systemd/system root @@ -55,6 +72,22 @@ + + /usr/share/node + root + root + 644 + false + + + rpm/usr/share/node + + config.ini + all.policy + + + + /usr/sbin root @@ -75,7 +108,7 @@ rpm/scripts/preinstall - + argeo-cms-node osgi-boot diff --git a/dist/argeo-node/rpm/etc/node/conf.d/app-template.txt b/dist/argeo-node/rpm/etc/node/conf.d/app-template.txt new file mode 100644 index 000000000..02aac6a82 --- /dev/null +++ b/dist/argeo-node/rpm/etc/node/conf.d/app-template.txt @@ -0,0 +1,7 @@ +# Rename to .ini + +# Backend +#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 diff --git a/dist/argeo-node/rpm/etc/node/config.ini b/dist/argeo-node/rpm/etc/node/config.ini deleted file mode 100644 index ec75a4f7a..000000000 --- a/dist/argeo-node/rpm/etc/node/config.ini +++ /dev/null @@ -1,42 +0,0 @@ -argeo.node.repo.type=h2 -org.osgi.service.http.port=8080 -osgi.console=2323 - -# Backend -#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 - -# DO NOT CHANGE BELOW UNLESS YOU KNOW WHAT YOU ARE DOING -osgi.clean=true -osgi.bundles=org.argeo.osgi.boot.jar@start -argeo.osgi.bundles=\ -/usr/local/share/osgi;in=**/*.jar,\ -/usr/share/osgi;in=**/*.jar - -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.rap.rwt.osgi - -argeo.osgi.start.3.node=\ -org.argeo.cms - -argeo.osgi.start.4.node=\ -org.eclipse.gemini.blueprint.extender,\ -org.eclipse.equinox.http.registry - -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 - -eclipse.ignoreApp=true -osgi.noShutdown=true -org.eclipse.equinox.http.jetty.autostart=false -org.eclipse.rap.workbenchAutostart=false diff --git a/dist/argeo-node/rpm/etc/node/node.ini b/dist/argeo-node/rpm/etc/node/node.ini new file mode 100644 index 000000000..f150c4df9 --- /dev/null +++ b/dist/argeo-node/rpm/etc/node/node.ini @@ -0,0 +1,22 @@ +## HTTP server +org.osgi.service.http.port=8080 + +## System management +osgi.console=2323 + +## Standalone +#argeo.node.useradmin.uris=dc=example,dc=com.ldif +#argeo.node.repo.type=h2 + +## Deployed +#argeo.node.useradmin.uris=ldap://cn=Directory%20Manager:argeoargeo@localhost/dc=example,dc=com +#argeo.node.repo.type=postgresql +#argeo.node.repo.dburl=jdbc:postgresql://localhost/node +#argeo.node.repo.dbuser=argeo +#argeo.node.repo.dbpassword=argeo + +## Complex user configuration examples +#argeo.node.useradmin.uris="dc=example,dc=com.ldif dc=example,dc=org.ldif" +#argeo.node.useradmin.uris="ldap://uid=admin,ou=system:secret@localhost:10389\ +#/dc=example,dc=com?userBase=ou=users&groupBase=ou=groups dc=example,dc=org.ldif" + diff --git a/dist/argeo-node/rpm/etc/node/node.policy b/dist/argeo-node/rpm/etc/node/node.policy deleted file mode 100644 index facb61327..000000000 --- a/dist/argeo-node/rpm/etc/node/node.policy +++ /dev/null @@ -1,3 +0,0 @@ -grant { - permission java.security.AllPermission; -}; \ No newline at end of file diff --git a/dist/argeo-node/rpm/etc/node/settings.sh b/dist/argeo-node/rpm/etc/node/settings.sh new file mode 100644 index 000000000..8141f0495 --- /dev/null +++ b/dist/argeo-node/rpm/etc/node/settings.sh @@ -0,0 +1,3 @@ +export LANG=en_US.utf8 +JAVA_OPTS="-showversion -Xmx128m" +#JAVA_OPTS="-showversion -Xmx512m -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=7084 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false" diff --git a/dist/argeo-node/rpm/usr/sbin/nodectl b/dist/argeo-node/rpm/usr/sbin/nodectl index 26fe3eeaf..fb1b5802a 100755 --- a/dist/argeo-node/rpm/usr/sbin/nodectl +++ b/dist/argeo-node/rpm/usr/sbin/nodectl @@ -5,16 +5,19 @@ JVM=java # Directories and files CONF_DIR=/etc/$APP +CONF_DIRS=/etc/$APP/conf.d +BASE_POLICY_ALL=/usr/share/$APP/all.policy +BASE_CONFIG_INI=/usr/share/$APP/config.ini EXEC_DIR=/var/lib/$APP DATA_DIR=$EXEC_DIR/data CONF_RW=$EXEC_DIR/state +CONFIG_INI=$CONF_RW/config.ini 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 @@ -27,29 +30,22 @@ fi 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 + mkdir -p $CONF_RW + mkdir -p $DATA_DIR + chown -R $APP.APP $EXEC_DIR + + # Merge config files + echo ## Equinox configuration - Generated by /usr/sbin/nodectl > $CONFIG_INI + cat $BASE_CONFIG_INI >> $CONFIG_INI + cat $CONF_DIR/$APP.ini >> $CONFIG_INI + for file in `ls -v $CONF_DIRS/*.ini`; do + echo "\n# $file\n" >> $CONFIG_INI; + cat $file >> $CONFIG_INI + done; -# if [ ! -f $CONF_RW/config.ini ]; then - cp --preserve $CONF_DIR/config.ini $CONF_RW/config.ini -# fi -# touch $SHUTDOWN_FILE cd $EXEC_DIR $JVM \ -Dlog4j.configuration="file:$CONF_DIR/log4j.properties" \ - -Djava.security.manager= \ - -Djava.security.policy="file:$CONF_DIR/node.policy" \ $JAVA_OPTS -jar $OSGI_FRAMEWORK \ -configuration "$CONF_RW" \ -data "$DATA_DIR" @@ -77,7 +73,8 @@ stop() { fi # notifies application by removing the shutdown file - rm -f $SHUTDOWN_FILE +# rm -f $SHUTDOWN_FILE + kill $PID # wait 10 min for application to shutdown, then kill it TIMEOUT=$((10*60)) diff --git a/dist/argeo-node/rpm/usr/share/node/all.policy b/dist/argeo-node/rpm/usr/share/node/all.policy new file mode 100644 index 000000000..facb61327 --- /dev/null +++ b/dist/argeo-node/rpm/usr/share/node/all.policy @@ -0,0 +1,3 @@ +grant { + permission java.security.AllPermission; +}; \ No newline at end of file diff --git a/dist/argeo-node/rpm/usr/share/node/config.ini b/dist/argeo-node/rpm/usr/share/node/config.ini new file mode 100644 index 000000000..5c54d84e1 --- /dev/null +++ b/dist/argeo-node/rpm/usr/share/node/config.ini @@ -0,0 +1,44 @@ +# Only Argeo OSGi Boot is explicitly started +osgi.bundles=org.argeo.osgi.boot.jar@start +osgi.clean=true + +# Provisioning +argeo.osgi.bundles=\ +/etc/node/modules;in=*/*,\ +/usr/local/share/osgi;in=**/*.jar,\ +/usr/share/osgi;in=**/*.jar + +# 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.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.eclipse.equinox.http.registry + +# 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