How do I make my site with pre-loaded content and pre-loaded config available to others without creating a distribution? [closed]

drupal.stackexchange https://drupal.stackexchange.com/questions/287915

  •  19-02-2021
  •  | 
  •  

Question

I want to be able to provide a simple way for users to install a Drupal website that contains a certain set of content, contributed modules and custom content types. I also want to keep the process of developing this scenario as simple as possible for the developer.

I know that the standard way to do this would be to create a Distribution such as those that are listed at https://www.drupal.org/project/project_distribution. Another example is the Umami content available in a standard Drupal distribution. However, building a distribution seems to be quite a bit of work and should require a commitment to maintain that distribution if it is listed on the Drupal website. So, my question is whether there is a simpler way to allow users to install a website with some given content without my having to make the effort of building a distribution, since whatever I build will not be listed on the Drupal website.

The thought that there may be an easier way was prompted by my experience with some theme vendors. With some theme vendors, the process of installation involves only creating a database from an included SQL script and then starting the installation wizard and only having to input the database credentials. No other answers need to be answered in the installation wizard. It is almost as easy for the user as installing a distribution, and I am wondering if it may be easier for me as a developer to implement.

When I examine some of these theme installations that use this approach (e.g., News+ lite at https://www.drupal.org/project/newsplus_lite) there is no code in the docroot/profile sub-directory, so this approach cannot be using a standard install profile or distribution because that is where extra content or code would be stored for an install profile or distribution. From my investigations so far about creating Distributions or Installation Profiles, I have not yet read how such an approach would work or be implemented. So, I am asking if anyone knows how such an approach (as utilized in the News+ Lite and other similar installations) works and how I might duplicate it.

Was it helpful?

Solution

One of the support staff at MoreThanThemes was kind enough to provide some direction on how they do this. You can see the result in the structure of their free or paid themes. In short, the steps are pretty simple for what might be termed a cloned installation. The steps are basically the following.

  1. Create a clone of the site that you want to install (https://www.youtube.com/watch?v=9NMRwkTzrCM describes that pretty well)
  2. In the clone, overwrite/replace the /docroot/default/settings.php file with the docroot/default/default.settings.php file
  3. Make a clone of the original database (e.g., using MySQLDump, PhpMyAdmin copy or drush sql-dump) and install it in a new database instance that you will use for the cloned site.

If you also have removed the Umami distribution and the minimal distribution from core, then the installation wizard will automatically bypass the choice for which install profile to use. In that case, the installation wizard only asks for the database information, where you will use the information for the cloned database. That will be all you need, and you will have a installed clone of your original website.

From my testing, it looks like the UUID of both sites are the same, just as if you had cloned the original site. So, the main use case from what I can see for this scenario would be if you wanted to share a copy of your site with other people, including the content (like the theme companies do). The only difference from a regular distribution like Umami or OpenAtrium from the user's standpoint is that they have to load the database file on their own before they do the installation. But from a developer's standpoint, this seems to be a much easier approach to sharing a website with the content and should be adequate for many users who want to test out your site.

I am surprised that this is not more widely documented and perhaps I have missed something here. But in my tests so far, this seems to be all that is needed. Hopefully this will help someone else who may need this simpler approach.

Licensed under: CC-BY-SA with attribution
Not affiliated with drupal.stackexchange
scroll top