Sign inSign up

fiware/biz-ecosystem-charging-backend

By fiware

Updated 22 days ago

Business Ecosystem Charging Backend component of the FIWARE/TMF Business API Ecosystem GE

Image
1

10K+

fiware/biz-ecosystem-charging-backend repository overview

Business Ecosystem Charging Backend Docker Image

This repository contains the Docker image of the Business Ecosystem Charging Backend component of the FIWARE Business API Ecosystem GE.

You can build a docker image based on this Dockerfile. This image will contain an instance of the Business Ecosystem Charging Backend, exposing port 8006. This requires that you have docker installed on your machine.

If you just want to have a Business Ecosystem Charging Backend instance running as quickly as possible jump to section The Fastest Way.

If you want to know what is behind the scenes of our container you can go ahead and read the build and run sections.

The Fastest Way

The Business Ecosystem Charging Backend component uses a MongoDB container as database. The software can be configured using the standard settings.py file or the supported environment variables. For details of the different configuration options, have a look at the Business API Ecosystem Configuration Guide

To run the Business Ecosystem Charging Backend, docker compose can be used. To do so, you can use the file docker-compose.yml provided with the source code or create a new one with the following content:

version: '3'
services:
    mongo:
        image: mongo:4.4
        ports:
            - 27017:27017
        volumes:
            - ./charging-data:/data/db

    charging:
        image: fiware/biz-ecosystem-charging-backend:master
        links:
            - mongo
        depends_on:
            - mongo
        ports:
            - 8006:8006
        volumes:
            - ./charging-bills:/business-ecosystem-charging-backend/src/media/bills
            - ./charging-assets:/business-ecosystem-charging-backend/src/media/assets
            - ./charging-plugins:/business-ecosystem-charging-backend/src/plugins
            - ./charging-inst-plugins:/business-ecosystem-charging-backend/src/wstore/asset_manager/resource_plugins/plugins
        environment:
          - BAE_CB_PAYMENT_METHOD=None  # Paypal or None (testing mode payment disconected)
          # - BAE_CB_PAYPAL_CLIENT_ID=client_id
          # - BAE_CB_PAYPAL_CLIENT_SECRET=client_secret

          # ----- Database configuration ------
          - BAE_CB_MONGO_SERVER=mongo
          - BAE_CB_MONGO_PORT=27017
          - BAE_CB_MONGO_DB=charging_db
          # - BAE_CB_MONGO_USER=user
          # - BAE_CB_MONGO_PASS=passwd

          # ----- Roles Configuration -----
          - BAE_LP_OAUTH2_ADMIN_ROLE=admin
          - BAE_LP_OAUTH2_SELLER_ROLE=seller
          - BAE_LP_OAUTH2_CUSTOMER_ROLE=customer

          # ----- Email configuration ------
          - [email protected]
          # - BAE_CB_EMAIL_USER=user
          # - BAE_CB_EMAIL_PASS=pass
          # - BAE_CB_EMAIL_SMTP_SERVER=smtp.server.com
          # - BAE_CB_EMAIL_SMTP_PORT=587

          - BAE_CB_VERIFY_REQUESTS=True  # Whether or not the BAE validates SSL certificates on requests to external components 

          # ----- Site configuration -----
          - BAE_SERVICE_HOST=https://store.lab.fiware.org/  # External URL used to access the BAE
          - BAE_CB_LOCAL_SITE=http://charging.docker:8006/  # Local URL of the charging backend

          # ----- APIs Conection config -----
          - BAE_CB_CATALOG=http://apis.docker:8080/DSProductCatalog
          - BAE_CB_INVENTORY=http://apis.docker:8080/DSProductInventory
          - BAE_CB_ORDERING=http://apis.docker:8080/DSProductOrdering
          - BAE_CB_BILLING=http://apis.docker:8080/DSBillingManagement
          - BAE_CB_RSS=http://rss.docker:8080/DSRevenueSharing
          - BAE_CB_USAGE=http://apis.docker:8080/DSUsageManagement
          - BAE_CB_AUTHORIZE_SERVICE=http://proxy.docker:8004/authorizeService/apiKeys

As you can see, the biz-ecosystem-charging-backend image defines 4 volumes. In particular:

  • /business-ecosystem-charging-backend/src/media/bills: This directory contains the PDF invoices generated by the Business Ecosystem Charging Backend
  • /business-ecosystem-charging-backend/src/media/assets: This directory contains the different digital assets uploaded by sellers to the Business Ecosystem Charging Backend
  • /business-ecosystem-charging-backend/src/plugins: This directory is used for providing asset plugins (see section Installing Asset Plugins)
  • /business-ecosystem-charging-backend/src/wstore/asset_manager/resource_plugins/plugins: This directory includes the code of the plugins already installed

It can be seen that the system can be configured with the environment variables defined by the software. In this case, providing the settings file is not mandatory, taking into account that the environment variables values override the file ones.

Once you have created the file, run the following command:

docker compose up

Then, the Business Ecosystem Charging Backend should be up and running in http://YOUR_HOST:PORT/ replacing YOUR_HOST by the host of your machine and PORT by the port selected in the previous step.

Once the different containers are running, you can stop them using:

docker compose stop

And start them again using:

docker compose start

Additionally, you can terminate the different containers by executing:

docker compose down

Build the image

If you have downloaded the Business Ecosystem Charging Backend's source code you can build your own image. The end result will be the same, but this way you have a bit more of control of what's happening.

To create the image, just navigate to the docker directory and run:

$ docker build -t biz-ecosystem-charging-backend -f docker/Dockerfile .

The parameter -t biz-ecosystem-charging-backend gives the image a name. This name could be anything, or even include an organization like -t fiware/biz-ecosystem-charging-backend. This name is later used to run the container based on the image.

If you want to know more about images and the building process you can find it in Docker's documentation.

Installing Asset Plugins

As you may know, the Business API Ecosystem is able to sell different types of digital assets by loading asset plugins in its Charging Backend. In this context, it is possible to install asset plugins in the current Docker image as follows:

  1. Copy the plugin file into the host directory of the volume /business-ecosystem-charging-backend/src/plugins

  2. Enter the running container:

docker exec -i -t your-container /bin/bash
  1. Go to the installation directory
cd /business-ecosystem-charging-backend/src
  1. Load the plugin
./manage.py loadplugin ./plugins/pluginfile.zip

Tag summary

Content type

Image

Digest

sha256:13e20c2b1

Size

594.6 MB

Last updated

6 months ago

docker pull fiware/biz-ecosystem-charging-backend