Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Next »

How to configure Serf with plugin CloudUpload to send files from a Dynaform to an external filesystem, in this case, an MS Sharepoint site.

Files

INSTALLATION RECAP:

Cloud Storage Integration to Sharepoint:

1 Register PM for oauth2
• Visit the unlinked oauth2 screen and register (url/oauth2/applications)

  • Create New Application → Any website → no need for Description or Callback → Register Application


• Get Client ID / Client Secret

2. Deploy and configure serf in host machine
• Download xx/colosa/serf from Bitbucket
• Create .env from .env.example

• Copy cloudupload plugin into storage/plugins/processmaker

• run composer install on /serf
• run php artisan key:generate
• Edit .env with MySQL credentials to blank Db
• Edit .env with redis url and any credentials
• Edit .env by adding these variables with ProcessMaker credentials:

PROCESSMAKER_HOST=https://url/to/processmaker
PROCESSMAKER_WORKSPACE=workspace_name
PROCESSMAKER_CLIENT_ID=XXX (as obtained in step 1)
PROCESSMAKER_CLIENT_SECRET=YYY( as obtained in step 1)
PROCESSMAKER_USERNAME=username
PROCESSMAKER_PASSWORD=password


• composer update on /serf
• Edit config/filesystems.php, add clouduploads-sharepoint entry as per below
'clouduploads-sharepoint' => [
 'driver' => 'sharepoint',
 'url' => 'https://pmaker.sharepoint.com/sites/ImmochanSite',
 'host' => 'https://pmaker.sharepoint.com',
 'username' => 'processmaker@pmaker.onmicrosoft.com',
 'password' => 'processmaker'
]

composer update on serf dir (as sudo)
• install supervisor sudo pip install supervisor
• edit /etc/supervisord.conf with program as below:

[program:immochan-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /home/ec2-user/apps/serf/artisan queue:work  --tries=3
autostart=true
autorestart=true
;user=forge
numprocs=1
redirect_stderr=true
stdout_logfile=/home/ec2-user/apps/serf/storage/logs/immochan-worker.log

• run supervisord from terminal.• To ensure supervisor keeps the process running at all times, create a cron job entry to force restart the job every 30 minutes, or as needed. Edit /etc/crontab adding */30 * * * * username /usr/local/bin/supervisorcrtl restart all. Mind the actual username and bin path.

3 Install serf helper plugin in PM
• Copy plugin folder to workflow/engine/plugins
• either setenv REDIS_HOST or edit asynchelper.php directly on line 44, to redis server URL
• no password in AWS elasticache case, but must be in same security group
• mv asynchelper.php up to plugins folder
• another sudo composer update (should create vendor dir, or mkdir maually)
• In PM -> Admin -> Plugins -> Plugin Manager, find and Enable

4 In-Process use
• Upload using Multiple File Uploader control in Form
~make sure worker is running with Supervisor or call manually with php artisan queue:work on serf dir~ replaced with supervisord, see above
• After dynaform, call in trigger as follows:

\asyncHelperPlugin::dispatch("\ProcessMaker\Serf\Plugins\CloudUpload\Jobs\UploadToSharepoint",[
 'app_doc_uid' => @@mFilePhoto[0]['appDocUid'],
 'version' => @@mFilePhoto[0]['version'],
 'destination_path' => '/UploadedFiles/' . @@sharepoint_path_photo,
 'app_uid' => @@APPLICATION,
 'variable' => 'strSharepointURLPhoto',
 'route' => false,
]);

• Mind the mFile var name.
• The manual path is /list/filename.ext
'variable' is a @@ string that will hold URL path to file in SP




  • No labels