---
title: "Remote-space publishing"
canonical: "https://support.appfire.com/space/CDML/649728423/Remote-space%20publishing"
format: markdown
---
> Macro (aura-html)


## Overview


> Macro (excerpt)
> 
> Remote-space publishing lets you edit content on a local Confluence instance and then publish it to a remote Confluence Cloud or other hosted Confluence instance.
> 
> ![image](media://9ae0b4a4-52b4-4e9d-8918-7f371fdda5b9)
> 
> > ℹ️ The [Comala Remote Publishing app](https://marketplace.atlassian.com/plugins/com.comalatech.remotepublishing/server/overview) is used to publish content in a source space to a space in a completely separate instance.
> 
> Whenever content is updated and approved in the source instance using Comala Document Management, the [Comala Remote Publishing app](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649955967) can automatically update the published content in the remote instance.
> 
> The remote instance can be configured to allow anonymous access to share the content with outside users.
> 
> |  |  |
> | --- | --- |
> | ![image](media://4b03cf4c-3549-4acf-b098-203fdc63592c) | The **[Comala Remote Publishing app](https://marketplace.atlassian.com/plugins/com.comalatech.remotepublishing/server/overview)** for Comala Document Management must be installed on the source instance to enable remote-space publishing.<br>> ℹ️ The Comala Remote Publishing app only functions when used with Comala Document Management. |

## Activating remote-space publishing

Once the Comala Remote Publishing app is installed, there are three steps to setting up different-space publishing:

- Set up the remote Confluence instance
- Set up the local Confluence instance
- Update your applied Comala Document Management workflow to trigger the publishing process

The publishing action in the workflow is actioned using one of the following remote publishing macros. 

- [ remotepublish-page](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649628625) to publish a page to the remote instance
- [remoteremove-page](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649628704) to unpublish (remove) a published page from the remote instance

> 📝 These publishing action macros are added to workflow triggers in your custom workflow.

## Remote instance setup

These steps should be performed on the remote Confluence instance to which you plan to publish content:

- Create the space where you want to publish the content
- Set up a user account with user permissions to view, add, and delete content in the space for the published content

> 📝 For Confluence v8.7.1 and later in your source instance, the remote instance must be added to the Confluence [Allowlist Configuration](https://confluence.atlassian.com/doc/configuring-the-allowlist-381255821.html#ConfiguringtheAllowlist-AllowIncomingSection) with the “Domain Name” type to ensure that outgoing connections to it are accepted (*Comala Remote Publishing v2.6.10+*).

When content is published into this remote space, it appears to be authored and edited by the user you have set up.

The remote instance can be a server, data center, or cloud instance.

> ℹ️ If a Cloud instance is used for the remote instance, then you [need to configure an API token in the user account Atlassian administration](https://id.atlassian.com/manage/api-tokens). 
> ℹ️ 
> ℹ️ Make sure the API token needed for the user password field is requested by the user who will appear to publish the articles.

## Local setup

For remote publishing to work, the server/data center hosting the local Confluence instance must be able to access the remote instance.

These configuration steps are undertaken in each space in the local instance (source instance) where the content is initially created.

> 📝 Each remote space instance can only be configured as a remote space for a single source space instance.

### Source space Remote Publishing dashboard

The remote space details are configured in the Document Management dashboard in the source space that holds the source content.

- navigate to **Space Tools** > **Document Management** > **Remote Publishing**

![image](media://b4e88cc1-0234-4f5e-bc0c-a80b9af76524)

### Confluence Allowlist configuration

For a source instance installation of Confluence v8.7.1 or higher, in order for outgoing connections to the remote space to be accepted, you must include the remote instance in the Confluence [Allowlist Configuration](https://confluence.atlassian.com/doc/configuring-the-allowlist-381255821.html#ConfiguringtheAllowlist-AllowIncomingSection) with the “Domain Name” type.

![rp_allowlist_warningmessage_spacedashboard.png](media://e25d6e44-4421-46e1-9812-72c112e55b15)

### Add remote space details

- Add the remote space details to configure the remote space publishing

![image](media://2b7ede08-8aac-43ce-95d7-e09ae1b1edc3)

| ### **Configuration options** | Description |
| --- | --- |
| **Name** | The name of this publishing profile |
| **Base URL** | The base URL for the remote instance, for example<br>- `https://www.company.com/confluence/` |
| **User** | The username of the user you created on the remote instance<br>- Content updates on the remote instance will be carried out by this user account |
| **Password** | The password of the user created on the remote instance - added as **User** in this configuration<br>> 📝 If publishing to a cloud Confluence instance, you will need to enter an API token here, not the user's password.  An API token can be generated when logged into an Atlassian account here: [https://id.atlassian.com/manage/api-tokens](https://id.atlassian.com/manage/api-tokens) |
| **Space Key** | The SPACEKEY of the space to publish in to on the remote Instance |

> 📝 We recommend you set up a user on the **remote** instance that only has access to the spaces you are publishing to for security purposes. This will also help to prevent any accidental overwrite of other spaces.

## Publishing content

In our example, pages and blogposts with an applied Comala Document Management workflow, are published to the **remote** instance when the page transitions to the **Published** state.

This is done using the following workflow trigger listening for the state change to the **Published** state.

The [remotepublish-page](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649628625) macro is configured to publish to the named space, **remote**.

Publishing requires connection and transmitting data to the other instance, and this could take some time.

> ✅ As we want to minimize any chance of error or session expiration we **queue** the request by adding the `queue=true` parameter to each publishing trigger in the applied workflow.

A pending message is shown when the page is submitted for publishing.

![image](media://42b624a9-5096-49f4-bbb8-ad817500f3b8)

If a published page is updated in the source space, the workflow status is changed in our applied workflow to a different workflow state. This does not affect the remote instance space page.

To publish any updates to the remote instance space the page needs to be re-approved and transition to the workflow state configured in the workflow trigger (the **Published** state in our example)

> 📝 Comala Remote Publishing **does not add a publishing status breadcrumb** to either the source instance space page or the remote instance space page. Management of the published page is based on the applied workflow state and the action of the workflow remote publishing trigger.

## Publishing all pages in the Space

If you want all the existing pages in the space to be published remotely, then you need to set the state of all pages to the **Published** state.

You can do this through the **Initialize states** feature available for each workflow in the space tools Document Management dashboard.

![image](media://e11d7c74-1c32-4883-8ca1-a0722259929b)

> ✅ Hierarchy of the source instance space pages is maintained in the published remote instance space but initial publishing action publishes pages to the root of the remote space. Once initial whole space is published, reorder the remote space pages and if necessary edit the homepage of the remote space to the published home page from the source space.

Further publishing of source space instance pages retains the page hierarchy if the parent exists in the target remote instance space.

## Workflow markup

The publishing is triggered by an action macro [remotepublish-page](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649628625). This action macro is added to a Comala Document Management [workflow trigger](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649859133).

```
{trigger:statechanged|state=Published|queue=true}
        {remotepublish-page:remote}
{trigger}
```

The value used in the example for the `remotepublish-page` macro is the **Name** for the remote publishing profile added in the Remote Space Publishing Configuration dashboard in the source space - here we have used **remote**.

In our workflow applied to the source space content we can use a state change event to action the remote publishing

- the change of state to the **Published** state

When the state changes to **Published**, a trigger is added to the workflow listens for this event.

When the trigger is activated the `remotepublish-page` macro instructs the Remote Publishing for Comala Document Management app to send the published content to the remote space.

```
{trigger:statechanged|state=Published|queue=true|newevent=pagepublished}
        {remotepublish-page:remote}
{trigger}
```

We have also used this trigger to create a custom event `newevent=pagepublished` that can be used in other triggers.

Here we have used this custom event to check if the remote publishing is successful using the `success=true` parameter in the trigger.

For a successful publishing action - the custom event `pagepublished`

- a workflow trigger generates a message confirming success

```
{trigger:pagepublished|success=true}
        {set-message:style=info}Page Published to remote instance!{set-message}
{trigger}
```

If the publishing action event  `pagepublished` is unsuccessful - `success=false`

- a workflow trigger listening for the unsuccessful event actions
  - the transition of the content to the **Review** state
  - generates a warning message notification

```
{trigger:pagepublished|success=false}
        {set-state:For Review}
        {set-message:user=@user@|style=warning}Publishing to the remote instance failed @errormessage@{set-message}
{trigger}
```

The example markup above is based on the example from [same-space publishing](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649794062), but we've added the following workflow [trigger](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649563178) at the bottom. This additional trigger removes page content from the **remote** instance using the `remoteremove-page` macro.

```
{trigger:statechanged|state=Remove}
        {remoteremove-page:remote}
{trigger}
```

> ℹ️ The example workflow below does not include a transition to the **Remove** state.

With no configured transition to the **Remove** state from another state in the workflow, the ability to transition to the **Remove** state is limited to users with administrator permission who can use the [administrator state override](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649760835) option to transition the page to the **Remove** state from any other state in the workflow.

> 📝 The workflow is also configured to hide this **Remove** state from the workflow popup progress tracker when the page or blog post is in any other state in the workflow.

The overall example workflow looks like

![image](media://f670c672-e18e-496d-a948-90203b3a99bd)


Here’s the complete workflow markup for this example, which includes a remote publishing process for blog posts using the `newsstatechanged` event, a **Newsarchived** state, and publishing archived blog posts to a different remote instance **remote2**.

<details>
<summary>Remote publishing workflow example - workflow markup</summary>

```plaintext
{workflow:name=Remote Publishing Workflow|key=dm.remotepublishing}
    {description}
        This workflow allows one-way synchronization of a remote confluence instance. Please visit the [workflow's page|https://wiki.comalatech.com/display/CDML/Remote-space+publishing] for instructions on how to set up the _private_ and _remote_ instances.
    {description}
    {state:Draft|submit=For Review}
    {state}
    {state:For Review|approved=Published|rejected=Draft}
        {approval:Publish}
    {state}
    {state:Published|updated=For Review}
    {state}
    {state:Remove|hidefrompath=true|hideselection=true}
    {state}
    {state:Newsarchived|hidefrompath=true|hideselection=true}
    {state}
    {trigger:statechanged|state=Published}
        {set-message:type=note}Page publishing pending...{set-message}
    {trigger}
    {trigger:statechanged|state=For Review}
        {set-message}{set-message}
    {trigger}
    {trigger:statechanged|state=Published|queue=true|newevent=pagepublished}
        {remotepublish-page:remote}
    {trigger}
    {trigger:newsstatechanged|state=Published}
        {set-message:type=note}Page publishing pending...{set-message}
    {trigger}
    {trigger:newsstatechanged|state=For Review}
        {set-message}{set-message}
    {trigger}
    {trigger:newsstatechanged|state=Published|queue=true|newevent=pagepublished}
        {remotepublish-page:remote}
    {trigger}
    {trigger:newsstatechanged|state=Newsarchived|queue=true|newevent=pagepublished}
        {remotepublish-page:remote2}
    {trigger}
    {trigger:pagepublished|success=true}
        {set-message:style=info}Document Published to remote instance!{set-message}
    {trigger}
    {trigger:pagepublished|success=false}
        {set-state:For Review}
        {set-message:user=@user@|style=warning}Publishing to the remote instance failed @errormessage@{set-message}
    {trigger}
    {trigger:statechanged|state=Remove}
        {remoteremove-page:remote}
    {trigger}
    {trigger:newsstatechanged|state=Newsarchived}
        {remoteremove-page:remote}
    {trigger}
{workflow}
```
</details>

Several workflow triggers publish content to a remote instance. There are separate triggers for publishing

- pages using the `statechanged` event
- blog posts using the `newsstatechanged` event

These triggers also generate a custom event `pagepublished` that is used to generate message notifications.

> 📝 The `final=true` parameter for a workflow state is not necessary for remote space publishing action, all the work is done by the `remotepublish-page` macro added as a workflow trigger action macro

Pages and blog posts in the **Remove** and **Newsarchived** states can only be transitioned to other workflow states (and hence back into the documentation and publishing process) by a user with administrator permission.

## Macros

> Macro (contentbylabel)

## Examples

> Macro (contentbylabel)

## Administration

- [Comala Remote Publishing Release notes](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649660565)

## Workflows Exchange

- [Comala Remote Publishing Workflow](/wiki/spaces/CWE/pages/615776475)

## See also

> Macro (contentbylabel)