Skip to content

Commit

Permalink
Feat: native cf deployment with hana cloud (#26)
Browse files Browse the repository at this point in the history
Native deployment to CF with HANA Cloud persistency
  • Loading branch information
willemi069808 authored Oct 30, 2024
1 parent eb54601 commit d28941a
Show file tree
Hide file tree
Showing 55 changed files with 30,380 additions and 764 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,7 @@ mta_archives/
.idea
db/data/migrationtool-Tenants*.csv
temp/
dist/

# added by cds
.cdsrc-private.json
40 changes: 37 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ If you don't have a SAP Integration Suite license yet, you can use the BTP Free

## Download & Installation

This tool is designed to run locally on your own laptop, server or VM. It is developed using the [SAP Cloud Application Programming Model](https://cap.cloud.sap), using Node.js as server language. It can also be hosted on SAP Business Technology Platform via Docker.
This tool is designed to run locally on your own laptop, server or VM. It is developed using the [SAP Cloud Application Programming Model](https://cap.cloud.sap), using Node.js as server language. It can also be hosted on SAP Business Technology Platform natively via CF, HC and Work Zone, or via Docker.

Locally stored data is kept in a local SQLite database file.

Expand All @@ -56,9 +56,9 @@ Now the tool is built and can be started:

To stop the tool, in Terminal or Command Prompt, press `control-C`

### Manual Install
### Locally on laptop

It is required to have an active installation of Node.js (version 14.5 or later), available from the [Node.js](https://nodejs.org/) website, including Node Package Manager (NPM). You can verify your installed version via `node -v`.
It is required to have an active installation of Node.js (version 20 or later), available from the [Node.js](https://nodejs.org/) website, including Node Package Manager (NPM). You can verify your installed version via `node -v`.

To install, in Terminal or Command Prompt, run:

Expand All @@ -75,6 +75,38 @@ Now the tool is installed and can be started:

To stop the tool, in Terminal or Command Prompt, press `control-C`

### Natively on BTP using Cloud Foundry, HANA Cloud/PostgresSQL and Work Zone

This option requires you to have a HANA Cloud database (or you can use Postgres), and a subscription to SAP Work Zone (standard edition)

*Optional: The default MTA.yaml configuration specifies HANA Cloud. To switch to Postgres, do the following:*
*1. Change package.json hybrid > db > kind to 'postgres'*
*2. Change mta.yaml and change the 'requires' section of the srv module + disable the db-deployer in favor of the postgres-deployer, as well as the postgres db resource.*

To install, in Terminal or Command Prompt, run:

1. Install the SAP CAP SDK 'CDS-DK': `npm i -g @sap/cds-dk`
2. Download this tool from git: `git clone https://github.com/SAP/migration-tool-for-cloud-integration.git --depth 1`
3. Navigate into the root project folder: `cd migration-tool-for-cloud-integration`
4. Install this tool: `npm install`
5. Build the project: `mbt build`
6. Deploy the project: `cf deploy ./mta_archives/migrationtool_1.3.0.mtar`

Now you can add the Fiori applications to your Work Zone site via the Work Zone Admin site:
1. Sync your HTML5 repository
2. Add the HTML5 apps to your content
3. Assign the apps to a Group and Role
4. Create a Site containing the Role

Now you can grant users access to the application via the BTP Cockpit Role Collections
1. Assign the CF role `CPI Migration Tool User`
2. Assign the front-end role created by you in the previous step

Now the tool can be accessed via Work Zone:
To locally monitor the application logs, run the following command in Terminal: `cf logs migrationtool-srv | grep -v RTR`

To enable Hybrid mode, excute `cds bind -2 migrationtool-db` to use the HANA database and run your local application via `cds watch --profile hybrid`.

## Documentation

To learn how to use the tool, please refer to the [user documentation](/docs).
Expand All @@ -89,6 +121,7 @@ To learn how to use the tool, please refer to the [user documentation](/docs).
- **1.99.0**: Deprecated
- **1.108.2**: Stable
- **1.126.2**: Stable
- **1.129.2**: Stable

Specify the version to be used in [/app/home.html](./app/home.html)

Expand All @@ -104,6 +137,7 @@ Version availability: https://ui5.sap.com/versionoverview.html
- **6.8.4**: Stable
- **7.0.2**: Stable (new major release, so some codeline was migrated)
- **7.9.3**: Stable
- **8.3.1**: Stable

More information on changelog: https://cap.cloud.sap/docs/releases

Expand Down
19 changes: 7 additions & 12 deletions api/sample APIs.http
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@

# Sample API call to retrieve all registered tenants:
GET http://localhost:4004/config/Tenants HTTP/1.1
GET http://localhost:4004/odata/v4/config/Tenants HTTP/1.1
###

# Sample API call to test the connection to a tenant (change the ObjectID to an existing entity):
POST http://localhost:4004/config/Tenants(20466922-7d57-4e76-b14c-e53fd97dcb14)/ConfigService.Tenant_testConnection HTTP/1.1
POST http://localhost:4004/odata/v4/config/Tenants(20466922-7d57-4e76-b14c-e53fd97dcb14)/ConfigService.Tenant_testConnection HTTP/1.1
Accept:application/json;odata.metadata=minimal;IEEE754Compatible=true
Accept-Language:en-US
Content-Type:application/json;charset=UTF-8;IEEE754Compatible=true
Expand All @@ -13,7 +13,7 @@ Content-Type:application/json;charset=UTF-8;IEEE754Compatible=true
###

# Sample API call to refresh the integration content of a tenant (change the ObjectID to an existing entity):
POST http://localhost:4004/config/Tenants(20466922-7d57-4e76-b14c-e53fd97dcb14)/ConfigService.Tenant_getIntegrationContent HTTP/1.1
POST http://localhost:4004/odata/v4/config/Tenants(20466922-7d57-4e76-b14c-e53fd97dcb14)/ConfigService.Tenant_getIntegrationContent HTTP/1.1
Accept:application/json;odata.metadata=minimal;IEEE754Compatible=true
Accept-Language:en-US
Content-Type:application/json;charset=UTF-8;IEEE754Compatible=true
Expand All @@ -22,7 +22,7 @@ Content-Type:application/json;charset=UTF-8;IEEE754Compatible=true
###

# Sample API call to create a migration task (change the ObjectID to an existing entity):
POST http://localhost:4004/config/Tenants(20466922-7d57-4e76-b14c-e53fd97dcb14)/ConfigService.Tenant_createNewMigrationTask HTTP/1.1
POST http://localhost:4004/odata/v4/config/Tenants(20466922-7d57-4e76-b14c-e53fd97dcb14)/ConfigService.Tenant_createNewMigrationTask HTTP/1.1
Accept:application/json;odata.metadata=minimal;IEEE754Compatible=true
Accept-Language:en-US
Content-Type:application/json;charset=UTF-8;IEEE754Compatible=true
Expand All @@ -35,7 +35,7 @@ Content-Type:application/json;charset=UTF-8;IEEE754Compatible=true
###

# Sample API call to run a migration task (change the ObjectID to an existing entity):
POST http://localhost:4004/config/MigrationTasks(ObjectID=da325fa7-dfc7-4347-828c-764e9a045c36,IsActiveEntity=true)/ConfigService.Task_startMigration HTTP/1.1
POST http://localhost:4004/odata/v4/config/MigrationTasks(ObjectID=da325fa7-dfc7-4347-828c-764e9a045c36,IsActiveEntity=true)/ConfigService.Task_startMigration HTTP/1.1
Accept:application/json;odata.metadata=minimal;IEEE754Compatible=true
Accept-Language:en-US
Content-Type:application/json;charset=UTF-8;IEEE754Compatible=true
Expand All @@ -44,19 +44,14 @@ Content-Type:application/json;charset=UTF-8;IEEE754Compatible=true
###

# Sample API call to query the status of a job run (change the ObjectID to the returned value from the previous call):
GET http://localhost:4004/config/MigrationJobs(ObjectID=435f559d-9f6c-4730-a4e9-9fbe140046e7,IsActiveEntity=true) HTTP/1.1
GET http://localhost:4004/odata/v4/config/MigrationJobs(ObjectID=435f559d-9f6c-4730-a4e9-9fbe140046e7,IsActiveEntity=true) HTTP/1.1
###

# Sample API call to analyze a package for System.getEnv() (change the ObjectID and PackageID to an existing entity):
POST http://localhost:4004/config/Tenants(20466922-7d57-4e76-b14c-e53fd97dcb14)/toIntegrationPackages(Id='DEV165Handson',ObjectID=cee765a9-faff-4e12-b2ed-5113ed8107ca)/ConfigService.Package_analyzeScriptFiles HTTP/1.1
POST http://localhost:4004/odata/v4/config/Tenants(20466922-7d57-4e76-b14c-e53fd97dcb14)/toIntegrationPackages(Id='DEV165Handson',ObjectID=cee765a9-faff-4e12-b2ed-5113ed8107ca)/ConfigService.Package_analyzeScriptFiles HTTP/1.1
Accept:application/json;odata.metadata=minimal;IEEE754Compatible=true
Accept-Language:en-US
Content-Type:application/json;charset=UTF-8;IEEE754Compatible=true

{}
###

#API used to create dynamic tiles and show version information:
GET http://localhost:4004/app-information/LaunchpadInfo/Script/$value HTTP/1.1

###
Loading

0 comments on commit d28941a

Please sign in to comment.