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

From Wiki
 
(3 intermediate revisions by the same user not shown)
Line 146: Line 146:


4) Configurando o módulo de upload:
4) Configurando o módulo de upload:
<nowiki>
<Location /ihs/activities>
IBMUploadHandler On
SetHandler ibm_upload_handler
IBMUploadBaseStore "/opt/IBM/Connections/data/activities/content"
IBMUploadMethods POST,PUT
IBMUploadURLPrefix /ihs
</Location>
</nowiki>


  <nowiki>
  <nowiki>
Line 161: Line 151:
IBMUploadHandler On     
IBMUploadHandler On     
SetHandler ibm_upload_handler     
SetHandler ibm_upload_handler     
IBMUploadBaseStore "/opt/IBM/Connections/data/files/upload/files"     
IBMUploadBaseStore "/opt/IBM/</nowiki>'''SharedArea'''<nowiki>/files/upload/files"     
IBMUploadMethods POST,PUT
IBMUploadMethods POST,PUT
IBMUploadURLPrefix /ihs
IBMUploadURLPrefix /ihs
Line 250: Line 240:
IBMUploadHandler On
IBMUploadHandler On
SetHandler ibm_upload_handler
SetHandler ibm_upload_handler
IBMUploadBaseStore "/opt/IBM/Connections/data/activities/content"
IBMUploadBaseStore "/opt/IBM/</nowiki>'''SharedArea'''<nowiki>/activities/content"
IBMUploadMethods POST,PUT
IBMUploadMethods POST,PUT
IBMUploadURLPrefix /ihs
IBMUploadURLPrefix /ihs
Line 287: Line 277:
  <max-concurrent-downloads>10</max-concurrent-downloads>  
  <max-concurrent-downloads>10</max-concurrent-downloads>  
  </objectStore>
  </objectStore>
Salve e feche o arquivo


Salve e feche o arquivo
Salve e feche o arquivo

Latest revision as of 12:33, 25 January 2019

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  <USUARIO>@<IP_SERVIDOR_IHS>/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

Configurado para a aplicação Files

Altere no httpd.conf

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

<IfModule mod_rewrite.c>    
RewriteEngine On    

# Uncomment to create log messages.    
# RewriteLog logs/rewrite.log    
# 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]

</IfModule>
 

4) Configurando o módulo de upload:

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

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:

<upload>  
<modIBMUpload enabled="true"/> 
</upload>

Adicione a propriedade maximumSizeInKb property em simpleUploadAPI

<api>   
<simpleUploadAPI maximumSizeInKb="512000">
</simpleUploadAPI> 
</api>

Salve e feche o arquivo

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

Configurado para a aplicação Activities

Altere no httpd.conf

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

<IfModule mod_rewrite.c>
RewriteEngine On
#RewriteLog logs/rewrite.log
#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]
</IfModule>
 

4) Configurando o módulo de upload:

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

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:

<store default="true" class="com.ibm.openactivities.objectstore.filesystem.ContentStore">
<id>filestore</id>            
<property name="use.historic">false</property>
<property name="fileUploadPluginEnabled">true</property>            
<property name="root.directory">${ACTIVITIES_CONTENT_DIR}</property>
</store>

Adicione a propriedade formFileUploadSizeLimit:

<objectStore>  
...  
<sizeLimits>            
<limit mimeFilenameRegex=".*">2147483648</limit>        
</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