Pesquisar

Discussão (0)1
Entre ou crie uma conta para continuar
Discussão (0)1
Entre ou crie uma conta para continuar
Discussão (0)1
Entre ou crie uma conta para continuar
Artigo
· Jul. 14 6min de leitura

Windows に Apache Web サーバをインストールし Web ゲートウェイを構成する方法

これは InterSystems FAQ サイトの記事です。

InterSystems 製品の Windows 版インストールキットでは、IIS に対して Web ゲートウェイをインストールするインストールキットの提供はありますが、Windows にインストールした Apache に対するインストールキットが提供されていないため、以下の手順で Web ゲートウェイを構成します。

1、InterSystems 製品のインストール

2、Apache for Windows のインストール

3、Windows 版 Web ゲートウェイのインストール(※)

4、https.conf の修正

5、Apache を Windows サービスにインストールし開始する

6、Web ゲートウェイ管理画面で各種設定

(※)Windows 版 Web ゲートウェイのインストールキットは WRC よりダウンロードいただけます。

 

以下、手順詳細です。

インストール時、インスタンス名を IRISTEST、インストールディレクトリを c:\InterSystems\IRISTEST に設定した流れでの図解で解説しています。

例では、http://Webサーバ/インスタンス名/csp/sys/UtilHome.csp で管理ポータルへアクセスできるようにするための設定例で記載しています。

 

1、InterSystems 製品のインストール

バージョン 2023.2 以降では、Windows 版 InterSystems 製品 のインストールキットから以下確認が表示されます。
この説明では、IIS ではなく Apache を使用する例で記載していますので、「このインスタンスにローカルIIS Webサーバを設定しないでください」(または「Webゲートウェイなしでインストールを続行する」) を選択しています。

注意:インストール後、Apacheに対する設定が完了するまで管理ポータルは開きません。

 

また、インストール時の初期セキュリティで「通常」または「ロックダウン」を選択された場合は、CSPSystemアカウントに対して設定したパスワードをメモしておいてください(この後の手順で使用します)。

 

2、Apache for Windows のインストール

インストールキットを入手します:https://www.apachelounge.com/download/

ダウンロード後、Zipを展開するとApache24フォルダがありますので任意のディレクトリにコピーします。

例では、C:¥Apache24 に展開しています。

 

3、Windows 版 Web ゲートウェイのインストール

Windows 版 Web ゲートウェイをインストールします(WRCアカウントをお持ちの場合、WRCよりダウンロードいただけます)。

インストール時の指定項目は以下の通りです。例では、Apache用モジュールのみのインストールを選択してインストールしています。

 

 

(1) Custom を選択します。

(2) Web Gateway module for Apache HTTPD ・・・のみをインストール用に指定します。

 デフォルトで c:\InterSystems\WebGateway にインストールします。

(3) Configure Web Gateway to connect to a server のチェックを外します。

(4) Installボタンでインストールを開始します。

 

4、https.conf の修正

C:\Apache24\conf\httpd.conf の末尾に以下追記します。

例は、以下の環境での設定例です。インストール環境に合わせて適宜ご変更ください。

 InterSystems 製品のインスタンス名:IRISTEST ※httpd.confに設定する場合インスタンス名の小文字を利用します。

 Web ゲートウェイインストールディレクトリ:C:\InterSystems\WebGateway

追記内容は以下の通りです。

  • Define GATEAY に Web ゲートウェイインストールディレクトリを指定します。
  • Define PREFIX に InterSystems 製品のインスタンス名を小文字にし、/ から始まる文字列で設定します。(例:/iristest)
  • Define IRISPATH に InterSystems 製品のインストールディレクトリを指定します。
### for IRIS ###
Define GATEWAY "C:/InterSystems/WebGateway/"
LoadModule cspsys_module_sa "${GATEWAY}/CSPa24Sys.dll"
LoadModule csp_module_sa "${GATEWAY}/CSPa24.dll"
 
Define PREFIX "/iristest"
 
<Location "${PREFIX}/">
  CSP On
  SetHandler csp-handler-sa
</Location>
### for IRIS ###

 

この他、Apacheのポート番号を適宜変更します。デフォルトでは80番が設定されています。

例では、

Listen 8080

に変更しています(80ポートから8080ポートに変更)。

追加が終了したら保存し、ファイルを閉じます。

 

5、Apache を Windows サービスにインストールし開始する

管理者権限でコマンドプロンプトを起動し、以下実行します。

cd C:\Apache24\bin
httpd.exe -k install

Windows のサービス画面を開き、Apache2.4を開始します。

 

ここで、http://localhost:8080/   にアクセスします。It Works と表示されれば Apacheの設定は成功です。

 

6、Web ゲートウェイ管理画面で各種設定

http://localhost:8080/iristest/csp/bin/Systems/Module.cxw にアクセスします(Webゲートウェイ管理画面のURL)。

Web ゲートウェイから InterSystems 製品に接続するために設定している「サーバ接続」情報と InterSystems 製品にアクセスするための「アプリケーション用パス」を設定します。

 

サーバ接続:LOCALの編集

 

(1) Server Access をクリック

(2) LOCALを選択し、Edit Server にチェックが付いていることを確認し、Submit ボタンをクリック

(3) 接続情報を確認し、適宜変更します。

 InterSystems 製品の「IP Address or DNS Name」「Superserver TCP Port」が正しく設定されているか確認します。

 Connection Security の項目を確認します。InterSystems 製品インストール時の初期セキュリティを「最小」とした場合は未設定のままとします。

 「通常(Normal)」または「ロックダウン(LockedDown)」を選択した場合は、インストール時に指定した CSPSystem ユーザのユーザ名とパスワードを入力します。

 画面下に「Save Configuration」ボタンがあるので、忘れずにクリックしてください。

(4) 接続テストを行います(図例はこの文章の下にあります)。

 Test Server Connectionをクリックし、Server Name で LOCAL を選択した状態で「Connect」ボタンをクリックします。エラーが出る場合は(3)の接続情報を再度ご確認ください。

アプリケーションアクセスの設定

続いて、インスタンス名と同じ文字列を使用したアプリケーションアクセス(パス)を作成します。

 

(1) Application Access をクリック

(2) 画面下の「Add Application」ボタンをクリック

(3) Application Path に /インスタンス名 を指定(インスタンス名は小文字で指定)。Server 0 に LOCAL を設定し、「Save Configutaion」ボタンをクリックして設定を保存します。

 例では、/iristest をパスに指定しています。

ここまでの設定で、管理ポータルが開きます。

http://localhost:8080/iristest/csp/sys/UtilHome.csp
 

Discussão (0)1
Entre ou crie uma conta para continuar
Artigo
· Jul. 14 3min de leitura

Hosting a Flask REST API on InterSystems IRIS using WSGI

For my intern project, I am building a Flask REST API backend. My goal is to host it on InterSystems IRIS using the WSGI interface. This is a relatively new approach and is currently only being used in a handful of projects such as AskMe. To help others get started, I decided to write this article to simplify the process.

 

Creating a Basic Flask App

First, let’s create a minimal Flask application. Here is the code:

from flask import Flask
from flask_cors import CORS

app = Flask(__name__)
CORS(app)

@app.route('/test')
def test():
    return "Test"
if __name__ == "__main__":
    app.run()

This simple app runs a Flask server with one API endpoint at /test that returns the text “Test.”

 

Let's analyze our code line by line:

from flask import Flask
from flask_cors import CORS
  • We are using Flask as our web framework to build the REST API, so we import Flask .
  • CORS (Cross-Origin Resource Sharing) is imported via flask_cors to allow requests from different domains (important for frontend apps hosted elsewhere to access your API without security errors).
app = Flask(__name__)
CORS(app)
  • We create an instance of the Flask application named app.
  • We then wrap this app with CORS middleware, enabling cross-origin requests by default. Without this, browsers might block API calls from other domains.
@app.route('/test')
def test():
    return "Test"
  • Here we define a route /test using the @app.route decorator. This binds the URL /test to the Python function test().
  • When a user sends an HTTP GET request to /test, Flask will invoke the test() function, which simply returns the string "Test". This serves as a simple API endpoint for testing connectivity.
if __name__ == "__main__":
    app.run()
  • This block checks if the script is being run directly (not imported as a module).
  • If so, it starts Flask’s built-in development server locally on your machine.
  • Note: When deploying on InterSystems IRIS using WSGI, this section is ignored because IRIS manages the server.

 

Configuring the Web App on IRIS

Once your Flask app is ready, the next step is to host it on IRIS by configuring a Web Application with the WSGI option.

  1. Open the IRIS Management Portal for your instance.
  2. Go to System > Security Management > Web Applications or search Web Applications.
  3. Click the Create New Web Application button.
  4. Fill out the form as follows:
    • Name: Give your web app a path, for example: /csp/user/api.
    • Description: Add a brief description like My Flask API backend.
    • Enabled: Make sure this checkbox is checked.
  5. Scroll down and check the WSGI (Experimental) option to enable running Python WSGI apps.
  6. Then fill in the WSGI details:
    • Application Name: main (This corresponds to the WSGI callable you want IRIS to use.)
    • Callable Name: app (This matches the Flask application variable name in your code.)
    • WSGI App Directory: Enter the full file path to your main.py file where the Flask app is defined. For example: /path/to/main.py.
    • Debug: Unchecked
  7. Click Save.

 

Here’s what this configuration looks like in the portal:

   

 

 

Testing Your API

After saving, your Flask API should now be available at:

https://base.<your-domain>.com/csp/user/api/test or more generally, https://base.<your-domain>.com/<path>/test

 

Open this URL in your browser or test it using Postman or curl. You should see the response:

'Test'

 

What’s Next?

This setup lets you run a Flask REST API hosted directly on IRIS using the WSGI integration. From here, you can expand your API with more endpoints and connect to IRIS data sources to build powerful applications.

Put in the comments what you plan on building with Flask 
😜

Discussão (0)1
Entre ou crie uma conta para continuar