EXODUS Knowledge: Difference between revisions

From NEOSYS Technical Support Wiki
Jump to navigationJump to search
No edit summary
No edit summary
Line 1: Line 1:
==EXODUS Intro==
EXODUS is the new version of NEOSYS, which has been converted to Linux, C++ and postgres. It is comprised of two main sections:
Overview:
*EXODUS is a complete conversion of the AREV's CRUD and web service framework. (https://github.com/exodusdb/exodusdb)
*NEOSYS is the complete conversion of the NEOSYS Agency AREV programs. (not public git)
Programs such as post vouchers, invoice schedules, print booking orders, list media invoices, ledgerprint e.t
==TMUX Screens==
==TMUX Screens==


Line 16: Line 8:
#ex1_root        - /root                                  - general usage  
#ex1_root        - /root                                  - general usage  
#exodus          - /root/exodus                          -  
#exodus          - /root/exodus                          -  
#exodus src      - /root/exodus/exodus/libexodus/exodus  -  
#exodus src      - /root/exodus/exodus/libexodus/exodus  - LibExodus is the core EXODUS library source files (emulating AREV CRUD)
#exo cli        - /root/exodus/cli/src                  -  
#exo cli        - /root/exodus/cli/src                  - Core EXODUS program which can be executed from bash (clearfile, edir, edic, compile)
#service        - /root/exodus/service                  -  
#service        - /root/exodus/service                  - Default working environment for EXODUS only service, including EXODUS core www and data directories. Also used to keep NEOSYS database installation scripts.
#ser src        - /root/exodus/service/src              -
#ser src        - /root/exodus/service/src              -
#neosys          - /root/neosys                          - ./doall
#neosys          - /root/neosys                          - ./doall
Line 66: Line 58:
*Backup <dbcode>.sql file is written to /root/backups/sql; which is rsynced to nl19:/backups/current/exodus/
*Backup <dbcode>.sql file is written to /root/backups/sql; which is rsynced to nl19:/backups/current/exodus/
*Unlike AREV, postgres can perform a "backup" of a database whilst the system is in use.
*Unlike AREV, postgres can perform a "backup" of a database whilst the system is in use.
==Debugging NEOSYS EXODUS C++ gdb==
Two scripts can be used to start a process in debug mode. (WARNING: other running TEST or LIVE processes for client will stop during debugging)
Screen 6: ./test will use the TEST program object code. and ./run will use the LIVE object code.
#Do ./test or ./live  <dbcode>
#Enter debugger: Ctrl +C
#Set Breakpoint(s), enter:
* b <programname>:<lineNo> or
* b functionname>
#Press y to add break point to a library that will be called in future.
#Enter "r" to restart process, or "c" to continue.
#Replicate issue in wGUI.
====Useful EXODUS bash environment Variables====
Set these bash environment vars for the desired effect:
*EXO_DBTRACE=1          - activate printing of pgsql errors on next started process. (by default not set)
*EXO_DEBUG=1            - activate debug mode
*EXO_DBNAME=<dbname>"    - switch to required database for next commands e.g listfiles or list companies (default db code is test)
===Edit programs/data records===
Edit programs:
edic <program name>
e.g edic LISTJOBINVS  or e LISTJOBINVS  (works on anywhere)
Info: <br>
*edic works in any screen.
*If edic cannot find the program name, then it offers to create a basic program or header file instead.
*If you save and exit edic, the program is automatically compiled and the new object code is put into /lib. (used only by TEST processes)
Edit sql data records:
edir <file> <key> [fieldNo] 
e.g edir companies D 1
Edit OS files:
edir DOS <file> [field] [value]
e.g edir DOS work/system.cfg
===Compiling===
compile <filename>
If successful, updates program's .so file in /lib. (used only by TEST processes)
===Apply patch for Test===
# edic <programname>
# Save, exit and compile.
# Restart TEST processes - in order to load new object code in to memory.
# Check & test patch/change in WGUI (test database).
WARNING: This will UPDATE ALL CLIENT LIVE installations. (DO NOT USE)
~/neosys/src/copytest
   
===Maintenance F5 equivalent===
AREV Maintenance mode F5 equivalent do ./run or ./test, press key "x" and enter command. (e.g CHK.FILES, CHKLIC, CRETEALERTS)
==Converting AREV to Exodus==
===Convert Programs===
In AREV: <br>
#Update program source code and check it can be compiled.
#Ensure the program you want to recompile into exodus has below e.g "*c job" in source code on line 2, col 1
#Command: "attach adecomc"          #attaches exodus recompiler/decompiler
#Command: "adecom <programname>"
In Cygwin: <br>
#Run "cygdrive/d/exodus/pickos/syncup.sh"    #syncs all decompiled programs to nl19:/backups/current/hosts/win3/pickos/
In Exodus: <br>
Command explanations:
#rsync arev decompiled code from sshfs /backups/current/win3/pickos/
getpickos
#There are three "getpickos" & "compall".
TODO down
*cd exodus/service/src getpickos && compall
*cd ~/neosys/src && getpickos && compall
*cd ~/neosys/src && getpickos && compile <progname> or
*WARNING following command is DANGEROUS! all LIVE object code updated and all LIVE/TEXT process restarted! 
**INCLUDES: "exodus compall" and "neosys compall" and "copyall" and "restart all"!
***Use with caution: "cd ~/neosys && compall"
cd exodus/service copyall
TODO up
===Convert dictionary items===
Two methods:
a) Quick exodus patch (next sync-up from overwrite with win10a version)
b) Update exodus from AREV
====Quick Method====
#Update dict item in win10a
#In exodus run command "e dicta2e"
# Paste below and edit for your case:
<pre>
#include <exodus/program.h>
programinit()
function main() {
    var originalvalue;
    //edit the string
    var replacevalue="Line Description";
    //check the value of the field TO replace
    //SYNTAX: readv(<record/field> from <filename>, <key> [,field])
    readv(originalvalue from "DICT_JOB_INVOICES", "LINE_TEXT", 3);
    outputl("REPLACE:"^quote(originalvalue)^" with "^quote(replacevalue));
    //uncomment below 2 lines AFTER using check above
    //writev(replacevalue from "DICT_JOB_INVOICES", "LINE_TEXT", 3);
    outputl("REPLACED:"^quote(originalvalue)^" with "^quote(replacevalue));
    return 0;
}
programexit()
</pre>
#Save, exit and make sure complied.
#./doall TEST all bash dicta2e
#Check changes on a TEST database.
#./doall LIVE all bash dicta2e
====Safe Method====
In AREV: <br>
#Update dict item in win10a
#attach adecomc
#adecom <dictfile>      (e.g  adecom dict.production.invoices)
#base2sql
In Cygwin: <br>
#./d/exodus/pickos/syncup.sh
In Exodus: <br>
#neosys/src/getpickos
#./doall all import_db R
Renew dict items for xxx_test database: <br>
*doall all create_testdb  - will use mornings backup
*doall all backup_db      - will use latest version of database
#Check dictionary item in the <dictfile>.cpp file & effect on website.
===Hosted EXODUS===
ex1 (exodus win3) nightly backup all databases. (see crontab)
===Client Hosted EXODUS===

Revision as of 15:21, 6 July 2021

TMUX Screens

To create the EXODUS maintenance/programming environment

exodus#: ./tmux.exodus
SCREEN NAME      STANDARD PATH                            PURPOSE
#ex1_root        - /root                                  - general usage 
#exodus          - /root/exodus                           - 
#exodus src      - /root/exodus/exodus/libexodus/exodus   - LibExodus is the core EXODUS library source files (emulating AREV CRUD)
#exo cli         - /root/exodus/cli/src                   - Core EXODUS program which can be executed from bash (clearfile, edir, edic, compile)
#service         - /root/exodus/service                   - Default working environment for EXODUS only service, including EXODUS core www and data directories. Also used to keep NEOSYS database installation scripts.
#ser src         - /root/exodus/service/src               -
#neosys          - /root/neosys                           - ./doall
#neo src         - /root/neosys/src                       -
#hosts           - /root/hosts                            -   
#test src        - /root/exodus/test/src                  - 
#t10             - ~/                                     - 
#t11             - ~/                                     - 
#t12             - ~/                                     - 


Object Code/Libraries

LIVE and TEST processes use different sets of object code. TEST processes use libraries in ~/lib/, whereas LIVE processes use object code in ~/neo/lib

This means development & testing can be done stress free on TEST database, as apposed to testing on production databases.

When compiling using edic, the TEST object code is updated if the compilation is successful. (~/lib) In order to apply a tested patch to LIVE see Update LIVE programs.

Dictionaries

Dictionaries, the files used to describe the fields of a file's record. Unlike in AREV, there is a copy of all dictionaries in each pgsql database. (In AREV updating a dictionary would affect all the databases)

Processes

The TEST process for all database use the same object code stored in /root/lib, whereas all LIVE process use the object code in /root/neo/.

Postgres

Connect into postgres shell:

sudo -u postgres psql

List databases once in postgres shell:

\l

Delete a database:

sudo -u postgres dropdb <dbcode>

./doall

General

Screen 6: ./doall script contains all the necessary information(codes) to setup a installation. It includes scripts to backup, restore, create a Apache site, create/start/stop/status a service, import a AREV database into postgres and more.

backup_db

  • Does a backup & restore of a LIVE database into the corresponding TEST database.
  • Backup <dbcode>.sql file is written to /root/backups/sql; which is rsynced to nl19:/backups/current/exodus/
  • Unlike AREV, postgres can perform a "backup" of a database whilst the system is in use.