Roots Discourse

Deploy-hooks. How to run command on server

sage9

#1

I’ve installed acf-field-openstreetmaps plugin with Composer:

This plugin needs to run npm install && gulp inside its root directory, so, I’m trying to add this task to deploy-hooks;

- name: Compile assets of ACF Open Street Maps plugin
  command: npm install && gulp
  args:
    chdir: "{{ project.local_path }}/web/app/mu-plugins/acf-field-openstreetmap"

It returns an error:

No such file or directory: '/home/musicasusual/web/app/mu-
plugins/acf-field-openstreetmap'

The acf-field-openstreetmap directoy is in the server inside mu-plugins (checked). So, which is the right way to run the npm install && gulp command from plugin directory on server side?

Thank you!

EDIT: tried too with {{ deploy_helper.current_path }}


#2

Which hook are you using?

You likely need to use deploy_helper.new_release_path. current_path probably isn’t set at that point yet.


#3

It looks like you’d want to use a production version of that plugin and not the development one (that requires building) to deploy it. You could use their ZIP file from GitHub with Composer.


#4

@swalkinshaw deploy_helper.new_release_path works fine in a build-after hook, after Install Composer dependencies. Thank you for the answer!

@benword definitely, installing zip version solve the plugin installation. I was thinking that zip file was an abandoned zip because it lacks of gulpfile inside, but it is just the dist version :sweat_smile: Thank you for point me in the right direction.