Merge pull request #8071 from backstage/feat/change-default-port

Change default port of backend from 7000 to 7007
This commit is contained in:
Fredrik Adelöw
2021-11-22 15:58:48 +01:00
committed by GitHub
77 changed files with 171 additions and 137 deletions
@@ -14,7 +14,7 @@
* limitations under the License.
*/
const API_ENDPOINT = 'http://localhost:7000/api/search/query';
const API_ENDPOINT = 'http://localhost:7007/api/search/query';
describe('SearchPage', () => {
describe('Given a search context with a term, results, and filter values', () => {
+3 -3
View File
@@ -27,14 +27,14 @@ describe('App', () => {
data: {
app: {
title: 'Test',
support: { url: 'http://localhost:7000/support' },
support: { url: 'http://localhost:7007/support' },
},
backend: { baseUrl: 'http://localhost:7000' },
backend: { baseUrl: 'http://localhost:7007' },
lighthouse: {
baseUrl: 'http://localhost:3003',
},
techdocs: {
storageUrl: 'http://localhost:7000/api/techdocs/static/docs',
storageUrl: 'http://localhost:7007/api/techdocs/static/docs',
},
},
context: 'test',
@@ -37,7 +37,7 @@ export class SingleHostDiscovery implements PluginEndpointDiscovery {
* for the internal one.
*
* The basePath defaults to `/api`, meaning the default full internal
* path for the `catalog` plugin will be `http://localhost:7000/api/catalog`.
* path for the `catalog` plugin will be `http://localhost:7007/api/catalog`.
*/
static fromConfig(config: Config, options?: { basePath?: string }) {
const basePath = options?.basePath ?? '/api';
@@ -40,7 +40,7 @@ import {
} from './config';
import { createHttpServer, createHttpsServer } from './hostFactory';
export const DEFAULT_PORT = 7000;
export const DEFAULT_PORT = 7007;
// '' is express default, which listens to all interfaces
const DEFAULT_HOST = '';
// taken from the helmet source code - don't seem to be exported
@@ -63,8 +63,8 @@ type CustomOrigin = (
* @example
* ```json
* {
* baseUrl: "http://localhost:7000",
* listen: "0.0.0.0:7000"
* baseUrl: "http://localhost:7007",
* listen: "0.0.0.0:7007"
* }
* ```
*/
+1 -1
View File
@@ -34,7 +34,7 @@ export type ServiceBuilder = {
*
* If no port is specified, the service will first look for an environment
* variable named PORT and use that if present, otherwise it picks a default
* port (7000).
* port (7007).
*
* @param port - The port to listen on
*/
+1 -1
View File
@@ -37,7 +37,7 @@ Substitute `x` for actual values, or leave them as
dummy values just to try out the backend without using the auth or sentry features.
You can also, instead of using dummy values for a huge number of environment variables, remove those config directly from app-config.yaml file located in the root folder.
The backend starts up on port 7000 per default.
The backend starts up on port 7007 per default.
### Debugging
@@ -18,7 +18,7 @@ import { getRootLogger } from '@backstage/backend-common';
import yn from 'yn';
import { startStandaloneServer } from './service/standaloneServer';
const port = process.env.PLUGIN_PORT ? Number(process.env.PLUGIN_PORT) : 7000;
const port = process.env.PLUGIN_PORT ? Number(process.env.PLUGIN_PORT) : 7007;
const enableCors = yn(process.env.PLUGIN_CORS, { default: false });
const logger = getRootLogger();
@@ -26,10 +26,10 @@ describe('UrlPatternDiscovery', () => {
it('should use a plain pattern', async () => {
const discoveryApi = UrlPatternDiscovery.compile(
'http://localhost:7000/{{ pluginId }}',
'http://localhost:7007/{{ pluginId }}',
);
await expect(discoveryApi.getBaseUrl('my-plugin')).resolves.toBe(
'http://localhost:7000/my-plugin',
'http://localhost:7007/my-plugin',
);
});
@@ -30,7 +30,7 @@ export class UrlPatternDiscovery implements DiscoveryApi {
* interpolation done for the template is to replace instances of `{{pluginId}}`
* with the ID of the plugin being requested.
*
* Example pattern: `http://localhost:7000/api/{{ pluginId }}`
* Example pattern: `http://localhost:7007/api/{{ pluginId }}`
*/
static compile(pattern: string): UrlPatternDiscovery {
const parts = pattern.split(/\{\{\s*pluginId\s*\}\}/);
@@ -1,8 +1,8 @@
app:
# Should be the same as backend.baseUrl when using the `app-backend` plugin
baseUrl: http://localhost:7000
baseUrl: http://localhost:7007
backend:
baseUrl: http://localhost:7000
baseUrl: http://localhost:7007
listen:
port: 7000
port: 7007
@@ -6,9 +6,9 @@ organization:
name: My Company
backend:
baseUrl: http://localhost:7000
baseUrl: http://localhost:7007
listen:
port: 7000
port: 7007
csp:
connect-src: ["'self'", 'http:', 'https:']
# Content-Security-Policy directives follow the Helmet format: https://helmetjs.github.io/#reference
@@ -10,9 +10,9 @@ describe('App', () => {
{
data: {
app: { title: 'Test' },
backend: { baseUrl: 'http://localhost:7000' },
backend: { baseUrl: 'http://localhost:7007' },
techdocs: {
storageUrl: 'http://localhost:7000/api/techdocs/static/docs',
storageUrl: 'http://localhost:7007/api/techdocs/static/docs',
},
},
context: 'test',
@@ -36,7 +36,7 @@ yarn start
Substitute `x` for actual values, or leave them as dummy values just to try out
the backend without using the auth or sentry features.
The backend starts up on port 7000 per default.
The backend starts up on port 7007 per default.
## Populating The Catalog
+1 -1
View File
@@ -471,7 +471,7 @@ async function testBackendStart(appDir: string, isPostgres: boolean) {
print('Try to fetch entities from the backend');
// Try fetch entities, should be ok
await fetch('http://localhost:7000/api/catalog/entities').then(res =>
await fetch('http://localhost:7007/api/catalog/entities').then(res =>
res.json(),
);
print('Entities fetched successfully');
@@ -5,8 +5,8 @@ app:
baseUrl: http://localhost:3000
backend:
baseUrl: http://localhost:7000
baseUrl: http://localhost:7007
techdocs:
builder: 'external'
requestUrl: http://localhost:7000/api
requestUrl: http://localhost:7007/api
@@ -26,9 +26,9 @@ describe('App', () => {
{
data: {
app: { title: 'Test' },
backend: { baseUrl: 'http://localhost:7000' },
backend: { baseUrl: 'http://localhost:7007' },
techdocs: {
storageUrl: 'http://localhost:7000/api/techdocs/static/docs',
storageUrl: 'http://localhost:7007/api/techdocs/static/docs',
},
},
context: 'test',
+6 -6
View File
@@ -50,7 +50,7 @@ const oauthRequestApi = builder.add(
builder.add(
googleAuthApiRef,
GoogleAuth.create({
apiOrigin: 'http://localhost:7000',
apiOrigin: 'http://localhost:7007',
basePath: '/auth/',
oauthRequestApi,
}),
@@ -59,7 +59,7 @@ builder.add(
builder.add(
githubAuthApiRef,
GithubAuth.create({
apiOrigin: 'http://localhost:7000',
apiOrigin: 'http://localhost:7007',
basePath: '/auth/',
oauthRequestApi,
}),
@@ -68,7 +68,7 @@ builder.add(
builder.add(
gitlabAuthApiRef,
GitlabAuth.create({
apiOrigin: 'http://localhost:7000',
apiOrigin: 'http://localhost:7007',
basePath: '/auth/',
oauthRequestApi,
}),
@@ -77,7 +77,7 @@ builder.add(
builder.add(
oktaAuthApiRef,
OktaAuth.create({
apiOrigin: 'http://localhost:7000',
apiOrigin: 'http://localhost:7007',
basePath: '/auth/',
oauthRequestApi,
}),
@@ -86,7 +86,7 @@ builder.add(
builder.add(
auth0AuthApiRef,
Auth0Auth.create({
apiOrigin: 'http://localhost:7000',
apiOrigin: 'http://localhost:7007',
basePath: '/auth/',
oauthRequestApi,
}),
@@ -95,7 +95,7 @@ builder.add(
builder.add(
oauth2ApiRef,
OAuth2.create({
apiOrigin: 'http://localhost:7000',
apiOrigin: 'http://localhost:7007',
basePath: '/auth/',
oauthRequestApi,
}),
@@ -36,7 +36,7 @@ export default async function serve(cmd: Command) {
// a backstage app, we define app.baseUrl in the app-config.yaml.
// Hence, it is complicated to make this configurable.
const backstagePort = 3000;
const backstageBackendPort = 7000;
const backstageBackendPort = 7007;
const mkdocsDockerAddr = `http://0.0.0.0:${cmd.mkdocsPort}`;
const mkdocsLocalAddr = `http://127.0.0.1:${cmd.mkdocsPort}`;
@@ -55,9 +55,9 @@ export class PublisherConfig {
return new ConfigReader({
// This backend config is not used at all. Just something needed a create a mock discovery instance.
backend: {
baseUrl: 'http://localhost:7000',
baseUrl: 'http://localhost:7007',
listen: {
port: 7000,
port: 7007,
},
},
techdocs: {
+1 -1
View File
@@ -865,7 +865,7 @@
Based on the config `techdocs.publisher.type`, the publisher could be either Local publisher or Google Cloud Storage publisher.
4. `techdocs.storageUrl` is now a required config. Should be `http://localhost:7000/api/techdocs/static/docs` in most setups.
4. `techdocs.storageUrl` is now a required config. Should be `http://localhost:7007/api/techdocs/static/docs` in most setups.
5. Parts of `@backstage/plugin-techdocs-backend` have been moved to a new package `@backstage/techdocs-common` to generate docs. Also to publish docs
to-and-fro between TechDocs and a storage (either local or external). However, a Backstage app does NOT need to import the `techdocs-common` package -
@@ -54,7 +54,7 @@ const createPublisherFromConfig = ({
} = {}) => {
const mockConfig = new ConfigReader({
techdocs: {
requestUrl: 'http://localhost:7000',
requestUrl: 'http://localhost:7007',
publisher: {
type: 'awsS3',
awsS3: {
@@ -51,7 +51,7 @@ const createPublisherFromConfig = ({
} = {}) => {
const config = new ConfigReader({
techdocs: {
requestUrl: 'http://localhost:7000',
requestUrl: 'http://localhost:7007',
publisher: {
type: 'azureBlobStorage',
azureBlobStorage: {
@@ -52,7 +52,7 @@ const createPublisherFromConfig = ({
} = {}) => {
const config = new ConfigReader({
techdocs: {
requestUrl: 'http://localhost:7000',
requestUrl: 'http://localhost:7007',
publisher: {
type: 'googleGcs',
googleGcs: {
@@ -39,7 +39,7 @@ const createMockEntity = (annotations = {}, lowerCase = false) => {
};
const testDiscovery: jest.Mocked<PluginEndpointDiscovery> = {
getBaseUrl: jest.fn().mockResolvedValue('http://localhost:7000/api/techdocs'),
getBaseUrl: jest.fn().mockResolvedValue('http://localhost:7007/api/techdocs'),
getExternalBaseUrl: jest.fn(),
};
@@ -84,7 +84,7 @@ beforeEach(() => {
mockFs.restore();
const mockConfig = new ConfigReader({
techdocs: {
requestUrl: 'http://localhost:7000',
requestUrl: 'http://localhost:7007',
publisher: {
type: 'openStackSwift',
openStackSwift: {
@@ -114,7 +114,7 @@ describe('OpenStackSwiftPublish', () => {
it('should reject incorrect config', async () => {
const mockConfig = new ConfigReader({
techdocs: {
requestUrl: 'http://localhost:7000',
requestUrl: 'http://localhost:7007',
publisher: {
type: 'openStackSwift',
openStackSwift: {
@@ -27,7 +27,7 @@ import { OpenStackSwiftPublish } from './openStackSwift';
const logger = getVoidLogger();
const discovery: jest.Mocked<PluginEndpointDiscovery> = {
getBaseUrl: jest.fn().mockResolvedValueOnce('http://localhost:7000'),
getBaseUrl: jest.fn().mockResolvedValueOnce('http://localhost:7007'),
getExternalBaseUrl: jest.fn(),
};
@@ -39,7 +39,7 @@ describe('Publisher', () => {
it('should create local publisher by default', async () => {
const mockConfig = new ConfigReader({
techdocs: {
requestUrl: 'http://localhost:7000',
requestUrl: 'http://localhost:7007',
},
});
@@ -53,7 +53,7 @@ describe('Publisher', () => {
it('should create local publisher from config', async () => {
const mockConfig = new ConfigReader({
techdocs: {
requestUrl: 'http://localhost:7000',
requestUrl: 'http://localhost:7007',
publisher: {
type: 'local',
},
@@ -70,7 +70,7 @@ describe('Publisher', () => {
it('should create google gcs publisher from config', async () => {
const mockConfig = new ConfigReader({
techdocs: {
requestUrl: 'http://localhost:7000',
requestUrl: 'http://localhost:7007',
publisher: {
type: 'googleGcs',
googleGcs: {
@@ -91,7 +91,7 @@ describe('Publisher', () => {
it('should create AWS S3 publisher from config', async () => {
const mockConfig = new ConfigReader({
techdocs: {
requestUrl: 'http://localhost:7000',
requestUrl: 'http://localhost:7007',
publisher: {
type: 'awsS3',
awsS3: {
@@ -115,7 +115,7 @@ describe('Publisher', () => {
it('should create Azure Blob Storage publisher from config', async () => {
const mockConfig = new ConfigReader({
techdocs: {
requestUrl: 'http://localhost:7000',
requestUrl: 'http://localhost:7007',
publisher: {
type: 'azureBlobStorage',
azureBlobStorage: {
@@ -143,7 +143,7 @@ describe('Publisher', () => {
const mockConfig = new ConfigReader({
techdocs: {
requestUrl: 'http://localhost:7000',
requestUrl: 'http://localhost:7007',
publisher: {
type: 'azureBlobStorage',
azureBlobStorage: {
@@ -166,7 +166,7 @@ describe('Publisher', () => {
it('should create Open Stack Swift publisher from config', async () => {
const mockConfig = new ConfigReader({
techdocs: {
requestUrl: 'http://localhost:7000',
requestUrl: 'http://localhost:7007',
publisher: {
type: 'openStackSwift',
openStackSwift: {