@ovotech/backstage-plugin-confluence-backend
TypeScript icon, indicating that this package has built-in type declarations

0.0.15 • Public • Published

Confluence search plugin backend

This plugin integrates Confluence documents to Backstage' search engine.

It is used in combination with its frontend counter-part.

Installation

Add the plugin to your backend app:

cd packages/backend && yarn add @k-phoen/backstage-plugin-confluence-backend

Configure the plugin in app-config.yaml:

# app-config.yaml
confluence:
  # Confluence base URL for wiki API
  # Typically: https://{org-name}.atlassian.net/wiki
  wikiUrl: https://org-name.atlassian.net/wiki

  # List of spaces to index
  # See https://confluence.atlassian.com/conf59/spaces-792498593.html
  spaces: [ENG]

  # Authentication credentials towards Confluence API
  auth:
    username: ${CONFLUENCE_USERNAME}
    # While Confluence supports BASIC authentication, using an API token is preferred.
    # See: https://support.atlassian.com/atlassian-account/docs/manage-api-tokens-for-your-atlassian-account/
    password: ${CONFLUENCE_PASSWORD}

It is also possible to use a Resource in the catalog to specify the spaces to index. The Resource should like like this:

apiVersion: backstage.io/v1alpha1
kind: Resource
metadata:
  name: company-confluence-spaces
  description: List of all company Confluence spaces to index
  annotations:
    atlassian.net/confluence-spaces: 'Eng, Sales, Marketing, BizDev'
spec:
  type: confluence-spaces
  owner: my-team

Enable Confluence documents indexing in the search engine:

// packages/backend/src/plugins/search.ts
import { ConfluenceCollatorFactory } from '@k-phoen/backstage-plugin-confluence-backend';

export default async function createPlugin({
  logger,
  permissions,
  discovery,
  config,
  tokenManager,
}: PluginEnvironment) {
  // Initialize a connection to a search engine.
  const searchEngine = await ElasticSearchSearchEngine.fromConfig({
    logger,
    config,
  });
  const indexBuilder = new IndexBuilder({ logger, searchEngine });

  // …

  // Confluence indexing
  const halfHourSchedule = env.scheduler.createScheduledTaskRunner({
    frequency: Duration.fromObject({ minutes: 30 }),
    timeout: Duration.fromObject({ minutes: 15 }),
    // A 3 second delay gives the backend server a chance to initialize before
    // any collators are executed, which may attempt requests against the API.
    initialDelay: Duration.fromObject({ seconds: 3 }),
  });
  indexBuilder.addCollator({
    schedule: halfHourSchedule,
    factory: ConfluenceCollatorFactory.fromConfig(env.config, {
      logger: env.logger,
    }),
  });

  // …

  // The scheduler controls when documents are gathered from collators and sent
  // to the search engine for indexing.
  const { scheduler } = await indexBuilder.build();

  // A 3 second delay gives the backend server a chance to initialize before
  // any collators are executed, which may attempt requests against the API.
  setTimeout(() => scheduler.start(), 3000);
  useHotCleanup(module, () => scheduler.stop());

  return await createRouter({
    engine: indexBuilder.getSearchEngine(),
    types: indexBuilder.getDocumentTypes(),
    permissions,
    config,
    logger,
  });
}

If you have decided to use the Catalog (Resource) to define the spaces to index then there is a small change to the initialisation code:

...
indexBuilder.addCollator({
  schedule: halfHourSchedule,
  factory: ConfluenceCollatorFactory.fromConfig(env.config, {
    logger: env.logger,
    catalogClient: new CatalogClient({ discoveryApi: env.discovery }),
  }),
});
...

This will ensure the Catalog Client is specified - and it can then get the Resources of the specified type.

License

This library is under the MIT license.

Readme

Keywords

none

Package Sidebar

Install

npm i @ovotech/backstage-plugin-confluence-backend

Weekly Downloads

58

Version

0.0.15

License

MIT

Unpacked Size

28.7 kB

Total Files

6

Last publish

Collaborators

  • irina.dimitriu
  • puzzledbytheweb
  • paul.gallagher
  • mike.holloway
  • pedro.caldeira
  • harrisonbaxter
  • rob.desbois
  • sophiar27
  • ion.nasu
  • manoj-ovo
  • jeffer_ovo
  • bohdan-kozerema
  • ryan.lee1
  • zolegovo
  • pablomuro-ovotech
  • irena3888
  • dvoroniuc-ovo
  • arpad.fesis.ovo
  • pkoretsovo
  • marknreynolds
  • ovotarasrusyniak
  • gabriel.hulubei
  • jnysevilla
  • pallait
  • mableyip
  • shonnguen
  • ik1004kaluza
  • kseniya.belevich
  • willshawmedia
  • joewhittles
  • rachelknightkaluza
  • philip.fol.ovo
  • zach-smith-kza
  • phala.kantan
  • mikitadzianisevich
  • romans-ovo
  • iain.rawson.ovo
  • kantan_m_rutter
  • ruhi-choudhury-kaluza
  • cohen990-ovo
  • andrew-brook-rad
  • sean-kantan
  • george.anthony
  • ovox
  • eloisechilvers
  • kaluzajianzu
  • mikemchugh
  • trickkaluza
  • david.ovo
  • jubril
  • sophiesillmanovo
  • emmadavids
  • harry.faulkner
  • willcorrigan-ovo
  • edvinas.ovo
  • jadamiec-ovo
  • crektek
  • andrewinci-dev
  • mbartish_ovo
  • saamiyayousuf
  • veljko.popovic
  • vipul_vk
  • cenkovic_ovo
  • zoelanham
  • pedro.costa.kaluza
  • ekeith-kaluza
  • iharea-ovo
  • gracyde
  • mihaidavidovo
  • kupxc
  • will.crick
  • andreiracasan-ovo
  • kim-wysocki-ovo
  • stumacovo
  • oep-accounts-bot
  • filoseovo
  • tombolinep
  • rajit-kaluza
  • nick.long
  • morris27sky
  • laurawady
  • daniel-billing-foundations
  • callumdenby
  • abilash999
  • tigranargit
  • srinivas.bada
  • stevedaykaluza
  • kelemensanyi
  • warren-ovo
  • catalin.andrei
  • bilaal-kaluza
  • jacktreble
  • nish1406
  • hentielouw
  • dtheasby-kaluza
  • ovo.backstage.admins
  • dlaird-ovo
  • garylaikaluza
  • rsh-ovo
  • gabrielngovo
  • robert-g-j
  • darinakulishovo
  • tommaso.bruno
  • djmelonz
  • r.midyk
  • jamieovo
  • luke.parsons.kaluza
  • bisongee
  • olliebatchelor
  • mikecsmith-ovo
  • gordok
  • andymay44
  • mark-b-ovo
  • brianbroughton
  • maricel-ovo
  • tc-kaluza
  • iuna4e
  • fulvio.ovo
  • chris.brookes
  • ivan.mihov-ovo
  • prashant16
  • aleksandyr
  • mishabruml
  • markwood23
  • lilbyteltd
  • fraserhamiltonovo
  • thomas.finch
  • benjamin.golding
  • mosman128
  • wjbenfold
  • ovo-markswaffer
  • jcholewa
  • benaston13
  • bookings-team
  • vitalii_khudenko
  • andbrss
  • ezio-intravaia-ovo
  • stevendiplock
  • georgexcollins
  • laxmi06
  • shnist
  • maieutiquer
  • orion-bot
  • kingfruit85
  • caolan.derry
  • manikant16
  • stefan-dospinescu-ovo
  • bare7aovo
  • jlucktay
  • lewisdick-ovo
  • phil-pinkowski
  • rekaelek-ovo
  • kaluzian
  • eugenovo
  • dyl349
  • wtaylor-ovo
  • bizval-bot
  • dangrebovic
  • mwidurek
  • raluza
  • brettburman-code
  • richard-mounter
  • miguel-catarino
  • jrdavenport
  • oeptariffs
  • mikethorpe-ovo
  • davekaluza
  • tarlingovo
  • mesh00
  • jthomasovo
  • props
  • adam-mcdevitt
  • vslepkan
  • melcbuckov
  • vkovetskyi
  • delaluza
  • rafael_kaluza
  • raraujo-ovo
  • zyurii
  • marcuskielly
  • michaelwheeler
  • xenjke
  • sulgee.kim
  • cifdso
  • liam-chambers
  • r0bturner
  • veselin.stamenov
  • adamblance-kaluza
  • kathryn.allan
  • lewright
  • friendigo
  • ovo-james
  • ovo-dc
  • samrumley88
  • t.vytrykush
  • metering-reads-health-bot
  • kuwotu
  • darren_thomas_ovo
  • lughino
  • jchoskins
  • ovotech-identity
  • vkobyletskyi_ovo
  • jamesnoble1
  • david.regula.ovo
  • danmaly
  • vasil.dininski
  • andy-heywood-ovo
  • tom.harrison-ovo
  • cristinapetrov
  • k-fernandez
  • vukovo
  • carolinelywood
  • prtn-ovo
  • m_heald
  • laurierw
  • csillabarna
  • marina-ovo
  • jennyunchan
  • paceteamkaluza
  • trading-and-dispatch
  • pkari
  • retail-payg-tech
  • cwkaluza
  • accrecovo
  • lenardprattovo
  • esra.kaya
  • ovo.trading.tech
  • simonmclean-ovo
  • qe-team
  • jonnyleakaluza
  • ovotech-smart-thermostat
  • scott-thomson239
  • laranjoeduardo
  • aga-ovo
  • gregshielkaluza
  • rise-team
  • nevenablagoeva
  • scdf
  • andrewjtn
  • nickfitton-ovo
  • mbrignall
  • ronald.nsabiyera
  • jcdclark
  • engagement-insights
  • askomaro
  • ovo_steve
  • rmcnovo
  • freddybushboy
  • ovo-aarongibbison
  • madalinadulhac
  • vcheban-ovo
  • gordonmartin
  • ievgen-paliichuk-ovo
  • fahedarshad
  • ellafutkowska
  • chrisfordkaluza
  • shubham-npm-ovo
  • jameswelshkaluza
  • petro.pavlenko
  • vzahakailo
  • harvey-appleton
  • mwz
  • dominicboston-kaluza
  • joepurnell-ovo
  • radhika-bijibilla
  • g-tibbs
  • jagreenwood1
  • vcobzaru
  • dwfullerton
  • per.linnett
  • edpatrick-ovo
  • mattgrayovo
  • kimnil
  • benvaughanjones
  • samwest
  • mtardugno-ovo
  • gjain-npm-ovo
  • alexvicolovo
  • rparkhomchuk
  • weiliangc3
  • mykola.p
  • ovo-josh
  • cbousie
  • david.chellapah.ovo
  • franciscodiasovo
  • vmary
  • a.calderwood
  • jamesbaum
  • retrojetpacks
  • samcooper720x
  • lebaptiste
  • iovana.pavlovici
  • tom.sherman
  • myovo-self-serve-service-account
  • admrply
  • serena-ahah
  • alicia.bowers
  • kelveden
  • mike.walters
  • khadra.ismail2
  • tashacallow
  • alan_smith_ovo
  • rohith-kaluza
  • ylukomskyi-corgi
  • achagan_kaluza
  • mike-gregory-kaluza
  • thomasgdane
  • anglox
  • mladjan-perceptive
  • amolrindhe
  • sujitkumar.shil
  • nathanmarshovo
  • andrixb
  • tudor.harries-kaluza
  • bphenriqueskaluza
  • anthony_tonev
  • michal-at-kantan
  • nick-ovox
  • asellick
  • npmpwoo
  • stewart-kantan
  • jamie-eb
  • luis.gashi
  • n-jeremic-npm
  • anthonykaluza
  • jackbott-ovo
  • klaudia.marzec
  • ponchosb
  • oliwia-lakatosz
  • luke-adams-ovo
  • jgok
  • dela_kaluza
  • maxandre.zils
  • chris-cooney-ovo
  • adam.vile
  • dhasovo
  • samrushton
  • maxatko
  • miksg
  • bindubp
  • ettie.eyre
  • ian.white
  • jonnycundall
  • mars-rover
  • ape-team
  • kgray-kaluza
  • daogilvie
  • kaluza-devex
  • ohs-aurora
  • kaluza-rnr
  • ipa-bot
  • gideoncaspi
  • kawbot
  • data.discovery.ovo
  • ovotech-sg
  • ovotech-qs
  • tomshawovo
  • potsec
  • rosario-ovo
  • zoejm
  • peterh-ovo
  • apjm
  • ovoenergyapps
  • homemoves
  • ovo-oot-bot
  • cp-ui-tooling
  • ovo-bit-tech
  • sir_hiss