DigitalOcean CDN Question

stevepurkiss's picture

Hiya

First thanks for all your work, h5p is awesome!!!

Almost a year ago I set up a small Drupal site for a trial project Māori weaving to women prisoners in New Zealand so they have a tradable skill on release. The project has gone well - in fact it's a finalist in the New Zealand Open Source Awards and the ceremony is tomorrow night so fingers crossed!

Trouble is it went so well they have issues with the playback of the video when multiple people are watching and due to their inane security issues they wouldn't let me use any external CDNs to host the video files so it's all on one DigitalOcean droplet. This kept the cost down to about $20pcm but in order to rectify the playback problems I had to put it on a performance improved setup on DigitalOcean which is now costing $100pcm and not really scalable.

DigitalOcean now have 'Spaces' which I can use as a CDN and I've been reading the documentation and support there, here, and on the Drupal module but I can't figure out whether this is going to work as an option so I thought I'd post here before spending time and money finding out it doesn't. I'm not really a server person, more sticking modules together and hacking code where needed.

I'm using the Tutorial content type and Interactive Video, and am awaiting some files for the captions as saw I could upload them - the client was going to embed them but it took days to ffmpeg the files down to sensible sizes last time so I don't want to go through all that again, plus it's more accessible that way. But that's not my quesiton here but thought it might be an issue so mentioning it.

Thanks for any advice, would be good to get the hosting cost down again and provide a more scalable solution as they're deciding in a couple of months as to whether to roll out to all prisons across NZ which would be cool!

icc's picture

It's a bit sad that you can only use their CDN for files in 'Spaces' and not to serve directly from your server e.g. like with Cloudflare. (from the looks of it)

If I understand you correctly your main issue is scaling bandwidth and many requests, not storage space on your server. The next step should definitively be to have media(images/video) and static assets(.js/.css) served through a CDN. The way this works is that the CDN sits in front of your server and serves the files from a cache. If the file is not in the cache or should not be served by the CDN, a request is made to your server for the file.

I have not tried but I'm unsure if 'Spaces' will work with this kind of setup. Completely moving all the media files to an object storage would require a lot more work.

It's also possible to do like a custom setup as well (your own mini-CDN) but again it requires some CDN knowledge and work.

stevepurkiss's picture

Thanks for your reply - according to their documentation (https://www.digitalocean.com/docs/spaces/quickstart/) you just enable 'Spaces CDN' - as you mention the main bulk of the task will be moving the media files, I was just checking that you can point h5p interactive video content to any CDN as I've seen a few support requests suggesting there are issues with certain CDNs.

Should work out cheap enough, there's not much content and the spaces is $5pcm for the smallest config which is 250Gb storage and 1Tb transfer and my whole snapshot of my droplet is only 9Gb and there's currently only about 10 people who watch the videos each week so should be a big cost saving when I've managed to transfer it all!

stevepurkiss's picture

So I set up the Spaces CDN and of course immediately the videos wouldn't play because the security wouldn't accept them from a different server. Now apparently *all* whitelisted resources are pulled and being reviewed, so I'm planning on leaving it like it is and keeping my fingers crossed it comes out alrigh the other side.

On a more positive note, the project won an award at the New Zealand Open Source Awards, so thanks to lots of people including h5p for all your work making this awesome learning platform!

https://www.hetetschoolofmaoriart.com/blog/the-lessons-we-learned-breaki...

icc's picture

That is really cool to hear, thank you for choosing/using H5P and for sharing!