Skip existing sites when provisioning

Whenever I add a new site and run vagrant provision, it runs through all of the tasks for all of the sites that I have set up, both existing and any new ones. I just timed it with no new sites added and 8 existing ones and it took vagrant provision 5m:30s. The “wordpress install : Change site owner to user” task took the majority of the time, at 3m:20s.

It’s not a major issue, but I was wondering if it was possible to have Trellis skip steps for existing site and just run them for any new sites when provisioning?

It’s not really possible to skip sites unfortunately. We just treat them as an array and iterate over each in a lot of places.

You can skip Ansible roles/tasks to speed it up though by using tags. You could set ansible.tags = 'wordpress-setup, wordpress-install' here and it would be way faster.

I think those are the only 2 roles needed to add a new site but not 100% sure.

Change site owner to user" task took the majority of the time, at 3m:20s.

This is pretty awful :frowning: I don’t think I’ve ever noticed it being that slow on that task.

Thanks, I will try out the tag thing next time I provision a new site.

This is pretty awful :frowning: I don’t think I’ve ever noticed it being that slow on that task.

Any ideas why it might be going so slow? I’m using a fully specced 2013 Macbook Pro with an SSD on OSX using the standard Trellis setup. I just assumed that it was normal - I assume it’s chmod’ing every file regardless of the current owner (is it possible to make it only chmod files that aren’t correctly owned?), and since there’s a whole lot of files for npm and bower I thought it was normal!

How many sites are there?

npm definitely adds an insane amount of files. I’ve personally never seen it take any noticeable amount of time but that’s only ever been with 1-2 sites. It’s probably also slower due to synced directories in Vagrant.

I’m not exactly sure what the solution is (or if there is one).

8 sites at the moment.

No worries, it’s not a huge problem so I will deal with it! :slight_smile:

Thanks for the help.

If you’re moving those to production, 8 sites sounds like a lot @kikandrew, you may want to split those up depending on the server. For instance, even with low traffic sites I never run more than 4, med-higher traffic ones usually need their own. Just be sure to check your server usage and make sure you’re ok. There’s also the possibility of 8 sites going down at once there, so lots more work and explaining to do if that happens. :slight_smile:

They’re all in my development environment :slight_smile: Unfortunately I have to work with shared hosting so I don’t use Trellis for production, only dev work.