Gitpod

Gitpod is a service that allows you to spin up an editing environment for your Git repositories. Since the editing environment is a real container and not just an IDE, you can use it to install Tome and edit your Drupal site without ever using local development.

Note that this is a guide for using Gitpod to edit your site, you will still need to host your static site somewhere else.

To start using Gitpod, first create a .gitpod.yml file in your repository. This will tell Gitpod how to spin up your editing environment. If you used the drupal-tome/tome-project Composer project you may already have this file, but if not it should look something like this:

image: mortenson/tome
tasks:
  - name: Install tome
    command: |
      COMPOSER_MEMORY_LIMIT=2048M composer install
      [ -d content ] && drush tome:install -y
      gp sync-done install
  - name: Init and login
    init: |
      echo "Waiting for install..."
      gp sync-await install
    command: |
      eval $(gp env -e DRUSH_OPTIONS_URI="0.0.0.0:8888")
      [ ! -d content ] && echo "Looks like you haven't initialized a Tome site yet - make sure to composer require any profiles you want to use (ex: 'composer require drupal-tome/bookish'), then run drush tome:init to get started!"
      [ -d content ] && drush uli
  - name: Runserver
    init: |
      echo "Waiting for install..."
      gp sync-await install
    command: |
      [ ! -d content ] && echo "When you're finished running drush tome:init you can use this tab to run your server with 'drush runserver 0.0.0.0:8888'"
      [ -d content ] && drush runserver 0.0.0.0:8888
    openMode: split-right
ports:
  - port: 8888
    onOpen: ignore
  - port: 8889
    onOpen: ignore

The configuration above will install Tome, start a server, and give you a login link. It also handles cases where you haven't installed Tome yet, which may not be relevant to your site.

Once you've committed a .gitpod.yml file, login to Gitpod at https://gitpod.io and create a new Project for your repository. Once created, spin up a new Workspace to start editing content in Drupal. From within the Visual Studio Code instance you should see your edits in Drupal come through and be able to commit and push them from there.

No more local development, for free (for now)!