Developing my CraftCMS site locally and deploying it
As mentioned in my previous post, I'm still in the middle of converting my old Expression Engine version of this site over to CraftCMS.
I've kicked the tires on CraftCMS a few times before. Each time they had a different method of getting a local development environment set up. The fluctuation of varying methods seems like it would be irritating, but I've seen how much easier each one has made things. Therefore, I find it refreshing that they're always willing to move to something better rather than getting stuck with stale technology.
The current method entails using Docker with DDEV, which has made it really easy to set up a local environment.
I already use Docker for work, so it feels right to use it here. Starting up is as simple as moving into my local directory and typing this:
This sets up a local URL where I can view and work with my site pretty much the same as it looks completely live, just how you'd expect and want it to work.
When I'm finished, whether that's updating templates, trying a new plugin, or setting up a new section, I type the following to shut things down.
I set up a new cloud server at Vultr. I've hosted with them for a while and don't have any complaints.
Here's the general overview of the steps I went through.
- I used manual server setup instructions which I wrote for myself from past installations. This includes setting up the basics like the database, PHP, Apache (I'm just more used to it than Nginx).
- Created a server user for my site.
- I then followed the composer method from the Craft CMS do to install it.
- Created a backup of my local database that I then imported into the server's databases.
- Copied files from my local installation.
This got me almost completely functional except for one thing.
I only use a few plugins for this site, but I couldn't enable them. The admin area allowed me to and reported that they were enabled but they never actually flipped to being actually enabled.
The solution was to simply re-install the plugins using composer. That did the trick, and the entire site seemed functional afterward. I just finished up this post leaving the absolute last step, which is to point my domain over to the new server.
Manually copying files?
Wondering why I'm not setting this up with some fancy Github automated deployment? Well, I probably should, but it's just a small site I can easily back up. Any changes, I'll just work on the live site. I know.
- Pagination. Since I'm just starting out, I don't really need it yet. I'll add it after I post some more.
- Excerpts for the home page. Maybe. I don't plan to write monster posts. On the fence right now about this one.