Tuesday, August 21, 2018

Installing Salesforce Workbench locally on OS X

I just love Workbench, even though officially it's in foster care by Salesforce at best.  The Swiss army knife-like tool is light, intuitive, and packed with a lot of features.  You can use it online, but for security/compliance or other reasons, you may wish to use it on premise.  If there isn't a computer/VM somewhere you can easily install it on, running it from your laptop is not a bad choice either.  On a Windows computer, that usually involves installing an easy AMP stack like xampp, and that's that (IIS + PHP is fine too if you like).  With OS X already bundled with Apache and PHP, there's no need for software install there, but some config is still needed, esp to get the HTTPS part right for Workbench.  So here's my step-by-step guide for the whole setup.  Most of the steps are done in Terminal, so all the italics are commands to run.

Enabling Apache

sudo su -
apachectl start 

Enabling PHP and SSL

PHP and SSL are needed to run a proper Workbench.  You'll need to edit Apache config file to enable the pieces needed by them.  I'm using nano here for editing but certainly feel free to use your beloved emacs or vi.

First back up the existing config file
cd /ect/apache2/
cp httpd.conf httpd.conf.backup 

Next edit the config file.
nano httpd.confUncomment the following lines for PHP and SSL
LoadModule php7_module libexec/apache2/libphp7.so
LoadModule socache_shmcb_module libexec/apache2/mod_socache_shmcb.so
LoadModule ssl_module libexec/apache2/mod_ssl.so

Include /private/etc/apache2/extra/httpd-ssl.conf

Save the config file and test it by running
apachectl configtest

Restart Apache
apachectl restart

You can test PHP by adding a really simple PHP page to the DocumentRoot (default is /Library/WebServer/Documents)

echo ' /Library/WebServer/Documents/phpinfo.php
Verify PHP by accessing http://localhost/phpinfo.php

Installing Workbench 

It can be copied to local hard drive by git.
git clone https://github.com/forceworkbench/forceworkbench
Then copy the folder workbench to Apache's DocumentRoot (default is /Library/WebServer/Documents)

Creating Self-Signed Certificate and Enable SSL with Apache

To use SSL with Workbench Apache will need a certificate configured and some configuration changes.  Here's a good guide that I don't need to retype here.   😀

Trusting the Cert

Setting up a Proper Server Name with TLS

 

References:

https://jason.pureconcepts.net/2016/09/install-apache-php-mysql-mac-os-x-sierra/

https://gist.github.com/jed/6147872

https://gist.github.com/nrollr/4daba07c67adcb30693e 

No comments:

Post a Comment