Experimental technological stack, including:
- Application Server Impress
- Client Run-time Console
- JavaScript Transfer Protocol JSTP
- Database Management System GlobalStorage
Enterprise application server for Node.js and Metarhia private cloud ⚡
Home Page: https://metarhia.com
License: MIT License
Experimental technological stack, including:
In server deployment shell scripts
Планируется ли добавить другие движки шаблонов? (например ejs, jade)
Scheduling for applications: single process, multiple processes on single server (cluster), multiple processes on multiple servers (cloud). No duplicate execution in multiple instances but with guaranted execution and restarting on fails.
Replace .existsSync to asynchronous analogs in API introspection implementation, see impress.js, lines: 1001, 1003
Consolidate and aggregate health data transmitting from workers to cluster and from cluster to Impress Cloud Controller. Create visualization interface for online and offline monitoring.
Probably this driver will be wrapped as plugin for db.js interface https://github.com/brianc/node-postgres
Does Impress have it's own localization engine?
If it hasn't any i18n lib if I use some external library like https://github.com/mashpie/i18n-node will it work with Impress templates?
Implement raw tcp socket support for Impress-hosted applications
Commands "service impress update" and "service impress restart" now starts impress after update and after stop respectively, but this behavior is wrong, service/daemon state should become the same as it was before command execution.
Fork url-handlers as separate process for long processing.
Try to fix IP "sticky" serving strategy on windows or disable this strategy with warning and fall-back to "multiple" strategy if it is impossible.
Startup check at https://github.com/tshemsedinov/impress/blob/master/lib/impress.js#L307 always goes in on('errror'), even if port is available and nothing is running on it.
допустим я у себя в hosts делаю запись
127.0.0.1 xn--127-qdd4dec.xn--p1ai
и захожу браузером соответственно на http://тест127.рф/
в applications/example/config/hosts.js остается как и было
module.exports = [
"127.0.0.1"
]
тогда сервер падает с таким сообщением
2014-01-29T21:54:19.252Z Master(7484/C1N0) TypeError: Cannot read property 'cache' of undefined; Client.include (\node_modules\impress\lib\impress.js:1037:23); Client.error (\node_modules\impress\lib\impress.js:898:9); Server.impress.dispatcher (\node_modules\impress\lib\impress.js:579:29); Server.EventEmitter.emit (events.js:98:17); HTTPParser.parser.onIncoming (http.js:2108:12); HTTPParser.parserOnHeadersComplete as onHeadersComplete; Socket.socket.ondata (http.js:1966:22); TCP.onread (net.js:525:27)
если конечно в applications/example/config/hosts.js сделать
module.exports = ["*"]
то работает и http://127.0.0.1/ и http://тест127.рф/
я так понимаю, что на левый домен страница с ошибкой все таки должна вылезать...
I've installed example and it has only sites
folder and config.js
, server.js
, setup.js
. Now I need to create custom module (plugin) or override existing. I've tried one way: cloned impress from git, added test plugin into it and then configured my project to use impress from local git, not from npm. And this way worked. Is this right way to add custom modules to impress or may-be there is another way to do it?
Зарегистрировался, вхожу с использованием формы логина. Ничего не происходит. Верхнее меню не меняется. В базе mongodb/impress пользователь зарегистрировался. Сессия есть.
Пример, который идет в комплекте довольно сложный. Было бы неплохо, если бы были более простые примеры типа Hello World.
А документация на конфиги и основные модули была бы просто незаменима.
Fork works only from master thread, bur raise exception on worker threads:
worker AssertionError: false == true; Cluster.cluster.fork (cluster.js:505:3); Client.fork (\lib\impress.js:677:32);
Solution: call master thread by IPC and fork from master.
допустим я создаю в /applications каталог test
в /config/servers.js остается
applications: ["example"]
тем не менее impress при запуске этот test сразу грузит:
C:\data\node\ws>node server.js
�[32m�[1mImpress Application Server starting�[22m�[39m�[32m, reading configuration�[39m
open C:/data/node/ws/config/cloud.js
open C:/data/node/ws/config/cluster.js
open C:/data/node/ws/config/log.js
open C:/data/node/ws/config/plugins.js
open C:/data/node/ws/config/sandbox.js
open C:/data/node/ws/config/servers.js
�[32mStartup check: �[39mhttp://127.0.0.1/
listen on 127.0.0.1:80
open C:/data/node/ws/log/2014-01-30-access.log
open C:/data/node/ws/log/2014-01-30-error.log
open C:/data/node/ws/log/2014-01-30-debug.log
open C:/data/node/ws/log/2014-01-30-slow.log
open C:/data/node/ws/applications/example/config/application.js
open C:/data/node/ws/applications/example/config/databases.js
open C:/data/node/ws/applications/example/config/example.js
open C:/data/node/ws/applications/example/config/files.js
open C:/data/node/ws/applications/example/config/hosts.js
open C:/data/node/ws/applications/example/config/mail.js
open C:/data/node/ws/applications/example/config/routes.js
open C:/data/node/ws/applications/example/config/sessions.js
open C:/data/node/ws/applications/test/config/application.js
open C:/data/node/ws/applications/test/config/databases.js
open C:/data/node/ws/applications/test/config/files.js
open C:/data/node/ws/applications/test/config/hms.js
open C:/data/node/ws/applications/test/config/hosts.js
open C:/data/node/ws/applications/test/config/mail.js
open C:/data/node/ws/applications/test/config/routes.js
open C:/data/node/ws/applications/test/config/sessions.js
а если каталог test пустой падает:
2014-01-30T09:04:24.203Z Master(8804/C1N0) TypeError: Object.keys called on non-object; Function.keys (native); \node_modules\impress\lib\impress.js:154:26; ReaddirReq.Req.done (\node_modules\impress\node_modules\npm\node_modules\graceful-fs\graceful-fs.js:143:5); ReaddirReq.done (\node_modules\impress\node_modules\npm\node_modules\graceful-fs\graceful-fs.js:90:22); Object.oncomplete (fs.js:107:15)
Fixed. Sory port 80 problem.
I start a server on mac os x 10.8.4.
And resive folowind errors:
TypeError: Cannot read property 'getsockname' of undefined
at net.js:1055:23
at Object.32:1 (cluster.js:587:5)
at handleResponse (cluster.js:171:41)
at respond (cluster.js:192:5)
at handleMessage (cluster.js:202:5)
at process.EventEmitter.emit (events.js:117:20)
at handleMessage (child_process.js:318:10)
at Pipe.channel.onread (child_process.js:345:11)
net.js:1055
if (port && handle.getsockname && port != handle.getsockname().port) {
^
TypeError: Cannot read property 'getsockname' of undefined
at net.js:1055:23
at Object.31:1 (cluster.js:587:5)
at handleResponse (cluster.js:171:41)
at respond (cluster.js:192:5)
at handleMessage (cluster.js:202:5)
at process.EventEmitter.emit (events.js:117:20)
at handleMessage (child_process.js:318:10)
at Pipe.channel.onread (child_process.js:345:11)
And so on.
On windows (same notebook) works good.
Now there is one sandbox configuration for all applications. We need to have separate configurations for each application with different access to namespaces.
Let's imagine that I need urls like: http://example.com/<username>/profile
which will point to folder profile
and use get.js or post.js inside that folder and pass <username>
as query string param or as a part of form data.
Can this framework do something like this?
We can change mixin to class factory, to prepare special class for each application on server start or on config change and mixin additional methods to this class prototype but not to Client instances. This will increase performance I believe, but testing needed.
In static folders or if access.js matched static regexp Impress serving is as a static file. This file includes no critical security information except flags and group names but should be fixed because we may want to hold real static code in /js/access.js to be executed at client side, so we have name overlapping.
on windows node 10.25 server creates above error
"Master(5500/C1N0) TypeError: Cannot read property 'cache' of undefined; \node_modules\impress\lib\impress.js:1336:17; Object.cb as oncomplete"
при включении в /config/plugins.js
"db.mongodb"
после запуска падает:
Impress Application Server starting, reading configuration
Exception in master process
TypeError: Cannot set property 'mongodb' of undefined
at global.db (/node_modules/impress/lib/db.mongodb.js:7:22)
at Object. (/node_modules/impress/lib/db.mongodb.js:43:3)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at loadPlugins (/node_modules/impress/lib/impress.js:227:17)
at /node_modules/impress/lib/impress.js:276:4
Impress shutting down
Now implemented this way: multiple processes, one master and different workers for each server (master should not listen ports). On port 80 it works well, but on other ports session cookie "SID" and process identifier "node" cookie not works.
Example log file now, when SyntaxError occurs in handler(request.js, get/post.js, etc.): 2014-06-16T13:51:17.136Z Master(11260/C1N0) SyntaxError: Unexpected token :; new Script (vm.js:32:12); Function.Script.createScript (vm.js:48:10); impress.js:116:27; fs.js:266:14; Object.oncomplete (fs.js:107:15)
в качестве БД - mysql, сервер sles 11
для mysql и системы указана правильная временная зона
запросы к mysql из консоли (mysql) и MySQL Workbench возвращают правильные даты (тип datetime)
запросы из impress возвращают даты приведенные к UTC (на 4 часа меньше)
в результате получаются даты и неверным днем (это зависит от времени - если время = 00:00, вычитается 4 часа и получается вчерашний день)
в Node пока чайник, в результате поисков нашлось вот это:
process.env.TZ = 'Europe/Moscow';
прописал в один из обработчиков, но изменений нет
что нужно сделать, чтобы получать даты из запросов к mysql в соответствии с временной зоной?
When we have
"routes": {
"Test1": {
"url": "/Test-0/GetPersons",
"rewrite": "/api/Test/GetPersons",
"host": "10.13.125.167",
"port": 81
}
}
//Test1 /Test-0/GetPersons(.) /api/Test/GetPersons 10.13.125.167 81
the rewrite engine not accept url, but when we change "url" option to "url": "/Test-0/GetPersons(.)" then all works fine.
Can you implement simple syntax when we not need (.*) at end of url.
./applications/example/app/html.template
./applications/example/app/dbmi/html.template
24 <script type="text/javascropt" src="/js/eventsource.js"></script>
If handler (get.js, post.js, request.js, etc.) will not call function callback within timeout we should detect it, terminate connection and reply with error message.
Implement authentication in social networks using Passport.js
Implement cache memory limits with serving statistics to release less used resources.
Do not create log files inside application if separate logging is OFF and logs will be empty.
New conventions:
вот я ковыряю импресс под виндой в каталоге C:\data\node\ws
соответственно ваш пример в C:\data\node\ws\applications\example
и конфиг в C:\data\node\ws\config
запустил из под отладчика вебшторма и увидел вот такие попытки найти конфиги в корне диска, но при этом однако все работает.... как то странно...
"C:\Program Files\nodejs\node.exe" --debug-brk=51320 server.js
debugger listening on port 51320
Impress Application Server starting, reading configuration
{ [Error: ENOENT, no such file or directory 'C:\config\cloud.js']
errno: 34,
code: 'ENOENT',
path: 'C:\config\cloud.js',
syscall: 'open' }
Startup check: http://127.0.0.1/
{ [Error: ENOENT, no such file or directory 'C:\config\cluster.js']
errno: 34,
code: 'ENOENT',
path: 'C:\config\cluster.js',
syscall: 'open' }
listen on 127.0.0.1:80
{ [Error: ENOENT, no such file or directory 'C:\config\log.js']
errno: 34,
code: 'ENOENT',
path: 'C:\config\log.js',
syscall: 'open' }
{ [Error: ENOENT, no such file or directory 'C:\config\plugins.js']
errno: 34,
code: 'ENOENT',
path: 'C:\config\plugins.js',
syscall: 'open' }
{ [Error: ENOENT, no such file or directory 'C:\config\servers.js']
errno: 34,
code: 'ENOENT',
path: 'C:\config\servers.js',
syscall: 'open' }
{ [Error: ENOENT, no such file or directory 'C:\config\sandbox.js']
errno: 34,
code: 'ENOENT',
path: 'C:\config\sandbox.js',
syscall: 'open' }
{ [Error: ENOENT, no such file or directory 'C:\example\config\databases.js']
errno: 34,
code: 'ENOENT',
path: 'C:\example\config\databases.js',
syscall: 'open' }
{ [Error: ENOENT, no such file or directory 'C:\example\config\application.js']
errno: 34,
code: 'ENOENT',
path: 'C:\example\config\application.js',
syscall: 'open' }
{ [Error: ENOENT, no such file or directory 'C:\example\config\example.js']
errno: 34,
code: 'ENOENT',
path: 'C:\example\config\example.js',
syscall: 'open' }
{ [Error: ENOENT, no such file or directory 'C:\example\config\files.js']
errno: 34,
code: 'ENOENT',
path: 'C:\example\config\files.js',
syscall: 'open' }
{ [Error: ENOENT, no such file or directory 'C:\example\config\hosts.js']
errno: 34,
code: 'ENOENT',
path: 'C:\example\config\hosts.js',
syscall: 'open' }
{ [Error: ENOENT, no such file or directory 'C:\example\config\mail.js']
errno: 34,
code: 'ENOENT',
path: 'C:\example\config\mail.js',
syscall: 'open' }
{ [Error: ENOENT, no such file or directory 'C:\example\config\routes.js']
errno: 34,
code: 'ENOENT',
path: 'C:\example\config\routes.js',
syscall: 'open' }
{ [Error: ENOENT, no such file or directory 'C:\example\config\sessions.js']
errno: 34,
code: 'ENOENT',
path: 'C:\example\config\sessions.js',
syscall: 'open' }
For example.
Config:
"url": "/Test-1/GetPerson(.*)"
"rewrite": "/api/Test/GetPerson[1]",
Query http://someserver.com/Test-1/GetPerson?id=1
not routed to http://anotherserver.com/api/Test/GetPerson?id=1
But we have http://anotherserver.com/api/Test/GetPerson[1]
Create visual setup for optional modules, plugings and configuration parameters.
If you run impress that configured to listen on 80
port from non-root (non-privileged) user it will say that application is started successfully and is listening on 80 port. And logs will be empty.
But on linux non-root users can't open ports below 1024
for listening. So as a result application says that's all ok and it's runnning, but actually it can't listen on 80 port, so if I open i.e. http://127.0.0.1/ browser will show an error.
May be it will be better if impress somehow check if it actually can open that port, or at least show some warning about possible problems with ports below 1024.
It would be great if impress will support websokets.
And if you're planning to add it will it be your own implementation or you'll use something like socket.io or sockjs?
If you choose last may be you'll be interested in this library https://github.com/primus/primus. It acts like wrapper on many existing nodejs websocket implementations and allows easilly switch backends (like socket.io, engine.io and others) without rewriting your code.
I'm trying to get POST data from client.fields property and getting such string which cannot be parsed with JSON.parse:
{ '{"0":{"value":"alega","path":"services.list.1.0.header"},"1":{"value":"agafonov ': '',
'nbsp;","path":"services.list.1.1.header"}}': '' }
while client.data of the same post gives: {"0":{"value":"alega","path":"services.list.1.0.header"},"1":{"value":"agafonov ","path":"services.list.1.1.header"}}
which is ok for the parser.
Separate log files for applications as optional feature. Allow to choice (for each application):
Detected problem: it seems that virtual group "everyone" is not applied for user if one have other group but we have no appropriate template for his group, in this case "everyone" template should be used but it does not.
We need self-testing mode, so Application Server should run with special configuration key and execute internal testing for all functionality, log results and detect problems.
имеем приложение impress, базы mongodb и mysql
impress запущен через forever
после запуска работает нормально весь день (процесс разработки и отладки приложения), остается работающим на серверt и на следующий день начинаются проблемы - в обозреватель загружаются только статические файла (то, что в files.js).
запросы api не выполняются.
после рестарта - все работает
кусочки конфига:
cloud.js:
controller: "192.168.3.100",
cluster.js:
check: "http://192.168.3.100/"
strategy: "sticky",
plugins.js:
"db",
//"db.schema",
"db.mongodb",
//"db.memcached",
"db.mysql",
//"db.mysql.schema",
"impress.log",
"impress.security",
"impress.security.mongodb",
//"impress.mail",
"impress.uglify",
//"impress.health",
//"impress.cloud",
//"impress.geoip",
//"impress.websocket",
"impress.sse"
servers.js:
protocol: "http",
address: "192.168.3.100",
port: 80,
applications: ["agat", "iserv"],
nagle: true,
slowTime: "1s"
databases.js:
impress: {
url: "mongodb://localhost:27017/impress",
slowTime: "2s",
collections: ["sessions", "users", "groups"],
security: true
},
system: {
url: "mysql://root:123456789@localhost/agat",
slowTime: 1000,
tables: []
}
логи:
access.log - всегда отображаются все входящие запросы
debug.log - отображаются sql запросы, после появления ошибки - ничего не фиксируется
error.log:
2014-03-12T21:19:24.891Z Master(6242/C1N0) {"fatal":true,"code":"PROTOCOL_CONNECTION_LOST"}
2014-03-12T21:19:24.891Z Worker(6251/C1N3) {"fatal":true,"code":"PROTOCOL_CONNECTION_LOST"}
2014-03-12T21:19:24.893Z Worker(6249/C1N2) {"fatal":true,"code":"PROTOCOL_CONNECTION_LOST"}
2014-03-12T21:19:59.889Z Worker(6248/C1N1) {"fatal":true,"code":"PROTOCOL_CONNECTION_LOST"}
может быть, коннект отваливается по тайм-ауту при простое и при появлении новых запросов не поднимается...?
F:\Impress>node server
Startup check: http://127.0.0.1/
Impress Application Server starting, reading configuration
listen on 127.0.0.1:80
events.js:72
throw er; // Unhandled 'error' event
^
Error: spawn ENOENT
at errnoException (child_process.js:980:11)
at Process.ChildProcess._handle.onexit (child_process.js:771:34)
F:\Impress>node -v
v0.10.18
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.