(partial) synchronization of two Confluence instances
Asked by Petr Holod??k:

Is it possible to have two Confluences set up in a way that they share part of content? i.e. one space?

The idea is to have two separate servers with Confluence. One purely for internal purposes (beyond firewall, without access from the internet) and second one published. Is there a way of syncing part of contents from one server to another? Either one way or both ways? Idea is to have one space (or more) that would be edited in internal Conflu. and later (either real time or online od once a day) copied/synced to public.

Is there a way? Or maybe even some tool / script to do it somehow? Or some best practices? We can adjust our expectations according to what is possible.


Answers:
author: Bob Swift (personal)
body: [Confluence Command Line Interface](https://bobswift.atlassian.net/wiki/display/CSOAP) can be used to script coping of pages between instances.

comments: author: Jaime Hablutzel
body: Is there any further documentation for Confluence CLI commands, e.g "copyPage", something more than just the CLI help description?


author: Bruna Griebeler
body: Hello!

I believe you may consider running Confluence in a clustered environment.

You can run multiple copies of Confluence in a cluster, so that clients (such as a browser) can connect to any copy and see the same information.

However, you would duplicate the entire site, and not only a space.  

If you need further information, please take some time to read this page: [https://confluence.atlassian.com/display/DOC/Confluence+Clustering+Overview"](https://confluence.atlassian.com/display/DOC/Confluence+Clustering+Overview%22)

comments: author: Todd_Gamblin
body: This isn't suitable for the situation described. The two instances have distinct security requirements, and in this environment you would NOT want to run the two instances clustered.


author: Dmitry Chubatov
body: ` Confluence command line inteface:`  
`confluence.bat --action copyspace --space spacekey --newSpace spacekey_to --replace --server http:``//from_wiki.com`` --user admin --password xxx --targetServer http:``//to_wiki.com` `--targetUser admin --targetPassword xxx`  
if necessary to sync permissions as well (steps 2-3):  
2. export permissions to file:  
`confluence --server http:``//`[](http://from_wiki.com/)[from_wiki.com](http://from_wiki.com)`--user dmitryc --password xxx --action runFromPageList --space ``"fromspace"` `--common ``"-a getPermissionList --id @pageId@ --outputFormat: 2 --file c:/temp/permissionList.csv --append"`  
3. import permissions with groovy :  

|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `class` `CSVParser {` `static` `def` `parseCSV(file, closure) {` `def` `lineCount = ``0` `file.``eachLine``() {line ->` `def` `field = line.``tokenize``(``","``)` `lineCount++` `closure(lineCount, field)` `}` `}` `}` `use``(CSVParser.``class``) {` `File file = ``new` `File(``"c:\\temp\\permissionList.csv"``)` `file.parseCSV {index, field ->` `def` `proc = ``"C:\\dev\\downloads\\atlassian\\confluence-cli-3.7.0\\confluence.bat --action addPermissions --space to_space --title ${field[1]} --permissions ${field[3]} --group ${field[4]} --server`[](http://127.0.0.1:1990/confluence)<http://127.0.0.1:1990/confluence>`--user admin --password admin"``.execute()` `def` `b = ``new` `StringBuffer()` `proc.consumeProcessErrorStream(b)` `println` `proc.text` `println` `b.toString()` `//println "row: ${index} | ${field[0]} ${field[1]} ${field[2]} ${field[3]} ${field[4]}"` `}` `}` 4. cron step(s) 1 (-2-3) |


author: Dmitry Chubatov
body: `1. Confluence command line inteface: `  
`confluence.bat --action copyspace --space spacekey --newSpace spacekey_to --replace --server http:``//from_wiki.com`` --user admin --password xxx --targetServer http:``//to_wiki.com` `--targetUser admin --targetPassword xxx`  
if necessary to sync permissions as well (steps 2-3):  
2. export permissions to file:  
`confluence --server http:``//`[from_wiki.com](http://from_wiki.com)` --user dmitryc --password xxx --action runFromPageList --space ``"fromspace"` `--common ``"-a getPermissionList --id @pageId@ --outputFormat: 2 --file c:/temp/permissionList.csv --append"`  
` `  
3. import permissions with groovy :  

|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `class` `CSVParser { ` ` ``static` `def` `parseCSV(file, closure) { ` ` ``def` `lineCount = ``0` ` ``file.``eachLine``() {line -> ` ` ``def` `field = line.``tokenize``(``","``) ` ` ``lineCount++ ` ` ``closure(lineCount, field) ` ` ``} ` ` ``} ` `} ` `use``(CSVParser.``class``) { ` ` ``File file = ``new` `File(``"c:\\temp\\permissionList.csv"``) ` ` ``file.parseCSV {index, field -> ` ` ``def` `proc = ``"C:\\dev\\downloads\\atlassian\\confluence-cli-3.7.0\\confluence.bat --action addPermissions --space to_space --title ${field[1]} --permissions ${field[3]} --group ${field[4]} --server `[](http://127.0.0.1:1990/confluence)<http://127.0.0.1:1990/confluence>`--user admin --password admin"``.execute()` ` ``def` `b = ``new` `StringBuffer()` ` ``proc.consumeProcessErrorStream(b)` ` ``println` `proc.text` ` ``println` `b.toString()` ` ``//println "row: ${index} | ${field[0]} ${field[1]} ${field[2]} ${field[3]} ${field[4]}" ` ` ``} ` `}` 4. cron step(s) 1 (-2-3) |


Tags: content

mirror

sync