Hosting a PHP-based CMS on Digital Ocean
Any idea how to set up a CraftCMS site in Digital Ocean? It's a PHP-based CMS and I think they use MariaDB. Never did any hosting more complicated than Netlify and I have some experience with cPanel but that's about it, and I can't find any good articles specific for CraftCMS. Would appreciate some guidance!
94 Replies
I have the project locally running inside a docker container, can I just upload the docker container to the server and run docker that way?
what kinda container (hosting) do you have on DO?
err dropplet xD
I rebuilt the droplet using the Docker setup if that's what you mean
so you just have a ssh into a unbuntu box?
Yea
or w/e you picked
With docker set up
so you can copy your docker img up and run it yea
I would setup some nginx/apache though
certbot etc too >.>;;
my lazy ass just uses CapRover as I've mentioned
Coolify is another good option
CapRover is simple and slender, Coolify is a bit heavy but lots of options and tools.
See the thing is I'm using DDEV for local development, which is a wrapper for docker
So I don't have any of the docker files and need to make them myself for the remote hosting and I have no idea what I'm doing ๐
This is so much harder than using Netlify
I mean if its not helping why use it
I mean Netlify is one way
lol
Again I'd use Caprover
If you want something like Netfliy that you run
๐
Then you would just do w/e 6 ways to deploy you want too.
hell lets you drop a .rar on it ๐คฃ
But you will still use dockerfiles for build steps and what not, so not all easy ig.
No but I wouldn't either
Looks like a money grab >.>;;
Yea I saw the free tier has only 5 deployments a month...
yea fuk all that
Use Cap or Coolify
But the 8$ tier is unlimited deployments (its in pounds / euros?) so honeslty what's that like 10$ a month or something? I'd be willing to try that
na fuk that
You already pay for hosting why pay for deployment
Cause u said with Cap I still need to set up a docker container right? And I have no idea how to do that through my setup now
Bruh
No I said you would need a dockerfile
its basically a set of commands man
simple shit for someone like you
build commands like npm run dev and shit lol
Oh I thought I needed a docker-compose file too sorry I have no idea wtf any of this is lol
I mean you could yes
CapRover is just a helper GUI for nginx/certbot/docker so you don't have to lift so heavy
honestly getting a dockerfile up might be hard too because ddev literally sets it all up for me so I have no idea what it actually ran. I literally just run a command like
ddev config --project=craftcms
and it installs everything needed to get the cms up and running locallybut ya you will need to learn a little bit
then that is what you would run in the dockerfile prob but pprod
all docker is .. is isolation
Think of it as a micro box in your box
Craft has to have docs on it too if not just learn how to run prod
If the dev command is that easy I'm sure the prod one is too
I know they have a docker hub thing Idk if that is any use
Like I would imagine you are talking about two different things too
One hosting Craft... other hosting a website that uses craft?
Or does it all just tie into the one ?
Dude I literally have no idea ๐
You have used it yes? (thought you said you had)
Yea but I just don't know how any of this stuff works, I'm purely frontend
CraftCMS is just a php-based CMS that uses twig files to build out html templates, and it lets you login and edit stuff in the dashboard, and runs MySQL
That's all I know of how it works lol
It does make this /web folder so I guess that's where all the actual files are built?

yea so if you are just hosting the CMS locally then keep doing that and just upload the output ๐
but you will need a php server nginx/apache to host it
with*
Okay that explanation just made things sound 200x easier, I'd still be able to go into the actual site then and go into the dashboard and change stuff around right?
I guess since it just is all .php files at the end
ummm if its local? idk lol
I mean yes to local to their site idk
actual site*
Got it, since I already pay for DO I'll just try to set it up on there. Just set up something like a LAMP template and upload the /web/ files under /var/html/web?
sure or use what I suggested xD
thank you i'll see what i can figure out from both
i dont know why this stuff just doesnt make sense to me it seems so complicated
yea I just checked CapRover nor Coolify have one click installs but...
looking it does not seem to hard to setup with docker files
follow docs like everything
https://hub.docker.com/r/craftcms/nginx
yea so they do have it on hub too
so thats where I would start if I was using CapRover
yea i was gonna link that earlier i saw that, so just try following that and use caprover?
yup
You can still use what you use locally since its easy
Then setup something that works on hosting too nothing wrong with that. I'd be shocked if that local tool does not have a prod option too though.
I personally would just use the local and upload php files with ci/cd like normal though
Just make sure it does not need anything special for hosting the php files
Idk though i'd think if it worked like that it would be static so not like Netlify works
Maybe it does need itself or atleast the db
they are not real clear about this. but I'm out of it and probably can't read.
Yea it definitely needs the DB, on prod you have the frontend site and then you can do something like https://site.com/admin and log into the admin dashboard, and make changes to the components and things that gets rendered to the frotnend
if thats what u meant
idk im out of it too lol
Note: We purposely do not provide a web server image because that choice depends on your project needs. We do, however, provide examples illustrating how to use Nginx or Caddy with the php-fpm images.So ya you would use one these imgs and config Cap or something with it
Docker Compose ยท CapRover
What is Docker Compose?
Sux there is not a one click for it. You get this working you should submit one ๐คฃ
oh god if i ever get this working it'll be a frankenstein lmao
I mean having something like Cap and Coolify is a great exp though, its good to know a little.
It would allow you to host anything you want too
God I hope so, man. I've been so stuck on this hosting stuff for legitimately years
well within reason xD
I have hope though now ๐ thank you
I'm just gonna start with the getting started docs in CapRover and go from there
Yea I mean other stuffs really easy too, it gets a bit more complicated when you need to have all the containers talking like this will need but I have faith in you.
Its really just configs of commands xD (its insanity really but trying to make you feel better)
Nice part once its up its up lol just make notes of any footguns (like nginx wants trailing slash urls/ for static paths without extensions so you need to make sure you don't pull your hair out trying to reverse this... just tell your framework to add them lol)
Like hosting JS stuff is stupid easy cause well .. its got that going for it (I have multiple github hooks setup for deployment, so it works just like vercel/netlify)
But I have actual node servers and actual static sites >.>;; not "serverless" thats still servers lol
damn man you know all this stuff ๐
kinda not really I just abuse CapRover and learn as I go since its just a GUI layer
I found Coolify too much and too heavy for my servers (little 2cpu 2gigs) but its a good option as mentioned too
takes the pain out of a lot of this
It favors Caddy over Nginx (is another factor)
progress ๐

Okay so I uploaded a .tar and added a Dockerfile, now I think I need to make that docker-compose / captain-compose file and it should work?
(ignore the name lol)

So yea I guess the Dockerfile installs the dependencies to build the image and then builds the container image on the host, and then we need the docker-compose to tell it how to run the image? Am I understanding that correctly?
The more I use CraftCMS for anything outside the recommended default the worse it gets ๐
It's really nice when it works well, not so much when it doesn't
Following their guide for getting Docker setup and the steps in the documentation just don't work
Because they recommend DDEV, but I'd rather just set up the Docker container directly (rather than using DDEV as a wrapper) so I can push the container & dockerfiles to CapRover
A hate systems like this
I'm literally going into the Docker container and setting
chgrp
and perms to the www-data
user lmaoThis would deter me from using craft CMS personally
I don't like things with such limits ๐
I used it at my old company and I thought the development process was suuuuuuuper smooth which is what's keeping me trying at this point it's just a PITA rn
The admin dashboard and the ability to create custom fields was really really easy
But have you tried anything else ๐ ignorance is bliss as they say
Nope not really xD
I mean I did WP but it wasn't anything custom
I don't really want to use WP since it seems kinda monolithic when I used it
I'm sure headless WP is a lot better but eh
Na it's not really
I was looking into headless WP for awhile but it's just not great way
The API is lack luster and the control is nill
Really depends on how you want things rendered to ig though
What cms do you recommend that'll be easy to get hosted on caprover? I just want something I can build a frontend in and I can have people go in and add videos / change some text around if I configure it
I didn't really have one I like self hosted yet
I was going to look at KirbyCms
Maybe tinaCms
PagesCMS
I've used Tina but it was really barebones, I guess it could work for what I need too but wanted something a bit more robust
I'm using free tier of Prismic now
Might try prismic then, u said u haven't self hosted it tho?
Which I just love how they do things
You can't self host Prismic
Oof
I mean you self host the websites
But the CMS is on their servers ๐ฅฒ
You get imigx cdn with it which is killer, but yea is a vendor lockin
They do things like no other though which is really nice imo
I love slices and the control as a developer I have over what the CMS can and can't use for the content creator
I've spent so much time at this point I want to try to get something self hosted up (because I hate myself ๐) prismic does look easy though
Yea thats why I love craftcms
You build out what fields a content type has in the dashboard and then just call the fields out in the twig files to render them
It's super nice
Yea again this is very dependant on how you want things to render and what language you want to use.
I am talking about the other direction, where a person wants to edit a page or slice content, as a developer I am defining what slices can be put on a page type and what elements can be used.
ooo yea that's way too heavy for what i need
This for me is killer cause I've had almost every WP website I've built be destroyed by some "WP admin" lol
But also allows me to be the one that controls if a slice can use the correct heading levels I.e.
That is really nice tbh just not what I need :( maybe I'll try Tina, last time I used it it was really easy because whenever someone made changes in the admin dashboard it would commit it to git
That way I didn't even need a DO droplet or anything I could just host the frontend on netlify and it would update
But I'm being stubborn now and want to learn docker and how to self host a container
Too tired of feeling vendor locked or not understanding how to selfhost something
Cap Rover you can do that too like I mentioned
Ye I really like caprover's dashboard and I feel all techy using it lol so I want to keep using it if possible
brb driving to gym
Kk drive safe get swol
It's just for maintenance at this point lmao
asked again on some new advice for getting regular docker setup in the CraftCMS discord and one of the guys messaged me privately trying to sell me Ploi again ๐
If I have to pay a third party just to deploy my code then maybe the cms isn't mature enough...
And I know I'm definitely a devops noob so that's where a lot of the issues are coming from but also there's just like... no documentation on how to get something up and running? It seems like the whole local dev ecosystem is tied to a build tool and if I try to deviate and follow the docs directly I get errors? Like what is that
Might look into using Astro + Strapi, Strapi actually has great documentation and I'm decently familiar with Astro
And it's in the one-click apps for CapRover too
This is after I've finished contracts. Managers have full rights
Guys... I did it. Legitimately took me all weekend. I caved and bought Ploi for the third-party deployment service. idc anymore it's like 15$ a month to host this site but it saved me my sanity

I was going to go the Astro + Strapi route and then after a couple hours saw that the one click deployment for Strapi in CapRover was outdated and not working...
Sounds worse than Vercel and nextjs lol
That kinda lockin sux but I'm happy your happy
I agree but I could have probably spent another weekend trying to get it to work
15/month is not breaking the bank
at all
Free is nicer
I agree I wish I could have gotten it to work but just wasn't happening
So you pay for deployment and your vps still or that includes the hosting? I didn't look that hard
It's just for deployment, so it's 6$ a month for the DO droplet and then 8 (pounds? euros?) for the deployment service, so that's what like 10$ usd? so 16 usd a month
This is a hobby stupid fun project too so sucks im spending almost 20 a month out of my pocket to host it but its whatever
At that point isn't it better to just use crafts hosting?
Or same boat?
I didn't look tbh I was so focused on getting it to work on DO but just checked the prices lol

Holy bawls
Yea which is probably one of the reasons why it was so hard to find anything good documentation-wise on hosting it
Lowkey they probably do it on purpose
Yea kinda jank they make deployment so hard too
like self hosting is not really self hosting at that point ๐คฃ
fr lol
I'll look into them but I'm just happy I got something hosted at this point ๐ I think I spent like 12 hours over the weekend trying to host it lol