Deploying Projects Automatically

Deployers enable you to deploy services on a docker-based environment automatically in a few simple steps. 

Step 1. Select a deployer plugin

OpenLegacy supports automated deployment to several docker-based environments.  

To learn which deployers are supported by the OpenLegacy Hub run:

> ol list deployers --remote
$ ol list deployers --remote

The deployer list is displayed.

 Deployer Name                           Deployer Version                       
================================================================================
 ol-cloud                                1.39.12                                
 openshift                               1.39.12  

Step 2. View deployer configuration properties

Each deployer has different configuration properties. To learn what they are, run the ol config deployer or the ol deploy commands with the deployer name and the --help option. We use the openshift deployer in the example. 

> ol deploy openshift --help
$ ol deploy openshift --help

The deployer configuration properties are displayed. If the deployer is not installed on your local OL CLI installation, it will be downloaded automatically from the OpenLegacy Hub.

Options:
  --verbose                   Enables verbose mode
  -pv, --project-version INT  Project Version
  --deployer TEXT             Deployer name
  -p, --profile TEXT          Select profile that contains predefined deployer
                              options
  --client-master-url TEXT    Openshift client master url (required)
  --client-token TEXT         Openshift client token (required)
  --namespace TEXT            Namespace (default: default)
  --replicas INT              Replicas (default: 1)
  --image TEXT                Docker image for deployment (required)
  --hub-api-key TEXT          Hub api-key
  --hub-url TEXT              (default: https://api.ol-hub.com)
  --command TEXT              Command (default: )
  --selector MAP(key=value)   Selector
  -h, --help                  Show this message and exit

Arguments:
  PROJECT_NAME  Project name

Step 3. Deploy the service

To deploy the service, provide the project name you want to deploy and the configuration properties. 

> ol deploy demo-account-details --deployer openshift  
--client-master-url <https://api.ol-cluster02.sdk-hub.com:6443>  
--client-token token --namespace default --replicas=1 --image  
openlegacy/oracle-db:latest --selector app=oracle
$ ol deploy demo-account-details --deployer openshift  
--client-master-url <https://api.ol-cluster02.sdk-hub.com:6443>  
--client-token token --namespace default --replicas=1 --image  
openlegacy/oracle-db:latest --selector app=oracle

If the properties are already included in the default configuration profile, you don't have to include them. To learn more about configuration profiles, see ol config deployer.

> ol deploy demo-account-details
$ ol deploy demo-account-details

Add only the options whose values are not included in the profile. The updated values will override the current default values. 

> ol deploy demo-account-details  
--client-master-url=https://api.ol-cluster02.sdk-hub.com:7553
$ ol deploy demo-account-details  
--client-master-url=https://api.ol-cluster02.sdk-hub.com:7553

You can deploy with a different configuration profile than the default one.

> ol deploy demo-account-details profile dev
$ ol deploy demo-account-details profile dev

If the deployment is successful, the following message is displayed:

Service available at https://demo-account-details.ol-cluster02.sdk-hub.com

Now you can use the URL to access the service.