Installing to an existing site

If you have an existing Drupal 8 site, installing Tome is fairly straightforward. This guide will take you through the process of installing Tome or Tome Static.

Installing Tome Static

If you want to keep your current Drupal hosting setup and just want to generate a static site, this guide is for you.

First, you'll need to add  Tome as a dependency to your site and install Tome Static:

$ composer require drupal/tome
$ drush en tome_static -y

You'll also need to have Drush 9 installed locally if you want to use the command line. This can be required like so:

$ composer require drush/drush:^9

Then, ensure that the Tome Static export directory is writeable. This defaults to "../html", which would be the "html" folder above your web root. If you want to change this directory, add a line like this to settings.php:

$settings['tome_static_directory'] = '../html';

Now you're ready to generate static HTML. If you want to use the command line, you can run this command:

$ drush tome:static --uri=

Where "" is the domain of your production site. If you prefer to use the user interface, login as a user with the "use tome static" permission and submit the form at "/admin/config/tome/static/generate".

Once the static site is generated, you can upload the contents of your static export directory to your preferred hosting provider.

Migrating to Tome

If you want the full Tome experience, where content, config, and files are stored in Git, you can follow this guide. This may not be a fit for sites with many concurrent editors or if you want to stay with your traditional hosting provider for other reasons.

First, require Tome's dependencies and enable Tome:

$ composer require drupal/tome drupal-tome/tome_drush drush/drush:^9
$ drush en tome -y

Then, ensure that the Tome Static export directory (defaults to "../html") and Tome Sync export directories (defaults to "../content" and "../files") are writeable. You'll also want to make sure your config sync directory is writeable and in a location that's tracked by Git. Here's what a settings.php file with all these configured looks like:

$settings['tome_files_directory'] = '../files';
$settings['tome_content_directory'] = '../content';
$settings['tome_static_directory'] = '../html';
$config_directories['sync'] = '../config';

Once that configuration is done, you will need to run an initial export. This could take a long time if you have a lot of entities on your site, so be patient:

$ drush tome:export -y

Now you can test that a fresh Tome install works correctly by running:

$ drush tome:install -y

If the process finishes successfully and your site looks right, then the migration worked! If not there could be an incompatibility with a custom or contrib module, or a bug in Tome. Please report bugs with replication steps if you find any.

At this point, you now have a Drupal site managed by Tome where all the configuration, content, and files on your site can be tracked in Git (assuming you add/commit the changes you just made). This means you can use Tome completely locally, without hosting Drupal anywhere. Alternatively you can spin up your site temporarily for editing, then spin it down when you're finished. Check out the "Render" hosting guide for a good example of this.

To generate static HTML at this point, you can run:

$ drush tome:static --uri=

Where "" is the domain of your production site. Make sure to check out the hosting guides for Github Pages, Render, and Netlify to see how a CI can automatically deploy your static site when you commit a content, config, or file change.