not production-ready
Pre-requirements: Xcode Command Line Tools (macOS), Node.js, yarn, git.
expand me
-
Install firebird (version >= 3):
$ curl -LO https://github.com/FirebirdSQL/firebird/releases/download/R3_0_3/Firebird-3.0.3-32900-x86_64.pkg $ open ./Firebird-3.0.3-32900-x86_64.pkg
-
Setup firebird:
$ firebirdHome='export FIREBIRD_HOME="/Library/Frameworks/Firebird.framework/Resources"' $ grep -q -F "$firebirdHome" ~/.bash_profile || echo "$firebirdHome" >> ~/.bash_profile $ firebirdBin='export PATH=$PATH:$FIREBIRD_HOME/bin' $ grep -q -F "$firebirdBin" ~/.bash_profile || echo "$firebirdBin" >> ~/.bash_profile $ mkdir -p /usr/local/lib $ ln -s /Library/Frameworks/Firebird.framework/Versions/A/Firebird /usr/local/lib/libfbclient.dylib # troubleshooting: Can not access lock files directory /tmp/firebird/ $ sudo dseditgroup -o edit -a $(whoami) -t user firebird # troubleshooting: I/O error during "open O_CREAT" operation. Error while trying to create file. Permission denied $ chgrp -R firebird /Library/Frameworks/Firebird.framework $ sudo chmod -R g+rwx /Library/Frameworks/Firebird.framework
See: advanced configuration (optional).
-
Install repository:
$ git clone https://github.com/gsbelarus/gdmn-back.git $ cd gdmn-back $ yarn
-
Troubleshooting
How do i check firebird server is running?
$ netstat -an | grep 3050
If something is listening on port 3050 then the server is running.
How do i restart firebird server?
$ ps -ef | grep xinetd $ kill -USR2 <pid>
expand me
-
Install build tools:
$ yarn global add windows-build-tools $ yarn global add node-gyp
-
Install firebird (version >= 3.0):
$ curl -LO https://github.com/FirebirdSQL/firebird/releases/download/R3_0_3/Firebird-3.0.3.32900_0_x64.exe $ cmd /K ./Firebird-3.0.3.32900_0_x64.exe
-
Setup firebird:
-
$ copy <fb_dir>/fbclient.dll <win_dir>/SysWOW64
(System32)There's no need if firebird directory(<fb_dir>) in $PATH
-
apply configuration patch to <fb_dir>/firebird.conf:
@@ -405,11 +405,11 @@ # # Per-database configurable. # -#AuthServer = Srp +AuthServer = Legacy_Auth # # Per-connection and per-database configurable. # -#AuthClient = Srp, Win_Sspi, Legacy_Auth +AuthClient = Legacy_Auth # # If you need to use server plugins that do not provide encryption key (both Legacy_Auth # & Win_Sspi) you should also turn off required encryption on the wire with WireCrypt @@ -423,7 +423,7 @@ # # Per-database configurable. # -#UserManager = Srp +UserManager = Legacy_UserManager # TracePlugin is used by firebird trace facility to send trace data to the user # or log file in audit case. @@ -599,7 +599,7 @@ # # Type: string (predefined values) # -#WireCrypt = Enabled (for client) / Required (for server) +WireCrypt = Disabled # # Should connection over the wire be compressed? @@ -610,7 +610,7 @@ # # Type: boolean # -#WireCompression = false +WireCompression = false
Troubleshooting: Create 'localhost:3050/c:\gdmn-back\databases\MAIN.FDB' (node:2308) UnhandledPromiseRejectionWarning: Error: Install incomplete, please read the Compatibility chapter in the release notes for this version
-
-
Install repository:
$ git clone https://github.com/gsbelarus/gdmn-back.git $ cd gdmn-back $ yarn
- Verify the configuration is correct (
./config/development.json
). - Run command.
$ yarn start
- Wait for initialization and startup
- Clone config file
./db/database.ts.sample
to the same directory and rename it to./db/database.ts
- Fill this config file
expand me
- To work with the auth database you need to simple
CONNECT
- To work with the user's databases you need to
CONNECT
with header:app-uid
- To restore the session you need to
CONNECT
with header:session
>>> CONNECT
login:login
passcode:password
session:session (optional)
create-user:1
<<< CONNECTED
server:gdmn-back/1.0.0
version:1.2
session:session-0
access-token:token-0
refresh-token:token-1
>>> CONNECT
login:login
passcode:password
session:session-0 (optional)
create-user:0 (optional)
app-uid:uid (for user's apps)
<<< CONNECTED
server:gdmn-back/1.0.0
version:1.2
session:session-0
access-token:token-0
refresh-token:token-1
or
>>> CONNECT
authorization:token-0
session:session-0 (optional)
app-uid:uid (for user's apps)
<<< CONNECTED
server:gdmn-back/1.0.0
version:1.2
session:session-0
or
>>> CONNECT
authorization:token-1
session:session-0 (optional)
app-uid:uid (for user's apps)
<<< CONNECTED
server:gdmn-back/1.0.0
version:1.2
session:session-0
access-token:access-token
refresh-token:refresh-token
>>> CONNECT
authorization:token-1
session:session-0 (optional)
app-uid:uid (for user's apps)
<<< CONNECTED
server:gdmn-back/1.0.0
version:1.2
session:session-0
access-token:token-2
refresh-token:token-3
or
>>> CONNECT
login:login
passcode:password
session:session-0 (optional)
create-user:0 (optional)
app-uid:uid (for user's apps)
<<< CONNECTED
server:gdmn-back/1.0.0
version:1.2
session:session-0
access-token:token-2
refresh-token:token-3
>>> SEND
destination:/task
receipt:receipt-0
action:...
content-type:application/json;charset=utf-8
content-length:...
{"payload":{...}}
- {
action
,payload
}: wiki
<<< RECEIPT
receipt-id:receipt-0
task-id:task-0
<<< MESSAGE
destination:/task
action:...
message-id:msg-0
ack:client-individual (optional)
subscription:sub-0
task-id:task-0
content-type:application/json;charset=utf-8
content-length:...
{"payload":{...},"status":1,...}
payload
- is request payloadstatus
:- 3 -
INTERRUPTED
- 4 -
FAILED
- 5 -
SUCCESS
- 3 -
error
is sent only when the status isFAILED
code
- error codemessage
- error message
result
is sent only when the status isSUCCESS
<<< MESSAGE
destination:/task/status
action:...
message-id:msg-0
subscription:sub-0
task-id:task-0
content-type:application/json;charset=utf-8
content-length:...
{"payload":{...},"status":1,...}
payload
- is request payloadstatus
:- 1 -
RUNNING
- 2 -
PAUSED
- 3 -
INTERRUPTED
- 4 -
FAILED
- 5 -
SUCCESS
- 1 -
<<< MESSAGE
destination:/task/progress
action:...
message-id:msg-0
subscription:sub-0
task-id:task-0
content-type:application/json;charset=utf-8
content-length:...
{"payload":{...},"progress":{"value":50,"description":"progress"}}
payload
- is request payloadprogress
:value
- is value between 0 and 100description
- some text about progress
<<< ERROR
code:0
message:message
receipt-id:receipt-0 (optional)
code
:- 0 -
INTERNAL
- 1 -
UNSUPPORTED
- 2 -
UNAUTHORIZED
- 3 -
INVALID
- 4 -
NOT_FOUND
- 5 -
NOT_UNIQUE
- 0 -
message
- error message
login: Administrator
password: Administrator
gdmn-front
- web client