GithubHelp home page GithubHelp logo

direkshan-digital / refarch-cloudnative-bluecompute-bff-ios Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ibm-cloud-architecture/refarch-cloudnative-bluecompute-bff-ios

0.0 1.0 0.0 456 KB

This project is part of the 'IBM Cloud Native Reference Architecture for Kubernetes' suite

Home Page: https://github.com/ibm-cloud-architecture/refarch-cloudnative-kubernetes

Swift 98.06% Shell 1.94%

refarch-cloudnative-bluecompute-bff-ios's Introduction

refarch-cloudnative-bluecompute-bff-ios

This project is part of the 'IBM Cloud Native Reference Architecture' suite, available at https://github.com/ibm-cloud-architecture/refarch-cloudnative

This project sits between the iOS Application and the Object Storage Service. It is built with Swift 3.0 and Kitura web framework with following functionality:

  • Serve the application images stored in the Bluemix Object Storage service

The Swift code is located in the Sources folder.

Pre-requisites

  1. Provision an instance of Object Storage into your Bluemix space.
  • Select name for your instance.
  • Click the Create button.
  • Note:
    • You can only provision one Free instance of Object Storage per Bluemix organization.
  1. Once provisioned, obtain Object Storage service credentials.
  • Click on Service Credentials tab.
  • Then click on the View Credentials dropdown next to the credentials.
  1. You will need the following:
  • projectId: Object Storage Open Stack project id.
  • userId: Object Storage user.
  • password: Object Storage password.
  1. Keep those credential handy as they will be needed throughout the rest of this document.
  2. Create an Object Storage container. Bluemix Object Storage uses container as unit of managing content.
  • Click the "Manage" tab, then click the Select Action dropdown, and choose Create Container.
  • Name the Container bluecompute.
  1. Upload the application images into the container.
  • From your compute file explore (or Finder in Mac), locate the image folder.
  • Drag and drop all the images to the Browser Object Storage bluecompute container.
    • Alternatively, you can click add file actions to load images.

Deploy BlueCompute iOS BFF using DevOps Toolchain

You can use the following button to deploy the BlueCompute iOS BFF to Bluemix, or you can follow the manual instructions in the following sections. If you decide on the toolchain button, you have to fulfill the following pre-requisites:

  • Provision an Object Storage service instance in your Bluemix Space.
    • The toolchain will automatically pick up the Object Storage credentials.

Create BlueCompute Deployment Toolchain

Run the application locally:

  1. If not already done, provision an instance of Object Storage.
  2. Open env.sh and enter the following Object Storage credentials collected in the Pre-requisites:
  • projectId
  • userId
  • password
  1. Load credentials into environment

    # source env.sh
    
  2. Run the application:

    # swift build
    # ./.build/debug/bluecompute-bff-ios
    
  • This will start the application on port 8090.
  1. Validate the local application:

Deploy to Bluemix Cloud Foundry runtime:

  1. If not already done, provision an instance of Object Storage.
  2. Open manifest.yml and enter the following Object Storage credentials collected in the Pre-requisites:
  • projectId
  • userId
  • password
  1. Deploy application to Cloud Foundry:

    # cf push
    
  2. Alternatively, you can bind existing Object Storage instance directly to cf app:

    cf push bluecompute-bff-ios -n bluecompute-bff-ios -d "mybluemix.net" --no-start
    cf bind-service bluecompute-bff-ios objectstorage-instance-name
    cf start bluecompute-bff-ios
    
  3. Validate the Cloud Foundry application:

Run application in local docker container

  1. If not already done, provision an instance of Object Storage.

  2. Build container image:

    # docker build -t cloudnative/bluecompute-bff-ios .
    
  3. Start the application in docker container:

    # docker run -i -d -p 8090:8090 --name bluecompute-bff-ios \
      -e "projectId={OS_PROJECT_ID}" \
      -e "userId={OS_USER_ID}" \
      -e "password={OS_PASSWORD}" \
      cloudnative/bluecompute-bff-ios
    
  • Replace {OS_PROJECT_ID} with the Object Storage project id.
  • Replace {OS_USER_ID} with the Object Storage user id.
  • Replace {OS_PASSWORD} with the Object Storage password.
  1. Validate the local docker application:

##Deploy Mobile BFF Service application on Bluemix container In this section you will deploy the Mobile BFF application to run in IBM Bluemix containers.

  1. Log in to your Bluemix account.

    # cf login -a <bluemix-api-endpoint> -u <your-bluemix-user-id>
    
  2. Set target to use your Bluemix Org and Space.

    # cf target -o <your-bluemix-org> -s <your-bluemix-space>
    
  3. Log in to IBM Containers plugin.

    # cf ic login
    
  4. Build container image

    # docker build -t cloudnative/bluecompute-bff-ios .
    
  5. Tag and push the local docker image to bluemix private registry.

    # docker tag cloudnative/bluecompute-bff-ios registry.ng.bluemix.net/$(cf ic namespace get)/bluecompute-bff-ios:cloudnative
    # docker push registry.ng.bluemix.net/$(cf ic namespace get)/bluecompute-bff-ios:cloudnative
    
  6. If not already done, provision an instance of Object Storage.

  7. Start the application in IBM Bluemix container.

  # cf ic group create -p 8090 -m 1024 --min 1 --auto --name bluecompute-bff-ios \
  -e "projectId={OS_PROJECT_ID}" \
  -e "userId={OS_USER_ID}" \
  -e "password={OS_PASSWORD}" \
  -n bluecompute-bff-ios \
  -d mybluemix.net registry.ng.bluemix.net/$(cf ic namespace get)/bluecompute-bff-ios:cloudnative
  ```

- Replace {OS_PROJECT_ID} with the `Object Storage` project id.
- Replace {OS_USER_ID} with the `Object Storage` user id.
- Replace {OS_PASSWORD} with the `Object Storage` password.

7. **Validate. Open a browser and enter the following:**
- [https://bluecompute-bff-ios.mybluemix.net/image/collator.jpg](https://bluecompute-bff-ios.mybluemix.net/image/collator.jpg)

refarch-cloudnative-bluecompute-bff-ios's People

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.