Use 'argeo' instead of 'node' as app name (in order to avoid conflicts
authorMathieu Baudier <mbaudier@argeo.org>
Sat, 5 May 2018 18:53:45 +0000 (20:53 +0200)
committerMathieu Baudier <mbaudier@argeo.org>
Sat, 5 May 2018 18:53:45 +0000 (20:53 +0200)
with node.js packaging in EPEL, and more generally confusion with this
framework)

dist/argeo-node/base/etc/argeo/log4j.properties
dist/argeo-node/base/etc/argeo/settings.sh [new file with mode: 0644]
dist/argeo-node/pom.xml
dist/argeo-node/rpm/scripts/preinstall
dist/argeo-node/rpm/usr/lib/systemd/system/argeo.service [new file with mode: 0644]
dist/argeo-node/rpm/usr/lib/systemd/system/node.service [deleted file]
dist/argeo-node/rpm/usr/sbin/argeoctl [new file with mode: 0755]
dist/argeo-node/rpm/usr/sbin/nodectl [deleted file]

index 45acf1f67d7c58aade12368d594dff033db571d6..d93b2345654be156229624fe56b02bd5b2d7906d 100644 (file)
@@ -8,7 +8,7 @@ log4j.appender.console.layout=org.apache.log4j.PatternLayout
 log4j.appender.console.layout.ConversionPattern=%-5p %m%n
 
 log4j.appender.file=org.apache.log4j.DailyRollingFileAppender
-log4j.appender.file.File=/var/log/node/node.csv
+log4j.appender.file.File=/var/log/argeo/argeo.csv
 log4j.appender.file.layout=org.apache.log4j.PatternLayout
 log4j.appender.file.layout.ConversionPattern=%d{ISO8601};"%m";%c;%p%n
 log4j.appender.file.bufferedIO=true
diff --git a/dist/argeo-node/base/etc/argeo/settings.sh b/dist/argeo-node/base/etc/argeo/settings.sh
new file mode 100644 (file)
index 0000000..8141f04
--- /dev/null
@@ -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"
index 4b0f4a8107b8c5bc23f9b04249a7b84d7bd35271..a181ade16d4caa15308715bf373032e88a6e2172 100644 (file)
                                                                        <name>argeo-node</name>
                                                                        <mappings>
                                                                                <mapping>
-                                                                                       <directory>/etc/node</directory>
+                                                                                       <directory>/etc/argeo</directory>
                                                                                        <username>root</username>
-                                                                                       <groupname>node</groupname>
+                                                                                       <groupname>argeo</groupname>
                                                                                        <filemode>640</filemode>
                                                                                        <configuration>noreplace</configuration>
                                                                                        <directoryIncluded>false</directoryIncluded>
                                                                                        <sources>
                                                                                                <source>
-                                                                                                       <location>rpm/etc/node</location>
+                                                                                                       <location>base/etc/argeo</location>
                                                                                                </source>
                                                                                        </sources>
                                                                                </mapping>
                                                                                <mapping>
-                                                                                       <directory>/etc/node/conf.d</directory>
+                                                                                       <directory>/etc/argeo/conf.d</directory>
                                                                                        <username>root</username>
-                                                                                       <groupname>node</groupname>
+                                                                                       <groupname>argeo</groupname>
                                                                                        <filemode>640</filemode>
                                                                                        <configuration>noreplace</configuration>
                                                                                        <directoryIncluded>false</directoryIncluded>
                                                                                        <sources>
                                                                                                <source>
-                                                                                                       <location>rpm/etc/node/conf.d</location>
+                                                                                                       <location>base/etc/argeo/conf.d</location>
                                                                                                        <includes>
                                                                                                                <include>*.ini</include>
                                                                                                                <include>*.txt</include>
                                                                                        </sources>
                                                                                </mapping>
                                                                                <mapping>
-                                                                                       <directory>/usr/lib/systemd/system</directory>
-                                                                                       <username>root</username>
-                                                                                       <groupname>root</groupname>
-                                                                                       <filemode>644</filemode>
-                                                                                       <directoryIncluded>false</directoryIncluded>
-                                                                                       <sources>
-                                                                                               <source>
-                                                                                                       <location>rpm/usr/lib/systemd/system</location>
-                                                                                                       <includes>
-                                                                                                               <include>*.service</include>
-                                                                                                       </includes>
-                                                                                               </source>
-                                                                                       </sources>
-                                                                               </mapping>
-                                                                               <mapping>
-                                                                                       <directory>/usr/share/node</directory>
+                                                                                       <directory>/usr/share/argeo</directory>
                                                                                        <username>root</username>
                                                                                        <groupname>root</groupname>
                                                                                        <filemode>644</filemode>
                                                                                        <directoryIncluded>false</directoryIncluded>
                                                                                        <sources>
                                                                                                <source>
-                                                                                                       <location>rpm/usr/share/node</location>
+                                                                                                       <location>base/share/argeo</location>
                                                                                                        <includes>
-                                                                                                               <include>config.ini</include>
-                                                                                                               <include>all.policy</include>
+                                                                                                               <include>**</include>
                                                                                                        </includes>
                                                                                                </source>
                                                                                        </sources>
                                                                                </mapping>
                                                                                <mapping>
-                                                                                       <directory>/usr/share/node/jjs</directory>
+                                                                                       <directory>/usr/lib/systemd/system</directory>
                                                                                        <username>root</username>
                                                                                        <groupname>root</groupname>
                                                                                        <filemode>644</filemode>
                                                                                        <directoryIncluded>false</directoryIncluded>
                                                                                        <sources>
                                                                                                <source>
-                                                                                                       <location>rpm/usr/share/node/jjs</location>
+                                                                                                       <location>rpm/usr/lib/systemd/system</location>
                                                                                                        <includes>
-                                                                                                               <include>*.js</include>
+                                                                                                               <include>*.service</include>
                                                                                                        </includes>
                                                                                                </source>
                                                                                        </sources>
                                                                                                <source>
                                                                                                        <location>rpm/usr/sbin</location>
                                                                                                        <includes>
-                                                                                                               <include>nodectl</include>
+                                                                                                               <include>argeoctl</include>
                                                                                                        </includes>
                                                                                                </source>
                                                                                        </sources>
index a5415fc7d29c03429b8d2ad2cd8c51689a42c704..2e460655563e62fac86483cd95ca344f3ff6556d 100644 (file)
@@ -1,5 +1,5 @@
 if [ $1 = "1" ];then
-       APP=node
+       APP=argeo
        
        # check if user exists
        /bin/id $APP 2>/dev/null
diff --git a/dist/argeo-node/rpm/usr/lib/systemd/system/argeo.service b/dist/argeo-node/rpm/usr/lib/systemd/system/argeo.service
new file mode 100644 (file)
index 0000000..f30e9fb
--- /dev/null
@@ -0,0 +1,14 @@
+[Unit]
+Description=Argeo Node
+After=network.target
+Wants=postgresql.service
+
+[Service]
+Type=simple
+PIDFile=/var/run/argeo/argeo.pid
+ExecStart=/usr/sbin/argeoctl start
+ExecReload=/usr/sbin/argeoctl reload
+SuccessExitStatus=143
+
+[Install]
+WantedBy=multi-user.target
diff --git a/dist/argeo-node/rpm/usr/lib/systemd/system/node.service b/dist/argeo-node/rpm/usr/lib/systemd/system/node.service
deleted file mode 100644 (file)
index 80cd827..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-[Unit]
-Description=Argeo Node
-After=network.target
-Wants=postgresql.service
-
-[Service]
-Type=simple
-PIDFile=/var/run/node/node.pid
-ExecStart=/usr/sbin/nodectl start
-ExecReload=/usr/sbin/nodectl reload
-SuccessExitStatus=143
-
-[Install]
-WantedBy=multi-user.target
diff --git a/dist/argeo-node/rpm/usr/sbin/argeoctl b/dist/argeo-node/rpm/usr/sbin/argeoctl
new file mode 100755 (executable)
index 0000000..ccadd8e
--- /dev/null
@@ -0,0 +1,129 @@
+#!/bin/sh
+APP=argeo
+
+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
+
+OSGI_INSTALL_AREA=/usr/share/osgi/boot
+OSGI_FRAMEWORK=$OSGI_INSTALL_AREA/org.eclipse.osgi.jar
+
+# Overwrite variables
+if [ -f $CONF_DIR/settings.sh ];then
+       . $CONF_DIR/settings.sh
+fi
+
+RETVAL=0
+
+start() {
+       mkdir -p $CONF_RW
+       mkdir -p $DATA_DIR
+
+    # Merge config files
+    printf "## Equinox configuration - Generated by /usr/sbin/nodectl ##\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
+    for file in `ls -v $CONF_DIRS/*.ini`; do
+            printf "\n##\n## $file\n##\n\n" >> $CONFIG_INI
+            cat $file >> $CONFIG_INI
+    done;
+
+       cd $EXEC_DIR
+       $JVM \
+               -Dlog4j.configuration="file:$CONF_DIR/log4j.properties" \
+               $JAVA_OPTS -jar $OSGI_FRAMEWORK \
+               -configuration "$CONF_RW" \
+               -data "$DATA_DIR"
+}
+
+reload() {
+       echo Not yet implemented
+}
+
+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
+       kill $PID
+       
+       # wait 10 min for application to shutdown, then kill it
+       TIMEOUT=$((10*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
+}
+
+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 "$1" in
+  start)
+        start
+        ;;
+  reload)
+        reload
+        ;;
+  stop)
+        stop
+        ;;
+  status)
+       status
+        ;;
+  *)
+        echo $"Usage: $0 {start|stop|status}"
+        exit 1
+esac
\ No newline at end of file
diff --git a/dist/argeo-node/rpm/usr/sbin/nodectl b/dist/argeo-node/rpm/usr/sbin/nodectl
deleted file mode 100755 (executable)
index e0703f0..0000000
+++ /dev/null
@@ -1,129 +0,0 @@
-#!/bin/sh
-APP=node
-
-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
-
-OSGI_INSTALL_AREA=/usr/share/osgi/boot
-OSGI_FRAMEWORK=$OSGI_INSTALL_AREA/org.eclipse.osgi.jar
-
-# Overwrite variables
-if [ -f $CONF_DIR/settings.sh ];then
-       . $CONF_DIR/settings.sh
-fi
-
-RETVAL=0
-
-start() {
-       mkdir -p $CONF_RW
-       mkdir -p $DATA_DIR
-
-    # Merge config files
-    printf "## Equinox configuration - Generated by /usr/sbin/nodectl ##\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
-    for file in `ls -v $CONF_DIRS/*.ini`; do
-            printf "\n##\n## $file\n##\n\n" >> $CONFIG_INI
-            cat $file >> $CONFIG_INI
-    done;
-
-       cd $EXEC_DIR
-       $JVM \
-               -Dlog4j.configuration="file:$CONF_DIR/log4j.properties" \
-               $JAVA_OPTS -jar $OSGI_FRAMEWORK \
-               -configuration "$CONF_RW" \
-               -data "$DATA_DIR"
-}
-
-reload() {
-       echo Not yet implemented
-}
-
-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
-       kill $PID
-       
-       # wait 10 min for application to shutdown, then kill it
-       TIMEOUT=$((10*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
-}
-
-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 "$1" in
-  start)
-        start
-        ;;
-  reload)
-        reload
-        ;;
-  stop)
-        stop
-        ;;
-  status)
-       status
-        ;;
-  *)
-        echo $"Usage: $0 {start|stop|status}"
-        exit 1
-esac
\ No newline at end of file