Connecting read-only Databases in a Multisite Scenario

rrichter
Occasional Collector
0 8 2,574

In FirstSpirit there are several possibilities to transfer content from one or more master projects to different so called target projects. This could be country websites that use central content from a corporate website or subsidiary companies of a corporation that want to reuse content published in the corporate intranet.

In most cases this will be done using the FirstSpirit module CorporateContent which provides the necessary functions for target projects to subscribe to global content created and updated in a master project. During the publicatishing process changes of global content packages done in the master project will be rolled out to the subscribed target projects. In the target projects changed objects will be released and published to the live site.

This process covers most of the scenarios in which content is reused, but there are other combinations in which the changes of global content will directly affect objects in the target projects and where the editors want to work with recent references of the objects and not copies.

This is when you have to use the FirstSpirit feature of connecting “read-only” databases. One of the standard examples is a global product database - using FirstSpirit datasources – managed in a master project (e.g. a corporate website of an international corporation).

products_datasource.jpgThe goal is to make it possible for every country website to create their very own product overviews with products that might only be available in the concerning region.In our example we assume that the product datasource in the master project is based on a database table named “Products”. This table is located in a database schema based on a database layer named “MASTER_DB”.

product_table.jpg

In the section below you will find a step-by-step instruction to make this datasource available „read-only“ for the target project(s).


Step 1: Creating a „read-only“ copy of the database layer

The first step is to create a „read-only“ copy of the existing database layer “MASTER_DB”.

You open the „ServerManager“ and navigate to „Server > Properties > databases“. You will now see a list of all database layers connected with different projects.

By creating a copy of the layer "MASTER_DB" with the exact same settings and the suffix _ro ("MASTER_DB_ro") we will be able to distinguish between the original and the "read only"-copy.

master_db_ro.jpg

Step 2: Making the layer available for the target project

Now we have to open the project properties of the target project and navigate to the Databases section.

The checkboxes „Selected“ and „No schema sync“ have to be activated for the „read-only“-layer “MASTER_DB_ro” and confirmed with the OK-button.

target_project_db.jpg

Step 3: Saving the schema information

Now we have to save the schema information of the master database schema. To do this we have to open the master project using the “SiteArchitect”. Select the database schema (in the section “Templates > Database Schemata”) that contains the table “Products” and switch into edit mode.

We now save the XML-schema information into a local txt-File by navigating to “Right-mouse-click > Edit externally > Database-Schema”.

database_edit.jpg

The dialog has to be closed via „Discard local copy“. After that we have to leave the edit-mode (CTRL+Shift+E) to avoid further changes.

xml-schema.jpg

Step 4: Creating a read-only database schema in the target project

As a base for the datasource in the target project the read-only database schema has to be created.

Using the „SiteArchitect“ we open the target project and create a new database schema (Templates > Database-Schemata) via „New > Create new schema“.

newschema.jpg

The schema has to be based on the read-only database layer “MASTER_DB_ro” and should have a name showing that this is a schema used for read-only purposes.

newschema2.jpg

Using „Edit external > Database schema“ we now save the content of the txt-File (see Step 3) into the Database schema. In this case the dialog has to be left via „Save local copy and close“ while the database schema has to be saved as well.

dbedit.jpg

Step 5: Activating write protection for the target project

This last step shows how to activate the write protection for the database layer connected to the target project. That avoids changes to the schema or content of the database via the target project.

You can do this in the „Databases“ section of the target project properties in the “ServerManager”. You only have to activate the checkbox „Read-only“ at the corresponding database layer (“MASTER_DB_ro”).

target_project_ro.jpg

After confirming with „OK“ the product data of the master project is available read-only in the target project.

Now it is possible to create table templates and queries based on the read-only database schema of the target project.

Finally the product data can be visualized and generated for each target project using datasources and product overview pages. They can also be filtered by availability in specific countries if needed.

IMPORTANT: At this point one could assume that it is possible to omit step 5 and manage the global product database from different projects. This is not officially supported by FirstSpirit. A FirstSpirit database can only be managed by one project. All other projects have to be connected “read-only”.

Changes of the database schema in the master project

If there are changes of the database schema in the master project, we have to transfer the changes to the target projects.

We have to roll back the changes made in step 5 to save the XML-schema information following step 2 and to change the existing schema in the target project via „Edit externally > Database schema“ (step 4). After that we have to re-activate the write protection for the database layer in the target project(s) (step 5).

8 Comments
cstornowski
I'm new here

Das hat mir sehr weitergeholfen.

TimoMeister
Returning Responder

Wie sieht es mit Medien (Bilder und Dokumente) aus, die innerhalb eines Datensatzes verlinkt sind? Das funktioniert bei mir leider nicht.

cstornowski
I'm new here

Die Medien müssen remote eingebunden werden. Mir wurde das Stichwort RemoteMedia genannt. Dies bezieht sich wohl auf http://www.e-spirit.com/marketplace/de/corporatemedia.

rrichter
Occasional Collector

Genau.

Im Detail:

Die Medien müssen in einem Medien-Master-Projekt (das kann auch das Projekt sein, in dem die Daten in den Datenquellen gepflegt werden) liegen und "remote" referenziert werden.

Liegen die Medien im selben Projekt wie die zentralen Datenquellen, so zeigt diese "Remote-Referenz" auf das selbe Projekt.

Werden die Datenquellen read-only in anderen Projekten eingebunden, zeigen die Remote-Referenzen in das Master-Projekt und werden sowohl korrekt angezeigt als auch korrekt im Sinne von CorporateMedia (oder früher: RemoteMedia) generiert.

TimoMeister
Returning Responder

Danke für die Antwort. Dieses Szenario habe ich irgendwo schon mal gehört/gelesen.
Was ist aber, wenn man eine bestehende Datenquelle mit vielen Datensätzen und referenzierte Medien in ein anderes Projekt einbinden will? Müssen dann alle Medien nochmal neu referenziert werden?

rrichter
Occasional Collector

Ja, das muss natürlich "migriert" werden, lässt sich aber automatisieren. Ich kann einmal schauen, ob wir ein Skript zur "Remotifizierung" noch in der Schublade liegen haben. Die Anforderung ist nicht neu.

cstornowski
I'm new here

Uns ist gerade etwas aufgefallen, dass beachtungswert sein könnte. Wir nutzen die Verison 5.1.410.67084.

1. Ein Datensatzeintrag im Hauptprojekt verändern und freigegeben

2. In einem anderen Projekt mit der Remote Datenbankanbidung nichts verändern

3. Detailseiten generieren

=> Beim Generieren wird der alte Stand verwendet.

1. Ein Datensatzeintrag im Hauptprojekt verändern und freigegeben

2. In einem anderen Projekt mit der Remote Datenbankanbidung nichts verändern

3. Detailseiten generieren

4. Irgendetwas ändern und freigeben

5. Detailseiten generieren

=> Beim Generieren wird der aktuellste Stand verwendet.

Kann dies jemand bestätigen?

rrichter
Occasional Collector
Version history
Last update:
‎01-23-2014 08:27 AM
Updated by: