Skip to content
This repository was archived by the owner on Feb 20, 2024. It is now read-only.

Commit 9cc0a69

Browse files
author
Ricardo Gomez-Ulmke
authored
Merge pull request #7 from solace-iot-team/feature-about
Feature about
2 parents 3b83fa1 + 70288e1 commit 9cc0a69

File tree

210 files changed

+4212
-1876
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

210 files changed

+4212
-1876
lines changed

.github/workflows/build.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@ on:
1212
branches:
1313
- main
1414
env:
15-
DEBUG_FLAG: ${{ true }}
16-
# DEBUG_FLAG: ${{ false }}
15+
# DEBUG_FLAG: ${{ true }}
16+
DEBUG_FLAG: ${{ false }}
1717
RELEASE_DIR: "release"
1818

1919
jobs:
20-
release:
20+
build:
2121
runs-on: ubuntu-18.04
2222
steps:
2323
- name: Check Auth
24-
if: github.event_name == 'workflow_dispatch' && github.actor != 'ricardojosegomezulmke' && github.actor != '195858'
24+
if: github.event_name == 'workflow_dispatch' && github.actor != 'ricardojosegomezulmke'
2525
run: |
2626
echo "not authorized"
2727
echo '::set-output name=IS_AUTHORIZED::false'

.github/workflows/release.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@ on:
88
release:
99
types: [created]
1010
env:
11-
DEBUG_FLAG: ${{ true }}
12-
# DEBUG_FLAG: ${{ false }}
11+
# DEBUG_FLAG: ${{ true }}
12+
DEBUG_FLAG: ${{ false }}
1313
RELEASE_DIR: "release"
1414

1515
jobs:
1616
release:
1717
runs-on: ubuntu-18.04
1818
steps:
1919
- name: Check Auth
20-
if: github.event_name == 'workflow_dispatch' && github.actor != 'ricardojosegomezulmke' && github.actor != '195858'
20+
if: github.event_name == 'workflow_dispatch' && github.actor != 'ricardojosegomezulmke'
2121
run: |
2222
echo "not authorized"
2323
echo '::set-output name=IS_AUTHORIZED::false'

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
.devel
22
gh-pages
3+
.DS_Store

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11

22
[![integration-test](https://github.com/solace-iot-team/async-apim/actions/workflows/integration-test.yml/badge.svg?branch=main)](https://github.com/solace-iot-team/async-apim/actions/workflows/integration-test.yml)
3+
[![build](https://github.com/solace-iot-team/async-apim/actions/workflows/build.yml/badge.svg)](https://github.com/solace-iot-team/async-apim/actions/workflows/build.yml)
34
[![release](https://github.com/solace-iot-team/async-apim/actions/workflows/release.yml/badge.svg)](https://github.com/solace-iot-team/async-apim/actions/workflows/release.yml)
45

56

ReleaseNotes.md

+37
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,43 @@
22

33
Solace Async API Management.
44

5+
## Version 0.0.27
6+
* [API-M Admin & Developer Portal](https://github.com/solace-iot-team/async-apim/tree/main/apim-portal): 0.0.27
7+
* [API-M Server OpenAPI](https://github.com/solace-iot-team/async-apim/blob/main/apim-server/server/common/api.yml): 0.0.13
8+
* [API-M Server](https://github.com/solace-iot-team/async-apim/tree/main/apim-server): 0.0.8
9+
10+
#### API-M Admin & Developer Portal
11+
**New:**
12+
- **logos**
13+
- separate logos for admin & developer portal, logo switched based on view
14+
- **about info**
15+
- click on logo to see about info
16+
- **health check apim-server**
17+
- healthcheck now includes apim-server
18+
- **handling of health check failures**
19+
- server: auto logout
20+
- connector: disable connector components
21+
22+
**Fixes:**
23+
- **Manage User**
24+
- ability to manage users even without connector available
25+
26+
#### API-M Server OpenAPI
27+
**New:**
28+
- **about**
29+
- get about info
30+
- **monitor/status**
31+
- get the status of the server
32+
33+
#### API-M Server
34+
**New:**
35+
- **about**
36+
- generate about in build phase
37+
- **monitor**
38+
- periodic monitor of DB connection
39+
- **logging**
40+
- added middleware to log API requests & responses
41+
542
## Version 0.0.25
643
* [API-M Admin & Developer Portal](https://github.com/solace-iot-team/async-apim/tree/main/apim-portal): 0.0.25
744
* [API-M Server OpenAPI](https://github.com/solace-iot-team/async-apim/blob/main/apim-server/server/common/api.yml): 0.0.12

apim-portal/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ node_modules
22
_todo*
33
build
44
public/*about.json
5+
working_dir

apim-portal/dev-build.ts

+88-50
Original file line numberDiff line numberDiff line change
@@ -1,86 +1,118 @@
11
import s from 'shelljs';
22
import fs from 'fs';
33
import path from 'path';
4+
import { TAPPortalAbout } from './src/utils/Globals';
5+
import { OpenAPI as ApimConnectorOpenApi } from '@solace-iot-team/apim-connector-openapi-browser';
6+
import { Constants } from './devel/lib/Constants';
7+
48

59
const scriptName: string = path.basename(__filename);
610
const scriptDir: string = path.dirname(__filename);
7-
// files & dirs
8-
const apimPortalDir = `${scriptDir}`;
9-
const outputAdminPortalAboutFile = `${apimPortalDir}/public/admin-portal/about.json`;
10-
const outputDeveloperPortalAboutFile = `${apimPortalDir}/public/developer-portal/about.json`;
11+
12+
const CONSTANTS = new Constants(scriptDir);
1113

1214
// names
1315
const AdminPortalName = 'async-apim-admin-portal';
1416
const AdminPortalDescription = 'Solace Async API Management Admin Portal';
1517
const DeveloperPortalName = 'async-apim-developer-portal';
1618
const DeveloperPortalDescription = 'Solace Async API Management Developer Portal';
17-
const ApimServerOpenApiBrowserPackageName = '@solace-iot-team/apim-server-openapi-browser';
18-
const ApimConnectorOpenApiBrowserPackageName = '@solace-iot-team/apim-connector-openapi-browser';
19-
20-
type TAbout = {
21-
name: string;
22-
description: string;
23-
repository: {
24-
type: string;
25-
url: string;
26-
revision: {
27-
sha1: string
28-
}
29-
},
30-
issues_url: string;
31-
author: string;
32-
license: string;
33-
version: string;
34-
'apim-server-openapi-version': string;
35-
"apim-connector-open-api-version": string;
36-
}
3719

3820
const prepare = () => {
3921
const funcName = 'prepare';
4022
const logName = `${scriptDir}/${scriptName}.${funcName}()`;
4123
console.log(`${logName}: starting ...`);
42-
if(s.rm('-f', outputAdminPortalAboutFile).code !== 0) process.exit(1);
43-
if(s.rm('-f', outputDeveloperPortalAboutFile).code !== 0) process.exit(1);
24+
if(s.rm('-rf', CONSTANTS.WorkingDir).code !== 0) process.exit(1);
25+
if(s.mkdir('-p', CONSTANTS.WorkingDir).code !== 0) process.exit(1);
26+
if(s.rm('-rf', CONSTANTS.OutputGeneratedApimServerOpenApiSrcDir).code !== 0) process.exit(1);
27+
if(s.rm('-f', CONSTANTS.OutputAdminPortalAboutFile).code !== 0) process.exit(1);
28+
if(s.rm('-f', CONSTANTS.OutputDeveloperPortalAboutFile).code !== 0) process.exit(1);
4429
console.log(`${logName}: success.`);
4530
}
4631

47-
const getApimServerOpenApiVersion = (): string => {
48-
const funcName = 'getApimServerOpenApiVersion';
32+
const copyApimServerSourcesToWorkingDir = () => {
33+
const funcName = 'copyApimServerSourcesToWorkingDir';
34+
const logName = `${scriptDir}/${scriptName}.${funcName}()`;
35+
console.log(`${logName}: starting ...`);
36+
37+
console.log(`${logName}: copying apim-server sources to working dir ...`);
38+
if(s.cp('-rf', CONSTANTS.ApimServerDir, CONSTANTS.WorkingDir).code !== 0) process.exit(1);
39+
if(s.rm('-rf', `${CONSTANTS.WorkingApimServerDir}/dist`).code !== 0) process.exit(1);
40+
if(s.rm('-rf', `${CONSTANTS.WorkingApimServerDir}/node_modules`).code !== 0) process.exit(1);
41+
if(s.rm('-rf', `${CONSTANTS.WorkingApimServerDir}/src/*`).code !== 0) process.exit(1);
42+
if(s.rm('-rf', `${CONSTANTS.WorkingApimServerDir}/server/@types`).code !== 0) process.exit(1);
43+
44+
console.log(`${logName}: success.`);
45+
}
46+
47+
const devBuildApimServer = () => {
48+
const funcName = 'devBuildApimServer';
49+
const logName = `${scriptDir}/${scriptName}.${funcName}()`;
50+
console.log(`${logName}: starting ...`);
51+
s.cd(`${CONSTANTS.WorkingApimServerDir}`);
52+
console.log(`${logName}: directory = ${s.exec(`pwd`)}`);
53+
if(s.exec('npm install').code !== 0) process.exit(1);
54+
if(s.exec('npm run dev:build').code !== 0) process.exit(1);
55+
if(s.cd(`${scriptDir}`).code !== 0) process.exit(1);
56+
console.log(`${logName}: success.`);
57+
}
58+
59+
const copyApimServerAssets = () => {
60+
const funcName = 'copyApimServerAssets';
4961
const logName = `${scriptDir}/${scriptName}.${funcName}()`;
62+
63+
const copySrcs = (srcDir: string, outDir: string) => {
64+
console.log(`${logName}: copy ${srcDir}`);
65+
if(s.rm('-rf', `${outDir}`).code !== 0) process.exit(1);
66+
if(s.mkdir('-p', outDir).code !== 0) process.exit(1);
67+
if(s.cp('-r', `${srcDir}/*`, `${outDir}`).code !== 0) process.exit(1);
68+
}
69+
5070
console.log(`${logName}: starting ...`);
51-
const x = s.exec(`npm list ${ApimServerOpenApiBrowserPackageName}`).stdout;
52-
const invalidIdx: number = x.search('invalid');
53-
if(invalidIdx > -1) throw new Error(`${logName}: invalid version of ${ApimServerOpenApiBrowserPackageName} in package.json`);
54-
const idx: number = x.lastIndexOf(ApimServerOpenApiBrowserPackageName);
55-
const y = x.slice(idx).replace(/\s/g, '' );
71+
72+
copySrcs(CONSTANTS.GeneratedApimServerOpenApiSrcDir, CONSTANTS.OutputGeneratedApimServerOpenApiSrcDir);
73+
5674
console.log(`${logName}: success.`);
57-
return y;
5875
}
5976

77+
const getApimServerOpenApiVersion = (): string => {
78+
const funcName = 'getApimServerOpenApiVersion';
79+
const logName = `${scriptDir}/${scriptName}.${funcName}()`;
80+
console.log(`${logName}: starting ...`);
81+
82+
const x = require(`${CONSTANTS.OutputGeneratedApimServerOpenApiSrcDir}/core/OpenAPI.ts`);
83+
return x.OpenAPI.VERSION;
84+
}
85+
6086
const getApimConnectorOpenApiVersion = (): string => {
6187
const funcName = 'getApimConnectorOpenApiVersion';
6288
const logName = `${scriptDir}/${scriptName}.${funcName}()`;
6389
console.log(`${logName}: starting ...`);
64-
const x = s.exec(`npm list ${ApimConnectorOpenApiBrowserPackageName}`).stdout;
65-
const invalidIdx: number = x.search('invalid');
66-
if(invalidIdx > -1) throw new Error(`${logName}: invalid version of ${ApimConnectorOpenApiBrowserPackageName} in package.json`);
67-
const idx: number = x.lastIndexOf(ApimConnectorOpenApiBrowserPackageName);
68-
const y = x.slice(idx).replace(/\s/g, '' );
69-
console.log(`${logName}: success.`);
70-
return y;
90+
91+
return ApimConnectorOpenApi.VERSION;
92+
93+
// read from npm package
94+
// const x = s.exec(`npm list ${ApimConnectorOpenApiBrowserPackageName}`).stdout;
95+
// const invalidIdx: number = x.search('invalid');
96+
// if(invalidIdx > -1) throw new Error(`${logName}: invalid version of ${ApimConnectorOpenApiBrowserPackageName} in package.json`);
97+
// const idx: number = x.lastIndexOf(ApimConnectorOpenApiBrowserPackageName);
98+
// const y = x.slice(idx).replace(/\s/g, '' );
99+
// console.log(`${logName}: success.`);
100+
// return y;
71101
}
72102
const buildAbouts = () => {
73103
const funcName = 'buildAbouts';
74104
const logName = `${scriptDir}/${scriptName}.${funcName}()`;
75105

76-
const buildAbout = (name: string, description: string, packageJson: any, sha1: string): TAbout => {
77-
const about: TAbout = {
106+
const buildAbout = (name: string, description: string, packageJson: any, sha1: string): TAPPortalAbout => {
107+
const tsDate = new Date();
108+
const about: TAPPortalAbout = {
78109
name: name,
79110
description: description,
80111
author: packageJson.author,
81112
license: packageJson.license,
82113
version: packageJson.version,
83-
"apim-connector-open-api-version": getApimConnectorOpenApiVersion(),
114+
build_date: tsDate.toUTCString(),
115+
"apim-connector-openapi-version": getApimConnectorOpenApiVersion(),
84116
"apim-server-openapi-version": getApimServerOpenApiVersion(),
85117
repository: {
86118
type: packageJson.repository.type,
@@ -93,7 +125,7 @@ const buildAbouts = () => {
93125
}
94126
return about;
95127
}
96-
const copyAbout = (about: TAbout, outputFile: string) => {
128+
const copyAbout = (about: TAPPortalAbout, outputFile: string) => {
97129
const funcName = 'copyAbout';
98130
const logName = `${scriptDir}/${scriptName}.${funcName}()`;
99131
console.log(`${logName}: starting ...`);
@@ -108,24 +140,30 @@ const buildAbouts = () => {
108140

109141
// func main
110142
console.log(`${logName}: starting ...`);
111-
const packageJsonFile = `${apimPortalDir}/package.json`;
143+
const packageJsonFile = `${CONSTANTS.ApimPortalDir}/package.json`;
112144
const packageJson = require(`${packageJsonFile}`);
113145
const sha1 = s.exec('git rev-parse HEAD').stdout.slice(0, -1);
114-
const adminPortalAbout: TAbout = buildAbout(AdminPortalName, AdminPortalDescription, packageJson, sha1);
146+
const adminPortalAbout: TAPPortalAbout = buildAbout(AdminPortalName, AdminPortalDescription, packageJson, sha1);
115147
console.log(`${logName}: adminPortalAbout = ${JSON.stringify(adminPortalAbout, null, 2)}`);
116-
copyAbout(adminPortalAbout, outputAdminPortalAboutFile);
117-
const developerPortalAbout: TAbout = buildAbout(DeveloperPortalName, DeveloperPortalDescription, packageJson, sha1);
148+
copyAbout(adminPortalAbout, CONSTANTS.OutputAdminPortalAboutFile);
149+
const developerPortalAbout: TAPPortalAbout = buildAbout(DeveloperPortalName, DeveloperPortalDescription, packageJson, sha1);
118150
console.log(`${logName}: developerPortalAbout = ${JSON.stringify(developerPortalAbout, null, 2)}`);
119-
copyAbout(developerPortalAbout, outputDeveloperPortalAboutFile);
151+
copyAbout(developerPortalAbout, CONSTANTS.OutputDeveloperPortalAboutFile);
120152
console.log(`${logName}: success.`);
121153
}
122154

123155
const main = () => {
124156
const funcName = 'main';
125157
const logName = `${scriptDir}/${scriptName}.${funcName}()`;
126158
console.log(`${logName}: starting ...`);
159+
CONSTANTS.log();
160+
127161
prepare();
162+
copyApimServerSourcesToWorkingDir();
163+
devBuildApimServer();
164+
copyApimServerAssets();
128165
buildAbouts();
166+
129167
console.log(`${logName}: success.`);
130168
}
131169

apim-portal/devel/README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,20 @@ apim-connector-system/stop.system.sh
1616
## Start Devel Portal
1717
````bash
1818
npm install
19+
npm run dev-build
1920
````
2021
````bash
21-
# react script
22+
# start portal with react script
2223
npm start
2324
````
2425
````bash
25-
# static server
26+
# start portal with static server
2627
npm run build
2728
npm install -g serve
2829
serve -s build
2930
````
3031

31-
32-
## Using APIM Server OpenAPI from Local Release
32+
<!-- ## Using APIM Server OpenAPI from Local Release
3333
````bash
3434
cd async-apim/release/apim-server-openapi/apim-server-openapi-browser
3535
# create link in global node_modules
@@ -56,7 +56,7 @@ cd async-apim/apim-portal
5656
npm unlink --no-save @solace-iot-team/apim-server-openapi-browser
5757
# NOTE: now install the released package
5858
npm install
59-
````
59+
```` -->
6060

6161
## Using Connector OpenAPI from Local Release
6262

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*
2+
!.gitignore

apim-portal/devel/apim-connector-system/docker.compose.yml

+4-30
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ services:
44
container_name: apim-devel-connector-mongodb
55
image : mongo:5.0.2
66
volumes:
7-
- mongodbdata:/data/db
7+
- ./docker-volumes/apim-connector-mongodb-data:/data/db
88
restart: unless-stopped
99
apim-devel-connector:
1010
container_name: ${APIM_PORTAL_CONNECTOR_CONTAINER_NAME}
@@ -30,32 +30,6 @@ services:
3030
- AUTH_VERIFICATION_AUD="0oancf26sFegoXz8l5d6"
3131
- AUTH_DISCOVERY_OIDC_URL=https://dev-1.okta.com/x/oauth2/default/.well-known/openid-configuration
3232
# - APIS_PROXY_MODE=false
33-
apim-devel-demo-portal:
34-
container_name: apim-devel-demo-portal
35-
links:
36-
- apim-devel-connector
37-
image: "solaceiotteam/apim-demo-portal:latest"
38-
ports:
39-
- 9096:8090
40-
volumes:
41-
- ./docker-volumes/demo-portal:/data/apim-demo-portal
42-
restart: unless-stopped
43-
environment:
44-
#sammode=dev disables login screen
45-
- sammode=prod
46-
#url of apim-connector
47-
- solace_spa_url=http://apim-devel-connector:3000/v1
48-
#user-name of platform api (as defined in organization_users.json)
49-
- solace_spa_user=apim-portal-service-admin
50-
#user-password of platform api (as defined in organization_users.json)
51-
- solace_spa_password=Solace123!
52-
#admin-name of platform api
53-
- solace_spa_adminuser=apim-portal-service-admin
54-
#admin-password of platform api
55-
- solace_spa_adminpassword=Solace123!
56-
#login name of portal
57-
- solace_portal_login_user=portal_user
58-
#password of portal
59-
- solace_portal_login_password=portal_user_123!
60-
volumes:
61-
mongodbdata:
33+
34+
##
35+
# The End.

0 commit comments

Comments
 (0)