ACF installer setup


#1

Hello,

Thank you for taking the time to read this. I’m trying to install ACF pro and have followed the following directions:

In otherwords,

1.I added my ACF key to the vault files.

  1. Added the package to the composer.json file and required it.
    “repositories”: [
    {
    “type”: “composer”,
    “url”: “https://wpackagist.org
    },
    {
    “type”: “package”,
    “package”: {
    “name”: “advanced-custom-fields/advanced-custom-fields-pro”,
    “version”: “5.6.4”,
    “type”: “wordpress-plugin”,
    “dist”: {
    “type”: “zip”,
    “url”: “https://connect.advancedcustomfields.com/index.php?p=pro&a=download
    },
    “require”: {
    “philippbaschke/acf-pro-installer”: “^1.0”,
    “composer/installers”: “^1.0”
    }
    }
    }
    ],
    “require”: {
    “php”: “>=5.6”,
    “composer/installers”: “^1.4”,
    “vlucas/phpdotenv”: “^2.0.1”,
    “johnpbloch/wordpress”: “4.9.5”,
    “oscarotero/env”: “^1.1.0”,
    “roots/wp-password-bcrypt”: “1.0.0”,
    “advanced-custom-fields/advanced-custom-fields-pro”: “*”
    },

  2. I then run composer update in site folder, yarn build:production

(from trellis)
vagrante reload --provision,
ansible-playbook server.yml -e env=production,
$ ./bin/deploy.sh production mysite

When I root ssh into my server environment, it is not in my plugins folder. Any thoughts?


#2

Does it work on the local development server (i.e. Vagrant)?

Also, did you push your changes to the remote repo before deploying?


#3

Thanks for your reply.

It does work locally. Does trellis pull from the repo? I’m not sure if I push
and should I push before or after yarn build:production?


#4

Yes it does. And since you’re using Sage, I presume you are using the build-before hook to build Sage’s assets:

This builds the theme assets on your host machine and then syncs them with the remote server.

Sage ignores dist by default so running the production build script manually wouldn’t be necessary. The build-before hook mentioned above is the out-of-the-box way of getting your production assets to the remote server.


#5

Thanks again.

I’ve uncommented out the details but I’m not sure how to actually use the hook.


#6

Trellis loads the hook by default. So uncommenting out the line was all you had to do.

Read more about Trellis’ hooks:


#7

Hey,

Thanks so much for your help.

My production dashboard plugin said:

The plugin advanced-custom-fields/acf.php has been deactivated due to an error: Plugin file does not exist.

When I ssh into my environment, the file exists in vendor/advanced-custom-fields/acf.php.

This is a new warning, so pushing the file up definitely helped. Do you know where the file should be?

Thanks,


#8

Is it not also in /srv/www/example.com/current/app/plugins/ ? What you described makes me suspect composer/installers isn’t working correctly.


#9

I think you are right.

I added the ACF package to the site/composer.json file. Is that the correct composer.json file? is there a way to check the composer/installers?


#10

Nothing is my plugins folder


#11

Can you post your entire composer.json file? Also, if you post it, can you surround it like this:

```json
Contents of your composer.json go here
```

That way it will be properly formatted.


#12
{
  "name": "roots/bedrock",
  "type": "project",
  "license": "MIT",
  "description": "WordPress boilerplate with modern development tools, easier configuration, and an improved folder structure",
  "homepage": "https://roots.io/bedrock/",
  "authors": [
    {
      "name": "Scott Walkinshaw",
      "email": "scott.walkinshaw@gmail.com",
      "homepage": "https://github.com/swalkinshaw"
    },
    {
      "name": "Ben Word",
      "email": "ben@benword.com",
      "homepage": "https://github.com/retlehs"
    }
  ],
  "keywords": [
    "bedrock", "roots", "wordpress", "stack", "composer", "vagrant", "wp"
  ],
  "support": {
    "issues": "https://github.com/roots/bedrock/issues",
    "forum": "https://discourse.roots.io/category/bedrock"
  },
  "config": {
    "preferred-install": "dist"
  },
  "repositories": [
    {
      "type": "composer",
      "url": "https://wpackagist.org"
    },
    {
     "type": "package",
     "package": {
       "name": "advanced-custom-fields/advanced-custom-fields-pro",
       "version": "5.6.4",
       "type": "wordpress-plugin",
       "dist": {
         "type": "zip",
         "url": "https://connect.advancedcustomfields.com/index.php?p=pro&a=download"
       },
       "require": {
         "philippbaschke/acf-pro-installer": "^1.0",
         "composer/installers": "^1.0"
       }
     }
   }
  ],
  "require": {
    "php": ">=5.6",
    "composer/installers": "^1.4",
    "vlucas/phpdotenv": "^2.0.1",
    "johnpbloch/wordpress": "4.9.5",
    "oscarotero/env": "^1.1.0",
    "roots/wp-password-bcrypt": "1.0.0",
    "advanced-custom-fields/advanced-custom-fields-pro": "*"
  },
  "require-dev": {
    "squizlabs/php_codesniffer": "^3.0.2"
  },
  "extra": {
    "installer-paths": {
      "web/app/mu-plugins/{$name}/": ["type:wordpress-muplugin"],
      "web/app/plugins/{$name}/": ["type:wordpress-plugin"],
      "web/app/themes/{$name}/": ["type:wordpress-theme"]
    },
    "wordpress-install-dir": "web/wp"
  },
  "scripts": {
    "post-root-package-install": [
      "php -r \"copy('.env.example', '.env');\""
    ],
    "test": [
      "phpcs"
    ]
  }
}

Thank you, I’m pretty confused here.


#13

Are you on a Mac or a PC? Could you try installing Composer on your machine and running composer update From your site directory? I’m thinking there’s an error somewhere you’re not seeing during the reprovisioning of your dev environment.


#14

Thanks for jumping in. I am on a Mac and I run composer update first, at the beginning of each “launch”.

(from site)
I then run composer update,
yarn build: production

(from trellis)
vagrante reload --provision,
ansible-playbook server.yml -e env=production,
$ ./bin/deploy.sh production mysite.

Is there a place where I could see an error? Do I need to yarn lint or something? I’m at a loss.


#15

I think there’s some basic misunderstanding of the responsibilities for various tasks going on here.

yarn is a build process for Sage. Sage also uses composer for some PHP dependencies, but Sage doesn’t install or manage plugins; that’s Bedrock’s job.

Bedrock uses Composer to manage plugin dependencies for WordPress (which is also manages as a dependency but that’s not important for this conversation).

So running yarn won’t help with a plugin issue.

You also don’t need to reload or reprovision your Trellis machine each time you install a plugin any more than you would need to reboot your web server after installing a plugin in a traditional WordPress environment. You just install it, activate it, and go about your day.

Here’s what I recommend as a troubleshooting process:

  1. Stop your vagrant machine
    (from your trellis directory)
$ vagrant halt
  1. Start your vagrant machine again
    (from your trellis directory)
$ vagrant up
  1. Confirm that your site is reachable at its development URL in a browser.

  2. Update composer dependencies and watch for (and report on) any errors in the output.
    (from your site directory)

$ composer update

#16

Thank you for your help.

Breaking down the responsibilities helps. Anyway, I followed your directions, I was able to create my vagrant local environment but there are no errors.

I vagrant sshed into my system.

In /srv/www/mysite/current/vendor/advanced-custom-fields/advanced-custom-fields-pro:

is

acf.php assets includes lang pro readme.txt

The only plugin in my “plugin” folder is All-In-one migration. Thoughts?


#17

There’s no need to vagrant ssh to your system for any part of plugin management if you have Composer installed locally.

Just change directories to your site directory and type composer update.

Do that and paste the output your get here.


#18

I have one thought, I did receive this error:

The plugin advanced-custom-fields/acf.php has been deactivated due to an error: Plugin file does not exist.

Could the problem be the acf.php file is in the advanced-custom-fields-pro folder and not one step up?


#19

No. Composer will put the plugin into your site/web/app/plugins directory --it doesn’t use the vendor directory.


#20

Is there way to test installer errors?