diff --git a/.gitignore b/.gitignore index e4f7a424..c0de12ca 100644 --- a/.gitignore +++ b/.gitignore @@ -23,6 +23,9 @@ hs_err_pid* .idea/ *.iml +# macOS +.DS_Store + rat.txt # exclude everything diff --git a/CHANGELOG.md b/CHANGELOG.md index 44c4d1df..91616e06 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,29 +1,13 @@ # Changelog -All notable changes to Docker and Docker Compose resources for WSO2 API Management version `4.0.x` in each resource release, will be documented in this file. +All notable changes to Docker and Docker Compose resources for WSO2 API Management version `4.1.x` in each resource release, will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). -## [v4.0.0.4] - 2022-03-10 +## [v4.1.0.0] - 2022-03-23 ### Changed -- Use base OS images as opposed to AdoptOpenJDK images for each corresponding OS flavour (Alpine, CentOS, Ubuntu). -- Use Temurin OpenJDK binaries to build OpenJDK on top of the base OS image. -- Upgrade OpenJDK versions to the latest available versions of Temurin OpenJDK from Adoptium. - -## [v4.0.0.1] - 2021-04-28 - -### Added - -- Alpine, CentOS, and Ubuntu based Docker resources for WSO2 API Manager version `4.0.0`. -- Docker Compose resources for the deployment of WSO2 API Manager `4.0.0` with Choreo Analytics support. -- Docker Compose resources for the deployment of WSO2 API Manager `4.0.0` with Identity Server `5.11.0` as Key Manager and Choreo Analytics support. -- Docker Compose resources for the deployment of WSO2 API Manager `4.0.0` with Micro Integrator `4.0.0`. - -### Changed - -- Upgrade MySQL version used in Docker Compose resources - `5.7.34`. - -### Removed - -- WSO2 API Manager Analytics Dashboard and Worker related Docker Compose resources. +- Update all Docker resources to support WSO2 API Manager version `4.1.0`. +- Update all Docker Compose resources to supprt WSO2 API Manager version `4.1.0`. +- Update Docker Compose resources for the deployment of WSO2 APIM with MI to support Micro Integrator version `4.1.0.0`. +- Update IS extentions to the [latest version](https://repo1.maven.org/maven2/org/wso2/km/ext/wso2is/distribution/1.4.2/) `1.4.2` and mount wso2carbon and client-truststore keystores with the latest wso2carbon certificate in Identity Server as Key Manager with Choreo Analytics deployment setup. diff --git a/README.md b/README.md index 3a1d80f3..49667d5c 100644 --- a/README.md +++ b/README.md @@ -19,4 +19,4 @@ Docker Compose files have been created according to the most common API Manageme to quickly evaluate product features along side their co-operate API Management requirements. The Compose files make use of per profile Docker images of WSO2 API Manager, WSO2 Identity Server as Key Manager, and Micro Integrator as well as MySQL. -**Change log** from previous v3.2.0.3 release: [View Here](https://github.com/wso2/docker-apim/blob/3.2.x/CHANGELOG.md) +**Change log** from previous v4.0.0.4 release: [View Here](https://github.com/wso2/docker-apim/blob/4.0.x/CHANGELOG.md) diff --git a/docker-compose/apim-is-as-km-with-analytics/README.md b/docker-compose/apim-is-as-km-with-analytics/README.md index b1e936c3..8a882d31 100755 --- a/docker-compose/apim-is-as-km-with-analytics/README.md +++ b/docker-compose/apim-is-as-km-with-analytics/README.md @@ -33,7 +33,7 @@ `docker-apim-/docker-compose/apim-is-as-km-with-analytics` folder. > If you intend to try out an already released tag, after executing 2nd step, checkout the relevant tag, - i.e. for example: `git checkout tags/v4.0.0.1`, switch to `docker-compose/apim-is-as-km-with-analytics` folder and continue with below steps. + i.e. for example: `git checkout tags/v4.1.0.1`, switch to `docker-compose/apim-is-as-km-with-analytics` folder and continue with below steps. 4. [Optional] Replace the existing IS extensions with the latest. @@ -43,7 +43,7 @@ You may replace the web app in `docker-compose/apim-is-as-km-with-analytics/dockerfiles/is-as-km/webapps` as defined in step 5. -5. WSO2 no longer provides an on-premise Analytics solution. In order to connect WSO2 API Manager to [Choreo Analytics](https://analytics.choreo.dev/), obtain an `on-prem-key` by following the steps in the [documentation](https://apim.docs.wso2.com/en/4.0.0/observe/api-manager-analytics/configure-analytics/register-for-analytics/). +5. WSO2 no longer provides an on-premise Analytics solution. In order to connect WSO2 API Manager to [Choreo Analytics](https://analytics.choreo.dev/), obtain an `on-prem-key` by following the steps in the [documentation](https://apim.docs.wso2.com/en/4.1.0/observe/api-manager-analytics/configure-analytics/register-for-analytics/). 6. Update the analytics configurations in [deployment.toml](./conf/apim/repository/conf/deployment.toml) with the `on-prem key` obtained. @@ -80,3 +80,5 @@ ``` 9. To see analytics data, log in to [Choreo Analytics](https://analytics.choreo.dev/). + +Note: In order to support the renewed wso2carbon certificate in API Manager, we are mounting wso2carbon and client-truststore keystores with the renewed certificate in the Identity Server. diff --git a/docker-compose/apim-is-as-km-with-analytics/conf/apim/repository/conf/deployment.toml b/docker-compose/apim-is-as-km-with-analytics/conf/apim/repository/conf/deployment.toml index 565eab97..cdcdd306 100755 --- a/docker-compose/apim-is-as-km-with-analytics/conf/apim/repository/conf/deployment.toml +++ b/docker-compose/apim-is-as-km-with-analytics/conf/apim/repository/conf/deployment.toml @@ -39,6 +39,9 @@ password = "wso2carbon" alias = "wso2carbon" key_password = "wso2carbon" +#[keystore.listener_profile] +#bind_address = "0.0.0.0" + #[keystore.primary] #file_name = "wso2carbon.jks" #type = "JKS" @@ -56,6 +59,7 @@ key_password = "wso2carbon" [[apim.gateway.environment]] name = "Default" type = "hybrid" +provider = "wso2" display_in_api_console = true description = "This is a hybrid gateway that handles both production and sandbox token traffic." show_as_token_endpoint_url = true @@ -100,10 +104,10 @@ gateway_labels =["Default"] #[apim.cache.tags] #expiry_time = "2m" -[apim.analytics] -enable = true -config_endpoint = "https://analytics-event-auth.choreo.dev/auth/v1" -auth_token = "" +[apim.analytics] +enable = true +config_endpoint = "https://analytics-event-auth.choreo.dev/auth/v1" +auth_token = "" [apim.key_manager] service_url = "https://is-as-km:9444/services/" @@ -252,14 +256,20 @@ id = "token_revocation" type = "org.wso2.carbon.identity.core.handler.AbstractIdentityHandler" name = "org.wso2.is.notification.ApimOauthEventInterceptor" order = 1 + [event_listener.properties] notification_endpoint = "https://localhost:${mgt.transport.https.port}/internal/data/v1/notify" username = "${admin.username}" password = "${admin.password}" -'header.X-WSO2-KEY-MANAGER' = "default" +'header.X-WSO2-KEY-MANAGER' = "WSO2-IS" + +[oauth.grant_type.token_exchange] +enable = true +allow_refresh_tokens = true +iat_validity_period = "1h" -[config_data] -path = "/_system/apim/config" +[config_data] +path = "/_system/apim/config" -[transport.passthru_https.sender.parameters] +[transport.passthru_https.sender.parameters] HostnameVerifier="AllowAll" diff --git a/docker-compose/apim-is-as-km-with-analytics/conf/is-as-km/repository/resources/security/client-truststore.jks b/docker-compose/apim-is-as-km-with-analytics/conf/is-as-km/repository/resources/security/client-truststore.jks new file mode 100644 index 00000000..a65c507b Binary files /dev/null and b/docker-compose/apim-is-as-km-with-analytics/conf/is-as-km/repository/resources/security/client-truststore.jks differ diff --git a/docker-compose/apim-is-as-km-with-analytics/conf/is-as-km/repository/resources/security/wso2carbon.jks b/docker-compose/apim-is-as-km-with-analytics/conf/is-as-km/repository/resources/security/wso2carbon.jks new file mode 100644 index 00000000..86e6bcad Binary files /dev/null and b/docker-compose/apim-is-as-km-with-analytics/conf/is-as-km/repository/resources/security/wso2carbon.jks differ diff --git a/docker-compose/apim-is-as-km-with-analytics/conf/mysql/scripts/mysql_apim.sql b/docker-compose/apim-is-as-km-with-analytics/conf/mysql/scripts/mysql_apim.sql index 601ed1e4..508d8c80 100644 --- a/docker-compose/apim-is-as-km-with-analytics/conf/mysql/scripts/mysql_apim.sql +++ b/docker-compose/apim-is-as-km-with-analytics/conf/mysql/scripts/mysql_apim.sql @@ -190,7 +190,7 @@ CREATE TABLE IF NOT EXISTS IDN_OAUTH2_DEVICE_FLOW_SCOPES ( CREATE TABLE IF NOT EXISTS IDN_OAUTH2_ACCESS_TOKEN_SCOPE ( TOKEN_ID VARCHAR (255), - TOKEN_SCOPE VARCHAR (60), + TOKEN_SCOPE VARCHAR (100), TENANT_ID INTEGER DEFAULT -1, PRIMARY KEY (TOKEN_ID, TOKEN_SCOPE), FOREIGN KEY (TOKEN_ID) REFERENCES IDN_OAUTH2_ACCESS_TOKEN(TOKEN_ID) ON DELETE CASCADE @@ -1375,9 +1375,10 @@ CREATE TABLE IF NOT EXISTS AM_APPLICATION ( UPDATED_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP, UUID VARCHAR(256), TOKEN_TYPE VARCHAR(10), + ORGANIZATION VARCHAR(100), FOREIGN KEY(SUBSCRIBER_ID) REFERENCES AM_SUBSCRIBER(SUBSCRIBER_ID) ON UPDATE CASCADE ON DELETE RESTRICT, PRIMARY KEY(APPLICATION_ID), - UNIQUE (NAME,SUBSCRIBER_ID), + UNIQUE (NAME,SUBSCRIBER_ID,ORGANIZATION), UNIQUE (UUID) )ENGINE INNODB; @@ -1391,24 +1392,21 @@ CREATE TABLE IF NOT EXISTS AM_API ( CONTEXT_TEMPLATE VARCHAR(256), API_TIER VARCHAR(256), API_TYPE VARCHAR(10), + ORGANIZATION VARCHAR(100), + GATEWAY_VENDOR VARCHAR(100) DEFAULT 'wso2', CREATED_BY VARCHAR(100), CREATED_TIME TIMESTAMP, UPDATED_BY VARCHAR(100), UPDATED_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP, STATUS VARCHAR(30), + LOG_LEVEL VARCHAR(255) DEFAULT 'OFF', REVISIONS_CREATED INTEGER DEFAULT 0, + VERSION_COMPARABLE VARCHAR(15), PRIMARY KEY(API_ID), - UNIQUE (API_PROVIDER,API_NAME,API_VERSION), + UNIQUE (API_PROVIDER,API_NAME,API_VERSION,ORGANIZATION), UNIQUE (API_UUID) )ENGINE INNODB; -CREATE TABLE IF NOT EXISTS AM_API_REVISION_METADATA ( - API_UUID VARCHAR(64), - REVISION_UUID VARCHAR(64), - API_TIER VARCHAR(128), - UNIQUE (API_UUID,REVISION_UUID) -)ENGINE INNODB; - CREATE TABLE IF NOT EXISTS AM_GRAPHQL_COMPLEXITY ( UUID VARCHAR(256), API_ID INTEGER NOT NULL, @@ -1443,7 +1441,7 @@ CREATE TABLE IF NOT EXISTS AM_API_RESOURCE_SCOPE_MAPPING ( CREATE TABLE IF NOT EXISTS AM_SECURITY_AUDIT_UUID_MAPPING ( API_ID INTEGER NOT NULL, AUDIT_UUID VARCHAR(255) NOT NULL, - FOREIGN KEY (API_ID) REFERENCES AM_API(API_ID) ON UPDATE CASCADE ON DELETE RESTRICT, + FOREIGN KEY (API_ID) REFERENCES AM_API(API_ID) ON UPDATE CASCADE ON DELETE CASCADE, PRIMARY KEY (API_ID) )ENGINE INNODB; @@ -1471,8 +1469,8 @@ CREATE TABLE IF NOT EXISTS AM_SUBSCRIPTION ( UPDATED_BY VARCHAR(100), UPDATED_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP, UUID VARCHAR(256), - FOREIGN KEY(APPLICATION_ID) REFERENCES AM_APPLICATION(APPLICATION_ID) ON UPDATE CASCADE ON DELETE RESTRICT, - FOREIGN KEY(API_ID) REFERENCES AM_API(API_ID) ON UPDATE CASCADE ON DELETE RESTRICT, + FOREIGN KEY(APPLICATION_ID) REFERENCES AM_APPLICATION(APPLICATION_ID) ON UPDATE CASCADE ON DELETE CASCADE, + FOREIGN KEY(API_ID) REFERENCES AM_API(API_ID) ON UPDATE CASCADE ON DELETE CASCADE, PRIMARY KEY (SUBSCRIPTION_ID), UNIQUE (UUID) )ENGINE INNODB; @@ -1488,7 +1486,7 @@ CREATE TABLE IF NOT EXISTS AM_APPLICATION_KEY_MAPPING ( CREATE_MODE VARCHAR(30) DEFAULT 'CREATED', KEY_MANAGER VARCHAR(100), APP_INFO BLOB , - FOREIGN KEY(APPLICATION_ID) REFERENCES AM_APPLICATION(APPLICATION_ID) ON UPDATE CASCADE ON DELETE RESTRICT, + FOREIGN KEY(APPLICATION_ID) REFERENCES AM_APPLICATION(APPLICATION_ID) ON UPDATE CASCADE ON DELETE CASCADE, PRIMARY KEY(APPLICATION_ID,KEY_TYPE,KEY_MANAGER) )ENGINE INNODB; @@ -1500,7 +1498,7 @@ CREATE TABLE IF NOT EXISTS AM_API_LC_EVENT ( USER_ID VARCHAR(255) NOT NULL, TENANT_ID INTEGER NOT NULL, EVENT_DATE TIMESTAMP NOT NULL, - FOREIGN KEY(API_ID) REFERENCES AM_API(API_ID) ON UPDATE CASCADE ON DELETE RESTRICT, + FOREIGN KEY(API_ID) REFERENCES AM_API(API_ID) ON UPDATE CASCADE ON DELETE CASCADE, PRIMARY KEY (EVENT_ID) )ENGINE INNODB; @@ -1520,7 +1518,7 @@ CREATE TABLE IF NOT EXISTS AM_API_COMMENTS ( PARENT_COMMENT_ID VARCHAR(64) DEFAULT NULL, ENTRY_POINT VARCHAR(20), CATEGORY VARCHAR(20) DEFAULT 'general', - FOREIGN KEY(API_ID) REFERENCES AM_API(API_ID), + FOREIGN KEY(API_ID) REFERENCES AM_API(API_ID) ON DELETE CASCADE, FOREIGN KEY(PARENT_COMMENT_ID) REFERENCES AM_API_COMMENTS(COMMENT_ID), PRIMARY KEY (COMMENT_ID) )ENGINE INNODB; @@ -1530,7 +1528,7 @@ CREATE TABLE IF NOT EXISTS AM_API_RATINGS ( API_ID INTEGER, RATING INTEGER, SUBSCRIBER_ID INTEGER, - FOREIGN KEY(API_ID) REFERENCES AM_API(API_ID) ON UPDATE CASCADE ON DELETE RESTRICT, + FOREIGN KEY(API_ID) REFERENCES AM_API(API_ID) ON UPDATE CASCADE ON DELETE CASCADE, FOREIGN KEY(SUBSCRIBER_ID) REFERENCES AM_SUBSCRIBER(SUBSCRIBER_ID) ON UPDATE CASCADE ON DELETE RESTRICT, PRIMARY KEY (RATING_ID) )ENGINE INNODB; @@ -1586,7 +1584,7 @@ CREATE TABLE IF NOT EXISTS AM_APPLICATION_REGISTRATION ( KEY_MANAGER VARCHAR(255) NOT NULL, UNIQUE (SUBSCRIBER_ID,APP_ID,TOKEN_TYPE,KEY_MANAGER), FOREIGN KEY(SUBSCRIBER_ID) REFERENCES AM_SUBSCRIBER(SUBSCRIBER_ID) ON UPDATE CASCADE ON DELETE RESTRICT, - FOREIGN KEY(APP_ID) REFERENCES AM_APPLICATION(APPLICATION_ID) ON UPDATE CASCADE ON DELETE RESTRICT, + FOREIGN KEY(APP_ID) REFERENCES AM_APPLICATION(APPLICATION_ID) ON UPDATE CASCADE ON DELETE CASCADE, PRIMARY KEY (REG_ID) )ENGINE INNODB; @@ -1603,6 +1601,7 @@ CREATE TABLE IF NOT EXISTS AM_API_DEFAULT_VERSION ( API_PROVIDER VARCHAR(256) NOT NULL , DEFAULT_API_VERSION VARCHAR(30) , PUBLISHED_DEFAULT_API_VERSION VARCHAR(30) , + ORGANIZATION VARCHAR(100), PRIMARY KEY (DEFAULT_VERSION_ID) )ENGINE = INNODB; @@ -1822,7 +1821,7 @@ ENGINE = InnoDB; CREATE TABLE `AM_BLOCK_CONDITIONS` ( `CONDITION_ID` int(11) NOT NULL AUTO_INCREMENT, `TYPE` varchar(45) DEFAULT NULL, - `VALUE` varchar(512) DEFAULT NULL, + `BLOCK_CONDITION` varchar(512) DEFAULT NULL, `ENABLED` varchar(45) DEFAULT NULL, `DOMAIN` varchar(45) DEFAULT NULL, `UUID` VARCHAR(256), @@ -1878,7 +1877,7 @@ CREATE TABLE IF NOT EXISTS AM_API_LC_PUBLISH_EVENTS ( CREATE TABLE IF NOT EXISTS AM_APPLICATION_ATTRIBUTES ( APPLICATION_ID int(11) NOT NULL, NAME varchar(255) NOT NULL, - VALUE varchar(1024) NOT NULL, + APP_ATTRIBUTE varchar(1024) NOT NULL, TENANT_ID int(11) NOT NULL, PRIMARY KEY (APPLICATION_ID,NAME), FOREIGN KEY (APPLICATION_ID) REFERENCES AM_APPLICATION (APPLICATION_ID) ON DELETE CASCADE ON UPDATE CASCADE @@ -1918,8 +1917,8 @@ CREATE TABLE IF NOT EXISTS AM_API_CATEGORIES ( UUID VARCHAR(50), NAME VARCHAR(255), DESCRIPTION VARCHAR(1024), - TENANT_ID INTEGER DEFAULT -1, - UNIQUE (NAME,TENANT_ID), + ORGANIZATION VARCHAR(100), + UNIQUE (NAME,ORGANIZATION), PRIMARY KEY (UUID) ) ENGINE=InnoDB; @@ -2020,9 +2019,11 @@ CREATE TABLE IF NOT EXISTS AM_KEY_MANAGER ( TYPE VARCHAR(45) NULL, CONFIGURATION BLOB NULL, ENABLED BOOLEAN DEFAULT 1, - TENANT_DOMAIN VARCHAR(100) NULL, + ORGANIZATION VARCHAR(100) NULL, + TOKEN_TYPE VARCHAR(45) NULL, + EXTERNAL_REFERENCE_ID VARCHAR(100) NULL, PRIMARY KEY (UUID), - UNIQUE (NAME,TENANT_DOMAIN) + UNIQUE (NAME,ORGANIZATION) ); -- AM_GW_PUBLISHED_API_DETAILS & AM_GW_API_ARTIFACTS are independent tables for Artifact synchronizer feature which -- @@ -2040,10 +2041,10 @@ CREATE TABLE IF NOT EXISTS AM_GW_PUBLISHED_API_DETAILS ( CREATE TABLE IF NOT EXISTS AM_GW_API_ARTIFACTS ( API_ID VARCHAR(255) NOT NULL, REVISION_ID VARCHAR(255) NOT NULL, - ARTIFACT blob, + ARTIFACT MEDIUMBLOB, TIME_STAMP TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (REVISION_ID, API_ID), - FOREIGN KEY (API_ID) REFERENCES AM_GW_PUBLISHED_API_DETAILS(API_ID) ON UPDATE CASCADE ON DELETE NO ACTION + FOREIGN KEY (API_ID) REFERENCES AM_GW_PUBLISHED_API_DETAILS(API_ID) ON UPDATE CASCADE ON DELETE CASCADE )ENGINE=InnoDB; CREATE TABLE IF NOT EXISTS AM_GW_API_DEPLOYMENTS ( @@ -2052,7 +2053,7 @@ CREATE TABLE IF NOT EXISTS AM_GW_API_DEPLOYMENTS ( LABEL VARCHAR(255) NOT NULL, VHOST VARCHAR(255) NULL, PRIMARY KEY (REVISION_ID, API_ID,LABEL), - FOREIGN KEY (API_ID) REFERENCES AM_GW_PUBLISHED_API_DETAILS(API_ID) ON UPDATE CASCADE ON DELETE NO ACTION + FOREIGN KEY (API_ID) REFERENCES AM_GW_PUBLISHED_API_DETAILS(API_ID) ON UPDATE CASCADE ON DELETE CASCADE ) ENGINE=InnoDB; CREATE TABLE IF NOT EXISTS AM_SCOPE ( @@ -2080,7 +2081,16 @@ CREATE TABLE IF NOT EXISTS AM_REVISION ( CREATED_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP, CREATED_BY VARCHAR(255), PRIMARY KEY (ID, API_UUID), - UNIQUE(REVISION_UUID) + UNIQUE(REVISION_UUID), + FOREIGN KEY (API_UUID) REFERENCES AM_API(API_UUID) ON DELETE CASCADE +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS AM_API_REVISION_METADATA ( + API_UUID VARCHAR(64), + REVISION_UUID VARCHAR(255), + API_TIER VARCHAR(128), + UNIQUE (API_UUID,REVISION_UUID), + FOREIGN KEY(REVISION_UUID) REFERENCES AM_REVISION(REVISION_UUID) ON DELETE CASCADE )ENGINE INNODB; CREATE TABLE IF NOT EXISTS AM_DEPLOYMENT_REVISION_MAPPING ( @@ -2093,15 +2103,25 @@ CREATE TABLE IF NOT EXISTS AM_DEPLOYMENT_REVISION_MAPPING ( FOREIGN KEY (REVISION_UUID) REFERENCES AM_REVISION(REVISION_UUID) ON UPDATE CASCADE ON DELETE CASCADE )ENGINE INNODB; +CREATE TABLE IF NOT EXISTS AM_DEPLOYED_REVISION ( + NAME VARCHAR(255) NOT NULL, + VHOST VARCHAR(255) NULL, + REVISION_UUID VARCHAR(255) NOT NULL, + DEPLOYED_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (NAME, REVISION_UUID), + FOREIGN KEY (REVISION_UUID) REFERENCES AM_REVISION(REVISION_UUID) ON UPDATE CASCADE ON DELETE CASCADE +)ENGINE INNODB; + -- Gateway Environments Table -- CREATE TABLE IF NOT EXISTS AM_GATEWAY_ENVIRONMENT ( ID INTEGER NOT NULL AUTO_INCREMENT, UUID VARCHAR(45) NOT NULL, NAME VARCHAR(255) NOT NULL, - TENANT_DOMAIN VARCHAR(255) NOT NULL, DISPLAY_NAME VARCHAR(255) NULL, DESCRIPTION VARCHAR(1023) NULL, - UNIQUE (NAME, TENANT_DOMAIN), + PROVIDER VARCHAR(255) NOT NULL, + ORGANIZATION VARCHAR(255) NOT NULL, + UNIQUE (NAME, ORGANIZATION), UNIQUE (UUID), PRIMARY KEY (ID) ); @@ -2180,11 +2200,87 @@ CREATE TABLE IF NOT EXISTS AM_WEBHOOKS_UNSUBSCRIPTION ( ADDED_AT TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP )ENGINE INNODB; +CREATE TABLE IF NOT EXISTS AM_API_ENVIRONMENT_KEYS +( + UUID VARCHAR(45) NOT NULL, + ENVIRONMENT_ID VARCHAR(45) NOT NULL, + API_UUID VARCHAR(256) NOT NULL, + PROPERTY_CONFIG BLOB DEFAULT NULL, + UNIQUE (ENVIRONMENT_ID, API_UUID), + FOREIGN KEY (API_UUID) REFERENCES AM_API(API_UUID) ON DELETE CASCADE, + PRIMARY KEY (UUID) +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS AM_OPERATION_POLICY ( + POLICY_UUID VARCHAR(45) NOT NULL, + POLICY_NAME VARCHAR(300) NOT NULL, + POLICY_VERSION VARCHAR(45) DEFAULT 'v1', + DISPLAY_NAME VARCHAR(300) NOT NULL, + POLICY_DESCRIPTION VARCHAR(1024), + APPLICABLE_FLOWS VARCHAR(45) NOT NULL, + GATEWAY_TYPES VARCHAR(45) NOT NULL, + API_TYPES VARCHAR(45) NOT NULL, + POLICY_PARAMETERS blob, + ORGANIZATION VARCHAR(100), + POLICY_CATEGORY VARCHAR(45) NOT NULL, + POLICY_MD5 VARCHAR(45) NOT NULL, + PRIMARY KEY(POLICY_UUID) +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS AM_OPERATION_POLICY_DEFINITION ( + DEFINITION_ID INTEGER AUTO_INCREMENT, + POLICY_UUID VARCHAR(45) NOT NULL, + POLICY_DEFINITION blob NOT NULL, + GATEWAY_TYPE VARCHAR(20) NOT NULL, + DEFINITION_MD5 VARCHAR(45) NOT NULL, + UNIQUE (POLICY_UUID, GATEWAY_TYPE), + FOREIGN KEY (POLICY_UUID) REFERENCES AM_OPERATION_POLICY(POLICY_UUID) ON DELETE CASCADE, + PRIMARY KEY(DEFINITION_ID) +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS AM_COMMON_OPERATION_POLICY ( + COMMON_POLICY_ID INTEGER AUTO_INCREMENT, + POLICY_UUID VARCHAR(45) NOT NULL, + FOREIGN KEY (POLICY_UUID) REFERENCES AM_OPERATION_POLICY(POLICY_UUID) ON DELETE CASCADE, + PRIMARY KEY(COMMON_POLICY_ID) +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS AM_API_OPERATION_POLICY ( + API_SPECIFIC_POLICY_ID INTEGER AUTO_INCREMENT, + POLICY_UUID VARCHAR(45) NOT NULL, + API_UUID VARCHAR(45) NOT NULL, + REVISION_UUID VARCHAR(45), + CLONED_POLICY_UUID VARCHAR(45), + FOREIGN KEY (POLICY_UUID) REFERENCES AM_OPERATION_POLICY(POLICY_UUID) ON DELETE CASCADE, + PRIMARY KEY(API_SPECIFIC_POLICY_ID) +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS AM_API_OPERATION_POLICY_MAPPING ( + OPERATION_POLICY_MAPPING_ID INTEGER AUTO_INCREMENT, + URL_MAPPING_ID INTEGER NOT NULL, + POLICY_UUID VARCHAR(45) NOT NULL, + POLICY_ORDER INTEGER NOT NULL, + DIRECTION VARCHAR(10) NOT NULL, + PARAMETERS VARCHAR(1024) NOT NULL, + FOREIGN KEY (URL_MAPPING_ID) REFERENCES AM_API_URL_MAPPING(URL_MAPPING_ID) ON DELETE CASCADE, + FOREIGN KEY (POLICY_UUID) REFERENCES AM_OPERATION_POLICY(POLICY_UUID) ON DELETE CASCADE, + PRIMARY KEY(OPERATION_POLICY_MAPPING_ID) +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS AM_SYSTEM_CONFIGS +( + ORGANIZATION VARCHAR(100) NOT NULL, + CONFIG_TYPE VARCHAR(100) NOT NULL, + CONFIGURATION BLOB NOT NULL, + PRIMARY KEY (ORGANIZATION,CONFIG_TYPE) +)ENGINE INNODB; + -- Performance indexes start-- create index IDX_ITS_LMT on IDN_THRIFT_SESSION (LAST_MODIFIED_TIME); create index IDX_IOAT_UT on IDN_OAUTH2_ACCESS_TOKEN (USER_TYPE); create index IDX_AAI_CTX on AM_API (CONTEXT); +create index IDX_AAI_ORG on AM_API (ORGANIZATION); create index IDX_AAKM_CK on AM_APPLICATION_KEY_MAPPING (CONSUMER_KEY); create index IDX_AAUM_AI on AM_API_URL_MAPPING (API_ID); create index IDX_AAPM_AI on AM_API_PRODUCT_MAPPING (API_ID); diff --git a/docker-compose/apim-is-as-km-with-analytics/conf/mysql/scripts/mysql_shared.sql b/docker-compose/apim-is-as-km-with-analytics/conf/mysql/scripts/mysql_shared.sql index 38175e10..ac4d541a 100644 --- a/docker-compose/apim-is-as-km-with-analytics/conf/mysql/scripts/mysql_shared.sql +++ b/docker-compose/apim-is-as-km-with-analytics/conf/mysql/scripts/mysql_shared.sql @@ -23,21 +23,18 @@ CREATE TABLE IF NOT EXISTS REG_LOG ( PRIMARY KEY (REG_LOG_ID, REG_TENANT_ID) )ENGINE INNODB; -CREATE INDEX REG_LOG_IND_BY_REGLOG USING HASH ON REG_LOG(REG_LOGGED_TIME, REG_TENANT_ID); - -- The REG_PATH_VALUE should be less than 767 bytes, and hence was fixed at 750. -- See CARBON-5917. CREATE TABLE IF NOT EXISTS REG_PATH( REG_PATH_ID INTEGER NOT NULL AUTO_INCREMENT, - REG_PATH_VALUE VARCHAR(750) CHARACTER SET latin1 COLLATE latin1_general_cs NOT NULL, + REG_PATH_VALUE VARCHAR(750) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL, REG_PATH_PARENT_ID INTEGER, REG_TENANT_ID INTEGER DEFAULT 0, CONSTRAINT PK_REG_PATH PRIMARY KEY(REG_PATH_ID, REG_TENANT_ID), CONSTRAINT UNIQUE_REG_PATH_TENANT_ID UNIQUE (REG_PATH_VALUE,REG_TENANT_ID) )ENGINE INNODB; -CREATE INDEX REG_PATH_IND_BY_PATH_PARENT_ID USING HASH ON REG_PATH(REG_PATH_PARENT_ID, REG_TENANT_ID); CREATE TABLE IF NOT EXISTS REG_CONTENT ( REG_CONTENT_ID INTEGER NOT NULL AUTO_INCREMENT, @@ -56,7 +53,7 @@ CREATE TABLE IF NOT EXISTS REG_CONTENT_HISTORY ( CREATE TABLE IF NOT EXISTS REG_RESOURCE ( REG_PATH_ID INTEGER NOT NULL, - REG_NAME VARCHAR(256), + REG_NAME VARCHAR(256) CHARACTER SET latin1 COLLATE latin1_bin, REG_VERSION INTEGER NOT NULL AUTO_INCREMENT, REG_MEDIA_TYPE VARCHAR(500), REG_CREATOR VARCHAR(255) NOT NULL, @@ -70,13 +67,6 @@ CREATE TABLE IF NOT EXISTS REG_RESOURCE ( CONSTRAINT PK_REG_RESOURCE PRIMARY KEY(REG_VERSION, REG_TENANT_ID) )ENGINE INNODB; -ALTER TABLE REG_RESOURCE ADD CONSTRAINT REG_RESOURCE_FK_BY_PATH_ID FOREIGN KEY (REG_PATH_ID, REG_TENANT_ID) REFERENCES REG_PATH (REG_PATH_ID, REG_TENANT_ID); -ALTER TABLE REG_RESOURCE ADD CONSTRAINT REG_RESOURCE_FK_BY_CONTENT_ID FOREIGN KEY (REG_CONTENT_ID, REG_TENANT_ID) REFERENCES REG_CONTENT (REG_CONTENT_ID, REG_TENANT_ID); -CREATE INDEX REG_RESOURCE_IND_BY_NAME USING HASH ON REG_RESOURCE(REG_NAME, REG_TENANT_ID); -CREATE INDEX REG_RESOURCE_IND_BY_PATH_ID_NAME USING HASH ON REG_RESOURCE(REG_PATH_ID, REG_NAME, REG_TENANT_ID); -CREATE INDEX REG_RESOURCE_IND_BY_UUID USING HASH ON REG_RESOURCE(REG_UUID); -CREATE INDEX REG_RESOURCE_IND_BY_TENAN USING HASH ON REG_RESOURCE(REG_TENANT_ID, REG_UUID); -CREATE INDEX REG_RESOURCE_IND_BY_TYPE USING HASH ON REG_RESOURCE(REG_TENANT_ID, REG_MEDIA_TYPE); CREATE TABLE IF NOT EXISTS REG_RESOURCE_HISTORY ( REG_PATH_ID INTEGER NOT NULL, @@ -95,10 +85,6 @@ CREATE TABLE IF NOT EXISTS REG_RESOURCE_HISTORY ( CONSTRAINT PK_REG_RESOURCE_HISTORY PRIMARY KEY(REG_VERSION, REG_TENANT_ID) )ENGINE INNODB; -ALTER TABLE REG_RESOURCE_HISTORY ADD CONSTRAINT REG_RESOURCE_HIST_FK_BY_PATHID FOREIGN KEY (REG_PATH_ID, REG_TENANT_ID) REFERENCES REG_PATH (REG_PATH_ID, REG_TENANT_ID); -ALTER TABLE REG_RESOURCE_HISTORY ADD CONSTRAINT REG_RESOURCE_HIST_FK_BY_CONTENT_ID FOREIGN KEY (REG_CONTENT_ID, REG_TENANT_ID) REFERENCES REG_CONTENT_HISTORY (REG_CONTENT_ID, REG_TENANT_ID); -CREATE INDEX REG_RESOURCE_HISTORY_IND_BY_NAME USING HASH ON REG_RESOURCE_HISTORY(REG_NAME, REG_TENANT_ID); -CREATE INDEX REG_RESOURCE_HISTORY_IND_BY_PATH_ID_NAME USING HASH ON REG_RESOURCE(REG_PATH_ID, REG_NAME, REG_TENANT_ID); CREATE TABLE IF NOT EXISTS REG_COMMENT ( REG_ID INTEGER NOT NULL AUTO_INCREMENT, @@ -110,17 +96,15 @@ CREATE TABLE IF NOT EXISTS REG_COMMENT ( )ENGINE INNODB; CREATE TABLE IF NOT EXISTS REG_RESOURCE_COMMENT ( + REG_RESOURCE_COMMENT_ID INTEGER NOT NULL AUTO_INCREMENT, REG_COMMENT_ID INTEGER NOT NULL, REG_VERSION INTEGER, REG_PATH_ID INTEGER, REG_RESOURCE_NAME VARCHAR(256), - REG_TENANT_ID INTEGER DEFAULT 0 + REG_TENANT_ID INTEGER DEFAULT 0, + PRIMARY KEY(REG_RESOURCE_COMMENT_ID) )ENGINE INNODB; -ALTER TABLE REG_RESOURCE_COMMENT ADD CONSTRAINT REG_RESOURCE_COMMENT_FK_BY_PATH_ID FOREIGN KEY (REG_PATH_ID, REG_TENANT_ID) REFERENCES REG_PATH (REG_PATH_ID, REG_TENANT_ID); -ALTER TABLE REG_RESOURCE_COMMENT ADD CONSTRAINT REG_RESOURCE_COMMENT_FK_BY_COMMENT_ID FOREIGN KEY (REG_COMMENT_ID, REG_TENANT_ID) REFERENCES REG_COMMENT (REG_ID, REG_TENANT_ID); -CREATE INDEX REG_RESOURCE_COMMENT_IND_BY_PATH_ID_AND_RESOURCE_NAME USING HASH ON REG_RESOURCE_COMMENT(REG_PATH_ID, REG_RESOURCE_NAME, REG_TENANT_ID); -CREATE INDEX REG_RESOURCE_COMMENT_IND_BY_VERSION USING HASH ON REG_RESOURCE_COMMENT(REG_VERSION, REG_TENANT_ID); CREATE TABLE IF NOT EXISTS REG_RATING ( REG_ID INTEGER NOT NULL AUTO_INCREMENT, @@ -132,17 +116,15 @@ CREATE TABLE IF NOT EXISTS REG_RATING ( )ENGINE INNODB; CREATE TABLE IF NOT EXISTS REG_RESOURCE_RATING ( + REG_RESOURCE_RATING_ID INTEGER NOT NULL AUTO_INCREMENT, REG_RATING_ID INTEGER NOT NULL, REG_VERSION INTEGER, REG_PATH_ID INTEGER, REG_RESOURCE_NAME VARCHAR(256), - REG_TENANT_ID INTEGER DEFAULT 0 + REG_TENANT_ID INTEGER DEFAULT 0, + PRIMARY KEY(REG_RESOURCE_RATING_ID) )ENGINE INNODB; -ALTER TABLE REG_RESOURCE_RATING ADD CONSTRAINT REG_RESOURCE_RATING_FK_BY_PATH_ID FOREIGN KEY (REG_PATH_ID, REG_TENANT_ID) REFERENCES REG_PATH (REG_PATH_ID, REG_TENANT_ID); -ALTER TABLE REG_RESOURCE_RATING ADD CONSTRAINT REG_RESOURCE_RATING_FK_BY_RATING_ID FOREIGN KEY (REG_RATING_ID, REG_TENANT_ID) REFERENCES REG_RATING (REG_ID, REG_TENANT_ID); -CREATE INDEX REG_RESOURCE_RATING_IND_BY_PATH_ID_AND_RESOURCE_NAME USING HASH ON REG_RESOURCE_RATING(REG_PATH_ID, REG_RESOURCE_NAME, REG_TENANT_ID); -CREATE INDEX REG_RESOURCE_RATING_IND_BY_VERSION USING HASH ON REG_RESOURCE_RATING(REG_VERSION, REG_TENANT_ID); CREATE TABLE IF NOT EXISTS REG_TAG ( @@ -155,17 +137,20 @@ CREATE TABLE IF NOT EXISTS REG_TAG ( )ENGINE INNODB; CREATE TABLE IF NOT EXISTS REG_RESOURCE_TAG ( + REG_RESOURCE_TAG_ID INTEGER NOT NULL AUTO_INCREMENT, REG_TAG_ID INTEGER NOT NULL, REG_VERSION INTEGER, REG_PATH_ID INTEGER, REG_RESOURCE_NAME VARCHAR(256), - REG_TENANT_ID INTEGER DEFAULT 0 + REG_TENANT_ID INTEGER DEFAULT 0, + PRIMARY KEY(REG_RESOURCE_TAG_ID) )ENGINE INNODB; ALTER TABLE REG_RESOURCE_TAG ADD CONSTRAINT REG_RESOURCE_TAG_FK_BY_PATH_ID FOREIGN KEY (REG_PATH_ID, REG_TENANT_ID) REFERENCES REG_PATH (REG_PATH_ID, REG_TENANT_ID); ALTER TABLE REG_RESOURCE_TAG ADD CONSTRAINT REG_RESOURCE_TAG_FK_BY_TAG_ID FOREIGN KEY (REG_TAG_ID, REG_TENANT_ID) REFERENCES REG_TAG (REG_ID, REG_TENANT_ID); CREATE INDEX REG_RESOURCE_TAG_IND_BY_PATH_ID_AND_RESOURCE_NAME USING HASH ON REG_RESOURCE_TAG(REG_PATH_ID, REG_RESOURCE_NAME, REG_TENANT_ID); CREATE INDEX REG_RESOURCE_TAG_IND_BY_VERSION USING HASH ON REG_RESOURCE_TAG(REG_VERSION, REG_TENANT_ID); +CREATE INDEX REG_RESOURCE_TAG_IND_BY_REG_TAG_ID USING HASH ON REG_RESOURCE_TAG(REG_TAG_ID, REG_TENANT_ID); CREATE TABLE IF NOT EXISTS REG_PROPERTY ( REG_ID INTEGER NOT NULL AUTO_INCREMENT, @@ -176,17 +161,20 @@ CREATE TABLE IF NOT EXISTS REG_PROPERTY ( )ENGINE INNODB; CREATE TABLE IF NOT EXISTS REG_RESOURCE_PROPERTY ( + REG_RESOURCE_PROPERTY_ID INTEGER NOT NULL AUTO_INCREMENT, REG_PROPERTY_ID INTEGER NOT NULL, REG_VERSION INTEGER, REG_PATH_ID INTEGER, REG_RESOURCE_NAME VARCHAR(256), - REG_TENANT_ID INTEGER DEFAULT 0 + REG_TENANT_ID INTEGER DEFAULT 0, + PRIMARY KEY(REG_RESOURCE_PROPERTY_ID) )ENGINE INNODB; ALTER TABLE REG_RESOURCE_PROPERTY ADD CONSTRAINT REG_RESOURCE_PROPERTY_FK_BY_PATH_ID FOREIGN KEY (REG_PATH_ID, REG_TENANT_ID) REFERENCES REG_PATH (REG_PATH_ID, REG_TENANT_ID); ALTER TABLE REG_RESOURCE_PROPERTY ADD CONSTRAINT REG_RESOURCE_PROPERTY_FK_BY_TAG_ID FOREIGN KEY (REG_PROPERTY_ID, REG_TENANT_ID) REFERENCES REG_PROPERTY (REG_ID, REG_TENANT_ID); CREATE INDEX REG_RESOURCE_PROPERTY_IND_BY_PATH_ID_AND_RESOURCE_NAME USING HASH ON REG_RESOURCE_PROPERTY(REG_PATH_ID, REG_RESOURCE_NAME, REG_TENANT_ID); CREATE INDEX REG_RESOURCE_PROPERTY_IND_BY_VERSION USING HASH ON REG_RESOURCE_PROPERTY(REG_VERSION, REG_TENANT_ID); +CREATE INDEX REG_RESOURCE_PROPERTY_IND_BY_REG_PROP_ID ON REG_RESOURCE_PROPERTY(REG_TENANT_ID, REG_PROPERTY_ID); -- CREATE TABLE IF NOT EXISTS REG_ASSOCIATIONS ( -- SRC_PATH_ID INTEGER, @@ -196,13 +184,7 @@ CREATE INDEX REG_RESOURCE_PROPERTY_IND_BY_VERSION USING HASH ON REG_RESOURCE_PRO -- TGT_RESOURCE_NAME VARCHAR(256), -- TGT_VERSION INTEGER -- )ENGINE INNODB; --- --- ALTER TABLE REG_ASSOCIATIONS ADD CONSTRAINT REG_ASSOCIATIONS_FK_BY_SRC_PATH_ID FOREIGN KEY (SRC_PATH_ID) REFERENCES REG_PATH (PATH_ID); --- ALTER TABLE REG_ASSOCIATIONS ADD CONSTRAINT REG_ASSOCIATIONS_FK_BY_TGT_PATH_ID FOREIGN KEY (TGT_PATH_ID) REFERENCES REG_PATH (PATH_ID); --- CREATE INDEX REG_ASSOCIATIONS_IND_BY_SRC_VERSION ON REG_ASSOCIATIONS(SRC_VERSION); --- CREATE INDEX REG_ASSOCIATIONS_IND_BY_TGT_VERSION ON REG_ASSOCIATIONS(TGT_VERSION); --- CREATE INDEX REG_ASSOCIATIONS_IND_BY_SRC_RESOURCE_NAME ON REG_ASSOCIATIONS(SRC_RESOURCE_NAME); --- CREATE INDEX REG_ASSOCIATIONS_IND_BY_TGT_RESOURCE_NAME ON REG_ASSOCIATIONS(TGT_RESOURCE_NAME); +-- @@ -224,9 +206,7 @@ CREATE TABLE IF NOT EXISTS REG_SNAPSHOT ( CONSTRAINT PK_REG_SNAPSHOT PRIMARY KEY(REG_SNAPSHOT_ID, REG_TENANT_ID) )ENGINE INNODB; -CREATE INDEX REG_SNAPSHOT_IND_BY_PATH_ID_AND_RESOURCE_NAME USING HASH ON REG_SNAPSHOT(REG_PATH_ID, REG_RESOURCE_NAME, REG_TENANT_ID); -ALTER TABLE REG_SNAPSHOT ADD CONSTRAINT REG_SNAPSHOT_FK_BY_PATH_ID FOREIGN KEY (REG_PATH_ID, REG_TENANT_ID) REFERENCES REG_PATH (REG_PATH_ID, REG_TENANT_ID); -- ################################ @@ -254,44 +234,40 @@ CREATE TABLE UM_DOMAIN( UNIQUE(UM_DOMAIN_NAME,UM_TENANT_ID) )ENGINE INNODB; -CREATE UNIQUE INDEX INDEX_UM_TENANT_UM_DOMAIN_NAME - ON UM_TENANT (UM_DOMAIN_NAME); - -CREATE TABLE UM_USER ( - UM_ID INTEGER NOT NULL AUTO_INCREMENT, +CREATE TABLE UM_USER ( + UM_ID INTEGER NOT NULL AUTO_INCREMENT, UM_USER_ID VARCHAR(255) NOT NULL, UM_USER_NAME VARCHAR(255) NOT NULL, UM_USER_PASSWORD VARCHAR(255) NOT NULL, UM_SALT_VALUE VARCHAR(31), UM_REQUIRE_CHANGE BOOLEAN DEFAULT FALSE, UM_CHANGED_TIME TIMESTAMP NOT NULL, - UM_TENANT_ID INTEGER DEFAULT 0, - PRIMARY KEY (UM_ID, UM_TENANT_ID), + UM_TENANT_ID INTEGER DEFAULT 0, + PRIMARY KEY (UM_ID, UM_TENANT_ID), UNIQUE(UM_USER_ID, UM_TENANT_ID) -)ENGINE INNODB; +)ENGINE INNODB; -CREATE TABLE UM_SYSTEM_USER ( - UM_ID INTEGER NOT NULL AUTO_INCREMENT, - UM_USER_NAME VARCHAR(255) NOT NULL, +CREATE TABLE UM_SYSTEM_USER ( + UM_ID INTEGER NOT NULL AUTO_INCREMENT, + UM_USER_NAME VARCHAR(255) NOT NULL, UM_USER_PASSWORD VARCHAR(255) NOT NULL, UM_SALT_VALUE VARCHAR(31), UM_REQUIRE_CHANGE BOOLEAN DEFAULT FALSE, UM_CHANGED_TIME TIMESTAMP NOT NULL, - UM_TENANT_ID INTEGER DEFAULT 0, - PRIMARY KEY (UM_ID, UM_TENANT_ID), + UM_TENANT_ID INTEGER DEFAULT 0, + PRIMARY KEY (UM_ID, UM_TENANT_ID), UNIQUE(UM_USER_NAME, UM_TENANT_ID) )ENGINE INNODB; -CREATE TABLE UM_ROLE ( - UM_ID INTEGER NOT NULL AUTO_INCREMENT, +CREATE TABLE UM_ROLE ( + UM_ID INTEGER NOT NULL AUTO_INCREMENT, UM_ROLE_NAME VARCHAR(255) NOT NULL, - UM_TENANT_ID INTEGER DEFAULT 0, - UM_SHARED_ROLE BOOLEAN DEFAULT FALSE, + UM_TENANT_ID INTEGER DEFAULT 0, + UM_SHARED_ROLE BOOLEAN DEFAULT FALSE, PRIMARY KEY (UM_ID, UM_TENANT_ID), - UNIQUE(UM_ROLE_NAME, UM_TENANT_ID) + UNIQUE(UM_ROLE_NAME, UM_TENANT_ID) )ENGINE INNODB; - CREATE TABLE UM_MODULE( UM_ID INTEGER NOT NULL AUTO_INCREMENT, UM_MODULE_NAME VARCHAR(100), @@ -302,66 +278,59 @@ CREATE TABLE UM_MODULE( CREATE TABLE UM_MODULE_ACTIONS( UM_ACTION VARCHAR(255) NOT NULL, UM_MODULE_ID INTEGER NOT NULL, - PRIMARY KEY(UM_ACTION, UM_MODULE_ID), - FOREIGN KEY (UM_MODULE_ID) REFERENCES UM_MODULE(UM_ID) ON DELETE CASCADE + PRIMARY KEY(UM_ACTION, UM_MODULE_ID) )ENGINE INNODB; -CREATE TABLE UM_PERMISSION ( - UM_ID INTEGER NOT NULL AUTO_INCREMENT, - UM_RESOURCE_ID VARCHAR(255) NOT NULL, - UM_ACTION VARCHAR(255) NOT NULL, - UM_TENANT_ID INTEGER DEFAULT 0, - UM_MODULE_ID INTEGER DEFAULT 0, - UNIQUE(UM_RESOURCE_ID,UM_ACTION, UM_TENANT_ID), +CREATE TABLE UM_PERMISSION ( + UM_ID INTEGER NOT NULL AUTO_INCREMENT, + UM_RESOURCE_ID VARCHAR(255) NOT NULL, + UM_ACTION VARCHAR(255) NOT NULL, + UM_TENANT_ID INTEGER DEFAULT 0, + UM_MODULE_ID INTEGER DEFAULT 0, + UNIQUE(UM_RESOURCE_ID,UM_ACTION, UM_TENANT_ID), PRIMARY KEY (UM_ID, UM_TENANT_ID) -)ENGINE INNODB; +)ENGINE INNODB; -CREATE INDEX INDEX_UM_PERMISSION_UM_RESOURCE_ID_UM_ACTION ON UM_PERMISSION (UM_RESOURCE_ID, UM_ACTION, UM_TENANT_ID); -CREATE TABLE UM_ROLE_PERMISSION ( - UM_ID INTEGER NOT NULL AUTO_INCREMENT, - UM_PERMISSION_ID INTEGER NOT NULL, +CREATE TABLE UM_ROLE_PERMISSION ( + UM_ID INTEGER NOT NULL AUTO_INCREMENT, + UM_PERMISSION_ID INTEGER NOT NULL, UM_ROLE_NAME VARCHAR(255) NOT NULL, - UM_IS_ALLOWED SMALLINT NOT NULL, + UM_IS_ALLOWED SMALLINT NOT NULL, UM_TENANT_ID INTEGER DEFAULT 0, - UM_DOMAIN_ID INTEGER, - UNIQUE (UM_PERMISSION_ID, UM_ROLE_NAME, UM_TENANT_ID, UM_DOMAIN_ID), - FOREIGN KEY (UM_PERMISSION_ID, UM_TENANT_ID) REFERENCES UM_PERMISSION(UM_ID, UM_TENANT_ID) ON DELETE CASCADE, - FOREIGN KEY (UM_DOMAIN_ID, UM_TENANT_ID) REFERENCES UM_DOMAIN(UM_DOMAIN_ID, UM_TENANT_ID) ON DELETE CASCADE, - PRIMARY KEY (UM_ID, UM_TENANT_ID) -)ENGINE INNODB; - --- REMOVED UNIQUE (UM_PERMISSION_ID, UM_ROLE_ID) -CREATE TABLE UM_USER_PERMISSION ( - UM_ID INTEGER NOT NULL AUTO_INCREMENT, - UM_PERMISSION_ID INTEGER NOT NULL, + UM_DOMAIN_ID INTEGER, + UNIQUE (UM_ID, UM_PERMISSION_ID, UM_ROLE_NAME, UM_TENANT_ID, UM_DOMAIN_ID), + PRIMARY KEY (UM_ID, UM_TENANT_ID, UM_DOMAIN_ID) +)ENGINE INNODB; + +-- REMOVED UNIQUE (UM_PERMISSION_ID, UM_ROLE_ID) +CREATE TABLE UM_USER_PERMISSION ( + UM_ID INTEGER NOT NULL AUTO_INCREMENT, + UM_PERMISSION_ID INTEGER NOT NULL, UM_USER_NAME VARCHAR(255) NOT NULL, - UM_IS_ALLOWED SMALLINT NOT NULL, - UM_TENANT_ID INTEGER DEFAULT 0, - FOREIGN KEY (UM_PERMISSION_ID, UM_TENANT_ID) REFERENCES UM_PERMISSION(UM_ID, UM_TENANT_ID) ON DELETE CASCADE, + UM_IS_ALLOWED SMALLINT NOT NULL, + UM_TENANT_ID INTEGER DEFAULT 0, PRIMARY KEY (UM_ID, UM_TENANT_ID) )ENGINE INNODB; --- REMOVED UNIQUE (UM_PERMISSION_ID, UM_USER_ID) -CREATE TABLE UM_USER_ROLE ( - UM_ID INTEGER NOT NULL AUTO_INCREMENT, - UM_ROLE_ID INTEGER NOT NULL, +-- REMOVED UNIQUE (UM_PERMISSION_ID, UM_USER_ID) +CREATE TABLE UM_USER_ROLE ( + UM_ID INTEGER NOT NULL AUTO_INCREMENT, + UM_ROLE_ID INTEGER NOT NULL, UM_USER_ID INTEGER NOT NULL, - UM_TENANT_ID INTEGER DEFAULT 0, - UNIQUE (UM_USER_ID, UM_ROLE_ID, UM_TENANT_ID), - FOREIGN KEY (UM_ROLE_ID, UM_TENANT_ID) REFERENCES UM_ROLE(UM_ID, UM_TENANT_ID), - FOREIGN KEY (UM_USER_ID, UM_TENANT_ID) REFERENCES UM_USER(UM_ID, UM_TENANT_ID), + UM_TENANT_ID INTEGER DEFAULT 0, + UNIQUE (UM_USER_ID, UM_ROLE_ID, UM_TENANT_ID), PRIMARY KEY (UM_ID, UM_TENANT_ID) )ENGINE INNODB; CREATE TABLE UM_SHARED_USER_ROLE( + UM_SHARED_USER_ROLE_ID INTEGER NOT NULL AUTO_INCREMENT, UM_ROLE_ID INTEGER NOT NULL, UM_USER_ID INTEGER NOT NULL, UM_USER_TENANT_ID INTEGER NOT NULL, UM_ROLE_TENANT_ID INTEGER NOT NULL, UNIQUE(UM_USER_ID,UM_ROLE_ID,UM_USER_TENANT_ID, UM_ROLE_TENANT_ID), - FOREIGN KEY(UM_ROLE_ID,UM_ROLE_TENANT_ID) REFERENCES UM_ROLE(UM_ID,UM_TENANT_ID) ON DELETE CASCADE, - FOREIGN KEY(UM_USER_ID,UM_USER_TENANT_ID) REFERENCES UM_USER(UM_ID,UM_TENANT_ID) ON DELETE CASCADE + PRIMARY KEY(UM_SHARED_USER_ROLE_ID) )ENGINE INNODB; CREATE TABLE UM_ACCOUNT_MAPPING( @@ -371,61 +340,53 @@ CREATE TABLE UM_ACCOUNT_MAPPING( UM_USER_STORE_DOMAIN VARCHAR(100), UM_ACC_LINK_ID INTEGER NOT NULL, UNIQUE(UM_USER_NAME, UM_TENANT_ID, UM_USER_STORE_DOMAIN, UM_ACC_LINK_ID), - FOREIGN KEY (UM_TENANT_ID) REFERENCES UM_TENANT(UM_ID) ON DELETE CASCADE, PRIMARY KEY (UM_ID) )ENGINE INNODB; - -CREATE TABLE UM_USER_ATTRIBUTE ( - UM_ID INTEGER NOT NULL AUTO_INCREMENT, - UM_ATTR_NAME VARCHAR(255) NOT NULL, - UM_ATTR_VALUE VARCHAR(1024), - UM_PROFILE_ID VARCHAR(255), - UM_USER_ID INTEGER, - UM_TENANT_ID INTEGER DEFAULT 0, - FOREIGN KEY (UM_USER_ID, UM_TENANT_ID) REFERENCES UM_USER(UM_ID, UM_TENANT_ID), +CREATE TABLE UM_USER_ATTRIBUTE ( + UM_ID INTEGER NOT NULL AUTO_INCREMENT, + UM_ATTR_NAME VARCHAR(255) NOT NULL, + UM_ATTR_VALUE VARCHAR(1024), + UM_PROFILE_ID VARCHAR(255), + UM_USER_ID INTEGER, + UM_TENANT_ID INTEGER DEFAULT 0, PRIMARY KEY (UM_ID, UM_TENANT_ID) -)ENGINE INNODB; +)ENGINE INNODB; -CREATE INDEX UM_USER_ID_INDEX ON UM_USER_ATTRIBUTE(UM_USER_ID); -CREATE INDEX UM_ATTR_NAME_VALUE_INDEX ON UM_USER_ATTRIBUTE(UM_ATTR_NAME, UM_ATTR_VALUE(512)); -CREATE TABLE UM_DIALECT( - UM_ID INTEGER NOT NULL AUTO_INCREMENT, - UM_DIALECT_URI VARCHAR(255) NOT NULL, - UM_TENANT_ID INTEGER DEFAULT 0, - UNIQUE(UM_DIALECT_URI, UM_TENANT_ID), +CREATE TABLE UM_DIALECT( + UM_ID INTEGER NOT NULL AUTO_INCREMENT, + UM_DIALECT_URI VARCHAR(255) NOT NULL, + UM_TENANT_ID INTEGER DEFAULT 0, + UNIQUE(UM_DIALECT_URI, UM_TENANT_ID), PRIMARY KEY (UM_ID, UM_TENANT_ID) -)ENGINE INNODB; - -CREATE TABLE UM_CLAIM( - UM_ID INTEGER NOT NULL AUTO_INCREMENT, - UM_DIALECT_ID INTEGER NOT NULL, - UM_CLAIM_URI VARCHAR(255) NOT NULL, - UM_DISPLAY_TAG VARCHAR(255), - UM_DESCRIPTION VARCHAR(255), - UM_MAPPED_ATTRIBUTE_DOMAIN VARCHAR(255), - UM_MAPPED_ATTRIBUTE VARCHAR(255), - UM_REG_EX VARCHAR(255), - UM_SUPPORTED SMALLINT, - UM_REQUIRED SMALLINT, +)ENGINE INNODB; + +CREATE TABLE UM_CLAIM( + UM_ID INTEGER NOT NULL AUTO_INCREMENT, + UM_DIALECT_ID INTEGER NOT NULL, + UM_CLAIM_URI VARCHAR(255) NOT NULL, + UM_DISPLAY_TAG VARCHAR(255), + UM_DESCRIPTION VARCHAR(255), + UM_MAPPED_ATTRIBUTE_DOMAIN VARCHAR(255), + UM_MAPPED_ATTRIBUTE VARCHAR(255), + UM_REG_EX VARCHAR(255), + UM_SUPPORTED SMALLINT, + UM_REQUIRED SMALLINT, UM_DISPLAY_ORDER INTEGER, - UM_CHECKED_ATTRIBUTE SMALLINT, - UM_READ_ONLY SMALLINT, - UM_TENANT_ID INTEGER DEFAULT 0, - UNIQUE(UM_DIALECT_ID, UM_CLAIM_URI, UM_TENANT_ID,UM_MAPPED_ATTRIBUTE_DOMAIN), - FOREIGN KEY(UM_DIALECT_ID, UM_TENANT_ID) REFERENCES UM_DIALECT(UM_ID, UM_TENANT_ID), + UM_CHECKED_ATTRIBUTE SMALLINT, + UM_READ_ONLY SMALLINT, + UM_TENANT_ID INTEGER DEFAULT 0, + UNIQUE(UM_DIALECT_ID, UM_CLAIM_URI, UM_TENANT_ID), PRIMARY KEY (UM_ID, UM_TENANT_ID) -)ENGINE INNODB; +)ENGINE INNODB; - -CREATE TABLE UM_PROFILE_CONFIG( - UM_ID INTEGER NOT NULL AUTO_INCREMENT, - UM_DIALECT_ID INTEGER NOT NULL, - UM_PROFILE_NAME VARCHAR(255), - UM_TENANT_ID INTEGER DEFAULT 0, - FOREIGN KEY(UM_DIALECT_ID, UM_TENANT_ID) REFERENCES UM_DIALECT(UM_ID, UM_TENANT_ID), +CREATE TABLE UM_PROFILE_CONFIG( + UM_ID INTEGER NOT NULL AUTO_INCREMENT, + UM_DIALECT_ID INTEGER NOT NULL, + UM_PROFILE_NAME VARCHAR(255), + UM_TENANT_ID INTEGER DEFAULT 0, PRIMARY KEY (UM_ID, UM_TENANT_ID) )ENGINE INNODB; @@ -445,20 +406,18 @@ CREATE TABLE UM_HYBRID_ROLE( UM_ROLE_NAME VARCHAR(255) NOT NULL, UM_TENANT_ID INTEGER DEFAULT 0, PRIMARY KEY (UM_ID, UM_TENANT_ID), - UNIQUE(UM_ROLE_NAME,UM_TENANT_ID) + UNIQUE (UM_ROLE_NAME, UM_TENANT_ID) )ENGINE INNODB; -CREATE INDEX UM_ROLE_NAME_IND ON UM_HYBRID_ROLE(UM_ROLE_NAME); - CREATE TABLE UM_HYBRID_USER_ROLE( UM_ID INTEGER NOT NULL AUTO_INCREMENT, UM_USER_NAME VARCHAR(255), UM_ROLE_ID INTEGER NOT NULL, UM_TENANT_ID INTEGER DEFAULT 0, - UM_DOMAIN_ID INTEGER, + UM_DOMAIN_ID INTEGER, UNIQUE (UM_USER_NAME, UM_ROLE_ID, UM_TENANT_ID, UM_DOMAIN_ID), FOREIGN KEY (UM_ROLE_ID, UM_TENANT_ID) REFERENCES UM_HYBRID_ROLE(UM_ID, UM_TENANT_ID) ON DELETE CASCADE, - FOREIGN KEY (UM_DOMAIN_ID, UM_TENANT_ID) REFERENCES UM_DOMAIN(UM_DOMAIN_ID, UM_TENANT_ID) ON DELETE CASCADE, + FOREIGN KEY (UM_DOMAIN_ID, UM_TENANT_ID) REFERENCES UM_DOMAIN(UM_DOMAIN_ID, UM_TENANT_ID) ON DELETE CASCADE, PRIMARY KEY (UM_ID, UM_TENANT_ID) )ENGINE INNODB; @@ -488,18 +447,24 @@ CREATE TABLE UM_SYSTEM_USER_ROLE( UM_ROLE_ID INTEGER NOT NULL, UM_TENANT_ID INTEGER DEFAULT 0, UNIQUE (UM_USER_NAME, UM_ROLE_ID, UM_TENANT_ID), - FOREIGN KEY (UM_ROLE_ID, UM_TENANT_ID) REFERENCES UM_SYSTEM_ROLE(UM_ID, UM_TENANT_ID), PRIMARY KEY (UM_ID, UM_TENANT_ID) )ENGINE INNODB; - CREATE TABLE UM_HYBRID_REMEMBER_ME( UM_ID INTEGER NOT NULL AUTO_INCREMENT, - UM_USER_NAME VARCHAR(255) NOT NULL, - UM_COOKIE_VALUE VARCHAR(1024), - UM_CREATED_TIME TIMESTAMP, + UM_USER_NAME VARCHAR(255) NOT NULL, + UM_COOKIE_VALUE VARCHAR(1024), + UM_CREATED_TIME TIMESTAMP, UM_TENANT_ID INTEGER DEFAULT 0, - PRIMARY KEY (UM_ID, UM_TENANT_ID) + PRIMARY KEY (UM_ID, UM_TENANT_ID) +)ENGINE INNODB; + +CREATE TABLE UM_CUSTOM_USERSTORE( + UM_ID INTEGER NOT NULL AUTO_INCREMENT, + UM_USERSTORE_PROPERTY VARCHAR(255) NOT NULL, + UM_USERSTORE_VALUE VARCHAR(500) NOT NULL, + UM_TENANT_ID INTEGER DEFAULT 0, + PRIMARY KEY (UM_ID, UM_TENANT_ID) )ENGINE INNODB; CREATE TABLE IF NOT EXISTS UM_UUID_DOMAIN_MAPPER ( @@ -509,7 +474,7 @@ CREATE TABLE IF NOT EXISTS UM_UUID_DOMAIN_MAPPER ( UM_TENANT_ID INTEGER DEFAULT 0, PRIMARY KEY (UM_ID), UNIQUE (UM_USER_ID), - FOREIGN KEY (UM_DOMAIN_ID, UM_TENANT_ID) REFERENCES UM_DOMAIN(UM_DOMAIN_ID, UM_TENANT_ID) ON DELETE CASCADE + FOREIGN KEY (UM_DOMAIN_ID, UM_TENANT_ID) REFERENCES UM_DOMAIN(UM_DOMAIN_ID, UM_TENANT_ID) )ENGINE INNODB; CREATE INDEX UUID_DM_UID_TID ON UM_UUID_DOMAIN_MAPPER(UM_USER_ID, UM_TENANT_ID); diff --git a/docker-compose/apim-is-as-km-with-analytics/docker-compose.yml b/docker-compose/apim-is-as-km-with-analytics/docker-compose.yml index b971ee09..a5953303 100755 --- a/docker-compose/apim-is-as-km-with-analytics/docker-compose.yml +++ b/docker-compose/apim-is-as-km-with-analytics/docker-compose.yml @@ -15,7 +15,7 @@ version: '2.4' services: mysql: - image: mysql:5.7.34 + image: mysql:5.7.37 ports: - 3306 environment: diff --git a/docker-compose/apim-is-as-km-with-analytics/dockerfiles/apim/Dockerfile b/docker-compose/apim-is-as-km-with-analytics/dockerfiles/apim/Dockerfile index 4e897b9e..924c14aa 100644 --- a/docker-compose/apim-is-as-km-with-analytics/dockerfiles/apim/Dockerfile +++ b/docker-compose/apim-is-as-km-with-analytics/dockerfiles/apim/Dockerfile @@ -17,7 +17,9 @@ # ------------------------------------------------------------------------ # set base Docker image to WSO2 API Manager Docker image with latest WSO2 Updates -FROM docker.wso2.com/wso2am:4.0.0.0 + +FROM docker.wso2.com/wso2am:4.1.0.0 + LABEL maintainer="WSO2 Docker Maintainers " # build arguments for external artifacts diff --git a/docker-compose/apim-is-as-km-with-analytics/dockerfiles/is-as-km/dropins/wso2is.key.manager.core-1.0.17.jar b/docker-compose/apim-is-as-km-with-analytics/dockerfiles/is-as-km/dropins/wso2is.key.manager.core-1.0.17.jar deleted file mode 100644 index d3db8cf4..00000000 Binary files a/docker-compose/apim-is-as-km-with-analytics/dockerfiles/is-as-km/dropins/wso2is.key.manager.core-1.0.17.jar and /dev/null differ diff --git a/docker-compose/apim-is-as-km-with-analytics/dockerfiles/is-as-km/dropins/wso2is.key.manager.core-1.4.2.jar b/docker-compose/apim-is-as-km-with-analytics/dockerfiles/is-as-km/dropins/wso2is.key.manager.core-1.4.2.jar new file mode 100644 index 00000000..b4d0da99 Binary files /dev/null and b/docker-compose/apim-is-as-km-with-analytics/dockerfiles/is-as-km/dropins/wso2is.key.manager.core-1.4.2.jar differ diff --git a/docker-compose/apim-is-as-km-with-analytics/dockerfiles/is-as-km/dropins/wso2is.notification.event.handlers-1.0.17.jar b/docker-compose/apim-is-as-km-with-analytics/dockerfiles/is-as-km/dropins/wso2is.notification.event.handlers-1.0.17.jar deleted file mode 100644 index 4a8ce38c..00000000 Binary files a/docker-compose/apim-is-as-km-with-analytics/dockerfiles/is-as-km/dropins/wso2is.notification.event.handlers-1.0.17.jar and /dev/null differ diff --git a/docker-compose/apim-is-as-km-with-analytics/dockerfiles/is-as-km/dropins/wso2is.notification.event.handlers-1.4.2.jar b/docker-compose/apim-is-as-km-with-analytics/dockerfiles/is-as-km/dropins/wso2is.notification.event.handlers-1.4.2.jar new file mode 100644 index 00000000..124d2d54 Binary files /dev/null and b/docker-compose/apim-is-as-km-with-analytics/dockerfiles/is-as-km/dropins/wso2is.notification.event.handlers-1.4.2.jar differ diff --git a/docker-compose/apim-is-as-km-with-analytics/dockerfiles/is-as-km/webapps/keymanager-operations.war b/docker-compose/apim-is-as-km-with-analytics/dockerfiles/is-as-km/webapps/keymanager-operations.war index c41b6544..3ae02b6e 100644 Binary files a/docker-compose/apim-is-as-km-with-analytics/dockerfiles/is-as-km/webapps/keymanager-operations.war and b/docker-compose/apim-is-as-km-with-analytics/dockerfiles/is-as-km/webapps/keymanager-operations.war differ diff --git a/docker-compose/apim-with-analytics/README.md b/docker-compose/apim-with-analytics/README.md index 926602fc..c10a2df8 100755 --- a/docker-compose/apim-with-analytics/README.md +++ b/docker-compose/apim-with-analytics/README.md @@ -34,9 +34,9 @@ `docker-apim-/docker-compose/apim-with-analytics` folder. > If you intend to try out an already released tag, after executing 2nd step, checkout the relevant tag, - i.e. for example: `git checkout tags/v4.0.0.1`, switch to `docker-compose/apim-with-analytics` folder and continue with below steps. + i.e. for example: `git checkout tags/v4.1.0.1`, switch to `docker-compose/apim-with-analytics` folder and continue with below steps. -4. WSO2 no longer provides an on-premise Analytics solution. In order to connect WSO2 API Manager to [Choreo Analytics](https://analytics.choreo.dev/), obtain an `on-prem-key` by following the steps in the [documentation](https://apim.docs.wso2.com/en/4.0.0/observe/api-manager-analytics/configure-analytics/register-for-analytics/). +4. WSO2 no longer provides an on-premise Analytics solution. In order to connect WSO2 API Manager to [Choreo Analytics](https://analytics.choreo.dev/), obtain an `on-prem-key` by following the steps in the [documentation](https://apim.docs.wso2.com/en/4.1.0/observe/api-manager-analytics/configure-analytics/register-for-analytics/). 5. Update the analytics configurations in [deployment.toml](./conf/apim/repository/conf/deployment.toml) with the `on-prem key` obtained. diff --git a/docker-compose/apim-with-analytics/conf/apim/repository/conf/deployment.toml b/docker-compose/apim-with-analytics/conf/apim/repository/conf/deployment.toml index e62ea42d..9738dabf 100755 --- a/docker-compose/apim-with-analytics/conf/apim/repository/conf/deployment.toml +++ b/docker-compose/apim-with-analytics/conf/apim/repository/conf/deployment.toml @@ -34,6 +34,9 @@ password = "wso2carbon" alias = "wso2carbon" key_password = "wso2carbon" +#[keystore.listener_profile] +#bind_address = "0.0.0.0" + #[keystore.primary] #file_name = "wso2carbon.jks" #type = "JKS" @@ -51,6 +54,7 @@ key_password = "wso2carbon" [[apim.gateway.environment]] name = "Default" type = "hybrid" +#provider = "wso2" display_in_api_console = true description = "This is a hybrid gateway that handles both production and sandbox token traffic." show_as_token_endpoint_url = true @@ -95,9 +99,9 @@ gateway_labels =["Default"] #[apim.cache.tags] #expiry_time = "2m" -[apim.analytics] -enable = true -config_endpoint = "https://analytics-event-auth.choreo.dev/auth/v1" +[apim.analytics] +enable = true +config_endpoint = "https://analytics-event-auth.choreo.dev/auth/v1" auth_token = "" #[apim.key_manager] @@ -251,3 +255,8 @@ notification_endpoint = "https://localhost:${mgt.transport.https.port}/internal/ username = "${admin.username}" password = "${admin.password}" 'header.X-WSO2-KEY-MANAGER' = "default" + +[oauth.grant_type.token_exchange] +enable = true +allow_refresh_tokens = true +iat_validity_period = "1h" diff --git a/docker-compose/apim-with-analytics/conf/mysql/scripts/mysql_apim.sql b/docker-compose/apim-with-analytics/conf/mysql/scripts/mysql_apim.sql index 601ed1e4..508d8c80 100644 --- a/docker-compose/apim-with-analytics/conf/mysql/scripts/mysql_apim.sql +++ b/docker-compose/apim-with-analytics/conf/mysql/scripts/mysql_apim.sql @@ -190,7 +190,7 @@ CREATE TABLE IF NOT EXISTS IDN_OAUTH2_DEVICE_FLOW_SCOPES ( CREATE TABLE IF NOT EXISTS IDN_OAUTH2_ACCESS_TOKEN_SCOPE ( TOKEN_ID VARCHAR (255), - TOKEN_SCOPE VARCHAR (60), + TOKEN_SCOPE VARCHAR (100), TENANT_ID INTEGER DEFAULT -1, PRIMARY KEY (TOKEN_ID, TOKEN_SCOPE), FOREIGN KEY (TOKEN_ID) REFERENCES IDN_OAUTH2_ACCESS_TOKEN(TOKEN_ID) ON DELETE CASCADE @@ -1375,9 +1375,10 @@ CREATE TABLE IF NOT EXISTS AM_APPLICATION ( UPDATED_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP, UUID VARCHAR(256), TOKEN_TYPE VARCHAR(10), + ORGANIZATION VARCHAR(100), FOREIGN KEY(SUBSCRIBER_ID) REFERENCES AM_SUBSCRIBER(SUBSCRIBER_ID) ON UPDATE CASCADE ON DELETE RESTRICT, PRIMARY KEY(APPLICATION_ID), - UNIQUE (NAME,SUBSCRIBER_ID), + UNIQUE (NAME,SUBSCRIBER_ID,ORGANIZATION), UNIQUE (UUID) )ENGINE INNODB; @@ -1391,24 +1392,21 @@ CREATE TABLE IF NOT EXISTS AM_API ( CONTEXT_TEMPLATE VARCHAR(256), API_TIER VARCHAR(256), API_TYPE VARCHAR(10), + ORGANIZATION VARCHAR(100), + GATEWAY_VENDOR VARCHAR(100) DEFAULT 'wso2', CREATED_BY VARCHAR(100), CREATED_TIME TIMESTAMP, UPDATED_BY VARCHAR(100), UPDATED_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP, STATUS VARCHAR(30), + LOG_LEVEL VARCHAR(255) DEFAULT 'OFF', REVISIONS_CREATED INTEGER DEFAULT 0, + VERSION_COMPARABLE VARCHAR(15), PRIMARY KEY(API_ID), - UNIQUE (API_PROVIDER,API_NAME,API_VERSION), + UNIQUE (API_PROVIDER,API_NAME,API_VERSION,ORGANIZATION), UNIQUE (API_UUID) )ENGINE INNODB; -CREATE TABLE IF NOT EXISTS AM_API_REVISION_METADATA ( - API_UUID VARCHAR(64), - REVISION_UUID VARCHAR(64), - API_TIER VARCHAR(128), - UNIQUE (API_UUID,REVISION_UUID) -)ENGINE INNODB; - CREATE TABLE IF NOT EXISTS AM_GRAPHQL_COMPLEXITY ( UUID VARCHAR(256), API_ID INTEGER NOT NULL, @@ -1443,7 +1441,7 @@ CREATE TABLE IF NOT EXISTS AM_API_RESOURCE_SCOPE_MAPPING ( CREATE TABLE IF NOT EXISTS AM_SECURITY_AUDIT_UUID_MAPPING ( API_ID INTEGER NOT NULL, AUDIT_UUID VARCHAR(255) NOT NULL, - FOREIGN KEY (API_ID) REFERENCES AM_API(API_ID) ON UPDATE CASCADE ON DELETE RESTRICT, + FOREIGN KEY (API_ID) REFERENCES AM_API(API_ID) ON UPDATE CASCADE ON DELETE CASCADE, PRIMARY KEY (API_ID) )ENGINE INNODB; @@ -1471,8 +1469,8 @@ CREATE TABLE IF NOT EXISTS AM_SUBSCRIPTION ( UPDATED_BY VARCHAR(100), UPDATED_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP, UUID VARCHAR(256), - FOREIGN KEY(APPLICATION_ID) REFERENCES AM_APPLICATION(APPLICATION_ID) ON UPDATE CASCADE ON DELETE RESTRICT, - FOREIGN KEY(API_ID) REFERENCES AM_API(API_ID) ON UPDATE CASCADE ON DELETE RESTRICT, + FOREIGN KEY(APPLICATION_ID) REFERENCES AM_APPLICATION(APPLICATION_ID) ON UPDATE CASCADE ON DELETE CASCADE, + FOREIGN KEY(API_ID) REFERENCES AM_API(API_ID) ON UPDATE CASCADE ON DELETE CASCADE, PRIMARY KEY (SUBSCRIPTION_ID), UNIQUE (UUID) )ENGINE INNODB; @@ -1488,7 +1486,7 @@ CREATE TABLE IF NOT EXISTS AM_APPLICATION_KEY_MAPPING ( CREATE_MODE VARCHAR(30) DEFAULT 'CREATED', KEY_MANAGER VARCHAR(100), APP_INFO BLOB , - FOREIGN KEY(APPLICATION_ID) REFERENCES AM_APPLICATION(APPLICATION_ID) ON UPDATE CASCADE ON DELETE RESTRICT, + FOREIGN KEY(APPLICATION_ID) REFERENCES AM_APPLICATION(APPLICATION_ID) ON UPDATE CASCADE ON DELETE CASCADE, PRIMARY KEY(APPLICATION_ID,KEY_TYPE,KEY_MANAGER) )ENGINE INNODB; @@ -1500,7 +1498,7 @@ CREATE TABLE IF NOT EXISTS AM_API_LC_EVENT ( USER_ID VARCHAR(255) NOT NULL, TENANT_ID INTEGER NOT NULL, EVENT_DATE TIMESTAMP NOT NULL, - FOREIGN KEY(API_ID) REFERENCES AM_API(API_ID) ON UPDATE CASCADE ON DELETE RESTRICT, + FOREIGN KEY(API_ID) REFERENCES AM_API(API_ID) ON UPDATE CASCADE ON DELETE CASCADE, PRIMARY KEY (EVENT_ID) )ENGINE INNODB; @@ -1520,7 +1518,7 @@ CREATE TABLE IF NOT EXISTS AM_API_COMMENTS ( PARENT_COMMENT_ID VARCHAR(64) DEFAULT NULL, ENTRY_POINT VARCHAR(20), CATEGORY VARCHAR(20) DEFAULT 'general', - FOREIGN KEY(API_ID) REFERENCES AM_API(API_ID), + FOREIGN KEY(API_ID) REFERENCES AM_API(API_ID) ON DELETE CASCADE, FOREIGN KEY(PARENT_COMMENT_ID) REFERENCES AM_API_COMMENTS(COMMENT_ID), PRIMARY KEY (COMMENT_ID) )ENGINE INNODB; @@ -1530,7 +1528,7 @@ CREATE TABLE IF NOT EXISTS AM_API_RATINGS ( API_ID INTEGER, RATING INTEGER, SUBSCRIBER_ID INTEGER, - FOREIGN KEY(API_ID) REFERENCES AM_API(API_ID) ON UPDATE CASCADE ON DELETE RESTRICT, + FOREIGN KEY(API_ID) REFERENCES AM_API(API_ID) ON UPDATE CASCADE ON DELETE CASCADE, FOREIGN KEY(SUBSCRIBER_ID) REFERENCES AM_SUBSCRIBER(SUBSCRIBER_ID) ON UPDATE CASCADE ON DELETE RESTRICT, PRIMARY KEY (RATING_ID) )ENGINE INNODB; @@ -1586,7 +1584,7 @@ CREATE TABLE IF NOT EXISTS AM_APPLICATION_REGISTRATION ( KEY_MANAGER VARCHAR(255) NOT NULL, UNIQUE (SUBSCRIBER_ID,APP_ID,TOKEN_TYPE,KEY_MANAGER), FOREIGN KEY(SUBSCRIBER_ID) REFERENCES AM_SUBSCRIBER(SUBSCRIBER_ID) ON UPDATE CASCADE ON DELETE RESTRICT, - FOREIGN KEY(APP_ID) REFERENCES AM_APPLICATION(APPLICATION_ID) ON UPDATE CASCADE ON DELETE RESTRICT, + FOREIGN KEY(APP_ID) REFERENCES AM_APPLICATION(APPLICATION_ID) ON UPDATE CASCADE ON DELETE CASCADE, PRIMARY KEY (REG_ID) )ENGINE INNODB; @@ -1603,6 +1601,7 @@ CREATE TABLE IF NOT EXISTS AM_API_DEFAULT_VERSION ( API_PROVIDER VARCHAR(256) NOT NULL , DEFAULT_API_VERSION VARCHAR(30) , PUBLISHED_DEFAULT_API_VERSION VARCHAR(30) , + ORGANIZATION VARCHAR(100), PRIMARY KEY (DEFAULT_VERSION_ID) )ENGINE = INNODB; @@ -1822,7 +1821,7 @@ ENGINE = InnoDB; CREATE TABLE `AM_BLOCK_CONDITIONS` ( `CONDITION_ID` int(11) NOT NULL AUTO_INCREMENT, `TYPE` varchar(45) DEFAULT NULL, - `VALUE` varchar(512) DEFAULT NULL, + `BLOCK_CONDITION` varchar(512) DEFAULT NULL, `ENABLED` varchar(45) DEFAULT NULL, `DOMAIN` varchar(45) DEFAULT NULL, `UUID` VARCHAR(256), @@ -1878,7 +1877,7 @@ CREATE TABLE IF NOT EXISTS AM_API_LC_PUBLISH_EVENTS ( CREATE TABLE IF NOT EXISTS AM_APPLICATION_ATTRIBUTES ( APPLICATION_ID int(11) NOT NULL, NAME varchar(255) NOT NULL, - VALUE varchar(1024) NOT NULL, + APP_ATTRIBUTE varchar(1024) NOT NULL, TENANT_ID int(11) NOT NULL, PRIMARY KEY (APPLICATION_ID,NAME), FOREIGN KEY (APPLICATION_ID) REFERENCES AM_APPLICATION (APPLICATION_ID) ON DELETE CASCADE ON UPDATE CASCADE @@ -1918,8 +1917,8 @@ CREATE TABLE IF NOT EXISTS AM_API_CATEGORIES ( UUID VARCHAR(50), NAME VARCHAR(255), DESCRIPTION VARCHAR(1024), - TENANT_ID INTEGER DEFAULT -1, - UNIQUE (NAME,TENANT_ID), + ORGANIZATION VARCHAR(100), + UNIQUE (NAME,ORGANIZATION), PRIMARY KEY (UUID) ) ENGINE=InnoDB; @@ -2020,9 +2019,11 @@ CREATE TABLE IF NOT EXISTS AM_KEY_MANAGER ( TYPE VARCHAR(45) NULL, CONFIGURATION BLOB NULL, ENABLED BOOLEAN DEFAULT 1, - TENANT_DOMAIN VARCHAR(100) NULL, + ORGANIZATION VARCHAR(100) NULL, + TOKEN_TYPE VARCHAR(45) NULL, + EXTERNAL_REFERENCE_ID VARCHAR(100) NULL, PRIMARY KEY (UUID), - UNIQUE (NAME,TENANT_DOMAIN) + UNIQUE (NAME,ORGANIZATION) ); -- AM_GW_PUBLISHED_API_DETAILS & AM_GW_API_ARTIFACTS are independent tables for Artifact synchronizer feature which -- @@ -2040,10 +2041,10 @@ CREATE TABLE IF NOT EXISTS AM_GW_PUBLISHED_API_DETAILS ( CREATE TABLE IF NOT EXISTS AM_GW_API_ARTIFACTS ( API_ID VARCHAR(255) NOT NULL, REVISION_ID VARCHAR(255) NOT NULL, - ARTIFACT blob, + ARTIFACT MEDIUMBLOB, TIME_STAMP TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (REVISION_ID, API_ID), - FOREIGN KEY (API_ID) REFERENCES AM_GW_PUBLISHED_API_DETAILS(API_ID) ON UPDATE CASCADE ON DELETE NO ACTION + FOREIGN KEY (API_ID) REFERENCES AM_GW_PUBLISHED_API_DETAILS(API_ID) ON UPDATE CASCADE ON DELETE CASCADE )ENGINE=InnoDB; CREATE TABLE IF NOT EXISTS AM_GW_API_DEPLOYMENTS ( @@ -2052,7 +2053,7 @@ CREATE TABLE IF NOT EXISTS AM_GW_API_DEPLOYMENTS ( LABEL VARCHAR(255) NOT NULL, VHOST VARCHAR(255) NULL, PRIMARY KEY (REVISION_ID, API_ID,LABEL), - FOREIGN KEY (API_ID) REFERENCES AM_GW_PUBLISHED_API_DETAILS(API_ID) ON UPDATE CASCADE ON DELETE NO ACTION + FOREIGN KEY (API_ID) REFERENCES AM_GW_PUBLISHED_API_DETAILS(API_ID) ON UPDATE CASCADE ON DELETE CASCADE ) ENGINE=InnoDB; CREATE TABLE IF NOT EXISTS AM_SCOPE ( @@ -2080,7 +2081,16 @@ CREATE TABLE IF NOT EXISTS AM_REVISION ( CREATED_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP, CREATED_BY VARCHAR(255), PRIMARY KEY (ID, API_UUID), - UNIQUE(REVISION_UUID) + UNIQUE(REVISION_UUID), + FOREIGN KEY (API_UUID) REFERENCES AM_API(API_UUID) ON DELETE CASCADE +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS AM_API_REVISION_METADATA ( + API_UUID VARCHAR(64), + REVISION_UUID VARCHAR(255), + API_TIER VARCHAR(128), + UNIQUE (API_UUID,REVISION_UUID), + FOREIGN KEY(REVISION_UUID) REFERENCES AM_REVISION(REVISION_UUID) ON DELETE CASCADE )ENGINE INNODB; CREATE TABLE IF NOT EXISTS AM_DEPLOYMENT_REVISION_MAPPING ( @@ -2093,15 +2103,25 @@ CREATE TABLE IF NOT EXISTS AM_DEPLOYMENT_REVISION_MAPPING ( FOREIGN KEY (REVISION_UUID) REFERENCES AM_REVISION(REVISION_UUID) ON UPDATE CASCADE ON DELETE CASCADE )ENGINE INNODB; +CREATE TABLE IF NOT EXISTS AM_DEPLOYED_REVISION ( + NAME VARCHAR(255) NOT NULL, + VHOST VARCHAR(255) NULL, + REVISION_UUID VARCHAR(255) NOT NULL, + DEPLOYED_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (NAME, REVISION_UUID), + FOREIGN KEY (REVISION_UUID) REFERENCES AM_REVISION(REVISION_UUID) ON UPDATE CASCADE ON DELETE CASCADE +)ENGINE INNODB; + -- Gateway Environments Table -- CREATE TABLE IF NOT EXISTS AM_GATEWAY_ENVIRONMENT ( ID INTEGER NOT NULL AUTO_INCREMENT, UUID VARCHAR(45) NOT NULL, NAME VARCHAR(255) NOT NULL, - TENANT_DOMAIN VARCHAR(255) NOT NULL, DISPLAY_NAME VARCHAR(255) NULL, DESCRIPTION VARCHAR(1023) NULL, - UNIQUE (NAME, TENANT_DOMAIN), + PROVIDER VARCHAR(255) NOT NULL, + ORGANIZATION VARCHAR(255) NOT NULL, + UNIQUE (NAME, ORGANIZATION), UNIQUE (UUID), PRIMARY KEY (ID) ); @@ -2180,11 +2200,87 @@ CREATE TABLE IF NOT EXISTS AM_WEBHOOKS_UNSUBSCRIPTION ( ADDED_AT TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP )ENGINE INNODB; +CREATE TABLE IF NOT EXISTS AM_API_ENVIRONMENT_KEYS +( + UUID VARCHAR(45) NOT NULL, + ENVIRONMENT_ID VARCHAR(45) NOT NULL, + API_UUID VARCHAR(256) NOT NULL, + PROPERTY_CONFIG BLOB DEFAULT NULL, + UNIQUE (ENVIRONMENT_ID, API_UUID), + FOREIGN KEY (API_UUID) REFERENCES AM_API(API_UUID) ON DELETE CASCADE, + PRIMARY KEY (UUID) +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS AM_OPERATION_POLICY ( + POLICY_UUID VARCHAR(45) NOT NULL, + POLICY_NAME VARCHAR(300) NOT NULL, + POLICY_VERSION VARCHAR(45) DEFAULT 'v1', + DISPLAY_NAME VARCHAR(300) NOT NULL, + POLICY_DESCRIPTION VARCHAR(1024), + APPLICABLE_FLOWS VARCHAR(45) NOT NULL, + GATEWAY_TYPES VARCHAR(45) NOT NULL, + API_TYPES VARCHAR(45) NOT NULL, + POLICY_PARAMETERS blob, + ORGANIZATION VARCHAR(100), + POLICY_CATEGORY VARCHAR(45) NOT NULL, + POLICY_MD5 VARCHAR(45) NOT NULL, + PRIMARY KEY(POLICY_UUID) +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS AM_OPERATION_POLICY_DEFINITION ( + DEFINITION_ID INTEGER AUTO_INCREMENT, + POLICY_UUID VARCHAR(45) NOT NULL, + POLICY_DEFINITION blob NOT NULL, + GATEWAY_TYPE VARCHAR(20) NOT NULL, + DEFINITION_MD5 VARCHAR(45) NOT NULL, + UNIQUE (POLICY_UUID, GATEWAY_TYPE), + FOREIGN KEY (POLICY_UUID) REFERENCES AM_OPERATION_POLICY(POLICY_UUID) ON DELETE CASCADE, + PRIMARY KEY(DEFINITION_ID) +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS AM_COMMON_OPERATION_POLICY ( + COMMON_POLICY_ID INTEGER AUTO_INCREMENT, + POLICY_UUID VARCHAR(45) NOT NULL, + FOREIGN KEY (POLICY_UUID) REFERENCES AM_OPERATION_POLICY(POLICY_UUID) ON DELETE CASCADE, + PRIMARY KEY(COMMON_POLICY_ID) +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS AM_API_OPERATION_POLICY ( + API_SPECIFIC_POLICY_ID INTEGER AUTO_INCREMENT, + POLICY_UUID VARCHAR(45) NOT NULL, + API_UUID VARCHAR(45) NOT NULL, + REVISION_UUID VARCHAR(45), + CLONED_POLICY_UUID VARCHAR(45), + FOREIGN KEY (POLICY_UUID) REFERENCES AM_OPERATION_POLICY(POLICY_UUID) ON DELETE CASCADE, + PRIMARY KEY(API_SPECIFIC_POLICY_ID) +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS AM_API_OPERATION_POLICY_MAPPING ( + OPERATION_POLICY_MAPPING_ID INTEGER AUTO_INCREMENT, + URL_MAPPING_ID INTEGER NOT NULL, + POLICY_UUID VARCHAR(45) NOT NULL, + POLICY_ORDER INTEGER NOT NULL, + DIRECTION VARCHAR(10) NOT NULL, + PARAMETERS VARCHAR(1024) NOT NULL, + FOREIGN KEY (URL_MAPPING_ID) REFERENCES AM_API_URL_MAPPING(URL_MAPPING_ID) ON DELETE CASCADE, + FOREIGN KEY (POLICY_UUID) REFERENCES AM_OPERATION_POLICY(POLICY_UUID) ON DELETE CASCADE, + PRIMARY KEY(OPERATION_POLICY_MAPPING_ID) +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS AM_SYSTEM_CONFIGS +( + ORGANIZATION VARCHAR(100) NOT NULL, + CONFIG_TYPE VARCHAR(100) NOT NULL, + CONFIGURATION BLOB NOT NULL, + PRIMARY KEY (ORGANIZATION,CONFIG_TYPE) +)ENGINE INNODB; + -- Performance indexes start-- create index IDX_ITS_LMT on IDN_THRIFT_SESSION (LAST_MODIFIED_TIME); create index IDX_IOAT_UT on IDN_OAUTH2_ACCESS_TOKEN (USER_TYPE); create index IDX_AAI_CTX on AM_API (CONTEXT); +create index IDX_AAI_ORG on AM_API (ORGANIZATION); create index IDX_AAKM_CK on AM_APPLICATION_KEY_MAPPING (CONSUMER_KEY); create index IDX_AAUM_AI on AM_API_URL_MAPPING (API_ID); create index IDX_AAPM_AI on AM_API_PRODUCT_MAPPING (API_ID); diff --git a/docker-compose/apim-with-analytics/conf/mysql/scripts/mysql_shared.sql b/docker-compose/apim-with-analytics/conf/mysql/scripts/mysql_shared.sql index 38175e10..ff813864 100644 --- a/docker-compose/apim-with-analytics/conf/mysql/scripts/mysql_shared.sql +++ b/docker-compose/apim-with-analytics/conf/mysql/scripts/mysql_shared.sql @@ -166,6 +166,7 @@ ALTER TABLE REG_RESOURCE_TAG ADD CONSTRAINT REG_RESOURCE_TAG_FK_BY_PATH_ID FOREI ALTER TABLE REG_RESOURCE_TAG ADD CONSTRAINT REG_RESOURCE_TAG_FK_BY_TAG_ID FOREIGN KEY (REG_TAG_ID, REG_TENANT_ID) REFERENCES REG_TAG (REG_ID, REG_TENANT_ID); CREATE INDEX REG_RESOURCE_TAG_IND_BY_PATH_ID_AND_RESOURCE_NAME USING HASH ON REG_RESOURCE_TAG(REG_PATH_ID, REG_RESOURCE_NAME, REG_TENANT_ID); CREATE INDEX REG_RESOURCE_TAG_IND_BY_VERSION USING HASH ON REG_RESOURCE_TAG(REG_VERSION, REG_TENANT_ID); +CREATE INDEX REG_RESOURCE_TAG_IND_BY_REG_TAG_ID USING HASH ON REG_RESOURCE_TAG(REG_TAG_ID, REG_TENANT_ID); CREATE TABLE IF NOT EXISTS REG_PROPERTY ( REG_ID INTEGER NOT NULL AUTO_INCREMENT, @@ -187,6 +188,7 @@ ALTER TABLE REG_RESOURCE_PROPERTY ADD CONSTRAINT REG_RESOURCE_PROPERTY_FK_BY_PAT ALTER TABLE REG_RESOURCE_PROPERTY ADD CONSTRAINT REG_RESOURCE_PROPERTY_FK_BY_TAG_ID FOREIGN KEY (REG_PROPERTY_ID, REG_TENANT_ID) REFERENCES REG_PROPERTY (REG_ID, REG_TENANT_ID); CREATE INDEX REG_RESOURCE_PROPERTY_IND_BY_PATH_ID_AND_RESOURCE_NAME USING HASH ON REG_RESOURCE_PROPERTY(REG_PATH_ID, REG_RESOURCE_NAME, REG_TENANT_ID); CREATE INDEX REG_RESOURCE_PROPERTY_IND_BY_VERSION USING HASH ON REG_RESOURCE_PROPERTY(REG_VERSION, REG_TENANT_ID); +CREATE INDEX REG_RESOURCE_PROPERTY_IND_BY_REG_PROP_ID ON REG_RESOURCE_PROPERTY(REG_TENANT_ID, REG_PROPERTY_ID); -- CREATE TABLE IF NOT EXISTS REG_ASSOCIATIONS ( -- SRC_PATH_ID INTEGER, diff --git a/docker-compose/apim-with-analytics/docker-compose.yml b/docker-compose/apim-with-analytics/docker-compose.yml index 31c9c89f..485b604e 100755 --- a/docker-compose/apim-with-analytics/docker-compose.yml +++ b/docker-compose/apim-with-analytics/docker-compose.yml @@ -15,7 +15,7 @@ version: '2.4' services: mysql: - image: mysql:5.7.34 + image: mysql:5.7.37 ports: - 3306 environment: diff --git a/docker-compose/apim-with-analytics/dockerfiles/apim/Dockerfile b/docker-compose/apim-with-analytics/dockerfiles/apim/Dockerfile index 4e897b9e..fd3164cd 100644 --- a/docker-compose/apim-with-analytics/dockerfiles/apim/Dockerfile +++ b/docker-compose/apim-with-analytics/dockerfiles/apim/Dockerfile @@ -17,7 +17,7 @@ # ------------------------------------------------------------------------ # set base Docker image to WSO2 API Manager Docker image with latest WSO2 Updates -FROM docker.wso2.com/wso2am:4.0.0.0 +FROM docker.wso2.com/wso2am:4.1.0.0 LABEL maintainer="WSO2 Docker Maintainers " # build arguments for external artifacts diff --git a/docker-compose/apim-with-mi/README.md b/docker-compose/apim-with-mi/README.md index 46abfc0c..e3e65b10 100644 --- a/docker-compose/apim-with-mi/README.md +++ b/docker-compose/apim-with-mi/README.md @@ -33,13 +33,13 @@ `docker-apim-/docker-compose/apim-with-mi` folder. > If you intend to try out an already released tag, after executing 2nd step, checkout the relevant tag, - i.e. for example: `git checkout tags/v4.0.0.1`, switch to `docker-compose/apim-with-mi` folder and continue with below steps. + i.e. for example: `git checkout tags/v4.1.0.1`, switch to `docker-compose/apim-with-mi` folder and continue with below steps. 4. Add deployable `CAR` files You may add the relevant CAR files of your integration services to `docker-compose/apim-with-mi/dockerfiles/mi/capps/`. - Those will be added to the Service Catalog in APIM through Micro Integrator. For more information, refer the [documentation](https://apim.docs.wso2.com/en/4.0.0/tutorials/integration-tutorials/service-catalog-tutorial/#exposing-an-integration-service-as-a-managed-api). + Those will be added to the Service Catalog in APIM through Micro Integrator. For more information, refer the [documentation](https://apim.docs.wso2.com/en/4.1.0/tutorials/integration-tutorials/service-catalog-tutorial/#exposing-an-integration-service-as-a-managed-api). The backend service of the sample `CAR` provided can be found [here](https://github.com/wso2-docs/WSO2_EI/blob/master/Back-End-Service/Hospital-Service-JDK11-2.0.0.jar). diff --git a/docker-compose/apim-with-mi/conf/apim/repository/conf/deployment.toml b/docker-compose/apim-with-mi/conf/apim/repository/conf/deployment.toml index 04371273..f161ee2f 100644 --- a/docker-compose/apim-with-mi/conf/apim/repository/conf/deployment.toml +++ b/docker-compose/apim-with-mi/conf/apim/repository/conf/deployment.toml @@ -34,6 +34,9 @@ password = "wso2carbon" alias = "wso2carbon" key_password = "wso2carbon" +#[keystore.listener_profile] +#bind_address = "0.0.0.0" + #[keystore.primary] #file_name = "wso2carbon.jks" #type = "JKS" @@ -51,6 +54,7 @@ key_password = "wso2carbon" [[apim.gateway.environment]] name = "Default" type = "hybrid" +provider = "wso2" display_in_api_console = true description = "This is a hybrid gateway that handles both production and sandbox token traffic." show_as_token_endpoint_url = true @@ -98,7 +102,7 @@ gateway_labels =["Default"] [apim.analytics] enable = false config_endpoint = "https://localhost:8080/auth/v1" -auth_token = "" +auth_token = "" #[apim.key_manager] #service_url = "https://localhost:${mgt.transport.https.port}/services/" @@ -251,3 +255,8 @@ notification_endpoint = "https://localhost:${mgt.transport.https.port}/internal/ username = "${admin.username}" password = "${admin.password}" 'header.X-WSO2-KEY-MANAGER' = "default" + +[oauth.grant_type.token_exchange] +enable = true +allow_refresh_tokens = true +iat_validity_period = "1h" diff --git a/docker-compose/apim-with-mi/conf/mi/conf/deployment.toml b/docker-compose/apim-with-mi/conf/mi/conf/deployment.toml index 9c98572e..f6884bac 100644 --- a/docker-compose/apim-with-mi/conf/mi/conf/deployment.toml +++ b/docker-compose/apim-with-mi/conf/mi/conf/deployment.toml @@ -72,6 +72,11 @@ algorithm = "AES" # parameter.username = "guest" # parameter.password = "guest" +# [[transport.phase_order]] +# Entire phase_order list can be found under 'Axis2 Phases' in /repository/resources/conf/deployment-full.toml. +# If an Axis2 phase needs to added/removed, include all of the +# Inflow, OutFlow & OutFaultFlow phases found in the deployment-full.toml and change them as needed. + # [system.parameter] # 'key' = "value" @@ -105,3 +110,6 @@ apim_host = "https://api-manager:9443" enable = true username = "admin" password = "admin" + +# [dashboard_config] +# dashboard_url = "https://localhost:9743/dashboard/api/" diff --git a/docker-compose/apim-with-mi/conf/mysql/scripts/mysql_apim.sql b/docker-compose/apim-with-mi/conf/mysql/scripts/mysql_apim.sql index 601ed1e4..508d8c80 100644 --- a/docker-compose/apim-with-mi/conf/mysql/scripts/mysql_apim.sql +++ b/docker-compose/apim-with-mi/conf/mysql/scripts/mysql_apim.sql @@ -190,7 +190,7 @@ CREATE TABLE IF NOT EXISTS IDN_OAUTH2_DEVICE_FLOW_SCOPES ( CREATE TABLE IF NOT EXISTS IDN_OAUTH2_ACCESS_TOKEN_SCOPE ( TOKEN_ID VARCHAR (255), - TOKEN_SCOPE VARCHAR (60), + TOKEN_SCOPE VARCHAR (100), TENANT_ID INTEGER DEFAULT -1, PRIMARY KEY (TOKEN_ID, TOKEN_SCOPE), FOREIGN KEY (TOKEN_ID) REFERENCES IDN_OAUTH2_ACCESS_TOKEN(TOKEN_ID) ON DELETE CASCADE @@ -1375,9 +1375,10 @@ CREATE TABLE IF NOT EXISTS AM_APPLICATION ( UPDATED_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP, UUID VARCHAR(256), TOKEN_TYPE VARCHAR(10), + ORGANIZATION VARCHAR(100), FOREIGN KEY(SUBSCRIBER_ID) REFERENCES AM_SUBSCRIBER(SUBSCRIBER_ID) ON UPDATE CASCADE ON DELETE RESTRICT, PRIMARY KEY(APPLICATION_ID), - UNIQUE (NAME,SUBSCRIBER_ID), + UNIQUE (NAME,SUBSCRIBER_ID,ORGANIZATION), UNIQUE (UUID) )ENGINE INNODB; @@ -1391,24 +1392,21 @@ CREATE TABLE IF NOT EXISTS AM_API ( CONTEXT_TEMPLATE VARCHAR(256), API_TIER VARCHAR(256), API_TYPE VARCHAR(10), + ORGANIZATION VARCHAR(100), + GATEWAY_VENDOR VARCHAR(100) DEFAULT 'wso2', CREATED_BY VARCHAR(100), CREATED_TIME TIMESTAMP, UPDATED_BY VARCHAR(100), UPDATED_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP, STATUS VARCHAR(30), + LOG_LEVEL VARCHAR(255) DEFAULT 'OFF', REVISIONS_CREATED INTEGER DEFAULT 0, + VERSION_COMPARABLE VARCHAR(15), PRIMARY KEY(API_ID), - UNIQUE (API_PROVIDER,API_NAME,API_VERSION), + UNIQUE (API_PROVIDER,API_NAME,API_VERSION,ORGANIZATION), UNIQUE (API_UUID) )ENGINE INNODB; -CREATE TABLE IF NOT EXISTS AM_API_REVISION_METADATA ( - API_UUID VARCHAR(64), - REVISION_UUID VARCHAR(64), - API_TIER VARCHAR(128), - UNIQUE (API_UUID,REVISION_UUID) -)ENGINE INNODB; - CREATE TABLE IF NOT EXISTS AM_GRAPHQL_COMPLEXITY ( UUID VARCHAR(256), API_ID INTEGER NOT NULL, @@ -1443,7 +1441,7 @@ CREATE TABLE IF NOT EXISTS AM_API_RESOURCE_SCOPE_MAPPING ( CREATE TABLE IF NOT EXISTS AM_SECURITY_AUDIT_UUID_MAPPING ( API_ID INTEGER NOT NULL, AUDIT_UUID VARCHAR(255) NOT NULL, - FOREIGN KEY (API_ID) REFERENCES AM_API(API_ID) ON UPDATE CASCADE ON DELETE RESTRICT, + FOREIGN KEY (API_ID) REFERENCES AM_API(API_ID) ON UPDATE CASCADE ON DELETE CASCADE, PRIMARY KEY (API_ID) )ENGINE INNODB; @@ -1471,8 +1469,8 @@ CREATE TABLE IF NOT EXISTS AM_SUBSCRIPTION ( UPDATED_BY VARCHAR(100), UPDATED_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP, UUID VARCHAR(256), - FOREIGN KEY(APPLICATION_ID) REFERENCES AM_APPLICATION(APPLICATION_ID) ON UPDATE CASCADE ON DELETE RESTRICT, - FOREIGN KEY(API_ID) REFERENCES AM_API(API_ID) ON UPDATE CASCADE ON DELETE RESTRICT, + FOREIGN KEY(APPLICATION_ID) REFERENCES AM_APPLICATION(APPLICATION_ID) ON UPDATE CASCADE ON DELETE CASCADE, + FOREIGN KEY(API_ID) REFERENCES AM_API(API_ID) ON UPDATE CASCADE ON DELETE CASCADE, PRIMARY KEY (SUBSCRIPTION_ID), UNIQUE (UUID) )ENGINE INNODB; @@ -1488,7 +1486,7 @@ CREATE TABLE IF NOT EXISTS AM_APPLICATION_KEY_MAPPING ( CREATE_MODE VARCHAR(30) DEFAULT 'CREATED', KEY_MANAGER VARCHAR(100), APP_INFO BLOB , - FOREIGN KEY(APPLICATION_ID) REFERENCES AM_APPLICATION(APPLICATION_ID) ON UPDATE CASCADE ON DELETE RESTRICT, + FOREIGN KEY(APPLICATION_ID) REFERENCES AM_APPLICATION(APPLICATION_ID) ON UPDATE CASCADE ON DELETE CASCADE, PRIMARY KEY(APPLICATION_ID,KEY_TYPE,KEY_MANAGER) )ENGINE INNODB; @@ -1500,7 +1498,7 @@ CREATE TABLE IF NOT EXISTS AM_API_LC_EVENT ( USER_ID VARCHAR(255) NOT NULL, TENANT_ID INTEGER NOT NULL, EVENT_DATE TIMESTAMP NOT NULL, - FOREIGN KEY(API_ID) REFERENCES AM_API(API_ID) ON UPDATE CASCADE ON DELETE RESTRICT, + FOREIGN KEY(API_ID) REFERENCES AM_API(API_ID) ON UPDATE CASCADE ON DELETE CASCADE, PRIMARY KEY (EVENT_ID) )ENGINE INNODB; @@ -1520,7 +1518,7 @@ CREATE TABLE IF NOT EXISTS AM_API_COMMENTS ( PARENT_COMMENT_ID VARCHAR(64) DEFAULT NULL, ENTRY_POINT VARCHAR(20), CATEGORY VARCHAR(20) DEFAULT 'general', - FOREIGN KEY(API_ID) REFERENCES AM_API(API_ID), + FOREIGN KEY(API_ID) REFERENCES AM_API(API_ID) ON DELETE CASCADE, FOREIGN KEY(PARENT_COMMENT_ID) REFERENCES AM_API_COMMENTS(COMMENT_ID), PRIMARY KEY (COMMENT_ID) )ENGINE INNODB; @@ -1530,7 +1528,7 @@ CREATE TABLE IF NOT EXISTS AM_API_RATINGS ( API_ID INTEGER, RATING INTEGER, SUBSCRIBER_ID INTEGER, - FOREIGN KEY(API_ID) REFERENCES AM_API(API_ID) ON UPDATE CASCADE ON DELETE RESTRICT, + FOREIGN KEY(API_ID) REFERENCES AM_API(API_ID) ON UPDATE CASCADE ON DELETE CASCADE, FOREIGN KEY(SUBSCRIBER_ID) REFERENCES AM_SUBSCRIBER(SUBSCRIBER_ID) ON UPDATE CASCADE ON DELETE RESTRICT, PRIMARY KEY (RATING_ID) )ENGINE INNODB; @@ -1586,7 +1584,7 @@ CREATE TABLE IF NOT EXISTS AM_APPLICATION_REGISTRATION ( KEY_MANAGER VARCHAR(255) NOT NULL, UNIQUE (SUBSCRIBER_ID,APP_ID,TOKEN_TYPE,KEY_MANAGER), FOREIGN KEY(SUBSCRIBER_ID) REFERENCES AM_SUBSCRIBER(SUBSCRIBER_ID) ON UPDATE CASCADE ON DELETE RESTRICT, - FOREIGN KEY(APP_ID) REFERENCES AM_APPLICATION(APPLICATION_ID) ON UPDATE CASCADE ON DELETE RESTRICT, + FOREIGN KEY(APP_ID) REFERENCES AM_APPLICATION(APPLICATION_ID) ON UPDATE CASCADE ON DELETE CASCADE, PRIMARY KEY (REG_ID) )ENGINE INNODB; @@ -1603,6 +1601,7 @@ CREATE TABLE IF NOT EXISTS AM_API_DEFAULT_VERSION ( API_PROVIDER VARCHAR(256) NOT NULL , DEFAULT_API_VERSION VARCHAR(30) , PUBLISHED_DEFAULT_API_VERSION VARCHAR(30) , + ORGANIZATION VARCHAR(100), PRIMARY KEY (DEFAULT_VERSION_ID) )ENGINE = INNODB; @@ -1822,7 +1821,7 @@ ENGINE = InnoDB; CREATE TABLE `AM_BLOCK_CONDITIONS` ( `CONDITION_ID` int(11) NOT NULL AUTO_INCREMENT, `TYPE` varchar(45) DEFAULT NULL, - `VALUE` varchar(512) DEFAULT NULL, + `BLOCK_CONDITION` varchar(512) DEFAULT NULL, `ENABLED` varchar(45) DEFAULT NULL, `DOMAIN` varchar(45) DEFAULT NULL, `UUID` VARCHAR(256), @@ -1878,7 +1877,7 @@ CREATE TABLE IF NOT EXISTS AM_API_LC_PUBLISH_EVENTS ( CREATE TABLE IF NOT EXISTS AM_APPLICATION_ATTRIBUTES ( APPLICATION_ID int(11) NOT NULL, NAME varchar(255) NOT NULL, - VALUE varchar(1024) NOT NULL, + APP_ATTRIBUTE varchar(1024) NOT NULL, TENANT_ID int(11) NOT NULL, PRIMARY KEY (APPLICATION_ID,NAME), FOREIGN KEY (APPLICATION_ID) REFERENCES AM_APPLICATION (APPLICATION_ID) ON DELETE CASCADE ON UPDATE CASCADE @@ -1918,8 +1917,8 @@ CREATE TABLE IF NOT EXISTS AM_API_CATEGORIES ( UUID VARCHAR(50), NAME VARCHAR(255), DESCRIPTION VARCHAR(1024), - TENANT_ID INTEGER DEFAULT -1, - UNIQUE (NAME,TENANT_ID), + ORGANIZATION VARCHAR(100), + UNIQUE (NAME,ORGANIZATION), PRIMARY KEY (UUID) ) ENGINE=InnoDB; @@ -2020,9 +2019,11 @@ CREATE TABLE IF NOT EXISTS AM_KEY_MANAGER ( TYPE VARCHAR(45) NULL, CONFIGURATION BLOB NULL, ENABLED BOOLEAN DEFAULT 1, - TENANT_DOMAIN VARCHAR(100) NULL, + ORGANIZATION VARCHAR(100) NULL, + TOKEN_TYPE VARCHAR(45) NULL, + EXTERNAL_REFERENCE_ID VARCHAR(100) NULL, PRIMARY KEY (UUID), - UNIQUE (NAME,TENANT_DOMAIN) + UNIQUE (NAME,ORGANIZATION) ); -- AM_GW_PUBLISHED_API_DETAILS & AM_GW_API_ARTIFACTS are independent tables for Artifact synchronizer feature which -- @@ -2040,10 +2041,10 @@ CREATE TABLE IF NOT EXISTS AM_GW_PUBLISHED_API_DETAILS ( CREATE TABLE IF NOT EXISTS AM_GW_API_ARTIFACTS ( API_ID VARCHAR(255) NOT NULL, REVISION_ID VARCHAR(255) NOT NULL, - ARTIFACT blob, + ARTIFACT MEDIUMBLOB, TIME_STAMP TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (REVISION_ID, API_ID), - FOREIGN KEY (API_ID) REFERENCES AM_GW_PUBLISHED_API_DETAILS(API_ID) ON UPDATE CASCADE ON DELETE NO ACTION + FOREIGN KEY (API_ID) REFERENCES AM_GW_PUBLISHED_API_DETAILS(API_ID) ON UPDATE CASCADE ON DELETE CASCADE )ENGINE=InnoDB; CREATE TABLE IF NOT EXISTS AM_GW_API_DEPLOYMENTS ( @@ -2052,7 +2053,7 @@ CREATE TABLE IF NOT EXISTS AM_GW_API_DEPLOYMENTS ( LABEL VARCHAR(255) NOT NULL, VHOST VARCHAR(255) NULL, PRIMARY KEY (REVISION_ID, API_ID,LABEL), - FOREIGN KEY (API_ID) REFERENCES AM_GW_PUBLISHED_API_DETAILS(API_ID) ON UPDATE CASCADE ON DELETE NO ACTION + FOREIGN KEY (API_ID) REFERENCES AM_GW_PUBLISHED_API_DETAILS(API_ID) ON UPDATE CASCADE ON DELETE CASCADE ) ENGINE=InnoDB; CREATE TABLE IF NOT EXISTS AM_SCOPE ( @@ -2080,7 +2081,16 @@ CREATE TABLE IF NOT EXISTS AM_REVISION ( CREATED_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP, CREATED_BY VARCHAR(255), PRIMARY KEY (ID, API_UUID), - UNIQUE(REVISION_UUID) + UNIQUE(REVISION_UUID), + FOREIGN KEY (API_UUID) REFERENCES AM_API(API_UUID) ON DELETE CASCADE +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS AM_API_REVISION_METADATA ( + API_UUID VARCHAR(64), + REVISION_UUID VARCHAR(255), + API_TIER VARCHAR(128), + UNIQUE (API_UUID,REVISION_UUID), + FOREIGN KEY(REVISION_UUID) REFERENCES AM_REVISION(REVISION_UUID) ON DELETE CASCADE )ENGINE INNODB; CREATE TABLE IF NOT EXISTS AM_DEPLOYMENT_REVISION_MAPPING ( @@ -2093,15 +2103,25 @@ CREATE TABLE IF NOT EXISTS AM_DEPLOYMENT_REVISION_MAPPING ( FOREIGN KEY (REVISION_UUID) REFERENCES AM_REVISION(REVISION_UUID) ON UPDATE CASCADE ON DELETE CASCADE )ENGINE INNODB; +CREATE TABLE IF NOT EXISTS AM_DEPLOYED_REVISION ( + NAME VARCHAR(255) NOT NULL, + VHOST VARCHAR(255) NULL, + REVISION_UUID VARCHAR(255) NOT NULL, + DEPLOYED_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (NAME, REVISION_UUID), + FOREIGN KEY (REVISION_UUID) REFERENCES AM_REVISION(REVISION_UUID) ON UPDATE CASCADE ON DELETE CASCADE +)ENGINE INNODB; + -- Gateway Environments Table -- CREATE TABLE IF NOT EXISTS AM_GATEWAY_ENVIRONMENT ( ID INTEGER NOT NULL AUTO_INCREMENT, UUID VARCHAR(45) NOT NULL, NAME VARCHAR(255) NOT NULL, - TENANT_DOMAIN VARCHAR(255) NOT NULL, DISPLAY_NAME VARCHAR(255) NULL, DESCRIPTION VARCHAR(1023) NULL, - UNIQUE (NAME, TENANT_DOMAIN), + PROVIDER VARCHAR(255) NOT NULL, + ORGANIZATION VARCHAR(255) NOT NULL, + UNIQUE (NAME, ORGANIZATION), UNIQUE (UUID), PRIMARY KEY (ID) ); @@ -2180,11 +2200,87 @@ CREATE TABLE IF NOT EXISTS AM_WEBHOOKS_UNSUBSCRIPTION ( ADDED_AT TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP )ENGINE INNODB; +CREATE TABLE IF NOT EXISTS AM_API_ENVIRONMENT_KEYS +( + UUID VARCHAR(45) NOT NULL, + ENVIRONMENT_ID VARCHAR(45) NOT NULL, + API_UUID VARCHAR(256) NOT NULL, + PROPERTY_CONFIG BLOB DEFAULT NULL, + UNIQUE (ENVIRONMENT_ID, API_UUID), + FOREIGN KEY (API_UUID) REFERENCES AM_API(API_UUID) ON DELETE CASCADE, + PRIMARY KEY (UUID) +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS AM_OPERATION_POLICY ( + POLICY_UUID VARCHAR(45) NOT NULL, + POLICY_NAME VARCHAR(300) NOT NULL, + POLICY_VERSION VARCHAR(45) DEFAULT 'v1', + DISPLAY_NAME VARCHAR(300) NOT NULL, + POLICY_DESCRIPTION VARCHAR(1024), + APPLICABLE_FLOWS VARCHAR(45) NOT NULL, + GATEWAY_TYPES VARCHAR(45) NOT NULL, + API_TYPES VARCHAR(45) NOT NULL, + POLICY_PARAMETERS blob, + ORGANIZATION VARCHAR(100), + POLICY_CATEGORY VARCHAR(45) NOT NULL, + POLICY_MD5 VARCHAR(45) NOT NULL, + PRIMARY KEY(POLICY_UUID) +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS AM_OPERATION_POLICY_DEFINITION ( + DEFINITION_ID INTEGER AUTO_INCREMENT, + POLICY_UUID VARCHAR(45) NOT NULL, + POLICY_DEFINITION blob NOT NULL, + GATEWAY_TYPE VARCHAR(20) NOT NULL, + DEFINITION_MD5 VARCHAR(45) NOT NULL, + UNIQUE (POLICY_UUID, GATEWAY_TYPE), + FOREIGN KEY (POLICY_UUID) REFERENCES AM_OPERATION_POLICY(POLICY_UUID) ON DELETE CASCADE, + PRIMARY KEY(DEFINITION_ID) +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS AM_COMMON_OPERATION_POLICY ( + COMMON_POLICY_ID INTEGER AUTO_INCREMENT, + POLICY_UUID VARCHAR(45) NOT NULL, + FOREIGN KEY (POLICY_UUID) REFERENCES AM_OPERATION_POLICY(POLICY_UUID) ON DELETE CASCADE, + PRIMARY KEY(COMMON_POLICY_ID) +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS AM_API_OPERATION_POLICY ( + API_SPECIFIC_POLICY_ID INTEGER AUTO_INCREMENT, + POLICY_UUID VARCHAR(45) NOT NULL, + API_UUID VARCHAR(45) NOT NULL, + REVISION_UUID VARCHAR(45), + CLONED_POLICY_UUID VARCHAR(45), + FOREIGN KEY (POLICY_UUID) REFERENCES AM_OPERATION_POLICY(POLICY_UUID) ON DELETE CASCADE, + PRIMARY KEY(API_SPECIFIC_POLICY_ID) +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS AM_API_OPERATION_POLICY_MAPPING ( + OPERATION_POLICY_MAPPING_ID INTEGER AUTO_INCREMENT, + URL_MAPPING_ID INTEGER NOT NULL, + POLICY_UUID VARCHAR(45) NOT NULL, + POLICY_ORDER INTEGER NOT NULL, + DIRECTION VARCHAR(10) NOT NULL, + PARAMETERS VARCHAR(1024) NOT NULL, + FOREIGN KEY (URL_MAPPING_ID) REFERENCES AM_API_URL_MAPPING(URL_MAPPING_ID) ON DELETE CASCADE, + FOREIGN KEY (POLICY_UUID) REFERENCES AM_OPERATION_POLICY(POLICY_UUID) ON DELETE CASCADE, + PRIMARY KEY(OPERATION_POLICY_MAPPING_ID) +)ENGINE INNODB; + +CREATE TABLE IF NOT EXISTS AM_SYSTEM_CONFIGS +( + ORGANIZATION VARCHAR(100) NOT NULL, + CONFIG_TYPE VARCHAR(100) NOT NULL, + CONFIGURATION BLOB NOT NULL, + PRIMARY KEY (ORGANIZATION,CONFIG_TYPE) +)ENGINE INNODB; + -- Performance indexes start-- create index IDX_ITS_LMT on IDN_THRIFT_SESSION (LAST_MODIFIED_TIME); create index IDX_IOAT_UT on IDN_OAUTH2_ACCESS_TOKEN (USER_TYPE); create index IDX_AAI_CTX on AM_API (CONTEXT); +create index IDX_AAI_ORG on AM_API (ORGANIZATION); create index IDX_AAKM_CK on AM_APPLICATION_KEY_MAPPING (CONSUMER_KEY); create index IDX_AAUM_AI on AM_API_URL_MAPPING (API_ID); create index IDX_AAPM_AI on AM_API_PRODUCT_MAPPING (API_ID); diff --git a/docker-compose/apim-with-mi/conf/mysql/scripts/mysql_shared.sql b/docker-compose/apim-with-mi/conf/mysql/scripts/mysql_shared.sql index 38175e10..ff813864 100644 --- a/docker-compose/apim-with-mi/conf/mysql/scripts/mysql_shared.sql +++ b/docker-compose/apim-with-mi/conf/mysql/scripts/mysql_shared.sql @@ -166,6 +166,7 @@ ALTER TABLE REG_RESOURCE_TAG ADD CONSTRAINT REG_RESOURCE_TAG_FK_BY_PATH_ID FOREI ALTER TABLE REG_RESOURCE_TAG ADD CONSTRAINT REG_RESOURCE_TAG_FK_BY_TAG_ID FOREIGN KEY (REG_TAG_ID, REG_TENANT_ID) REFERENCES REG_TAG (REG_ID, REG_TENANT_ID); CREATE INDEX REG_RESOURCE_TAG_IND_BY_PATH_ID_AND_RESOURCE_NAME USING HASH ON REG_RESOURCE_TAG(REG_PATH_ID, REG_RESOURCE_NAME, REG_TENANT_ID); CREATE INDEX REG_RESOURCE_TAG_IND_BY_VERSION USING HASH ON REG_RESOURCE_TAG(REG_VERSION, REG_TENANT_ID); +CREATE INDEX REG_RESOURCE_TAG_IND_BY_REG_TAG_ID USING HASH ON REG_RESOURCE_TAG(REG_TAG_ID, REG_TENANT_ID); CREATE TABLE IF NOT EXISTS REG_PROPERTY ( REG_ID INTEGER NOT NULL AUTO_INCREMENT, @@ -187,6 +188,7 @@ ALTER TABLE REG_RESOURCE_PROPERTY ADD CONSTRAINT REG_RESOURCE_PROPERTY_FK_BY_PAT ALTER TABLE REG_RESOURCE_PROPERTY ADD CONSTRAINT REG_RESOURCE_PROPERTY_FK_BY_TAG_ID FOREIGN KEY (REG_PROPERTY_ID, REG_TENANT_ID) REFERENCES REG_PROPERTY (REG_ID, REG_TENANT_ID); CREATE INDEX REG_RESOURCE_PROPERTY_IND_BY_PATH_ID_AND_RESOURCE_NAME USING HASH ON REG_RESOURCE_PROPERTY(REG_PATH_ID, REG_RESOURCE_NAME, REG_TENANT_ID); CREATE INDEX REG_RESOURCE_PROPERTY_IND_BY_VERSION USING HASH ON REG_RESOURCE_PROPERTY(REG_VERSION, REG_TENANT_ID); +CREATE INDEX REG_RESOURCE_PROPERTY_IND_BY_REG_PROP_ID ON REG_RESOURCE_PROPERTY(REG_TENANT_ID, REG_PROPERTY_ID); -- CREATE TABLE IF NOT EXISTS REG_ASSOCIATIONS ( -- SRC_PATH_ID INTEGER, diff --git a/docker-compose/apim-with-mi/docker-compose.yml b/docker-compose/apim-with-mi/docker-compose.yml index 48b83110..a9565e29 100644 --- a/docker-compose/apim-with-mi/docker-compose.yml +++ b/docker-compose/apim-with-mi/docker-compose.yml @@ -15,7 +15,7 @@ version: '2.4' services: mysql: - image: mysql:5.7.34 + image: mysql:5.7.37 ports: - 3306 environment: diff --git a/docker-compose/apim-with-mi/dockerfiles/apim/Dockerfile b/docker-compose/apim-with-mi/dockerfiles/apim/Dockerfile index 30f07ca2..4fd13312 100644 --- a/docker-compose/apim-with-mi/dockerfiles/apim/Dockerfile +++ b/docker-compose/apim-with-mi/dockerfiles/apim/Dockerfile @@ -17,7 +17,7 @@ # ------------------------------------------------------------------------ # set base Docker image to WSO2 API Manager Docker image with latest WSO2 Updates -FROM docker.wso2.com/wso2am:4.0.0.0 +FROM docker.wso2.com/wso2am:4.1.0.0 LABEL maintainer="WSO2 Docker Maintainers " # build arguments for external artifacts diff --git a/docker-compose/apim-with-mi/dockerfiles/mi/Dockerfile b/docker-compose/apim-with-mi/dockerfiles/mi/Dockerfile index c31e04d7..e0ca3f39 100644 --- a/docker-compose/apim-with-mi/dockerfiles/mi/Dockerfile +++ b/docker-compose/apim-with-mi/dockerfiles/mi/Dockerfile @@ -16,7 +16,7 @@ # # ------------------------------------------------------------------------ -FROM docker.wso2.com/wso2mi:4.0.0.0 +FROM docker.wso2.com/wso2mi:4.1.0.0 LABEL maintainer="WSO2 Docker Maintainers " # copy CAR files to the MI server home diff --git a/docker-compose/apim-with-mi/dockerfiles/mi/capps/ServiceCatalogSampleCompositeExporter_1.0.0-SNAPSHOT.car b/docker-compose/apim-with-mi/dockerfiles/mi/capps/ServiceCatalogSampleCompositeExporter_1.0.0-SNAPSHOT.car old mode 100644 new mode 100755 index f2161119..7713c764 Binary files a/docker-compose/apim-with-mi/dockerfiles/mi/capps/ServiceCatalogSampleCompositeExporter_1.0.0-SNAPSHOT.car and b/docker-compose/apim-with-mi/dockerfiles/mi/capps/ServiceCatalogSampleCompositeExporter_1.0.0-SNAPSHOT.car differ diff --git a/dockerfiles/alpine/apim/Dockerfile b/dockerfiles/alpine/apim/Dockerfile index 7f09e058..20d2178f 100755 --- a/dockerfiles/alpine/apim/Dockerfile +++ b/dockerfiles/alpine/apim/Dockerfile @@ -61,7 +61,7 @@ RUN echo Verifying install ... \ && echo Complete. LABEL maintainer="WSO2 Docker Maintainers " \ - com.wso2.docker.source="https://github.com/wso2/docker-apim/releases/tag/v4.0.0.4" + com.wso2.docker.source="https://github.com/wso2/docker-apim/releases/tag/v4.1.0.1" # set Docker image build arguments # build arguments for user/group configurations @@ -72,7 +72,7 @@ ARG USER_GROUP_ID=802 ARG USER_HOME=/home/${USER} # build arguments for WSO2 product installation ARG WSO2_SERVER_NAME=wso2am -ARG WSO2_SERVER_VERSION=4.0.0 +ARG WSO2_SERVER_VERSION=4.1.0 ARG WSO2_SERVER_REPOSITORY=product-apim ARG WSO2_SERVER=${WSO2_SERVER_NAME}-${WSO2_SERVER_VERSION} ARG WSO2_SERVER_HOME=${USER_HOME}/${WSO2_SERVER} diff --git a/dockerfiles/alpine/apim/README.md b/dockerfiles/alpine/apim/README.md index b489f119..533a4488 100755 --- a/dockerfiles/alpine/apim/README.md +++ b/dockerfiles/alpine/apim/README.md @@ -1,6 +1,6 @@ # Dockerfile for WSO2 API Manager # -This section defines the step-by-step instructions to build an [Alpine](https://hub.docker.com/_/alpine/) Linux based Docker image for WSO2 API Manager 4.0.0. +This section defines the step-by-step instructions to build an [Alpine](https://hub.docker.com/_/alpine/) Linux based Docker image for WSO2 API Manager 4.1.0. ## Prerequisites @@ -9,7 +9,7 @@ This section defines the step-by-step instructions to build an [Alpine](https:// ## How to build an image and run -##### 1. Checkout this repository into your local machine using the following Git client command. +#### 1. Checkout this repository into your local machine using the following Git client command. ``` git clone https://github.com/wso2/docker-apim.git @@ -17,22 +17,35 @@ git clone https://github.com/wso2/docker-apim.git > The local copy of the `dockerfiles/alpine/apim` directory will be referred to as `AM_DOCKERFILE_HOME` from this point onwards. -##### 2. Build the Docker image. +#### 2. Build the Docker image. + + - Navigate to `` directory.
Execute `docker build` command as shown below. - + `docker build -t wso2am:4.0.0-alpine .` + +``` +docker build -t wso2am:4.1.0-alpine . +``` > By default, the Docker image will prepackage the General Availability (GA) release version of the relevant WSO2 product. -##### 3. Running the Docker image. +> Note:- wso2am:4.1.0-alpine image can only be built on amd64(x86_64). It is not supported to be built or run natively on Apple silicon. But it is possible to build an amd64 image using [Docker buildx](https://docs.docker.com/desktop/multi-arch/) and then run via emulation on rosetta. Use following command. + +``` +docker buildx build --platform linux/amd64 -t wso2am:4.1.0-alpine . +``` + +#### 3. Running the Docker image. -- `docker run -it -p 9443:9443 wso2am:4.0.0-alpine` +``` +docker run -it -p 9443:9443 -p 8243:8243 wso2am:4.1.0-alpine +``` -> Here, only port 9443 (HTTPS servlet transport) has been mapped to a Docker host port. +> Here, only port 9443 (HTTPS servlet transport) and port 8243 (Passthrough or NIO HTTPS transport) have been mapped to Docker host ports. You may map other container service ports, which have been exposed to Docker host ports, as desired. -##### 4. Accessing management console. +#### 4. Accessing management console. - To access the management console, use the docker host IP and port 9443. + `https://:9443/carbon` @@ -44,31 +57,43 @@ You may map other container service ports, which have been exposed to Docker hos Configurations would lie on the Docker host machine and they can be volume mounted to the container.
As an example, steps required to change the port offset using `deployment.toml` is as follows: -##### 1. Stop the API Manager container if it's already running. +#### 1. Stop the API Manager container if it's already running. -In WSO2 API Manager version 4.0.0 product distribution, `deployment.toml` configuration file
+In WSO2 API Manager version 4.1.0 product distribution, `deployment.toml` configuration file
can be found at `/repository/conf`. Copy the file to some suitable location of the host machine,
referred to as `/deployment.toml` and change the offset value (`[server]->offset`) to 1. -##### 2. Grant read permission to `other` users for `/deployment.toml`. +#### 2. Grant read permission to `other` users for `/deployment.toml`. ``` chmod o+r /deployment.toml ``` -##### 3. Run the image by mounting the file to container as follows: +#### 3. Run the image by mounting the file to container as follows: ``` docker run \ -p 9444:9444 \ +-p 8244:8244 \ --volume /deployment.toml:/deployment.toml \ -wso2am:4.0.0-alpine +wso2am:4.1.0-alpine +``` + +> In here, refers to /home/wso2carbon/wso2am-4.1.0/repository/conf folder of the container. + +## Running official wso2am image +It is possible to use official wso2am images without building them from the scratch. + +- To run on amd64 +``` +docker run -it -p 9443:9443 -p 8243:8243 wso2/wso2am:4.1.0-alpine ``` +> This image is only supported for amd64. -> In here, refers to /home/wso2carbon/wso2am-4.0.0/repository/conf folder of the container. ## Docker command usage references * [Docker build command reference](https://docs.docker.com/engine/reference/commandline/build/) * [Docker run command reference](https://docs.docker.com/engine/reference/run/) * [Dockerfile reference](https://docs.docker.com/engine/reference/builder/) +* [Docker buildx reference](https://docs.docker.com/buildx/working-with-buildx/) diff --git a/dockerfiles/centos/apim/Dockerfile b/dockerfiles/centos/apim/Dockerfile index bcfeb0bf..cd79b8e0 100755 --- a/dockerfiles/centos/apim/Dockerfile +++ b/dockerfiles/centos/apim/Dockerfile @@ -65,7 +65,7 @@ RUN echo Verifying install ... \ && echo Complete. LABEL maintainer="WSO2 Docker Maintainers " \ - com.wso2.docker.source="https://github.com/wso2/docker-apim/releases/tag/v4.0.0.4" + com.wso2.docker.source="https://github.com/wso2/docker-apim/releases/tag/v4.1.0.1" # set Docker image build arguments # build arguments for user/group configurations @@ -76,7 +76,7 @@ ARG USER_GROUP_ID=802 ARG USER_HOME=/home/${USER} # build arguments for WSO2 product installation ARG WSO2_SERVER_NAME=wso2am -ARG WSO2_SERVER_VERSION=4.0.0 +ARG WSO2_SERVER_VERSION=4.1.0 ARG WSO2_SERVER_REPOSITORY=product-apim ARG WSO2_SERVER=${WSO2_SERVER_NAME}-${WSO2_SERVER_VERSION} ARG WSO2_SERVER_HOME=${USER_HOME}/${WSO2_SERVER} diff --git a/dockerfiles/centos/apim/README.md b/dockerfiles/centos/apim/README.md index ba603475..734c2350 100755 --- a/dockerfiles/centos/apim/README.md +++ b/dockerfiles/centos/apim/README.md @@ -1,6 +1,6 @@ # Dockerfile for WSO2 API Manager # -This section defines the step-by-step instructions to build an [CentOS](https://hub.docker.com/_/centos/) Linux based Docker image for WSO2 API Manager 4.0.0. +This section defines the step-by-step instructions to build an [CentOS](https://hub.docker.com/_/centos/) Linux based Docker image for WSO2 API Manager 4.1.0. ## Prerequisites @@ -10,7 +10,7 @@ This section defines the step-by-step instructions to build an [CentOS](https:// ## How to build an image and run -##### 1. Checkout this repository into your local machine using the following Git client command. +#### 1. Checkout this repository into your local machine using the following Git client command. ``` git clone https://github.com/wso2/docker-apim.git @@ -18,22 +18,27 @@ git clone https://github.com/wso2/docker-apim.git > The local copy of the `dockerfiles/centos/apim` directory will be referred to as `AM_DOCKERFILE_HOME` from this point onwards. -##### 2. Build the Docker image. +#### 2. Build the Docker image. - Navigate to `` directory.
Execute `docker build` command as shown below. - + `docker build -t wso2am:4.0.0-centos .` + +``` +docker build -t wso2am:4.1.0-centos . +``` > By default, the Docker image will prepackage the General Availability (GA) release version of the relevant WSO2 product. -##### 3. Running the Docker image. +#### 3. Running the Docker image. -- `docker run -it -p 9443:9443 wso2am:4.0.0-centos` +``` +docker run -it -p 9443:9443 -p 8243:8243 wso2am:4.1.0-centos +``` -> Here, only port 9443 (HTTPS servlet transport) has been mapped to a Docker host port. +> Here, only port 9443 (HTTPS servlet transport) and port 8243 (Passthrough or NIO HTTPS transport) have been mapped to Docker host ports. You may map other container service ports, which have been exposed to Docker host ports, as desired. -##### 4. Accessing management console. +#### 4. Accessing management console. - To access the management console, use the docker host IP and port 9443. + `https://:9443/carbon` @@ -45,31 +50,82 @@ You may map other container service ports, which have been exposed to Docker hos Configurations would lie on the Docker host machine and they can be volume mounted to the container.
As an example, steps required to change the port offset using `deployment.toml` is as follows: -##### 1. Stop the API Manager container if it's already running. +#### 1. Stop the API Manager container if it's already running. -In WSO2 API Manager version 4.0.0 product distribution, `deployment.toml` configuration file
+In WSO2 API Manager version 4.1.0 product distribution, `deployment.toml` configuration file
can be found at `/repository/conf`. Copy the file to some suitable location of the host machine,
referred to as `/deployment.toml` and change the offset value (`[server]->offset`) to 1. -##### 2. Grant read permission to `other` users for `/deployment.toml`. +#### 2. Grant read permission to `other` users for `/deployment.toml`. ``` chmod o+r /deployment.toml ``` -##### 3. Run the image by mounting the file to container as follows: +#### 3. Run the image by mounting the file to container as follows: ``` docker run \ -p 9444:9444 \ +-p 8244:8244 \ --volume /deployment.toml:/deployment.toml \ -wso2am:4.0.0-centos +wso2am:4.1.0-centos ``` -> In here, refers to /home/wso2carbon/wso2am-4.0.0/repository/conf folder of the container. +> In here, refers to /home/wso2carbon/wso2am-4.1.0/repository/conf folder of the container. + +## Running official Ubuntu wso2am images +It is possible to use official wso2am images without building them from the scratch. + +- To run on amd64 or Apple Silicon (arm64) +``` +docker run -it -p 9443:9443 -p 8243:8243 wso2/wso2am:4.1.0-centos +``` +> This official image is built for amd64 thus it will not run on Apple silicon natively. But it will run on emulated docker on Rosetta. + +## How to build a Docker image with multi architecture support + +The above wso2am:4.1.0 image will only be supported for the CPU architecture of your current machine. Docker buildx plugin can be used to build wso2am:4.1.0 image to support any CPU architecture. + +#### 1. Install [Docker Buildx](https://docs.docker.com/buildx/working-with-buildx/) + +#### 2. Install [QEMU Emulators](https://github.com/tonistiigi/binfmt) +``` +docker run -it --rm --privileged tonistiigi/binfmt --install all +``` + +#### 3. Create, switch and inspect a new builder +``` +docker buildx create --name wso2ambuilder +``` +``` +docker buildx use wso2ambuilder +``` +``` +docker buildx inspect --bootstrap +``` +#### 4. Build and push + +``` +docker buildx build --platform linux/amd64,linux/arm64 -t /wso2am:4.1.0-centos-multiarch --push . +``` + +> - Here is a valid Docker or Dockerhub username. +> - Use command "docker login" to authenticate first if it fails to push. +> - You can specify any number of platforms to support --platform flag +> - Use command "docker buildx ls" to see list of existing builders and supported platforms. +> - Please note we have only tested this for linux/amd64 and linux/arm64 platforms only + +#### 5. Run +``` +docker run -it -p 9443:9443 -p 8243:8243 /wso2am:4.1.0-centos-multiarch +``` +> Docker will pull the suitable image for the architecture and run ## Docker command usage references * [Docker build command reference](https://docs.docker.com/engine/reference/commandline/build/) * [Docker run command reference](https://docs.docker.com/engine/reference/run/) * [Dockerfile reference](https://docs.docker.com/engine/reference/builder/) +* [Docker multi architecture build reference](https://docs.docker.com/desktop/multi-arch/) +* [Docker buildx reference](https://docs.docker.com/buildx/working-with-buildx/) diff --git a/dockerfiles/jdk8/alpine/apim/Dockerfile b/dockerfiles/jdk8/alpine/apim/Dockerfile index 6dc8a8f6..e9c4f4ec 100755 --- a/dockerfiles/jdk8/alpine/apim/Dockerfile +++ b/dockerfiles/jdk8/alpine/apim/Dockerfile @@ -90,7 +90,7 @@ RUN echo Verifying install ... \ && echo Complete. LABEL maintainer="WSO2 Docker Maintainers " \ - com.wso2.docker.source="https://github.com/wso2/docker-apim/releases/tag/v4.0.0.4" + com.wso2.docker.source="https://github.com/wso2/docker-apim/releases/tag/v4.1.0.1" # set Docker image build arguments # build arguments for user/group configurations @@ -101,7 +101,7 @@ ARG USER_GROUP_ID=802 ARG USER_HOME=/home/${USER} # build arguments for WSO2 product installation ARG WSO2_SERVER_NAME=wso2am -ARG WSO2_SERVER_VERSION=4.0.0 +ARG WSO2_SERVER_VERSION=4.1.0 ARG WSO2_SERVER_REPOSITORY=product-apim ARG WSO2_SERVER=${WSO2_SERVER_NAME}-${WSO2_SERVER_VERSION} ARG WSO2_SERVER_HOME=${USER_HOME}/${WSO2_SERVER} diff --git a/dockerfiles/jdk8/alpine/apim/README.md b/dockerfiles/jdk8/alpine/apim/README.md index 22e18218..267c6072 100755 --- a/dockerfiles/jdk8/alpine/apim/README.md +++ b/dockerfiles/jdk8/alpine/apim/README.md @@ -1,6 +1,6 @@ # Dockerfile for WSO2 API Manager # -This section defines the step-by-step instructions to build an [Alpine](https://hub.docker.com/_/alpine/) Linux based Docker image for WSO2 API Manager 4.0.0. +This section defines the step-by-step instructions to build an [Alpine](https://hub.docker.com/_/alpine/) Linux based Docker image for WSO2 API Manager 4.1.0. ## Prerequisites @@ -9,7 +9,7 @@ This section defines the step-by-step instructions to build an [Alpine](https:// ## How to build an image and run -##### 1. Checkout this repository into your local machine using the following Git client command. +#### 1. Checkout this repository into your local machine using the following Git client command. ``` git clone https://github.com/wso2/docker-apim.git @@ -17,22 +17,32 @@ git clone https://github.com/wso2/docker-apim.git > The local copy of the `dockerfiles/alpine/apim` directory will be referred to as `AM_DOCKERFILE_HOME` from this point onwards. -##### 2. Build the Docker image. +#### 2. Build the Docker image. - Navigate to `` directory.
Execute `docker build` command as shown below. - + `docker build -t wso2am:4.0.0-alpine-jdk8 .` +``` +docker build -t wso2am:4.1.0-alpine-jdk8 . +``` > By default, the Docker image will prepackage the General Availability (GA) release version of the relevant WSO2 product. -##### 3. Running the Docker image. +> Note:- wso2am:4.1.0-alpine-jdk8 image can only be built on amd64(x86_64). It is not supported to be built or run natively on Apple silicon. But it is possible to build an amd64 image using [Docker buildx](https://docs.docker.com/desktop/multi-arch/) and then run via emulation on rosetta. Use following command. + +``` +docker buildx build --platform linux/amd64 -t wso2am:4.1.0-alpine-jdk8 . +``` + +#### 3. Running the Docker image. -- `docker run -it -p 9443:9443 wso2am:4.0.0-alpine-jdk8` +``` +docker run -it -p 9443:9443 -p 8243:8243 wso2am:4.1.0-alpine-jdk8 +``` -> Here, only port 9443 (HTTPS servlet transport) has been mapped to a Docker host port. +> Here, only port 9443 (HTTPS servlet transport) and port 8243 (Passthrough or NIO HTTPS transport) have been mapped to Docker host ports. You may map other container service ports, which have been exposed to Docker host ports, as desired. -##### 4. Accessing management console. +#### 4. Accessing management console. - To access the management console, use the docker host IP and port 9443. + `https://:9443/carbon` @@ -44,31 +54,33 @@ You may map other container service ports, which have been exposed to Docker hos Configurations would lie on the Docker host machine and they can be volume mounted to the container.
As an example, steps required to change the port offset using `deployment.toml` is as follows: -##### 1. Stop the API Manager container if it's already running. +#### 1. Stop the API Manager container if it's already running. -In WSO2 API Manager version 4.0.0 product distribution, `deployment.toml` configuration file
+In WSO2 API Manager version 4.1.0 product distribution, `deployment.toml` configuration file
can be found at `/repository/conf`. Copy the file to some suitable location of the host machine,
referred to as `/deployment.toml` and change the offset value (`[server]->offset`) to 1. -##### 2. Grant read permission to `other` users for `/deployment.toml`. +#### 2. Grant read permission to `other` users for `/deployment.toml`. ``` chmod o+r /deployment.toml ``` -##### 3. Run the image by mounting the file to container as follows: +#### 3. Run the image by mounting the file to container as follows: ``` docker run \ -p 9444:9444 \ +-p 8244:8244 \ --volume /deployment.toml:/deployment.toml \ -wso2am:4.0.0-alpine-jdk8 +wso2am:4.1.0-alpine-jdk8 ``` -> In here, refers to /home/wso2carbon/wso2am-4.0.0/repository/conf folder of the container. +> In here, refers to /home/wso2carbon/wso2am-4.1.0/repository/conf folder of the container. ## Docker command usage references * [Docker build command reference](https://docs.docker.com/engine/reference/commandline/build/) * [Docker run command reference](https://docs.docker.com/engine/reference/run/) * [Dockerfile reference](https://docs.docker.com/engine/reference/builder/) +* [Docker buildx reference](https://docs.docker.com/buildx/working-with-buildx/) \ No newline at end of file diff --git a/dockerfiles/jdk8/centos/apim/Dockerfile b/dockerfiles/jdk8/centos/apim/Dockerfile index 183fae23..c091c8bf 100755 --- a/dockerfiles/jdk8/centos/apim/Dockerfile +++ b/dockerfiles/jdk8/centos/apim/Dockerfile @@ -65,7 +65,7 @@ RUN echo Verifying install ... \ && echo Complete. LABEL maintainer="WSO2 Docker Maintainers " \ - com.wso2.docker.source="https://github.com/wso2/docker-apim/releases/tag/v4.0.0.4" + com.wso2.docker.source="https://github.com/wso2/docker-apim/releases/tag/v4.1.0.1" # set Docker image build arguments # build arguments for user/group configurations @@ -76,7 +76,7 @@ ARG USER_GROUP_ID=802 ARG USER_HOME=/home/${USER} # build arguments for WSO2 product installation ARG WSO2_SERVER_NAME=wso2am -ARG WSO2_SERVER_VERSION=4.0.0 +ARG WSO2_SERVER_VERSION=4.1.0 ARG WSO2_SERVER_REPOSITORY=product-apim ARG WSO2_SERVER=${WSO2_SERVER_NAME}-${WSO2_SERVER_VERSION} ARG WSO2_SERVER_HOME=${USER_HOME}/${WSO2_SERVER} diff --git a/dockerfiles/jdk8/centos/apim/README.md b/dockerfiles/jdk8/centos/apim/README.md index c8e1c8b7..cfb73a0e 100755 --- a/dockerfiles/jdk8/centos/apim/README.md +++ b/dockerfiles/jdk8/centos/apim/README.md @@ -1,6 +1,6 @@ # Dockerfile for WSO2 API Manager # -This section defines the step-by-step instructions to build an [CentOS](https://hub.docker.com/_/centos/) Linux based Docker image for WSO2 API Manager 4.0.0. +This section defines the step-by-step instructions to build an [CentOS](https://hub.docker.com/_/centos/) Linux based Docker image for WSO2 API Manager 4.1.0. ## Prerequisites @@ -10,7 +10,7 @@ This section defines the step-by-step instructions to build an [CentOS](https:// ## How to build an image and run -##### 1. Checkout this repository into your local machine using the following Git client command. +#### 1. Checkout this repository into your local machine using the following Git client command. ``` git clone https://github.com/wso2/docker-apim.git @@ -18,22 +18,26 @@ git clone https://github.com/wso2/docker-apim.git > The local copy of the `dockerfiles/centos/apim` directory will be referred to as `AM_DOCKERFILE_HOME` from this point onwards. -##### 2. Build the Docker image. +#### 2. Build the Docker image. - Navigate to `` directory.
Execute `docker build` command as shown below. - + `docker build -t wso2am:4.0.0-centos-jdk8 .` +``` +docker build -t wso2am:4.1.0-centos-jdk8 . +``` > By default, the Docker image will prepackage the General Availability (GA) release version of the relevant WSO2 product. -##### 3. Running the Docker image. +#### 3. Running the Docker image. -- `docker run -it -p 9443:9443 wso2am:4.0.0-centos-jdk8` +``` +docker run -it -p 9443:9443 -p 8243:8243 wso2am:4.1.0-centos-jdk8 +``` -> Here, only port 9443 (HTTPS servlet transport) has been mapped to a Docker host port. +> Here, only port 9443 (HTTPS servlet transport) and port 8243 (Passthrough or NIO HTTPS transport) have been mapped to Docker host ports. You may map other container service ports, which have been exposed to Docker host ports, as desired. -##### 4. Accessing management console. +#### 4. Accessing management console. - To access the management console, use the docker host IP and port 9443. + `https://:9443/carbon` @@ -45,31 +49,73 @@ You may map other container service ports, which have been exposed to Docker hos Configurations would lie on the Docker host machine and they can be volume mounted to the container.
As an example, steps required to change the port offset using `deployment.toml` is as follows: -##### 1. Stop the API Manager container if it's already running. +#### 1. Stop the API Manager container if it's already running. -In WSO2 API Manager version 4.0.0 product distribution, `deployment.toml` configuration file
+In WSO2 API Manager version 4.1.0 product distribution, `deployment.toml` configuration file
can be found at `/repository/conf`. Copy the file to some suitable location of the host machine,
referred to as `/deployment.toml` and change the offset value (`[server]->offset`) to 1. -##### 2. Grant read permission to `other` users for `/deployment.toml`. +#### 2. Grant read permission to `other` users for `/deployment.toml`. ``` chmod o+r /deployment.toml ``` -##### 3. Run the image by mounting the file to container as follows: +#### 3. Run the image by mounting the file to container as follows: ``` docker run \ -p 9444:9444 \ +-p 8244:8244 \ --volume /deployment.toml:/deployment.toml \ -wso2am:4.0.0-centos-jdk8 +wso2am:4.1.0-centos-jdk8 +``` + +> In here, refers to /home/wso2carbon/wso2am-4.1.0/repository/conf folder of the container. + +## How to build a Docker image with multi architecture support + +The above wso2am:4.1.0-centos-jdk8 image will only be supported for the CPU architecture of your current machine. Docker buildx plugin can be used to build wso2am:4.1.0-centos-jdk8 image to support any CPU architecture. + +#### 1. Install [Docker Buildx](https://docs.docker.com/buildx/working-with-buildx/) + +#### 2. Install [QEMU Emulators](https://github.com/tonistiigi/binfmt) +``` +docker run -it --rm --privileged tonistiigi/binfmt --install all +``` + +#### 3. Create, switch and inspect a new builder +``` +docker buildx create --name wso2ambuilder +``` +``` +docker buildx use wso2ambuilder +``` +``` +docker buildx inspect --bootstrap ``` +#### 4. Build and push -> In here, refers to /home/wso2carbon/wso2am-4.0.0/repository/conf folder of the container. +``` +docker buildx build --platform linux/amd64,linux/arm64 -t /wso2am:4.1.0-centos-jdk8-multiarch --push . +``` + +> - Here is a valid Docker or Dockerhub username. +> - Use command "docker login" to authenticate first if it fails to push. +> - You can specify any number of platforms to support --platform flag +> - Use command "docker buildx ls" to see list of existing builders and supported platforms. +> - Please note we have only tested this for linux/amd64 and linux/arm64 platforms only + +#### 5. Run +``` +docker run -it -p 9443:9443 -p 8243:8243 /wso2am:4.1.0-centos-jdk8-multiarch +``` +> Docker will pull the suitable image for the architecture and run ## Docker command usage references * [Docker build command reference](https://docs.docker.com/engine/reference/commandline/build/) * [Docker run command reference](https://docs.docker.com/engine/reference/run/) * [Dockerfile reference](https://docs.docker.com/engine/reference/builder/) +* [Docker multi architecture build reference](https://docs.docker.com/desktop/multi-arch/) +* [Docker buildx reference](https://docs.docker.com/buildx/working-with-buildx/) diff --git a/dockerfiles/jdk8/ubuntu/apim/Dockerfile b/dockerfiles/jdk8/ubuntu/apim/Dockerfile index 43476276..fb779504 100755 --- a/dockerfiles/jdk8/ubuntu/apim/Dockerfile +++ b/dockerfiles/jdk8/ubuntu/apim/Dockerfile @@ -68,7 +68,7 @@ RUN echo Verifying install ... \ && echo Complete. LABEL maintainer="WSO2 Docker Maintainers " \ - com.wso2.docker.source="https://github.com/wso2/docker-apim/releases/tag/v4.0.0.4" + com.wso2.docker.source="https://github.com/wso2/docker-apim/releases/tag/v4.1.0.1" # set Docker image build arguments # build arguments for user/group configurations @@ -79,7 +79,7 @@ ARG USER_GROUP_ID=802 ARG USER_HOME=/home/${USER} # build arguments for WSO2 product installation ARG WSO2_SERVER_NAME=wso2am -ARG WSO2_SERVER_VERSION=4.0.0 +ARG WSO2_SERVER_VERSION=4.1.0 ARG WSO2_SERVER_REPOSITORY=product-apim ARG WSO2_SERVER=${WSO2_SERVER_NAME}-${WSO2_SERVER_VERSION} ARG WSO2_SERVER_HOME=${USER_HOME}/${WSO2_SERVER} diff --git a/dockerfiles/jdk8/ubuntu/apim/README.md b/dockerfiles/jdk8/ubuntu/apim/README.md index 899210e8..e2636f0c 100755 --- a/dockerfiles/jdk8/ubuntu/apim/README.md +++ b/dockerfiles/jdk8/ubuntu/apim/README.md @@ -1,6 +1,6 @@ # Dockerfile for WSO2 API Manager # -This section defines the step-by-step instructions to build an [Ubuntu](https://hub.docker.com/_/ubuntu/) Linux based Docker image for WSO2 API Manager 4.0.0. +This section defines the step-by-step instructions to build an [Ubuntu](https://hub.docker.com/_/ubuntu/) Linux based Docker image for WSO2 API Manager 4.1.0. ## Prerequisites @@ -9,7 +9,7 @@ This section defines the step-by-step instructions to build an [Ubuntu](https:// ## How to build an image and run -##### 1. Checkout this repository into your local machine using the following Git client command. +#### 1. Checkout this repository into your local machine using the following Git client command. ``` git clone https://github.com/wso2/docker-apim.git @@ -17,22 +17,26 @@ git clone https://github.com/wso2/docker-apim.git > The local copy of the `dockerfiles/ubuntu/apim` directory will be referred to as `AM_DOCKERFILE_HOME` from this point onwards. -##### 2. Build the Docker image. +#### 2. Build the Docker image. - Navigate to `` directory.
Execute `docker build` command as shown below. - + `docker build -t wso2am:4.0.0-jdk8 .` +``` +docker build -t wso2am:4.1.0-jdk8 . +``` > By default, the Docker image will prepackage the General Availability (GA) release version of the relevant WSO2 product. -##### 3. Running the Docker image. +#### 3. Running the Docker image. -- `docker run -it -p 9443:9443 wso2am:4.0.0-jdk8` +``` +docker run -it -p 9443:9443 -p 8242:8243 wso2am:4.1.0-jdk8 +``` -> Here, only port 9443 (HTTPS servlet transport) has been mapped to a Docker host port. +> Here, only port 9443 (HTTPS servlet transport) and port 8243 (Passthrough or NIO HTTPS transport) have been mapped to Docker host ports. You may map other container service ports, which have been exposed to Docker host ports, as desired. -##### 4. Accessing management console. +#### 4. Accessing management console. - To access the management console, use the docker host IP and port 9443. + `https://:9443/carbon` @@ -44,31 +48,73 @@ You may map other container service ports, which have been exposed to Docker hos Configurations would lie on the Docker host machine and they can be volume mounted to the container.
As an example, steps required to change the port offset using `deployment.toml` is as follows: -##### 1. Stop the API Manager container if it's already running. +#### 1. Stop the API Manager container if it's already running. -In WSO2 API Manager version 4.0.0 product distribution, `deployment.toml` configuration file
+In WSO2 API Manager version 4.1.0 product distribution, `deployment.toml` configuration file
can be found at `/repository/conf`. Copy the file to some suitable location of the host machine,
referred to as `/deployment.toml` and change the offset value (`[server]->offset`) to 1. -##### 2. Grant read permission to `other` users for `/deployment.toml`. +#### 2. Grant read permission to `other` users for `/deployment.toml`. ``` chmod o+r /deployment.toml ``` -##### 3. Run the image by mounting the file to container as follows: +#### 3. Run the image by mounting the file to container as follows: ``` docker run \ -p 9444:9444 \ +-p 8244:8244 \ --volume /deployment.toml:/deployment.toml \ -wso2am:4.0.0-jdk8 +wso2am:4.1.0-jdk8 +``` + +> In here, refers to /home/wso2carbon/wso2am-4.1.0/repository/conf folder of the container. + +## How to build a Docker image with multi architecture support + +The above wso2am:4.1.0-jdk8 image will only be supported for the CPU architecture of your current machine. Docker buildx plugin can be used to build wso2am:4.1.0-jdk8 image to support any CPU architecture. + +#### 1. Install [Docker Buildx](https://docs.docker.com/buildx/working-with-buildx/) + +#### 2. Install [QEMU Emulators](https://github.com/tonistiigi/binfmt) +``` +docker run -it --rm --privileged tonistiigi/binfmt --install all +``` + +#### 3. Create, switch and inspect a new builder +``` +docker buildx create --name wso2ambuilder +``` +``` +docker buildx use wso2ambuilder +``` +``` +docker buildx inspect --bootstrap ``` +#### 4. Build and push -> In here, refers to /home/wso2carbon/wso2am-4.0.0/repository/conf folder of the container. +``` +docker buildx build --platform linux/amd64,linux/arm64 -t /wso2am:4.1.0-jdk8-multiarch --push . +``` + +> - Here is a valid Docker or Dockerhub username. +> - Use command "docker login" to authenticate first if it fails to push. +> - You can specify any number of platforms to support --platform flag +> - Use command "docker buildx ls" to see list of existing builders and supported platforms. +> - Please note we have only tested this for linux/amd64 and linux/arm64 platforms only + +#### 5. Run +``` +docker run -it -p 9443:9443 -p 8243:8243 /wso2am:4.1.0-jdk8-multiarch +``` +> Docker will pull the suitable image for the architecture and run ## Docker command usage references * [Docker build command reference](https://docs.docker.com/engine/reference/commandline/build/) * [Docker run command reference](https://docs.docker.com/engine/reference/run/) * [Dockerfile reference](https://docs.docker.com/engine/reference/builder/) +* [Docker multi architecture build reference](https://docs.docker.com/desktop/multi-arch/) +* [Docker buildx reference](https://docs.docker.com/buildx/working-with-buildx/) diff --git a/dockerfiles/ubuntu/apim/Dockerfile b/dockerfiles/ubuntu/apim/Dockerfile index ddbd03ae..9f3a67a8 100755 --- a/dockerfiles/ubuntu/apim/Dockerfile +++ b/dockerfiles/ubuntu/apim/Dockerfile @@ -76,7 +76,7 @@ RUN echo Verifying install ... \ && echo Complete. LABEL maintainer="WSO2 Docker Maintainers " \ - com.wso2.docker.source="https://github.com/wso2/docker-apim/releases/tag/v4.0.0.4" + com.wso2.docker.source="https://github.com/wso2/docker-apim/releases/tag/v4.1.0.1" # set Docker image build arguments # build arguments for user/group configurations @@ -87,7 +87,7 @@ ARG USER_GROUP_ID=802 ARG USER_HOME=/home/${USER} # build arguments for WSO2 product installation ARG WSO2_SERVER_NAME=wso2am -ARG WSO2_SERVER_VERSION=4.0.0 +ARG WSO2_SERVER_VERSION=4.1.0 ARG WSO2_SERVER_REPOSITORY=product-apim ARG WSO2_SERVER=${WSO2_SERVER_NAME}-${WSO2_SERVER_VERSION} ARG WSO2_SERVER_HOME=${USER_HOME}/${WSO2_SERVER} diff --git a/dockerfiles/ubuntu/apim/README.md b/dockerfiles/ubuntu/apim/README.md index 3490362f..7b33b78f 100755 --- a/dockerfiles/ubuntu/apim/README.md +++ b/dockerfiles/ubuntu/apim/README.md @@ -1,6 +1,6 @@ # Dockerfile for WSO2 API Manager # -This section defines the step-by-step instructions to build an [Ubuntu](https://hub.docker.com/_/ubuntu/) Linux based Docker image for WSO2 API Manager 4.0.0. +This section defines the step-by-step instructions to build an [Ubuntu](https://hub.docker.com/_/ubuntu/) Linux based Docker image for WSO2 API Manager 4.1.0. ## Prerequisites @@ -9,7 +9,7 @@ This section defines the step-by-step instructions to build an [Ubuntu](https:// ## How to build an image and run -##### 1. Checkout this repository into your local machine using the following Git client command. +#### 1. Checkout this repository into your local machine using the following Git client command. ``` git clone https://github.com/wso2/docker-apim.git @@ -17,22 +17,26 @@ git clone https://github.com/wso2/docker-apim.git > The local copy of the `dockerfiles/ubuntu/apim` directory will be referred to as `AM_DOCKERFILE_HOME` from this point onwards. -##### 2. Build the Docker image. +#### 2. Build the Docker image. - Navigate to `` directory.
Execute `docker build` command as shown below. - + `docker build -t wso2am:4.0.0 .` +``` +docker build -t wso2am:4.1.0 +``` > By default, the Docker image will prepackage the General Availability (GA) release version of the relevant WSO2 product. -##### 3. Running the Docker image. +#### 3. Running the Docker image. -- `docker run -it -p 9443:9443 wso2am:4.0.0` +``` +docker run -it -p 9443:9443 -p 8243:8243 wso2am:4.1.0 +``` -> Here, only port 9443 (HTTPS servlet transport) has been mapped to a Docker host port. +> Here, only port 9443 (HTTPS servlet transport) and port 8243 (Passthrough or NIO HTTPS transport) have been mapped to Docker host ports. You may map other container service ports, which have been exposed to Docker host ports, as desired. -##### 4. Accessing management console. +#### 4. Accessing management console. - To access the management console, use the docker host IP and port 9443. + `https://:9443/carbon` @@ -44,31 +48,87 @@ You may map other container service ports, which have been exposed to Docker hos Configurations would lie on the Docker host machine and they can be volume mounted to the container.
As an example, steps required to change the port offset using `deployment.toml` is as follows: -##### 1. Stop the API Manager container if it's already running. +#### 1. Stop the API Manager container if it's already running. -In WSO2 API Manager version 4.0.0 product distribution, `deployment.toml` configuration file
+In WSO2 API Manager version 4.1.0 product distribution, `deployment.toml` configuration file
can be found at `/repository/conf`. Copy the file to some suitable location of the host machine,
referred to as `/deployment.toml` and change the offset value (`[server]->offset`) to 1. -##### 2. Grant read permission to `other` users for `/deployment.toml`. +#### 2. Grant read permission to `other` users for `/deployment.toml`. ``` chmod o+r /deployment.toml ``` -##### 3. Run the image by mounting the file to container as follows: +#### 3. Run the image by mounting the file to container as follows: ``` docker run \ -p 9444:9444 \ +-p 8244:8244 \ --volume /deployment.toml:/deployment.toml \ -wso2am:4.0.0 +wso2am:4.1.0 +``` + +> In here, refers to /home/wso2carbon/wso2am-4.1.0/repository/conf folder of the container. + +## How to build a Docker image with multi architecture support + +The above wso2am:4.1.0 image will only be supported for the CPU architecture of your current machine. Docker buildx plugin can be used to build wso2am:4.1.0 image to support any CPU architecture. + +#### 1. Install [Docker Buildx](https://docs.docker.com/buildx/working-with-buildx/) + +#### 2. Install [QEMU Emulators](https://github.com/tonistiigi/binfmt) +``` +docker run -it --rm --privileged tonistiigi/binfmt --install all +``` + +#### 3. Create, switch and inspect a new builder +``` +docker buildx create --name wso2ambuilder +``` +``` +docker buildx use wso2ambuilder +``` +``` +docker buildx inspect --bootstrap +``` +#### 4. Build and push + +``` +docker buildx build --platform linux/amd64,linux/arm64 -t /wso2am:4.1.0-multiarch --push . +``` + +> - Here is a valid Docker or Dockerhub username. +> - Use command "docker login" to authenticate first if it fails to push. +> - You can specify any number of platforms to support --platform flag +> - Use command "docker buildx ls" to see list of existing builders and supported platforms. +> - Please note we have only tested this for linux/amd64 and linux/arm64 platforms only + +#### 5. Run +``` +docker run -it -p 9443:9443 -p 8243:8243 /wso2am:4.1.0-multiarch +``` +> Docker will pull the suitable image for the architecture and run + +## Running official wso2am images +It is possible to use official wso2am images without building them from the scratch. + +- To run on amd64 +``` +docker run -it -p 9443:9443 -p 8243:8243 wso2/wso2am:latest +``` + +- To run on native Apple Silicon ( arm64 ) +``` +docker run -it -p 9443:9443 -p 8243:8243 wso2/wso2am:4.1.0-multiarch ``` -> In here, refers to /home/wso2carbon/wso2am-4.0.0/repository/conf folder of the container. ## Docker command usage references * [Docker build command reference](https://docs.docker.com/engine/reference/commandline/build/) * [Docker run command reference](https://docs.docker.com/engine/reference/run/) * [Dockerfile reference](https://docs.docker.com/engine/reference/builder/) +* [Docker multi architecture build reference](https://docs.docker.com/desktop/multi-arch/) +* [Docker buildx reference](https://docs.docker.com/buildx/working-with-buildx/)