-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Update to Backstage 1.25.0 (#45)
- Loading branch information
Showing
48 changed files
with
2,137 additions
and
3,287 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
{ | ||
"version": "1.23.0" | ||
"version": "1.25.0" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,126 +1,21 @@ | ||
/* | ||
* Hi! | ||
* | ||
* Note that this is an EXAMPLE Backstage backend. Please check the README. | ||
* | ||
* Happy hacking! | ||
*/ | ||
|
||
import Router from 'express-promise-router'; | ||
import { | ||
createServiceBuilder, | ||
loadBackendConfig, | ||
getRootLogger, | ||
useHotMemoize, | ||
notFoundHandler, | ||
CacheManager, | ||
DatabaseManager, | ||
HostDiscovery, | ||
UrlReaders, | ||
ServerTokenManager, | ||
} from '@backstage/backend-common'; | ||
import { TaskScheduler } from '@backstage/backend-tasks'; | ||
import { Config } from '@backstage/config'; | ||
import app from './plugins/app'; | ||
import auth from './plugins/auth'; | ||
import catalog from './plugins/catalog'; | ||
import scaffolder from './plugins/scaffolder'; | ||
import proxy from './plugins/proxy'; | ||
import techdocs from './plugins/techdocs'; | ||
import search from './plugins/search'; | ||
import { PluginEnvironment } from './types'; | ||
import { ServerPermissionClient } from '@backstage/plugin-permission-node'; | ||
import { DefaultIdentityClient } from '@backstage/plugin-auth-node'; | ||
import codepipeline from './plugins/codepipeline'; | ||
import codebuild from './plugins/codebuild'; | ||
import ecs from './plugins/ecs'; | ||
|
||
function makeCreateEnv(config: Config) { | ||
const root = getRootLogger(); | ||
const reader = UrlReaders.default({ logger: root, config }); | ||
const discovery = HostDiscovery.fromConfig(config); | ||
const cacheManager = CacheManager.fromConfig(config); | ||
const databaseManager = DatabaseManager.fromConfig(config, { logger: root }); | ||
const tokenManager = ServerTokenManager.noop(); | ||
const taskScheduler = TaskScheduler.fromConfig(config, { databaseManager }); | ||
|
||
const identity = DefaultIdentityClient.create({ | ||
discovery, | ||
}); | ||
const permissions = ServerPermissionClient.fromConfig(config, { | ||
discovery, | ||
tokenManager, | ||
}); | ||
|
||
root.info(`Created UrlReader ${reader}`); | ||
|
||
return (plugin: string): PluginEnvironment => { | ||
const logger = root.child({ type: 'plugin', plugin }); | ||
const database = databaseManager.forPlugin(plugin); | ||
const cache = cacheManager.forPlugin(plugin); | ||
const scheduler = taskScheduler.forPlugin(plugin); | ||
return { | ||
logger, | ||
database, | ||
cache, | ||
config, | ||
reader, | ||
discovery, | ||
tokenManager, | ||
scheduler, | ||
permissions, | ||
identity, | ||
}; | ||
}; | ||
} | ||
|
||
async function main() { | ||
const config = await loadBackendConfig({ | ||
argv: process.argv, | ||
logger: getRootLogger(), | ||
}); | ||
const createEnv = makeCreateEnv(config); | ||
|
||
const catalogEnv = useHotMemoize(module, () => createEnv('catalog')); | ||
const scaffolderEnv = useHotMemoize(module, () => createEnv('scaffolder')); | ||
const authEnv = useHotMemoize(module, () => createEnv('auth')); | ||
const proxyEnv = useHotMemoize(module, () => createEnv('proxy')); | ||
const techdocsEnv = useHotMemoize(module, () => createEnv('techdocs')); | ||
const searchEnv = useHotMemoize(module, () => createEnv('search')); | ||
const appEnv = useHotMemoize(module, () => createEnv('app')); | ||
const codebuildEnv = useHotMemoize(module, () => createEnv('aws-codebuild')); | ||
const codepipelineEnv = useHotMemoize(module, () => | ||
createEnv('aws-codepipeline'), | ||
); | ||
const ecsEnv = useHotMemoize(module, () => createEnv('aws-ecs')); | ||
|
||
const apiRouter = Router(); | ||
apiRouter.use('/catalog', await catalog(catalogEnv)); | ||
apiRouter.use('/scaffolder', await scaffolder(scaffolderEnv)); | ||
apiRouter.use('/auth', await auth(authEnv)); | ||
apiRouter.use('/techdocs', await techdocs(techdocsEnv)); | ||
apiRouter.use('/proxy', await proxy(proxyEnv)); | ||
apiRouter.use('/search', await search(searchEnv)); | ||
apiRouter.use('/aws/codebuild', await codebuild(codebuildEnv)); | ||
apiRouter.use('/aws/codepipeline', await codepipeline(codepipelineEnv)); | ||
apiRouter.use('/aws/ecs', await ecs(ecsEnv)); | ||
|
||
// Add backends ABOVE this line; this 404 handler is the catch-all fallback | ||
apiRouter.use(notFoundHandler()); | ||
|
||
const service = createServiceBuilder(module) | ||
.loadConfig(config) | ||
.addRouter('/api', apiRouter) | ||
.addRouter('', await app(appEnv)); | ||
|
||
await service.start().catch(err => { | ||
console.log(err); | ||
process.exit(1); | ||
}); | ||
} | ||
|
||
module.hot?.accept(); | ||
main().catch(error => { | ||
console.error('Backend failed to start up', error); | ||
process.exit(1); | ||
}); | ||
import { createBackend } from '@backstage/backend-defaults'; | ||
|
||
const backend = createBackend(); | ||
backend.add(import('@backstage/plugin-app-backend/alpha')); | ||
backend.add(import('@backstage/plugin-auth-backend')); | ||
backend.add(import('@backstage/plugin-auth-backend-module-guest-provider')); | ||
backend.add(import('@backstage/plugin-catalog-backend/alpha')); | ||
backend.add( | ||
import('@backstage/plugin-catalog-backend-module-scaffolder-entity-model'), | ||
); | ||
backend.add(import('@backstage/plugin-proxy-backend/alpha')); | ||
backend.add(import('@backstage/plugin-scaffolder-backend/alpha')); | ||
backend.add(import('@backstage/plugin-search-backend/alpha')); | ||
backend.add(import('@backstage/plugin-techdocs-backend/alpha')); | ||
|
||
backend.add(import('@aws/amazon-ecs-plugin-for-backstage-backend')); | ||
backend.add(import('@aws/aws-codebuild-plugin-for-backstage-backend')); | ||
backend.add(import('@aws/aws-codepipeline-plugin-for-backstage-backend')); | ||
backend.add(import('@aws/aws-core-plugin-for-backstage-scaffolder-actions')); | ||
|
||
backend.start(); |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.