summaryrefslogtreecommitdiff
path: root/src/local
diff options
context:
space:
mode:
authorLV-426 <lv-426@taproot.org.il>2015-04-29 19:03:46 +0300
committerLV-426 <lv-426@taproot.org.il>2015-04-29 19:50:01 +0300
commit60d9043f6e97b0c5ff17a888cd7ffac01d89736c (patch)
tree6ee5b419b929a218c81384b3050512ce39a929fe /src/local
parentbbdd4a57b30ec2b718e0e9b829539d76ebd8a9c5 (diff)
rz-mux-tool.sh: many path changes, other fixes
Diffstat (limited to 'src/local')
-rw-r--r--src/local/rz-mux/rz-mux-tool.sh151
1 files changed, 95 insertions, 56 deletions
diff --git a/src/local/rz-mux/rz-mux-tool.sh b/src/local/rz-mux/rz-mux-tool.sh
index 5dc597f0..97759494 100644
--- a/src/local/rz-mux/rz-mux-tool.sh
+++ b/src/local/rz-mux/rz-mux-tool.sh
@@ -3,25 +3,48 @@
#
# Multiplexed Neo4J instance installer
#
-# generated config dir structure:
+# generated apache structure:
#
-# /etc/neo4j/mux-conf.d/
-# └── dom-x
-# ├── neo4j.properties
-# ├── neo4j-server.properties
-# └── ...
+# /srv/www/rhizi/
+# └── mux-root.d
+# └── dom-x
+# └── webapp
+# ├── etc -> /etc/rhizi/mux-conf.d/dom-x
+# ├── static
+# │   ├── css -> /usr/share/rhizi/webapp/static/css
+# │   ├── font -> /usr/share/rhizi/webapp/static/font
+# │   ├── img -> /usr/share/rhizi/webapp/static/img
+# │   ├── js -> /usr/lib/rhizi/webapp/static/js
+# │   └── lib -> /usr/share/rhizi/webapp/static/lib
+# └── templates -> /usr/share/rhizi/webapp/templates/
#
-# generated root dir structure:
+# generated neo4j dir structure:
#
-# /var/lib/neo4j/mux-root.d/
-# └── dom-x
-# ├── data/
-# ├── bin -> /var/lib/neo4j/bin
-# ├── conf -> /etc/neo4j/mux-conf.d/dom-y
-# ├── lib -> /usr/share/neo4j/lib
-# ├── plugins -> /usr/share/neo4j/plugins
-# └── system -> /usr/share/neo4j/system
+# /etc/neo4j/mux-conf.d/
+# └── dom-x
+# ├── neo4j.properties
+# ├── neo4j-server.properties
+# └── ...
#
+# /var/lib/neo4j/mux-root.d/
+# └── dom-x
+# ├── data/
+# ├── bin -> /var/lib/neo4j/bin
+# ├── conf -> /etc/neo4j/mux-conf.d/dom-y
+# ├── lib -> /usr/share/neo4j/lib
+# ├── plugins -> /usr/share/neo4j/plugins
+# └── system -> /usr/share/neo4j/system
+#
+# generated rz structure:
+#
+# /etc/rhizi/
+# ├── domain-conf.d
+# └── mux-conf.d
+# └── dom-x
+# └── rhizi-server.conf.example
+#
+
+set -e
die() {
echo $1 1>&2; exit 1
@@ -37,59 +60,59 @@ install_instance__neo4j() {
install -v --owner=${NEO4J_USER} --group=adm --directory /var/lib/neo4j/mux-root.d/${RZ_INSTANCE_NAME}
install -v --owner=${NEO4J_USER} --group=adm --directory /var/lib/neo4j/mux-root.d/${RZ_INSTANCE_NAME}/data
+ # copy non-generated config files
cp /etc/neo4j/custom-logback.xml \
/etc/neo4j/jmx.access \
/etc/neo4j/jmx.password \
/etc/neo4j/logging.properties \
/etc/neo4j/neo4j-http-logging.xml \
- /etc/neo4j/neo4j.properties \
- /etc/neo4j/neo4j-server.properties \
/etc/neo4j/neo4j-wrapper.conf \
/etc/neo4j/mux-conf.d/${RZ_INSTANCE_NAME}
-
cp /etc/neo4j/custom-logback.xml \
/etc/neo4j/ssl/snakeoil.cert \
/etc/neo4j/ssl/snakeoil.key \
/etc/neo4j/mux-conf.d/${RZ_INSTANCE_NAME}/ssl
- ln -vs -T /etc/neo4j/mux-conf.d/${RZ_INSTANCE_NAME} /var/lib/neo4j/mux-root.d/${RZ_INSTANCE_NAME}/conf
- ln -vs -T /var/lib/neo4j/bin /var/lib/neo4j/mux-root.d/${RZ_INSTANCE_NAME}/bin
- ln -vs -T /usr/share/neo4j/lib /var/lib/neo4j/mux-root.d/${RZ_INSTANCE_NAME}/lib
- ln -vs -T /usr/share/neo4j/plugins /var/lib/neo4j/mux-root.d/${RZ_INSTANCE_NAME}/plugins
- ln -vs -T /usr/share/neo4j/system /var/lib/neo4j/mux-root.d/${RZ_INSTANCE_NAME}/system
-
- python /tmp/neo-m/neo4j-mux-tool.py --domain ${RZ_INSTANCE_NAME}
+ ln -vfs -T /etc/neo4j/mux-conf.d/${RZ_INSTANCE_NAME} /var/lib/neo4j/mux-root.d/${RZ_INSTANCE_NAME}/conf
+ ln -vfs -T /var/lib/neo4j/bin /var/lib/neo4j/mux-root.d/${RZ_INSTANCE_NAME}/bin
+ ln -vfs -T /usr/share/neo4j/lib /var/lib/neo4j/mux-root.d/${RZ_INSTANCE_NAME}/lib
+ ln -vfs -T /usr/share/neo4j/plugins /var/lib/neo4j/mux-root.d/${RZ_INSTANCE_NAME}/plugins
+ ln -vfs -T /usr/share/neo4j/system /var/lib/neo4j/mux-root.d/${RZ_INSTANCE_NAME}/system
# set modes, ownership
- chmod +x ${SVC_INIT_SCRIPT_PATH}
+ chmod +x ${NEO4J_INIT_SCRIPT_PATH}
}
install_instance__apache() {
- install -v --owner=${APACHE_USER} --group=${APACHE_USER} --directory /srv/rhizi/mux-root.d/${RZ_INSTANCE_NAME}
- install -v --owner=${APACHE_USER} --group=${APACHE_USER} --directory /srv/rhizi/mux-root.d/${RZ_INSTANCE_NAME}/webapp
- install -v --owner=${APACHE_USER} --group=${APACHE_USER} --directory /srv/rhizi/mux-root.d/${RZ_INSTANCE_NAME}/auth
+ install -v --owner=${APACHE_USER} --group=${APACHE_USER} --directory /srv/www/rhizi/mux-root.d/${RZ_INSTANCE_NAME}
+ install -v --owner=${APACHE_USER} --group=${APACHE_USER} --directory /srv/www/rhizi/mux-root.d/${RZ_INSTANCE_NAME}/webapp
+ install -v --owner=${APACHE_USER} --group=${APACHE_USER} --directory /srv/www/rhizi/mux-root.d/${RZ_INSTANCE_NAME}/webapp/static
+ install -v --owner=${APACHE_USER} --group=${APACHE_USER} --directory /srv/www/rhizi/mux-root.d/${RZ_INSTANCE_NAME}/auth
- ln -vs -T /etc/rhizi/mux-conf.d/${RZ_INSTANCE_NAME} /srv/rhizi/mux-root.d/${RZ_INSTANCE_NAME}/webapp/etc
- ln -vs -T /usr/share/rhizi/webapp/static/ /srv/rhizi/mux-root.d/${RZ_INSTANCE_NAME}/webapp/static
- ln -vs -T /usr/share/rhizi/webapp/templates/ /srv/rhizi/mux-root.d/${RZ_INSTANCE_NAME}/webapp/templates
+ ln -vfs -T /etc/rhizi/mux-conf.d/${RZ_INSTANCE_NAME} /srv/www/rhizi/mux-root.d/${RZ_INSTANCE_NAME}/webapp/etc
+ ln -vfs -T /usr/lib/rhizi/webapp/static/js /srv/www/rhizi/mux-root.d/${RZ_INSTANCE_NAME}/webapp/static/js
+ ln -vfs -T /usr/share/rhizi/webapp/static/css /srv/www/rhizi/mux-root.d/${RZ_INSTANCE_NAME}/webapp/static/css
+ ln -vfs -T /usr/share/rhizi/webapp/static/font /srv/www/rhizi/mux-root.d/${RZ_INSTANCE_NAME}/webapp/static/font
+ ln -vfs -T /usr/share/rhizi/webapp/static/img /srv/www/rhizi/mux-root.d/${RZ_INSTANCE_NAME}/webapp/static/img
+ ln -vfs -T /usr/share/rhizi/webapp/static/lib /srv/www/rhizi/mux-root.d/${RZ_INSTANCE_NAME}/webapp/static/lib
+ ln -vfs -T /usr/share/rhizi/webapp/templates/ /srv/www/rhizi/mux-root.d/${RZ_INSTANCE_NAME}/webapp/templates
- apache_site_conf=${RZ_INSTANCE_NAME}.${RZ_TOP_DOMAIN_NAME}
- ln -vs -T /etc/apache/sites-available/${apache_site_conf} /etc/apache/sites-enabled/${apache_site_conf}
- ln -vs -T /etc/apache/sites-available/${apache_site_conf} /etc/apache/sites-enabled/${apache_site_conf}
+ apache_site_conf=${RZ_INSTANCE_NAME}.${RZ_TOP_DOMAIN_NAME}.conf
+ ln -vfs -T /etc/apache2/sites-available/${apache_site_conf} /etc/apache2/sites-enabled/${apache_site_conf}
}
install_instance__rz() {
- install -v --owner=${NEO4J_USER} --group=adm --directory /etc/rhizi/mux-conf.d/${RZ_INSTANCE_NAME}
+ install -v --directory /etc/rhizi/mux-conf.d/${RZ_INSTANCE_NAME}
- cp /etc/rhizi/rhizi-server.conf.example /etc/rhizi/mux-conf.d/${RZ_INSTANCE_NAME}/
+ chmod +x /etc/init.d/rhizi__${RZ_INSTANCE_NAME}
}
uninstall_instance__apache() {
- rm -rvf /srv/rhizi/mux-root.d/${RZ_INSTANCE_NAME}
+ rm -rvf /srv/www/rhizi/mux-root.d/${RZ_INSTANCE_NAME}
}
uninstall_instance__neo4j() {
- rm ${SVC_INIT_SCRIPT_PATH}
+ rm ${NEO4J_INIT_SCRIPT_PATH}
rm -rf /etc/neo4j/mux-conf.d/${RZ_INSTANCE_NAME}
rm -rf /var/lib/neo4j/mux-root.d/${RZ_INSTANCE_NAME}
}
@@ -98,39 +121,55 @@ uninstall_instance__rz() {
rm -rvf /etc/rhizi/mux-conf.d/${RZ_INSTANCE_NAME}
}
-DEFAULT_USER='neo4j'
-
+#
+# static variables
+#
+APACHE_USER=www-data
NEO4J_HOME=`(cd $(dirname $0)/.. && pwd)`
NEO4J_USER=neo4j
-
-APACHE_USER=www-data
-
-SCRIPT_NAME="${NEO4J_HOME}/bin/neo4j"
-
RZ_TOP_DOMAIN_NAME=rhizi.net
-RZ_NEO4J_SVC_NAME='neo4j-service__domain-x'
-SVC_INIT_SCRIPT_PATH=/etc/init.d/${RZ_NEO4J_SVC_NAME}
-PID_FILE=/var/run/${RZ_NEO4J_SVC_NAME}
+#
+# sanity checks
+#
+[ $UID != 0 ] && die 'must be root to continue.'
RZ_INSTANCE_NAME=$2
-
-[ $UID != 0 ] && die 'must be root to continue.'
[ -z ${RZ_INSTANCE_NAME} ] && die 'RZ_INSTANCE_NAME arg missing, aborting'
[ -e "$PID_FILE" ] && die '${RZ_NEO4J_SVC_NAME} already running, please stop it before continuing'
+#
+# dynamic variables
+#
+NEO4J_INIT_SCRIPT_PATH=/etc/init.d/${RZ_NEO4J_SVC_NAME}
+RZ_NEO4J_SVC_NAME='neo4j-service__${RZ_INSTANCE_NAME}'
+PID_FILE=/var/run/${RZ_NEO4J_SVC_NAME}
+
case $1 in
install)
+
+ python /usr/lib/rhizi/tools/rz-mux/rz-mux-tool.py \
+ --template-dir /usr/share/rhizi/rz-mux/ \
+ --domain ${RZ_INSTANCE_NAME}
+
install_instance__apache
install_instance__neo4j
install_instance__rz
- tree /srv/www/rhizi/
- tree /var/lib/neo4j/mux-root.d/
- tree /etc/neo4j/mux-conf.d/
- tree /srv/www/rhizi/mux-root.d/
+ tree -ug --noreport /etc/apache2/sites-available
+ tree -ug --noreport /etc/apache2/sites-enabled
+ tree -ug --noreport /srv/www/rhizi/
+ tree -ug --noreport /var/lib/neo4j/mux-root.d/
+ tree -ug --noreport /etc/neo4j/mux-conf.d/
+ tree -ug --noreport /etc/rhizi/
- echo "please edit & enable rz_config at /etc/rhizi/mux-conf.d/${RZ_INSTANCE_NAME}/"
+ echo "# -----------------------------------------------------------------------------"
+ echo "# Summery:"
+ echo "#"
+ echo "# rz instance installed: name: ${RZ_INSTANCE_NAME}"
+ echo "#"
+ echo "# [!] please review & adjust /etc/rhizi/mux-conf.d/${RZ_INSTANCE_NAME}/rhizi-server.conf"
+ echo "#"
;;
uninstall)
uninstall_instance__apache