Connections: Configurando uploads de arquivos por meio do IBM HTTP Server

Vamos configurar o uploads de arquivos por meio do IBM HTTP Server pelos seguintes motivos:


 * Tuning necessário para subir arquivos maiores que 500 MB.
 * O WebSphere Application Server possui um thread-pools limitado que é ajustado para transações de curta duração, o que não é o caso do upload de arquivos grandes.

Um módulo instalado no IBM HTTP Server, intercepta os requests e armazena diretamente na SharedArea.

=Importante=


 * The upload module can be used only when WebSphere Application Server is not run as user root. Otherwise, file permissions prevent the application server and the IBM HTTP
 * Server from exchanging files. For security reasons, do not run the application server as root, but if that is not an option, then large files still can be uploaded. If
 * WebSphere Application Server is run as root, consider making the following change to the maximumSizeInKb property for the simpleUploadAPI file.

=Pré-requisito=


 * A SharedArea deve estar montada no servidor IBM HTTP Server

=Procedimento=

Configurando os HTTP Servers
1) No servidor em que o IBM Connections está instalado, copie o arquivo

scp /opt/IBM/Connections/ihs/mod_ibm_upload/ihs.linux.x86_64/mod_ibm_upload.so @/opt/IBM/HTTPServer/modules/.

2) Edite o arquivo /opt/IBM/HTTPServer/conf/httpd.conf no servidores IHS e adicione as linhas:

LoadModule rewrite_module modules/mod_rewrite.so LoadModule ibm_upload_module modules/mod_ibm_upload.so

Altere no httpd.conf
3) Adicione as linhas no virtual hosts para o Files.

   RewriteEngine On


 * 1) Uncomment to create log messages.
 * 2) RewriteLog logs/rewrite.log
 * 3) RewriteLogLevel 9

RewriteCond %{ENV:ENV-SKIP-IBM-UPLOAD-HANDLER} !=true [NC] RewriteCond %{HTTP:X-IBM-UPLOAD-METHOD} phases [NC] RewriteCond %{HTTP:X-IBM-UPLOAD-TOKEN} [0-9a-zA-Z-] [NC] RewriteCond %{REQUEST_METHOD} !=GET [NC] RewriteCond %{REQUEST_METHOD} !=OPTION [NC] RewriteCond %{REQUEST_METHOD} !=HEAD [NC] RewriteCond %{REQUEST_METHOD} !=DELETE [NC] RewriteRule ^/files/(basic|form|oauth)/api/myfilesync/feed(\?[^/]*)? /ihs/files/$1/api/myfilesync/feed$2 [PT,L]

RewriteCond %{ENV:ENV-SKIP-IBM-UPLOAD-HANDLER} !=true [NC] RewriteCond %{HTTP:X-IBM-UPLOAD-METHOD} phases [NC] RewriteCond %{HTTP:X-IBM-UPLOAD-TOKEN} [0-9a-zA-Z-] [NC] RewriteCond %{REQUEST_METHOD} !=GET [NC] RewriteCond %{REQUEST_METHOD} !=OPTION [NC] RewriteCond %{REQUEST_METHOD} !=HEAD [NC] RewriteCond %{REQUEST_METHOD} !=DELETE [NC] RewriteRule ^/files/(basic|form|oauth)/api/userlibrary/([^/]+)/feed(\?[^/]*)? /ihs/files/$1/api/userlibrary/$2/feed$3 [PT,L]

RewriteCond %{ENV:ENV-SKIP-IBM-UPLOAD-HANDLER} !=true [NC] RewriteCond %{HTTP:X-IBM-UPLOAD-METHOD} phases [NC] RewriteCond %{HTTP:X-IBM-UPLOAD-TOKEN} [0-9a-zA-Z-] [NC] RewriteCond %{REQUEST_METHOD} !=GET [NC] RewriteCond %{REQUEST_METHOD} !=OPTION [NC] RewriteCond %{REQUEST_METHOD} !=HEAD [NC] RewriteCond %{REQUEST_METHOD} !=DELETE [NC] RewriteRule ^/files/(basic|form|oauth)/api/communitylibrary/([^/]+)/feed(\?[^/]*)? /ihs/files/$1/api/communitylibrary/$2/feed$3 [PT,L]

RewriteCond %{ENV:ENV-SKIP-IBM-UPLOAD-HANDLER} !=true [NC] RewriteCond %{HTTP:X-IBM-UPLOAD-METHOD} phases [NC] RewriteCond %{HTTP:X-IBM-UPLOAD-TOKEN} [0-9a-zA-Z-] [NC] RewriteCond %{REQUEST_METHOD} !=GET [NC] RewriteCond %{REQUEST_METHOD} !=OPTION [NC] RewriteCond %{REQUEST_METHOD} !=HEAD [NC] RewriteCond %{REQUEST_METHOD} !=DELETE [NC] RewriteRule ^/files/(basic|form|oauth)/api/myfilesync/document/([^/]+)/entry(\?[^/]*)? /ihs/files/$1/api/myfilesync/document/$2/entry$3 [PT,L]

RewriteCond %{ENV:ENV-SKIP-IBM-UPLOAD-HANDLER} !=true [NC] RewriteCond %{HTTP:X-IBM-UPLOAD-METHOD} ^phases$ [NC] RewriteCond %{HTTP:X-IBM-UPLOAD-TOKEN} ^[0-9a-zA-Z-]+$ [NC] RewriteCond %{REQUEST_METHOD} !=GET [NC] RewriteCond %{REQUEST_METHOD} !=OPTION [NC] RewriteCond %{REQUEST_METHOD} !=HEAD [NC] RewriteCond %{REQUEST_METHOD} !=DELETE [NC] RewriteRule ^/files/(basic|form|oauth)/api/library/([^/]+)/document/([^/]+)/entry(\?[^/]*)? /ihs/files/$1/api/library/$2/document/$3/entry$4 [PT,L]

RewriteCond %{ENV:ENV-SKIP-IBM-UPLOAD-HANDLER} !=true [NC] RewriteCond %{HTTP:X-IBM-UPLOAD-METHOD} phases [NC] RewriteCond %{HTTP:X-IBM-UPLOAD-TOKEN} [0-9a-zA-Z-] [NC] RewriteCond %{REQUEST_METHOD} !=GET [NC] RewriteCond %{REQUEST_METHOD} !=OPTION [NC] RewriteCond %{REQUEST_METHOD} !=HEAD [NC] RewriteCond %{REQUEST_METHOD} !=DELETE [NC] RewriteRule ^/files/(basic|form|oauth)/api/userlibrary/([^/]+)/document/([^/]+)/entry(\?[^/]*)? /ihs/files/$1/api/userlibrary/$2/document/$3/entry$4 [PT,L]

RewriteCond %{ENV:ENV-SKIP-IBM-UPLOAD-HANDLER} !=true [NC] RewriteCond %{HTTP:X-IBM-UPLOAD-METHOD} phases [NC] RewriteCond %{HTTP:X-IBM-UPLOAD-TOKEN} [0-9a-zA-Z-] [NC] RewriteCond %{REQUEST_METHOD} !=GET [NC] RewriteCond %{REQUEST_METHOD} !=OPTION [NC] RewriteCond %{REQUEST_METHOD} !=HEAD [NC] RewriteCond %{REQUEST_METHOD} !=DELETE [NC] RewriteRule ^/files/(basic|form|oauth)/api/myuserlibrary/document/([^/]+)/entry(\?[^/]*)? /ihs/files/$1/api/myuserlibrary/document/$2/entry$3 [PT,L]

RewriteCond %{ENV:ENV-SKIP-IBM-UPLOAD-HANDLER} !=true [NC] RewriteCond %{HTTP:X-IBM-UPLOAD-METHOD} phases [NC] RewriteCond %{HTTP:X-IBM-UPLOAD-TOKEN} [0-9a-zA-Z-] [NC] RewriteCond %{REQUEST_METHOD} !=GET [NC] RewriteCond %{REQUEST_METHOD} !=OPTION [NC] RewriteCond %{REQUEST_METHOD} !=HEAD [NC] RewriteCond %{REQUEST_METHOD} !=DELETE [NC] RewriteRule ^/files/(basic|form|oauth)/api/myuserlibrary/feed(\?[^/]*)? /ihs/files/$1/api/myuserlibrary/feed$2 [PT,L]

RewriteCond %{ENV:ENV-SKIP-IBM-UPLOAD-HANDLER} !=true [NC] RewriteCond %{HTTP:X-IBM-UPLOAD-METHOD} phases [NC] RewriteCond %{HTTP:X-IBM-UPLOAD-TOKEN} [0-9a-zA-Z-] [NC] RewriteCond %{REQUEST_METHOD} !=GET [NC] RewriteCond %{REQUEST_METHOD} !=OPTION [NC] RewriteCond %{REQUEST_METHOD} !=HEAD [NC] RewriteCond %{REQUEST_METHOD} !=DELETE [NC] RewriteRule ^/files/(basic|form|oauth)/api/communitylibrary/([^/]+)/document/([^/]+)/entry(\?[^/]*)? /ihs/files/$1/api/communitylibrary/$2/document/$3/entry$4 [PT,L]

RewriteCond %{ENV:ENV-SKIP-IBM-UPLOAD-HANDLER} !=true [NC] RewriteCond %{HTTP:X-IBM-UPLOAD-METHOD} phases [NC] RewriteCond %{HTTP:X-IBM-UPLOAD-TOKEN} [0-9a-zA-Z-] [NC] RewriteCond %{REQUEST_METHOD} !=GET [NC] RewriteCond %{REQUEST_METHOD} !=OPTION [NC] RewriteCond %{REQUEST_METHOD} !=HEAD [NC] RewriteCond %{REQUEST_METHOD} !=DELETE [NC] RewriteRule ^/files/(basic|form|oauth)/api/library/([^/]+)/feed(\?[^/]*)? /ihs/files/$1/api/library/$2/feed$3 [PT,L]

RewriteCond %{ENV:ENV-SKIP-IBM-UPLOAD-HANDLER} !=true [NC] RewriteCond %{HTTP:X-IBM-UPLOAD-METHOD} phases [NC] RewriteCond %{HTTP:X-IBM-UPLOAD-TOKEN} [0-9a-zA-Z-] [NC] RewriteCond %{REQUEST_METHOD} !=GET [NC] RewriteCond %{REQUEST_METHOD} !=OPTION [NC] RewriteCond %{REQUEST_METHOD} !=HEAD [NC] RewriteCond %{REQUEST_METHOD} !=DELETE [NC] RewriteRule ^/files/(basic|form|oauth)/api/document/([^/]+)/entry(\?[^/]*)? /ihs/files/$1/api/document/$2/entry$3 [PT,L]



4) Configurando o módulo de upload:

 IBMUploadHandler On   SetHandler ibm_upload_handler IBMUploadBaseStore "/opt/IBM/ SharedArea /files/upload/files" IBMUploadMethods POST,PUT IBMUploadURLPrefix /ihs 

Configurando os WAS Servers
1) Edite o arquivo files-config.xml

cd /opt/IBM/WebSphere/AppServer/profiles/Dmgr01/config/cells/ConnectionsCell/LotusConnections-config cp files-config.xml files-config.xml_backupYYYYMMDD vim files-config.xml

Habilite o modIBMUpload:



Adicione a propriedade maximumSizeInKb property em simpleUploadAPI

 

Salve e feche o arquivo

Restart o HTTP server, a aplicação Activities e Files.

Altere no httpd.conf
3) Adicione as linhas no virtual hosts para o Activities.

 RewriteEngine On
 * 1) RewriteLog logs/rewrite.log
 * 2) RewriteLogLevel 9

RewriteCond %{ENV:ENV-SKIP-IBM-UPLOAD-HANDLER} !=true [NC] RewriteCond %{HTTP:X-IBM-UPLOAD-METHOD} phases [NC] RewriteCond %{HTTP:X-IBM-UPLOAD-TOKEN} [0-9a-zA-Z-] [NC] RewriteCond %{REQUEST_METHOD} !=GET [NC] RewriteCond %{REQUEST_METHOD} !=OPTION [NC] RewriteCond %{REQUEST_METHOD} !=HEAD [NC] RewriteCond %{REQUEST_METHOD} !=DELETE [NC] RewriteRule ^/activities/service/atom2/activitynode$ /ihs/activities/service/atom2/activitynode[PT,L]

RewriteCond %{ENV:ENV-SKIP-IBM-UPLOAD-HANDLER} !=true [NC] RewriteCond %{HTTP:X-IBM-UPLOAD-METHOD} phases [NC] RewriteCond %{HTTP:X-IBM-UPLOAD-TOKEN} [0-9a-zA-Z-] [NC] RewriteCond %{REQUEST_METHOD} !=GET [NC] RewriteCond %{REQUEST_METHOD} !=OPTION [NC] RewriteCond %{REQUEST_METHOD} !=HEAD [NC] RewriteCond %{REQUEST_METHOD} !=DELETE [NC] RewriteRule ^/activities/service/atom2/activity$ /ihs/activities/service/atom2/activity [PT,L]

RewriteCond %{ENV:ENV-SKIP-IBM-UPLOAD-HANDLER} !=true [NC] RewriteCond %{HTTP:X-IBM-UPLOAD-METHOD} phases [NC] RewriteCond %{HTTP:X-IBM-UPLOAD-TOKEN} [0-9a-zA-Z-] [NC] RewriteCond %{REQUEST_METHOD} !=GET [NC] RewriteCond %{REQUEST_METHOD} !=OPTION [NC] RewriteCond %{REQUEST_METHOD} !=HEAD [NC] RewriteCond %{REQUEST_METHOD} !=DELETE [NC] RewriteRule ^/activities/service/atom2/forms/activitynode$ /ihs/activities/service/atom2/forms/activitynode [PT,L]

RewriteCond %{ENV:ENV-SKIP-IBM-UPLOAD-HANDLER} !=true [NC] RewriteCond %{HTTP:X-IBM-UPLOAD-METHOD} phases [NC] RewriteCond %{HTTP:X-IBM-UPLOAD-TOKEN} [0-9a-zA-Z-] [NC] RewriteCond %{REQUEST_METHOD} !=GET [NC] RewriteCond %{REQUEST_METHOD} !=OPTION [NC] RewriteCond %{REQUEST_METHOD} !=HEAD [NC] RewriteCond %{REQUEST_METHOD} !=DELETE [NC] RewriteRule ^/activities/service/atom2/forms/activity$ /ihs/activities/service/atom2/forms/activity [PT,L] 

4) Configurando o módulo de upload:

 IBMUploadHandler On SetHandler ibm_upload_handler IBMUploadBaseStore "/opt/IBM/ SharedArea /activities/content" IBMUploadMethods POST,PUT IBMUploadURLPrefix /ihs 

Configurando os WAS Servers
Acesse o DMGR via terminal Linux

1) Edite o arquivo oa-config.xml

cd /opt/IBM/WebSphere/AppServer/profiles/Dmgr01/config/cells/ConnectionsCell/LotusConnections-config cp oa-config.xml oa-config.xml_backupYYYYMMDD vim oa-config.xml

Adicione fileUploadPluginEnabled:

 filestore <property name="use.historic">false <property name="fileUploadPluginEnabled">true <property name="root.directory">${ACTIVITIES_CONTENT_DIR}

Adicione a propriedade formFileUploadSizeLimit:

<objectStore> ...  <sizeLimits> <limit mimeFilenameRegex=".*">2147483648 </sizeLimits> <formFileUploadSizeLimit>31457280</formFileUploadSizeLimit> <max-concurrent-downloads>10</max-concurrent-downloads> </objectStore>

Salve e feche o arquivo

Restart o HTTP server, a aplicação Activities.

= Ver também =


 * IBM Connections:Reorg Connections Databases


 * Mais Artigos sobre IBM Connections