(partial) synchronization of two Confluence instances

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.

3 answers

1 accepted

1 vote
Accepted answer

Confluence Command Line Interface can be used to script coping of pages between instances.

Is there any further documentation for Confluence CLI commands, e.g "copyPage", something more than just the CLI help description?

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"

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.

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--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]} --serverhttp://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)
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 --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--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)

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Oct 24, 2018 in Confluence

Atlassian Research opportunity with Confluence templates

Do you use templates with Confluence? Take part in a remote 1-hr workshop. You'll receive USD $100 for your time!   We're looking for people to participate in a   remote 1-hr workshop...

1,022 views 14 12
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you