This repo gives some basic examples of migrating a CF app to OCP with no code change.
In order to run through the examples, you need access to a CF and an OCP environment.
If you don't already have access to a CF environment, you can get started by provisioning a space on IBM Cloud. Do keep in mind that, while inexpensive, this option is not free. Here is the billing information to be aware of:
- Cloud Foundry Pricing
- Compose For MySQL Pricing (Monthly prices are shown)
Here's how to get set up in IBM Cloud:
-
Create an IBM Cloud account by following this link
-
Create a sample application from the IBM Cloud UI. This will automatically create your CF org and space for you to use, while also providing you a sample workload to examine if you want.
-
Install the ibmcloud CLI. Afterwards, you may also need to install the cf cli in the ibmcloud cli
ibmcloud cf install. -
Log into IBM Cloud from the CLI using one of the following commands:
ibmcloud loginif logging in using an IBM Cloud username and passwordibmcloud login --ssoif logging in using a federated user ID
-
Target your CF org and space by running
ibmcloud target --cf. -
[Optional] Create an alias from
ibmcloud cftocf. This is a convenient step so that you don't have to remember to prepend "ibmcloud" to "cf" each time you want to interact with CF- In
~/.bashrc(or similar config file based on your shell), add the following line:alias cf="ibmcloud cf"
- In
-
Unless you want to keep your sample application running, remove the sample app by running the following command:
cf apps cf delete <application-name>
At the prompt, enter
yes. -
You must also upgrade your account to a "pay-as-you-go" account in order to follow the demos. Follow these steps to upgrade your account:
- Click the profile icon on the top-right of the IBM Cloud screen and select profile
- On the taskbar at the top, select Manage > Account
- On the menu to the left, select Account settings
- Select Add credit card and follow each prompt to provide your information.
Note that it may take up to 48 hrs for your account to be updated.
I'll assume more familiarity with OCP in this demo, but here are some options to provision an OCP cluster or namespace:
- crc (CodeReady Containers): Provision a single-node OCP cluster on your laptop
- Developer Sandbox: Provision a namespace on a multi-tenant OCP cluster
Once your have configured CF and OCP access, you can continue by exploring each of the demos in this repo. Here is a list of each demo:
- application-properties: A demo showcasing how you can migrate a CF app with service bindings, where datasources are configured using an application.properties file.
- auto-reconfiguration: Another demo showcasing the migration of a CF app with service bindings, except this time, the app does not explicitly define any datasources in application properties or code. This assumes CF's auto-reconfiguration feature is leveraged and explains how to mock this behavior in a migration to OCP.
These demos are not included but should be added at a later date to provide a more complete migration guide:
- Migrating a CF-internal database or other service to OCP
- Migrating Spring Boot apps using spring-cloud-connector
- Migrating Spring Boot apps using spring-cloud-config-server
- Migrating Spring Boot apps using an explicitly coded datasource
- Migrating applications using CredHub