patronage / bubs-timber

Gulp + Timber + WP
Other
5 stars 1 forks source link

Docker Based Local Dev #110

Closed kylehotchkiss closed 2 years ago

kylehotchkiss commented 4 years ago

Nick, Yuval, Cam, Stephen, any thoughts here before we get this merged? Have you guys tried docker and had any issues?

ccorda commented 4 years ago

I added some adjustments for DB handling. I was able to get this working by upgrading an existing project to docker.

The only real issue I'm seeing is that php is set to display warnings, and that breaks output. Setting WORDPRESS_DEBUG: 0 seems to fix, but I wonder if there is a different way to set the php error level to ignore warnings.

ccorda commented 4 years ago

One other issue, you can't have multiple local docker containers running at once. That feels to me like something we should support out of the box.

kylehotchkiss commented 4 years ago

One other issue, you can't have multiple local docker containers running at once. That feels to me like something we should support out of the box.

Do you mean two containers running one after the other? If so, is the issue that MySQL tries to load the same database that you last loaded from a different project? If that's the case, I think we need to figure out how to pass a different ID to the docker-compose.yml MySQL setup - i believe if docker-compose sees a unique ID for each site/install instance, it won't try to share the built image between them.

It's also possible to use the table prefix $table_prefix = 'wp_'; wp-config.php param to support this: https://help.one.com/hc/en-us/articles/360002107438-Change-the-table-prefix-for-WordPress- The challenge would be needing to transform any SQL exported from phpmyadmin to use the per-install client prefix.

Or is this about running two wordpress instances in parallel? I think that would be quite the performance hit to laptops as that's effectively 4 VMs running at once (I can feel quite a difference in performance just running one Wordpress instance on my computer)

ccorda commented 4 years ago

We can't solve every tradeoff, but I'm trying to understand them and see if we can.

I definitely have worked on multiple sites (containers) at once before when local hosting, but it does seem like that won't be easy to do here.

ccorda commented 4 years ago

Ran into issues with our usage of vendor. The problem is that the symlink needs to point to /var/www/node_modules in container, and the local node_modules on the host. There is probably a way to include a folder but exclude subfolder, but it wasn't working easily. I think we should take a look at that #117 before proceeding here. I also noticed that including node_modules as a volume slowed down the docker container.

The other approach I tried was one of doing gulp and other things in the container, but that really made the laptop CPU usage go 🔥, and feels overly complex IMO.

ccorda commented 2 years ago

This is 2 years old and has some conflicts, so closing out. But it looks pretty similar to recent efforts and probably easier to grab those changes than figure this one out.