Workspaces is a new experimental module first introduced in 8.6.0 branch, with a promise to bring real content staging capabilities into Drupal core.
Without Workspaces, the only way to achieve something similar is the Deploy suite of modules, which is quite heavy and complex and the community was begging for something simpler and more straightforward for quite a long time. And now we have it!
Having seen a lot of excitement in the blog posts and YouTube videos about the module I decided to give it a spin and check what can it provide out of the box, what are the current limitations and quirks to have in mind before diving in into implementing content staging with Workspaces on a live website.
What is a workspace?
A workspace is a copy of the live site, that exists in parallel to the live site within the same database. We should be using a workspace when we want to prepare multiple new or modified content items and get a full picture of how the site will look like in the end, but without exposing those changes to the live users.
A typical scenario would look like this:
Let's see if we can achieve something similar using fresh Drupal 8.6.1 install using Standard profile. In this scenario, I will try to create the classic Dev -> Stage -> Live workflow.
Enable and configure the Workspaces module
Enable the module as usual and go to
/admin/config/workflow/workspaces to configure it.
We can see that Stage and Live workspaces are already created.
Add Dev workspace and specify its owner. Owner of the workspace is the person who can view, edit and manage it. For example, if we create the workspace for a marketing campaign, the owner can be the person who is responsible for it, while other editors of the site would not be able to see or deploy anything to and from this workspace.
The panel at the top shows the workspaces available to us. Current one, and the default workspace is always Live. There is no way to change it.
If we try to switch between workspaces now, we will see that all of them have the content created initially for the site. In my case, I have two nodes with panda pictures. My goal would be:
- Change both nodes to be about dogs - titles and pictures
- Add a new node
- Be able to preview how my home page will look like before making changes available to the public.
Okay, we start with two panda nodes living in the Live workspace.
Manage configuration entities with Workspaces
If you switch to any other than Live workspace and try to edit Views, save or move around blocks or touch anything not related to the content entities you will get a message:
This form can only be submitted in the default workspace, which is Live.
So, sadly, one of the possible killer features, allowing us, let's say, to edit a View and deploy the changes made using the staging mechanism, is not available yet.
Editing content entities with Workspaces
Switch to Dev and try to change the title of one of the nodes. Please note that there will be no indication of the active workspace state on the node form itself - it can be seen only in the top panel.
I was able to change the node title and the content successfully, but as for the image - no luck. The form dies with no clear indication why and no errors. So, I guess, it's not quite ready for the files or media yet.
After re-saving two panda nodes with updated titles in the Dev workspace I got this.
Now, if we try to visit the Live one, we can see the titles are unaffected - we still see panda titles. Our live users are unaffected by the changes made in the Dev workspace, which is really what we want.
To deploy the amended titles to the live version of the site hit the "Deploy content" button.
And, finally, our live users can see the updated titles. Sadly, the images are the same, we were not able to change them.
Creating new content entities with Workspaces
The process of creating new content is exactly the same - switch back to Dev, create your content, hit "Deploy content" when it's ready to be pushed to Live.
Sadly again, I was not able to upload the image into the new node. The form widget dies.
Quirks and limitations of Workspaces
While I can see this feature has a tremendous potential I'd not recommend using it in production unless you're ready to dive into the issue queue and work on solutions on your own. At least the following should be kept in mind:
- There is no way to configure content deployment paths - you can't push the content from Dev to Stage. The target workspace is always Live
- It doesn't work with files, which is to me is the biggest bummer at the moment
- Lacks support for configuration entities and anything except nodes
- There is no pull option - you can't synchronize the content from Live to Dev, let's say.
This said, any help is very welcomed in the issue queue - https://www.drupal.org/project/issues/drupal?component=workspace.module
And, below is the short video from Dries on what is (or will be) possible with Workspaces in the near future. Just I have a feeling we're not there yet.
Anything I've missed, misunderstood or simply screwed up - let me know in the comments. And in the meantime I will keep an eye on Workspaces and update on the progress of this awesome feature.