Deployment

This page describes starting REST-based Swift publication with Magnolia for production environments and local development.

Starting REST-based Swift publication and Magnolia

For production environments, you can follow the steps in this section to start REST-based Swift publication and Magnolia.

  1. Ensure you have added the REST dependency, magnolia-swift-publication-rest, to your custom DX Core webapp.

  2. The Pages app is configured to use Swift by default. In the Assets app or any other content app, you must set up the configuration for Swift yourself. See Enabling versioning in Swift publication for more details.

  3. Signature authentication is enabled by default. Ensure that the public key is available on all public instances. See Signature authentication for more details.

  4. Start your Magnolia instance.

Migrating content from JCR to Swift

If you want to use existing JCR versions from previous publications so that you can restore them if needed, you should migrate any existing content before working with Swift publication.

Groovy script migration

You can use the Groovy script below to migrate your content.

import info.magnolia.swift.versioning.api.data.migration.JcrToSwift
import info.magnolia.objectfactory.Components

jcrToSwift = Components.newInstance(JcrToSwift.class)

website = MgnlContext.getInstance().getJCRSession("website")
page = website.getNode("/page")

jcrToSwift.migrateNode(page)
// jcrToSwift.migrateNode(page, "mgnl:custom") (1)
// jcrToSwift.migrateRecursively(page)
// jcrToSwift.migrateRecursively(page, "mgnl:custom") (1)
1 If you use custom node types for pages and their content, you need to provide node types to describe the page content.

Endpoint migration

Alternatively, you can enable a REST endpoint by providing a .yaml definition as follows.

/<YOUR_MODULE>/restEndpoints/swift-migration.yaml
class: info.magnolia.swift.versioning.api.data.migration.endpoint.MigrationEndpointDefinition

You can trigger the endpoint with the example URLs below.

http://yourdomain.com/.rest/swift-migration/jcr2swift/website
http://yourdomain.com/.rest/swift-migration/jcr2swift/website/mgnl:custom,mgnl:another

Local development for testing

For local development, you can start a container by following the steps in this section.

The receiver’s value in your local author instance could also be your computer’s local hostname or local network name, such as My-Computer.local on a Mac.
  1. Install Docker Desktop if you don’t have it already on your system.

  2. Clone the swift-publication repository.

  3. Add a file develop.env with a valid Magnolia license in the magnolia-swift-publication-it folder.

    MAGNOLIA_LICENSE_OWNER=<LICENSE_OWNER>
    MAGNOLIA_LICENSE_KEY=<YOUR_LICENSE_KEY>
  4. Use the docker-compose.yml file from the magnolia-swift-publication-it module.

    cd magnolia-swift-publication-it
  5. Set the environment variable for REST publication before running the build.

    export PUBLICATION=publication-rest
  6. Start containers for local development

    make build
    make up
Feedback

DX Core

×

Location

This widget lets you know where you are on the docs site.

You are currently perusing through the DX Core docs.

Main doc sections

DX Core Headless PaaS Legacy Cloud Incubator modules