Skip to content
This repository has been archived by the owner on Feb 5, 2021. It is now read-only.

Latest commit

 

History

History
162 lines (135 loc) · 6.43 KB

gcp-setup.md

File metadata and controls

162 lines (135 loc) · 6.43 KB

GCP setup

Prerequisites

Mandatory

Optional

  • Ballerina 1.0.3 If Ballerina 1.0.3 is not installed, Cellery will execute ballerina using Docker.

To create a GCP based cellery installation, you need to have GCP account and Gloud SDK installed in your machine. Follow the below steps to install cellery into your GCP.

i. Use gloud init command and create a project if not exists. Make sure gcloud is configured to the project which you want to install cellery runtime, and also billing is enabled.

   gcloud init

ii. Make sure zone and region is set correctly for the project. Execute below mentioned command.

   gcloud config list --format json

The expected output from the command should be as below with zone, and region fields.

    {
      "compute": {
        "region": "us-central1",
        "zone": "us-central1-c"
      },
      "core": {
        "account": "[email protected]",
        "disable_usage_reporting": "True",
        "project": "cellery-gcp-test"
      }
    }

iii. If region or zone is not set as above, then please go to GCP console, and select default zone and region for your project created. OR Use gcloud CLI to set the project zone and the region.

gcloud config set project <project name>
gcloud config set compute/region <region>
gcloud config set compute/zone <zone>

iv. Cellery uses some APIs to create resources in the GCP, therefore we need to enable the below listed APIs. You can enable this via the GCP Dashboard by going to menu pane, and selecting APIs and Services > Dashboard options. - Cloud Engine API - Kubernetes API - Cloud Filestore API - Cloud SQL Admin API

Or you can execute commands via gcloud as below.

    gcloud services enable container.googleapis.com file.googleapis.com sqladmin.googleapis.com

v. Since cellery creates the resources in the GCP, it needs the API key to access the above mentioned APIs. Hence create the key for default service account via selecting IAM & Admin > Service Account from left menu pane. And then select the default service account > Create Key > JSON options, and download the JSON file. Copy the downloaded JSON file into directory $HOME/.cellery/gcp folder.

vi. Now we are ready install cellery into GCP, either using interactive or non-interactive.

Inline Method

    cellery setup create gcp [--complete]

Interactive Method

    cellery setup
        $ ✔ Create
        [Use arrow keys]
        ? Select an environment to be installed
            Local
          ➤ GCP
            BACK

This will start the process of creating a Cellery runtime in GCP

    ✔ Create
    ✔ GCP
    ✔ Complete (Includes Api manager, Observability)
    ✔ Yes
    ✔ Creating kubernetes cluster
    Successfully created cluster cellery-cluster633
    ✔ Creating sql instance
    ✔ Creating storage
    ✔ Creating file system
    ⠙ Updating kube configFetching cluster endpoint and auth data.
    ⠇ Updating kube configkubeconfig entry generated for cellery-cluster633.
    ✔ Updating kube config
    ✔ Creating Cellery namespace
    ✔ Creating Istio CRDS
    ✔ Installing ingress-nginx
    ✔ Enabling istio injection
    ✔ Installing istio
    ✔ Installing knative
    ✔ Applying knative CRDs
    ✔ Installing controller
    ✔ Creating config maps
    ✔ Creating persistent volume
    ✔ Creating apim deployment
    ✔ Creating observability deployment
    ✔ Checking cluster status...
    ✔ Cluster status...OK
    ✔ Checking runtime status (Istio)...
    ✔ Runtime status (Istio)...OK
    ✔ Checking runtime status (Cellery)...
    ✔ Runtime status (Cellery)...OK
    
    ✔ Successfully installed Cellery runtime.
    
    What's next ?
    ======================
    To create your first project, execute the command:
      $ cellery init

When the process is completed Cellery will point to the newly created GCP cluster and user can start working on a Cellery project.

Once the installation is completed configure the host entries.

Inline Method

With the non-interactive method, creating the GCP setup with CLI commands with one go is supported. This supports both complete and basic setups as shown below:

Setup Option Package Command Description
GCP Basic cellery setup create gcp -y Creates basic GCP setup. This will spawn a GCP kubernetes cluster and create resources for the cellery runtime. You will require GCloud SDK as pre-requisite to perform this operation. Please check GCP for the steps.
GCP Complete cellery setup create gcp --complete -y Creates complete GCP setup. This will spawn a GCP kubernetes cluster and create resources for the cellery runtime. You will require GCloud SDK as pre-requisite to perform this operation. Please check GCP for the steps

Once the installation is completed configure the host entries

Configure host entries

Get the Nginx Ip and add it to the /etc/hosts. Run the following kubectl command to get the IP address.

 kubectl get ingress -n cellery-system

Then update the /etc/hosts file with that Ip as follows.

 <IP Address> wso2-apim cellery-dashboard wso2sp-observability-api wso2-apim-gateway cellery-k8s-metrics idp.cellery-system pet-store.com hello-world.com my-hello-world.com

Trying Out

Once the installation process is completed, you can try out quick start with cellery.

Cleaning Up

Please refer readme for managing cellery runtimes for details on how to clean up the setup.

What's Next?