MOBIS

(aktualizace v obis-v5.0/user.obis-demo/)

LuaConsole+Uzivatele+Skupiny pro Admin: na web serveru soubor obis5/uzivatele/Admin/mobis_menu.xml

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE Menu SYSTEM "startmenu.dtd">
<Menu>
  <MenuItem Name="uzivatele">
    <Caption>Uživatelé</Caption>
    <CmdString>@cf.ShowForm("UZIVATELE")</CmdString>
    <ImageIndex>67</ImageIndex>
  </MenuItem>
  <MenuItem Name="skupiny">
    <Caption>Skupiny</Caption>
    <CmdString>@cf.ShowForm("SKUPINY")</CmdString>
    <ImageIndex>78</ImageIndex>
  </MenuItem>
  <MenuItem Name="LuaConsole">
    <Caption>LuaConsole</Caption>
    <CmdString>@cf.ShowForm("LuaConsoleForm")</CmdString>
    <ImageIndex>21</ImageIndex>
  </MenuItem>
</Menu>

rename-mobilemenu.sh

#!/bin/sh
for FILEN in `find uzivatele -name mobilemenu.xml` `find user -name mobilemenu.xml`; do
  DIRN=`dirname $FILEN`
  echo rename $DIRN/mobilemenu.xml to $DIRN/mobis_menu.xml
  mv $DIRN/mobilemenu.xml $DIRN/mobis_menu.xml
done

Příkazy XMLRPCSERVER

  • telnet localhost serviceport
  • LIST
  • DUMP

XMLRPC, OBISCSERVER

Windows: virtualbox pro windows + (0vypalit/linux/distros/terminaly-obis/virtualbox-server-debian-obis.ova) - importovat applianci + run virtualbox as service nebo po spusteni: VBoxManage.exe startvm "obis" (Nefunkční VirtualBox viz. windows faq)

Debian/Ubuntu

apt-get install lighttpd php5-cgi php5-intl php5-xmlrpc

CentOS 6.* (neobsahuje lighttpd http://www.cyberciti.biz/faq/centos-install-lighttpd-web-server-with-yum-command/)

wget http://epel.mirror.net.in/epel/6/i386/epel-release-6-8.noarch.rpm
rpm -ivh epel-release-6-8.noarch.rpm
yum install lighttpd php-cgi php-intl php-xmlrpc lighttpd-fastcgi
vim /etc/php5/cgi/php.ini : cgi.fix_pathinfo = 1
echo 'obiscserver_uri = "tcp://localhost:9401"' > etc/phpserver.ini #port kde posloucha xmlrpc
  • pro webshop je nutny firebird alespon 2.1.5 (pouziti asci_char v list)
  • je nutne PHP 5.3 (squeezy)
  • rozbalit obis4-utils.tar.gz (soubory v bin, html, http)
  • otestovat pomoci: BINDIR=bin64; cd $BINDIR; IPV6=0 BASE_PORT=9400 ./obisxmlrpcserver.sh start; cd ..; HTTP_PORT=8080 http/lighttpd.sh start; w3m http://localhost:8080/mobis.php

XMLRPCSERVER

  • predpokladem je uzivatel obis a xinetd

Nastavení pro následující skripty

export OBISHOME=/home/obis/obis5
export BINDIR=bin64

SystemD

mkdir $OBISHOME/service
cat << EOF > $OBISHOME/service/xmlrpcserver.service
[Unit]
Description=Obis XMLRPC server
#az po zamontovani z fstabu
After=remote-fs.target
 
[Service]
Type=simple
User=obis
#pri ukonceni service je log smazan
RuntimeDirectory=xmlrpcserver
ExecStart=$OBISHOME/$BINDIR/xmlrpcserver.bin -listenport 9401 -serviceport 9402 -serverport 9400 -debug 3 -log %t/xmlrpcserver/log -readycon 2 -maxttl 86400 -maxcon 20 -noconsolelog
Restart=always
 
[Install]
WantedBy=multi-user.target
EOF
 
sudo cp $OBISHOME/service/xmlrpcserver.service /etc/systemd/system
sudo systemctl enable xmlrpcserver.service
sudo systemctl start xmlrpcserver.service

DaemonTools

Debian/Ubuntu

sudo apt-get install daemontools daemontools-run

CentOS http://www.lowfatgeek.com/linux/how-to-install-daemontools-on-centos-6-4/335/

yum install gcc
mkdir -p /package
chmod 1755 /package
cd /package
wget http://cr.yp.to/daemontools/daemontools-0.76.tar.gz
tar -xzvf daemontools-0.76.tar.gz
rm daemontools-0.76.tar.gz
cd /package/admin/daemontools-0.76
echo gcc -O2 -include /usr/include/errno.h > src/conf-cc
./package/install
echo "start on runlevel [12345]" > /etc/init/svscan.conf
echo "respawn" >> /etc/init/svscan.conf
echo "exec /command/svscanboot" >> /etc/init/svscan.conf
initctl reload-configuration
initctl start svscan
mkdir service
mkdir service/xmlrpcserver
mkdir service/xmlrpcserver/supervise
mkfifo service/xmlrpcserver/supervise/control
mkfifo service/xmlrpcserver/supervise/ok
 
cat << EOF > service/xmlrpcserver/run
#!/bin/sh
cd $OBISHOME
export LANG=cs_CZ.utf8
TMP_DIR=/tmp/obis
mkdir -p \$TMP_DIR -m 777
LOG_DIR=\$TMP_DIR/log
mkdir -p \$LOG_DIR -m 777
exec setuidgid obis ./$BINDIR/xmlrpcserver.bin -listenport 9401 -serviceport 9402 -serverport 9400 \\
  -savepid \$LOG_DIR/../xmlrpcserver.pid -debug 3 -log \$LOG_DIR/xmlrpcserver.log \\
  -readycon 1 \\
  -maxttl 86400 2>/dev/null
EOF
chmod +x service/xmlrpcserver/run
sudo ln -s $OBISHOME/service/xmlrpcserver /etc/service/
nohup /usr/bin/svscanboot &

OBISCSERVER přes xinetd

mkdir service/obiscserver
 
cat << EOF > service/obiscserver/run
#!/bin/bash
cd $OBISHOME
export LD_LIBRARY_PATH=./$BINDIR/lib
export LANG="cs_CZ.utf8"
TMP_DIR=/tmp/obis
mkdir -p \$TMP_DIR -m 777
LOG_DIR=\$TMP_DIR/log
mkdir -p \$LOG_DIR -m 777
#Port 9400 pres xinetd
exec ./$BINDIR/obiscserver -stdin -notrigger \\
  -log \$LOG_DIR/log.\$$ -sqllog \$LOG_DIR/sql.\$$ -sqlplan \\
  -dofile ./system/lua/server/web/obis.lua \\
  -debug 3 2>/dev/null 
EOF
chmod +x service/obiscserver/run
 
sudo cat << EOF > /etc/xinetd.d/mobiscserver
service mobiscserver
{
  type      = UNLISTED
  port      = 9400
  flags     = REUSE KEEPALIVE
  socket_type   = stream
  wait      = no
  user      = obis
  server    = $OBISHOME/service/obiscserver/run
  disable   = no
}
EOF
 
sudo service xinetd restart

fonty

APACHE2

  • testovano na debian 8
apt-get install apache2
apt-get install libapache2-mod-php7.0 php7.0-intl php7.0-xmlrpc php7.0-xml
a2enmod ssl
a2enmod auth_digest
a2enmod expires
#hlaska: Apache is running a threaded MPM, but your PHP Module is not compiled to be threadsafe. You need to recompile PHP.
a2dismod mpm_event; a2dismod mpm_worker; a2enmod mpm_prefork
apache2ctl configtest
apache2ctl -S #kontrola virtualhosts settings
apache2ctl -M #musi byt mpm_prefork_module

/etc/apache2/sites-enabled/mobis

  • htdigest -c .passwd obis loginname
  • na MIS vygenerovat a podepsat certifikat, nahrat na server do /etc/ssl
<VirtualHost *:443>

	ServerAdmin root

	DocumentRoot /home/mobis/html
	ErrorLog /home/mobis/log/error.log
	# Possible values include: debug, info, notice, warn, error, crit,
	# alert, emerg.
	LogLevel warn
	CustomLog /home/mobis/log/access.log combined
	SSLEngine on
	SSLCertificateFile    /etc/ssl/certs/mobis.domain.cz.pem
	SSLCertificateKeyFile /etc/ssl/private/mobis.domain.cz.key

  <Location />
    AuthType Digest
    AuthName "obis"
    AuthDigestDomain / 
    AuthDigestProvider file
    AuthUserFile "/home/mobis/.passwd"
    Require valid-user
  </Location>

</VirtualHost>

ExpiresActive On
ExpiresByType text/css "access plus 1 weeks"
ExpiresByType application/javascript "access plus 1 weeks"
ExpiresByType image/png "access plus 1 weeks"
ExpiresByType image/jpeg "access plus 1 weeks"
ExpiresByType image/gif "access plus 1 weeks"

/etc/apache2/sites-enabled/shop

<VirtualHost *:80>

	ServerAdmin root

	DocumentRoot /home/obis/html
	ErrorLog /home/obis/log/error.log
	# Possible values include: debug, info, notice, warn, error, crit,
	# alert, emerg.
	LogLevel warn
	CustomLog /home/obis/log/access.log combined

</VirtualHost>

ExpiresActive On
ExpiresByType text/css "access plus 1 weeks"
ExpiresByType application/javascript "access plus 1 weeks"
ExpiresByType image/png "access plus 1 weeks"
ExpiresByType image/jpeg "access plus 1 weeks"
ExpiresByType image/gif "access plus 1 weeks"

LIGHTTPD

  • pro jednouzivatelsky pristup
  • nastavit explicitne port 8080 v lighttpd.conf a lighttpd.sh (pro testovani se pouziva id -u + 7080)
  • na routeru presmerovat https 443 → 8080
cd $OBISHOME
echo 'obiscserver_uri = "tcp://localhost:9401"' > etc/phpserver.ini #port kde posloucha xmlrpcserver
mkdir http/tmp
mkdir http/log
mv /etc/lighttpd/lighttpd.conf /etc/lighttpd/lighttpd.conf.bk
cp $OBISHOME/http/lighttpd.conf /etc/lighttpd/lighttpd.conf #v obis4/http/ se prehrava pri upgrade
echo vim /etc/lighttpd/lighttpd.conf nastavit: var.basedir = \"$OBISHOME/http/\" server.document-root = \"$OBISHOME/html/\" server.port=8080 nahradit env.XDEBUG
echo zkontrolovat cestu k php5-cgi v fastcgi.server
w3m http://localhost:8080/mobis.php

Autentikace

lighttpd.conf

#Autentikace pres heslo
#Add user: htdigest .passwd obis user
auth.backend = "htdigest"
auth.backend.htdigest.userfile = basedir + ".passwd"
auth.debug = 2
auth.require = ( "/" =>
(
"method" => "digest",
"realm" => "obis",
"require" => "valid-user"
)
cd obis4/http
apg -m6 -x6 -MNL -n1
htdigest [-c] .passwd obis loginname

SSL

certifikat vygenererovat+podepsat /home/CA na MIS (heslo pro root), spojit klic+cert a nahrat na server

cat newkey.pem newcert.pem > server.pem

lighthttpd.conf

#SSL
ssl.engine = "enable"
ssl.pemfile = basedir + "server.pem"

init.d launchtool metoda

/etc/init.d/xmlrpcserver

#!/bin/sh
 
# Source function library.
#. /etc/rc.d/init.d/functions
 
NAME="xmlrpcserver"
RUNAS="epos"
LAUNCHTOOL=/usr/bin/launchtool
ROOTDIR=/home/obis/obis4
LOG_DIR=/tmp/obis4/log
LISTENPORT=19400
SERVICEPORT=19450
SERVERPORT=19300
READYCON=5
#DEBUGLAUNCH="--verbose --debug"
#DEBUGOBIS="-debug 5 -log $LOG_DIR/$NAME.log"
 
start() {
  echo -n $"Starting $NAME: "
  export LANG=cs_CZ.utf8
  mkdir -p $LOG_DIR -m 777
  chown $RUNAS $LOG_DIR/..
  $LAUNCHTOOL -t $NAME -d $DEBUG --user=$RUNAS --wait-times=1,1,1,3,3,3,10,10,10 \
    --chdir=$ROOTDIR --no-restrict-environment \
    --forwarded-signals=1,9,15 \
    --log-launchtool-errors=syslog:$NAME,LOG_DAEMON,LOG_ERR  \
    --log-launchtool-output=syslog:$NAME,LOG_DAEMON,LOG_ERR \
    --log-child-output=syslog:$NAME,LOG_DAEMON,LOG_ERR \
    --log-child-errors=syslog:$NAME,LOG_DAEMON,LOG_ERR \
    "./bin/xmlrpcserver.bin -listenport $LISTENPORT -serviceport $SERVICEPORT -serverport $SERVERPORT \
    -savepid $LOG_DIR/../$NAME.pid $DEBUGOBIS \
    -readycon $READYCON  maxttl 86400"
  echo
}
 
stop() {
  echo -n $"Shutting down $NAME: "
  kill `cat $LOG_DIR/../$NAME.pid`
  #$LAUNCHTOOL -t $NAME --kill=15
  echo
}
 
status() (
  $LAUNCHTOOL -t $NAME --check
)
 
# See how we were called.
case "$1" in
  start)
	start
        ;;
  stop)
	stop
        ;;
  status)
	status
	;;
  restart|reload)
	stop
        echo sleep 5
        sleep 5
	start
	;;
  *)
        echo $"Usage: $0 {start|stop|restart|status}"
        exit 1
esac
 
exit 0

user/scripts/obiscserver-webshop.sh

#!/bin/sh
NAME=obiscserver-webshop
ROOTDIR=/mnt/raid/obis/obis4
LOG_DIR=/tmp/obis4/log
#DEBUGOBIS="-debug 5 -log $LOG_DIR/$NAME-$$.log -sqllog $LOG_DIR/$NAME-$$"
cd $ROOTDIR
export LANG=cs_CZ.utf8
export LC_ALL=cs_CZ.utf8
export LD_LIBRARY_PATH=bin/lib
exec ./bin/obiscserver.bin -stdin $DEBUGOBIS \
  -model model-webshop -dofile ./system/lua/server/web/shop.lua -user webshop -pass "" -data data \
  -notrigger -documentdir $ROOTDIR/obisdoc/ 2>/dev/null

user/scripts/obiscserver-mobis.sh

#!/bin/sh
NAME=obiscserver-mobis
ROOTDIR=/home/obis/obis4
LOG_DIR=/tmp/obis4/log
DEBUGOBIS="-debug 5 -log $LOG_DIR/$NAME-$$.log -sqllog $LOG_DIR/$NAME-$$"
cd $ROOTDIR
export LANG=cs_CZ.utf8
export LC_ALL=cs_CZ.utf8
export LD_LIBRARY_PATH=bin/lib
exec ./bin/obiscserver.bin -stdin $DEBUGOBIS \
  -dofile ./system/lua/server/web/obis.lua \
  -notrigger -documentdir $ROOTDIR/obisdoc/ 2>/dev/null

/etc/xinetd.d/obiscserver-webshop

  • pokud hlasi chybu libwrap je treba povolit v /etc/hosts.allow
service obiscserver-webshop
{
  type      = UNLISTED
  port      = 19300
  flags     = REUSE KEEPALIVE 
  socket_type   = stream
  wait      = no
  user      = epos
  server    = /mnt/obis/obis4/user/scripts/obiscserver-webshop.sh
  disable   = no
}

service obiscserver-mobis
{
  type      = UNLISTED
  port      = 19301
  flags     = REUSE KEEPALIVE
  socket_type   = stream
  wait      = no
  user      = epos
  server    = /mnt/obis/obis4/user/scripts/obiscserver-mobis.sh
  disable   = no
}

Kontrola kódování češtiny v helpu

Spustit v LuaConsoli common_help.CheckHelpEncoding() nebo následující skript. Musí končit hláškou "OK kontrola v poradku" (error v obiscserver není vidět).

#!/bin/bash
cat <<EOF | ./bin64/obiscserver -notrigger -noxmlrpc -stdin | tee /tmp/test.log
Login Admin "" data-kaja
<EOF/>
Program "common_help.CheckHelpEncoding()"
<EOF/>
Exit
<EOF/>
EOF

Firefox

Telefonovani z desktopoveho prohlizece - protokol tel:

about:config
network.protocol-handler.expose.tel = false

po clicku na tel: odkaz lze zvolit aplikaci na telefonovani

  • autoreload plugin pro automatické načtení kalendáře vygenerovaném na serveru v HTML po změně souboru
 
progs/mobis.txt · Poslední úprava: 2020/07/21 13:34 autor: Karel Petrů
 
Kromě míst, kde je explicitně uvedeno jinak, je obsah této wiki licencován pod následující licencí:CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki