Roots Discourse

Best Practice: Adding Gravity Forms (and other plugins)

I ended up using this installer instead: https://github.com/junaidbhura/composer-wp-pro-plugins
which also supports installing Gravity Forms Add-ons!

https://packagist.org/packages/gotoandplay/gravityforms-composer-installer

1 Like

Folks, I’ve been experimenting with satispress https://github.com/cedaro/satispress
It turns an ordinary WordPress installation into a composer repository specifically for plugins and themes.
Nicely protected so you need an auth.json file for credentials. But is working great for me.
I manage my satispress installation in wpmanage as an ordinary WordPress site. So I use that to update almost 50 premium plugins and themes used in various projects.
It does mean using a site license for many of them so they’ll update, but if you don’t need the license for actually running the plugin in a project (or you have multi site licenses), then that’s fine.
Recommended.

3 Likes

This looks really useful, thanks…

@mikelittle I’m looking at setting this up right now. So it seems like for this to work the plugins have to be updated via the WordPress plugin update process? How are you handling authentication for things like CI/CD?

Yes. You can use whatever normal means to update the plugins. I happen to use ManageWP to remotely update a ton of sites I host. So the Satispress site is just part of the routine. But I am really considering just running a shell script to just update them every few hours.

Then the projects that use the commercial plugins can pull them in as and when I update them via composer update

As for authentication, I have set up a different account on the SatisPress site for each project. Then for each account I have generated different API keys (e.g. one for production, one for my local development, one for a remote designer, etc) Those credentials go into auth.json in each checked out copy of the project. The auth.json is git-ignored so the credentials don’t go in the repo. You can also add authentication to you CI/CD stack too. I’m not currently using this on any project with CI/CD set up.
Splitting the auth this way means I can for example revoke the api key from the remote designer when she stops working on the project.

Hope that helps.

Stay safe and healthy

Mike

This is still the best GF installation method for me, but an error has occurred on multiple websites lately, something like:
gf is not a recognised command

I solved this by using the deploy_finalize_after hooks instead, e.g.:

deploy_finalize_after:
  - "{{ playbook_dir }}/roles/deploy/hooks/finalize-after.yml"
  - "{{ playbook_dir }}/deploy-hooks/sites/{{ site }}-finalize-after.yml"

Create the file deploy-hooks/sites/mysite.com-finalize-after.yml and add the same hooks provided by runofthemill

This method works great!
I was just wondering how you guys handle the installations in your development environment, since you don’t have any deployments there?

I ended up adding the install commands in a vagrant trigger:

# Installing Gravity Forms plugin & Add-Ons
config.trigger.after [:up] do |trigger|
  trigger.info = "Installing Gravity Forms plugin & Add-Ons"
  trigger.run = {inline: "bash -c '
    wp @development plugin install gravityformscli --activate &&
    wp @development gf install --activate &&
    wp @development gf tool verify-checksums &&
    wp @development gf install gravityformsuserregistration --activate &&
    wp @development gf install gravityformsmailchimp --activate
  '"}
end

but that gives me errors when the plugins are already installed:

==> default: Running trigger...
==> default: Installing Gravity Forms plugin & Add-Ons
    default: Running local: Inline script
    default: bash -c '
    default:         wp @development plugin install gravityformscli --activate &&
    default:         wp @development gf install --activate &&
    default:         wp @development gf tool verify-checksums &&
    default:         wp @development gf install gravityformsuserregistration --activate &&
    default:         wp @development gf install gravityformsmailchimp --activate
    default:       '
    default: Warning: gravityformscli: Plugin already installed.
    default: 
    default: Activating 'gravityformscli'...
    default: 
    default: Success: Plugin already installed.
    default: 
    default: Warning: Plugin 'gravityformscli' is already active.
    default: 
    default: Installatiepakket downloaden van https://s3.amazonaws.com/gravityforms/releases/gravityforms_2.4.19.3.zip?AWSAccessKeyId=AKIAJC3LQNDWHBOFBQIA&Expires=1596301886&Signature=X9qH4erOHEIuAngakYpASfOda74%3D&key=ae24fe0d6c52a4bd144afdd0282db3c4...
    default: 
    default: Uitpakken van pakket...
    default: 
    default: De plugin installeren...
    default: 
    default: Warning: Doelmap bestaat al. "/srv/www/mydomain.com/current/web/app/plugins/gravityforms/"
    default: 
    default: Plugin-installatie mislukt.
    default: 
    default: Warning: The 'https://s3.amazonaws.com/gravityforms/releases/gravityforms_2.4.19.3.zip?AWSAccessKeyId=AKIAJC3LQNDWHBOFBQIA&Expires=1596301886&Signature=X9qH4erOHEIuAngakYpASfOda74%3D&key=ae24fe0d6c52a4bd144afdd0282db3c4' plugin could not be found.
    default: 
    default: Error: No plugins installed.
    default: 
==> default: Trigger run failed
==> default: A script exited with an unacceptable exit code 1.
A script exited with an unacceptable exit code 1.
1 Like