Chassis / Tachyon

A local Tachyon server for Chassis
0 stars 2 forks source link

The Tachyon service should run from the uploads directory, not the content directory #3

Closed goldenapples closed 6 years ago

goldenapples commented 6 years ago

In the service definition for tachyon, it looks as though the tachyon service in Chassis is being run from the WP content directory. This breaks the image lookups when using the tachyon-plugin, which expects image paths to be relative to the upload directory's base url.

In testing, if I change that line to "cd ${content}/uploads && /usr/bin/node ... images served from Tachyon work fine. That of course won't work anywhere that the uploads directory is filtered, but I wasn't able to find a puppet variable to define the uploads directory.

I'm not sure what the best fix would be here. Any ideas?

rmccue commented 6 years ago

That of course won't work anywhere that the uploads directory is filtered, but I wasn't able to find a puppet variable to define the uploads directory.

I don't think it's worth accounting for this edge case generally, I'd just go with updating to ${content}/uploads here. Really, all we care about is how things are mounted into the VM, not the edge cases of configuration.

@roborourke can you check this out? 🕵️

roborourke commented 6 years ago

@goldenapples I was using it with the tachyon plugin myself so I'm not sure why you're seeing different behaviour. Are you using minio as well or something?

goldenapples commented 6 years ago

@roborourke hmm. I did have minio provisioned when I first installed this, but then when I realized that wasn't necessary with the local server I removed the minio extension and reprovisioned. Its also possible that the paths in my local installation are being tweaked by another plugin on the site I'm working on.

It still seems like the paths are wrong, though. The tachyon plugin builds URLs relative to the uploads directory, so the tachyon service needs to be running in that same directory in order to find the source image files. Can you see what directory the tachyon local server was running from in your VM?

I'm wondering... would it make sense to just allow setting another value in chassis/config.local.yaml that could override the default content directory? Being able to specify something like

tachyon:
  port: 1234
  uploads: /chassis/content/uploads

in the config file would probably simplify any edge cases.

roborourke commented 6 years ago

Yeah that would be a good addition! I’ll dig into it and see what I can work out, maybe it’s my set up that’s odd... On Tue, 31 Jul 2018 at 17:59, Nathaniel Taintor notifications@github.com wrote:

@roborourke https://github.com/roborourke hmm. I did have minio provisioned when I first installed this, but then when I realized that wasn't necessary with the local server I removed the minio extension and reprovisioned. Its also possible that the paths in my local installation are being tweaked by another plugin on the site I'm working on.

It still seems like the paths are wrong, though. The tachyon plugin builds URLs relative to the uploads directory https://github.com/humanmade/tachyon-plugin/blob/master/tachyon.php#L57, so the tachyon service needs to be running in that same directory in order to find the source image files. Can you see what directory the tachyon local server was running from in your VM?

I'm wondering... would it make sense to just allow setting another value in chassis/config.local.yaml that could override the default content directory? Being able to specify something like

tachyon: port: 1234 uploads: /chassis/content/uploads

in the config file would probably simplify any edge cases.

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/Chassis/Tachyon/issues/3#issuecomment-409293501, or mute the thread https://github.com/notifications/unsubscribe-auth/AABbebgImRLeIp4H7Cm4Zt0kJR-OhoZ7ks5uMIzlgaJpZM4Vktxe .

roborourke commented 6 years ago

@goldenapples so found a bunch of mistakes I'd made - I'd managed to git ignore the local-config.php file which configures the TACHYON_URL constant. I've tried it out with the project you're on locally and it seems to work.

Can you update the extension and reprovision then let me know how you go?

goldenapples commented 6 years ago

This works nicely now, thanks!

I had muddled through a few of those setup steps on my own when trying to install originally, but this time the provisioning process went through without a hitch at all. It works fine to just add the uploads path to the TACHYON_URL constant for local development like you're doing here. even though that's different than the paths would look in production environment, it should work as is in most configurations, and people with different setups should be able to make them work by defining that constant.

roborourke commented 6 years ago

Awesome, thanks for testing. I based it off the configuration from our website here: https://github.com/humanmade/Human-Made-website/blob/master/wp-config.php#L260

I believe it's necessary to do this because we have a single S3 bucket for all sites in a region and a single tachyon instance per region. It's counter intuitive when running it for a single site I guess.

Thanks again!