RunCloud configuration for Craft CMS

RunCloud configuration for Craft CMS

Bryan Dugan4 min read

If you're setting up a Craft CMS website on RunCloud, here is everything you need to get started. For this setup, I am using a Digital Ocean server with Ubuntu 18.04.

Install packages/extensions

Start by installing some required and optional packages to make the most out of your RunCloud Installation. During the time of this writing, all my applications on the server are running PHP 7.4 so this article is geared towards that. You will need to install the extensions for every PHP version you're using. For example, if you're running PHP 7.1 and 7.4, you would need to do something like apt-get install php71rc-sodium php74rc-sodium to install the sodium package for both versions of PHP. Also, be sure to run the restart command for each version so the changes can take effect. systemctl restart php71rc-fpm php74rc-fpm. Also take note, that RunCloud has its own version of PHP, so the naming convention of things is slightly different.

If you may need any additional packages, RunCloud offers some documentation on other common PHP modules you can obtain here: https://runcloud.io/docs/guide/cheat-sheet/php#installing-modules

Getting Started

Start by opening up a terminal window and SSH into your server as your root user.

ssh [email protected]_IP_ADDRESS

Note: When I set up my Digital Ocean server through RunCloud UI, I was never sent an admin password. If you don't know your server's root password, never received one, you can reset it in Digital Ocean, by selecting your server, clicking the "access" tab, and selecting "reset root password".

Reset Root Password in Digital Ocean

Sodium (Required)

Sodium is a required PHP extension that Craft CMS uses to handle encryption, decryption, password hashing, and more.

apt-get install php74rc-sodium

To get the changes to take place, restart PHP by running the following

systemctl restart php74rc-fpm

Imagick (Preferred)

This is the preferred image rendering library for Craft CMS. It handles transforming images much better than the pre-installed module, GD, and is highly recommended for not only Craft but also WordPress and other popular CMS's.

apt-get install php74rc-pecl-imagick

To get the changes to take place, restart PHP by running the following

systemctl reload php74rc-fpm

FFmpeg (Optional)

FFmpeg is an optional application that's used for compressing video files on the fly. Craft doesn't handle this natively, but you can use a plugin like Transcoder to serve compressed video files if you plan on using them regularly. To learn more about FFmpeg, you can view their documentation at https://ffmpeg.org/ or this wonderful article on the best practices for background videos by Viget.

apt-get update
apt-get install ffmpeg

Now that we have the two required extensions, let's move on to configuring your application's PHP settings.

Configure PHP Settings within the RunCloud Dashboard

For each web application you create that uses Craft; Here are the settings I have applied to each application, based upon Craft's PHP system requirements. At this time, RunCloud doesn't have a way to create a template to quickly duplicate preferred PHP settings for each application, but I did put in a feature request so you don't have to go through these steps for each application.

To get to the PHP application settings in RunCloud, go to Web Application → [App Name] → Settings, then scroll down to PHP Settings.

open_basedir

Remove the text in this field:

Default: /home/undefined/webapps/undefined:/var/lib/php/session:/tmp

Note: Keeping the default field info will fail Craft CMS updates on the production site.

disable_functions

Remove the following functions from the list to enable them, as they are needed for Craft CMS to run properly. If your Craft site is having any issues with running or are getting multiple server errors while navigating the Admin panel, be sure to check these settings.

  • proc_open — Plugin Store operations and sending Emails
  • proc_close — Plugin Store operations and sending Emails
  • proc_terminate — Plugin Store operations and sending Emails
  • ignore_user_abort — Native web-based queue runner.

max_execution_time

Change default max_execution_time to 300.

Note: Craft requires a minimum PHP max execution of 120s.

RunCloud Craft CMS PHP Settings

Rebuild the Application to apply changes

After adjusting anything in the settings panel, RunCloud recommends you to rebuild the application. To do this, click on the "More" button on the top right portion of the screen and select "Rebuild web application".

Repeat the Configure PHP Settings process for each application that you want to set up on the server.

Rebuild RunCloud Web Application


Your RunCloud server is now properly configured for Craft CMS! If you have any issues or additional input, feel free to get a hold of me on Twitter @bryandugan

Note: Any links leading you to products or services are most likely affiliate links that I will receive compensation from. I only promote products or services that I own/use myself and truly feel will deliver value to you. By purchasing products or service through these links, you will help support me to keep creating awesome ad-free content.