V8-archive: Deployment on shared hosting

Created on 25 Jul 2020  路  4Comments  路  Source: directus/v8-archive

Even though the docs don't specify the possibility for obvious reasons, it wasn't that hard to get it working on a shared hosting plan. I'd propose adding a bit to the docs on this, as many of us are either stuck with clients on older servers mainly used for Wordpress or simply haven't got the budget for something more expensive.

The main issue seems to be the folders that shouldn't be publicly accessible are exposed. Even though one could set the permissions to 750; it is not a pretty sight/solution. The final API URL would still be something like;

mywebsite.com/public/someproject..

instead of;

mywebsite.com/someproject..

But - there is a solution that seems to work without too much hassle.

Presuming the server;

  1. Meets requirements for Directus
  2. Runs on Linux and Apache
  3. Allows SSH access and enable to user to;

    • create symlinks

    • remove the /public_html folder

    • execute git command

Installation

  1. Login with SSH
  2. Go to root folder of the domain (one level up from where the site usually has it's public files); for example
cd /home/client123/domains/mywebsite.com
  1. Remove the default public_html folder
rm -rf public_html/
  1. Clone Directus from GitHub
git clone https://github.com/directus/directus.git directus
  1. Recreate the public_html/ folder as a symlink
ln -s /home/client123/domains/mywebsite.com/directus/public public_html
  1. Run regular Directus setup, now available on https://mywebsite.com/admin

Notes

  • As far as Apache is concerned, the files are being served from the public_html folder as usual. It seems to care little about it being a symlink now.

FAQ

_Why not use Wordpress as headless CMS?_
Response time. In my case a static .json file would be served in +/- 20 msec. An API call to Directus with the exact same data about 60 msec and an API call to Wordpress' REST API (clean install) with the same data well over 150 msec.

docs

All 4 comments

stuck with clients on older servers mainly used for Wordpress or simply haven't got the budget for something more expensive.

VPNs nowadays are about as expensive as most shared hosts! For like $5/month on DigitalOcean you can have everything up and running.

@rijkvanzanten Agreed. Yet, in my particular case it wouldn't serve me well to change hosts.

I've got a project that generates an awful lot of data traffic. Serving a podcast, audio and video. The current hosting contract offers "unlimited" data for a price I could barely get a starter package for on DigitalOcean. Also - renewable into perpetually by the fine print.

In regard to the obvious reservations towards the more often than not misused term "unlimited", I reached out to this host in the preliminary stages of the project. Without so much as a fuss I've got written mandate to run the service as I currently do on their systems. Given I won't breach any laws and use their servers strictly for the website running on it.

+50 TB/month would be a rather pricy endeavour on a VPN, even with the data-serving part outsourced to something like AWS or any other object storage. Since burping up about 10 bucks a month seemed a bargain for so much traffic 谩nd a guarantee it wouldn't breach the terms of contract - it was well worth trying a dozen options to get Directus up and running on an unsupported platform.

_(PS. I do hope I've posted this in the right place though - but I wanted to get the knowledge of it out there. As one artist to another; we've got to hit a blue note every once and a while. Also, whilst I've noticed you are NY based at the moment, I dare argue your typical Dutch sense of stinginess is tingling at the mere thought of getting more for less. Because mine sure is ;)._

you're absolutely right 馃檪

just wanted to briefly throw it out there for others jumping on this thread through other channels that pricing alone should no longer be the deciding factor between going with a shared host over a VPS.

As for my Dutch stinginess, I can say that 50TB of transfer at $10/m seems like an absolute steal, and that things seem to be _getting more for way more_ rather than _getting more for less_ in NYC 馃槈

My two cents on pricing and cloud storage:

https://wasabi.com/

Was this page helpful?
0 / 5 - 0 ratings

Related issues

cdwmhcc picture cdwmhcc  路  3Comments

gitlabisbetterthangithub picture gitlabisbetterthangithub  路  3Comments

jwkellyiii picture jwkellyiii  路  3Comments

Nitwel picture Nitwel  路  3Comments

andgar2010 picture andgar2010  路  3Comments