this post was submitted on 14 Sep 2022
7 points (100.0% liked)

Lemmy Support

4651 readers
1 users here now

Support / questions about Lemmy.

Matrix Space: #lemmy-space

founded 5 years ago
MODERATORS
 

Hi everyone, we want to set up a cdn in order to avoid hosting the images in our instance

top 18 comments
sorted by: hot top controversial new old
[–] nutomic@lemmy.ml 6 points 2 years ago (2 children)

Your best option might be to setup sshfs to mount a folder from another server, and use that to store images.

https://www.cyberciti.biz/faq/how-to-mount-remote-directory-filesystems-with-sshfs-on-linux/

This will usually be rather slow, so you should also setup a cache for images in nginx.

https://www.nginx.com/blog/nginx-caching-guide/

[–] MaxElFantasma@mujico.org 5 points 2 years ago (1 children)

we want to avoid using a disk unit as possible, since our hosting is limited, i was thinking something about setting up an s3 bucket and use cloudfront, i have done this with some e-commerce applications so that's where i'm heading my question to

[–] nutomic@lemmy.ml 7 points 2 years ago (1 children)

Pictrs (image hosting software which we use for Lemmy) supports s3 as storage backend, so you could use that. However, migrating from local disk storage to s3 storage is currently not working and is being fixed. You might want to get in contact with the dev (asonix), hes very helpful.

The reason I recommended sshfs is that you can use it with any server, or even a desktop or raspberry pi. This approach is much cheaper than s3 afaik.

[–] Echedenyan@lemmy.ml 3 points 2 years ago (1 children)

There is always s3fs to mount S3 bucket as storage :^)

[–] DonDino@mujico.org 2 points 2 years ago (1 children)
[–] Echedenyan@lemmy.ml 2 points 2 years ago (1 children)

What do you mean? S3 storage basic unit for storage "device" is a bucket.

You don't use the whole S3, you use a "virtual storage device or database" and that is a bucket.

[–] DonDino@mujico.org 10 points 2 years ago (3 children)
[–] cypherpunks@lemmy.ml 7 points 2 years ago (2 children)

problem with s3 is that while you might think it is you who has a bucket, it is really jeff bezos' bucket

[–] DonDino@mujico.org 3 points 2 years ago

Bezos bucket brings the boyz to the yard

[–] Echedenyan@lemmy.ml 3 points 2 years ago (1 children)

When I say S3, I reference to the API itself and any provider of it, such as a hosted MinIO instance.

[–] DonDino@mujico.org 3 points 2 years ago

Does humor has a place in lemmy?

[–] AutoModerator@mujico.org 3 points 2 years ago

Oye DonDino, tas rechulo y lo sabes. !tip 12

[–] rajudev@lemmy.ml 2 points 2 years ago (1 children)

I have setup just a hosted a folder and serving it over nginx. Whenever I need to use CDN, I just transfer the content to the folder and use the link to that file as CDN link.

This is a very neat hack.

Not a very good hack if you need to host a large number of files.

[–] DonDino@mujico.org 1 points 2 years ago (1 children)

Sounds interesting, allow me to give it a try, any tips?

[–] rajudev@lemmy.ml 1 points 2 years ago

No tips, just host a path to a folder. Make sure the permissions to that folder are correct and only linked files are accessible

[–] acabjones@lemmygrad.ml 1 points 2 years ago

You want images not on local app server disk; do you want to host the files yourself (I.e. on VM disk)? Or are you open to a managed service like s3? What disk consumption are we at? Number of files? What kind of request volume and data throughout are we talking? How fast are those things growing?

Depending on your hosting, S3 may well be less expensive, and it will def be simpler.

If you're forced to DIY you could look at seaweedfs, which is an HA horizontally scalable blob storage cluster which exposes an S3 compatible interface.

Either way, someing like Pictrs might be nice over some kind of S3.