irma

其他类别 2025-08-18

irma

irma是一个有效的Web服务框架,源自业务项目,是由于诸如Enterprise要求采用.NET,SaaS&Cloud自动部署以及Linux运行环境等全面irma而创建的。它使用Mono在Linux上实现C#代码的解析和执行,并利用FastCGI和NGINX来处理HTTP交互。 irma有两个部分: irma call ,用C编写的多线程调度引擎,以及用C#编写的开发框架irma kitirma call负责启动和安排在irma kit框架上开发的各种Web应用程序。 irma的设计概念是:简单有效的调度,按需集成和扩展,这确实使irma看起来更像是工具包,而不是框架(实际上,它是工具包)。无论如何,我希望这对您有用:-)

建筑图

汇编和安装

首先对其进行配置:

$ make config

在这里,我假设您已经在$HOME/local/ (您可以根据实际情况输入正确的路径)安装了相关库,因此配置过程大致如下:

irma] log file generated hourly support ? [n] The irma is now hopefully configured for your setup. Check the config.in & config.h files and do 'make' to build it.">
 # #######################################
# mono config:
# #######################################
mono installed location ? [/home/fenkey/local/mono]

# #######################################
# ssl config:
# #######################################
ssl installed location ? [/home/fenkey/local/openssl]

# #######################################
# fcgi config:
# #######################################
fcgi installed location ? [/home/fenkey/local/fcgi]

# #######################################
# curl config:
# #######################################
curl installed location ? [/home/fenkey/local/curl]
c_ares support ? [y]
c_ares installed location ? [/home/fenkey/local/c-ares]

# #######################################
# memcached config:
# #######################################
memcached support ? [y]
memcached installed location ? [/home/fenkey/local/libmemcached]

# #######################################
# redis config:
# #######################################
redis support ? [y]
hiredis installed location ? [/home/fenkey/local/hiredis]

# #######################################
# smtp config:
# #######################################
smtp support ? [y]

# #######################################
# log config:
# #######################################
log prefix (string with valid characters or numbers, of which the length is limited to 20): [ irma ]
log file generated hourly support ? [n]

The irma is now hopefully configured for your setup.
Check the config.in & config.h files and do ' make ' to build it.

上述依赖项的源链接可能会提及以下:

  • mono :https://github.com/mono/mono.git
  • openssl :https://github.com/openssl/openssl.git
  • fcgi :http://fastcgi.com/或https://gi*thub**.com/jorben/fcgi
  • c-ares :https://github.com/c-ares/c-ares
  • curl :https://github.com/curl/curl.git
  • memcached :https://libmemcached.org/
  • hiredis :https://github.com/redis/hiredis.git

汇编LibCurl时,请注意添加SSL支持( --with-ssl )。由于libcurl不支持DNS异步分辨率,因此您必须利用signal的方式,或者是第三方c-ares套餐,这是Libcurl的官方建议。我们遵循使用c-ares建议:

$ ./configure --prefix= $HOME /local/c-ares --enable-static
$ make
$ make install

编译并安装libcurl:

$ ./buildconf
$ export PKG_CONFIG_PATH= $HOME /local/openssl/lib/pkgconfig
$ ./configure --prefix= $HOME /local/curl --disable-ldap --disable-ldaps --with-ssl --enable-ares= $HOME /local/c-ares --enable-static
$ make
$ make install

完成有关irma的配置后,生成了两个文件: config.inconfig.h 。现在让我们继续

$ make
$ make install

默认情况下,我们在静态上编译irma ,这意味着您可以以最少的方式应用和运行它。您可以通过直接修改Makefile来更改它。我们假设安装路径为$HOME/local/ irma ,并修改文件irma /Makefile

PREFIX = $( HOME ) /local/ irma

设置环境路径并重新加载:

irma/bin:$PATH" >> ~/.bash_profile $ . ~/.bash_profile">
$ echo " export PATH= $HOME /local/ irma /bin: $PATH " >> ~ /.bash_profile
$ . ~ /.bash_profile

执行它:

irmacall ___ ____ __ __ _ ____ _ _ |_ _| _ | / | / / ___|__ _| | | | || |_) | |/| | / _ | | / _` | | | | || _ <| | | |/ ___ |__| (_| | | | |___|_| __| |_/_/ _______,_|_|_| +------------------------------------------------------------------------------------------------------------------+ | Usage: irma call [-t ] [-x ] [-m ] [-c ] [-k] [-v] [-h] | | Options: | | -t: Log lever of 'debug', 'event', 'warn', 'error' or 'fatal' | | -x: Threads count of every process | | -m: Module invoking. Normally, it's a .Net DLL | | -c: Configuration file of module | | -k: Mock request support | | -v: Version of irma call | | -h: Help information | +------------------------------------------------------------------------------------------------------------------+ $ irma call -v irma call 0.8 Features: fetcher fuse c_ares memcached redis smtp logprefx(' irma ')">
$ irma call
 ___ ____  __  __    _    ____      _ _
| _ _ |  _ |  /  |  /   / ___ | __ _ | | |
 | || | _) | | / | | / _ | |   / _ ` | | |
 | ||  _ < | |  | | / ___  | __ | (_ | | | |
| ___ | _ | __ |  | _/_/   __ ___ _ _,_ | _ | _ |
+------------------------------------------------------------------------------------------------------------------+
| Usage: irma call [-t < log-type > ] [-x < thread-count > ] [-m < module-invoke > ] [-c < config-of-module > ] [-k] [-v] [-h]  |
| Options:                                                                                                         |
|    -t: Log lever of ' debug ' , ' event ' , ' warn ' , ' error ' or ' fatal '                                                 |
|    -x: Threads count of every process                                                                            |
|    -m: Module invoking. Normally, it ' s a .Net DLL                                                                |
|    -c: Configuration file of module                                                                              |
|    -k: Mock request support                                                                                      |
|    -v: Version of irma call                                                                                       |
|    -h: Help information                                                                                          |
+------------------------------------------------------------------------------------------------------------------+

$ irma call -v
irma call 0.8
Features: fetcher fuse c_ares memcached redis smtp logprefx( ' irma ' ) 

快速开始

创建并启动第一个名为Foo的项目:

irma-genapp Foo Generated project: 'Foo'. Check pls ! $ cd Foo $ make ... $ ./start.sh spawn-fcgi: child spawned successfully: PID: 17701">
$ cd ~ /tmp
$ irma -genapp Foo
Generated project: ' Foo ' . Check pls !

$ cd Foo
$ make
...
$ ./start.sh
spawn-fcgi: child spawned successfully: PID: 17701

请问我提醒您必须在启动Foo之前安装命令spawn-fcgi

$ git clone https://*git*hub*.com/lighttpd/spawn-fcgi
$ cd spawn-fcgi
$ ./autogen.sh
$ ./configure --prefix= $HOME /local/spawn-fcgi
$ make
$ make install
$ echo " export PATH= $HOME /local/spawn-fcgi/bin: $PATH " >> ~ /.bash_profile
$ . ~ /.bash_profile

Foo以多进程/多线程的方式运行,并在Bin/Debug/log目录中写入debug日志。您可以在start.sh文件中更新这些:

process_count=1
thread_count=4
log_type= " debug "
...

如果Foo无法启动,则应确认是否正在运行Memcached Server(请参阅file conf/Foo.conf中的system.session.server.serversuser.mc的配置)。

irma_20200903.log [14:46:15,554039|032126|7f4d19fa7700] Kit - Service init failed: Memcached client instance is null: Availability testing is failed [14:46:15,554132|032126|7f4d19fa7700] Core - Raise exception while invoking application ! Check it pls">
$ ./start.sh
!!!!!!!!!!!!!
!!! FATAL !!! - Fail to launch project ' Foo.dll ' ! check log files pls
!!!!!!!!!!!!!

$ cat Bin/Debug/log/fatal/ irma _20200903.log
[14:46:15,554039 | 032126 | 7f4d19fa7700] Kit - Service init failed: Memcached client instance is null: Availability testing is failed
[14:46:15,554132 | 032126 | 7f4d19fa7700] Core - Raise exception while invoking application ! Check it pls

如果还有其他原因,请参阅常见问题解答。如果成功,将生成log文件:

irma_20200903.log [15:01:38,147495|032299|7f017783e780] Core - irma call version(0.8) [15:01:38,601612|032299|7f0173da6700] Kit - Service start [15:01:38,688583|032299|7f0171e83700] Kit - Service start [15:01:38,787017|032299|7f01710ff700] Kit - Service start [15:01:38,875054|032299|7f017783e780] Core - Total (4) workers have been booted up successfully [15:01:38,875149|032299|7f0153fff700] Kit - Service start">
$ cat Bin/Debug/log/event/ irma _20200903.log
[15:01:38,147495 | 032299 | 7f017783e780] Core - irma call version(0.8)
[15:01:38,601612 | 032299 | 7f0173da6700] Kit - Service start
[15:01:38,688583 | 032299 | 7f0171e83700] Kit - Service start
[15:01:38,787017 | 032299 | 7f01710ff700] Kit - Service start
[15:01:38,875054 | 032299 | 7f017783e780] Core - Total (4) workers have been booted up successfully
[15:01:38,875149 | 032299 | 7f0153fff700] Kit - Service start

注意:如果选择支持make config中的loghourly ,则上面的日志文件名称为irma _2020090315.log 。支持loghourly将导致每小时生成日志文件。

配置NGINX(请记住重新加载或重新启动它):

irma.sock; include nginx_fastcgi.conf; } }">
server {
	listen 8020 ;
	server_name localhost ;
	
	...
	
	location ~ ^/Foo(/ | $) {
		fastcgi_pass unix:/home/fenkey/tmp/Foo/Bin/Debug/ irma .sock ;
		include nginx_fastcgi.conf ;
    }
}

nginx_fastcgi.conf文件描述了nginx和fastcgi之间请求参数的映射关系。例如:

fastcgi_param  SERVER_NAME      $server_name ;
fastcgi_param  SERVER_ADDR      $server_addr ;
fastcgi_param  SERVER_PORT      $server_port ;
fastcgi_param  SERVER_PROTOCOL  $server_protocol ;
fastcgi_param  REMOTE_ADDR      $remote_addr ;
fastcgi_param  REMOTE_PORT      $remote_port ;
fastcgi_param  DOCUMENT_ROOT    $document_root ;
fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name ;
fastcgi_param  REQUEST_URI      $request_uri ;
fastcgi_param  QUERY_STRING     $query_string ;
fastcgi_param  REQUEST_METHOD   $request_method ;
fastcgi_param  CONTENT_TYPE     $content_type ;
fastcgi_param  CONTENT_LENGTH   $content_length ;

在浏览器中输入地址访问:

常问问题

有关irma的更多详细信息,请参阅:常见问题解答

贡献

欢迎您以各种方式加入我们,例如提交您的公关,文件或问题。

下载源码

通过命令行克隆项目:

git clone https://github.com/Fenkey/irma.git