Deploy to SAP BTP, Cloud Foundry

Deploy to SAP BTP, Cloud Foundry

This article describes how to deploy the Figaf tool to CPI BTP, Cloud Foundry.
Notes
Before you get started you need to have a Cloud Foundry subaccount with PostgreSQL and Cloud Foundry Runtime enabled. Read more here how to get Setting up SAP BTP Account to deploy Figaf in Cloud Foundry
  1. Install "cf" command on your computer https://github.com/cloudfoundry/cli/wiki/V8-CLI-Installation-Guide#installers-and-compressed-binaries.
  2. Log in to your SAP BTP account (API Endpoint value can be found on your subaccount overview page):
    cf login -a https://api.cf.us10.hana.ondemand.com
    You should find the API on the subaccount page

  3. Download and unpack the archive Figaf-BTP-Deployment-btp-users.zip. Then go to the working directory.
  4. Fetch the possible work CF domains
    cf domains

    In the vars.yaml in the working directory add the cfapps URL to as the landscape domain
  5. Create PostgreSQL database in BTP and wait until it's ready. It is recommended to use the SAP BTP UI instead of CLI command. You can use default options.
    cf create-service postgresql-db trial figaf-db -c db.json
    Info
    In some cases the JSON is different and you may need to deploy it the BTP UI just make users it is called figaf-db. If you already have created the database then skip step. 

  6. Open vars.yml and fill in the needed values. You can find the latest docker image here. Don't use the Release candidates unless specified by our support team. 
    Notes
    By default, pull of the image will be done anonymously. Docker Hub limits amount of pulls without authentication. It may cause the error toomanyrequests: You have reached your pull rate limit. To prevent it, register your user on Docker Hub and specify username in vars.yml in a variable DOCKER_USERNAME.
  7. Create XSUAA service. It's possible to use SAP BTP UI instead of CLI command for the same operation.
    cf create-service xsuaa application figaf-xsuaa -c xs-security.json
  8. Go to Security -> Users and select/create your user. Assign Figaf role(s) to the user. For simplicity you can assign just the IRTAdmin role for the first user:
  9. The database creation can take some time (up to 10 minutes) so be sure to check the status of the creation of the services. 
  10. Deploy the applications from the working directory. (If you called your services differently than figaf-db and figaf-xsuaa, update the names in manifest.yml).
    cf push --vars-file vars.yml

  11. Go to the app router and open the URL.

  12. You will be redirected to the SAP login page (if the user is not logged in yet) where you will need to provide the username and password.
  13. Then you will be authenticated and redirected back to the Figaf tool.


You can get a license key by registering at figaf.com/devops
Go to Configuration -> License and insert your license key. 
Next up you can configure your agents. 


How to upgrade

We will monthly be publishing new versions of Figaf. You therefore need to have a good way to upgrade Figaf. It is normally fairly easy to upgrade. Just keep the versions of the BTP users directory in a place where you can easily access it.
1) Update the vars.yaml file to point to the newest docker image see
2)  Login to CF using
If you are using the same service
cf login 
or 
cf login -a https://api.cf.us10.hana.ondemand.com

3) Delete the running apps this can be done using cf commands or you can do it from the BTP cockpit. Just navigate to the subaccount and space for it

cf apps
cf delete pi-figaf-router -f
cf delete pi-figaf-app -f


4) Deploy again using 
cf push --vars-file vars.yml