Setup TOP Environments/Settings

Development & Contribution

This page provides information about local development of each subsystem and contribution to it.

System requirements

K2HR3 currently depends on the following software.

K2HR3 Repositories structure

This chapter describes the ‘k2hr3’ repository on GitHub.

The ‘k2hr3’ repository consists of the following submodules.

The latter part of this page will describe how to build packages in these repositories and test them.

The k2hr3_api repository

This chapter instructs how to build a ‘k2hr3_api’ package and test it in your local development environment.

k2hr3_api repository is a repository for K2HR3 API server.

  1. Fork the https://github.com/yahoojapan/k2hr3_api repository in GitHub.

  2. Clone your forked repository locally.

     $ git clone https://github.com/YOUR-USERNAME/k2hr3_api.git
    
  3. install dependent packages to your local development environment. To build a k2hr3_api package, k2hdkc shared library and the header files are required.

    For Debian(Stretch) or Ubuntu(Bionic Beaver) users, run the following commands::

     $ sudo apt-get update -y
     $ sudo apt-get install curl -y
     $ curl -s https://packagecloud.io/install/repositories/antpickax/stable/script.deb.sh | sudo bash
     $ sudo apt-get install k2hdkc-dev
    

    For CentOS users, runt the following commands. To compile a Node.js for ‘k2hdkc’, you need install the devtoolset package::

     $ sudo yum install centos-release-scl
     $ sudo yum install devtoolset-7
     $ scl enable devtoolset-7 bash
    

    For Fedora28 or CentOS7 users, run the following commands::

     $ sudo yum makecache
     $ sudo yum install curl -y
     $ curl -s https://packagecloud.io/install/repositories/antpickax/stable/script.rpm.sh | sudo bash
     $ sudo yum install k2hdkc-devel
    

    For other Linux system users, build sources on the https://github.com/yahoojapan/k2hdkc repository and install k2hdkc shared library and the header files. See https://k2hdkc.antpick.ax/build.html for details.

    After installing the k2hdkc shared library and the header files, install the npm package. Run the following commands::

     $ cd k2hr3_api/
     $ npm install
    
  4. Create a branch for local development::
     $ git checkout -b my-first-contribution
    

    Now you are ready for local code changes.

  5. The following command run tests. When you change codes locally, make sure the tests finish correctly.
     $ npm run test
    
  6. Commit your code changes and push your branch to GitHub when you change codes::
     $ git add .
     $ git commit -m "Short description of your changes."
     $ git push origin my-first-contribution
    
  7. Submit a pull request through the GitHub website when you change codes.

The k2hr3_app repository

This chapter instructs how to build a ‘k2hr3_app’ package and test it in your local development environment.

k2hr3_api repository is a repository for K2HR3 Web server.

  1. Fork the https://github.com/yahoojapan/k2hr3_app repository in GitHub.

  2. Clone your forked repository locally.

     $ git clone https://github.com/YOUR-USERNAME/k2hr3_app.git
    
  3. install dependent packages to your local development environment.

     $ cd k2hr3_app/
     $ npm install
    
  4. Create a branch for local development::

     $ git checkout -b my-first-contribution
    
  5. The following command run syntax validations and tests. When you change codes locally, make sure the tests finish correctly.

     $ npm run build
     $ npm run test
    
  6. Commit your code changes and push your branch to GitHub when you change codes::

     $ git add .
     $ git commit -m "Short description of your changes."
     $ git push origin my-first-contribution
    
  7. Submit a pull request through the GitHub website when you change codes.

The k2hr3_osnl repository

This chapter instructs how to build a ‘k2hr3_osnl’ package and test it in your local development environment.

k2hr3_api repository is a repository for K2HR3 OpenStack Notification Listener.

  1. Fork the https://github.com/yahoojapan/k2hr3_osnl repository in GitHub.

  2. Clone your forked repository locally.

     $ git clone https://github.com/YOUR-USERNAME/k2hr3_osnl.git
    
  3. install dependent packages to your local development environment.

     $ cd k2hr3_osnl/
     $ pip3 install pipenv
     $ python3 -m pipenv install -dev --python /path/to/python3
     $ pipenv shell
    
  4. Create a branch for local development::

     (k2hr3_osnl) $ git checkout -b my-first-contribution
    
  5. The following command run syntax validations and tests. When you change codes locally, make sure the tests finish correctly.

     (k2hr3_osnl) $ make lint test
    
  6. Commit your code changes and push your branch to GitHub when you change codes::

     (k2hr3_osnl) $ git add .
     (k2hr3_osnl) $ git commit -m "Short description of your changes."
     (k2hr3_osnl) $ git push origin my-first-contribution
    
  7. Submit a pull request through the GitHub website when you change codes.

The k2hr3_utils repository

This chapter instructs how to test codes in your local development environment.

This repository contains many utilities and tools for K2HR3.

The following example shows the devcluster tool.

  1. Fork the https://github.com/yahoojapan/k2hr3_utils repository in GitHub.

  2. Clone your forked repository locally.

     $ git clone https://github.com/YOUR-USERNAME/k2hr3_utils.git
    
  3. Create a branch for local development::

     $ cd k2hr3_utils/devcluster
     $ git checkout -b my-first-contribution
    
  4. The following command start installing ‘K2HR3’ subsystems with debug mode. When you change codes locally, make sure the installation finishes correctly.

     $ sh cluster.sh -d
    
  5. Commit your code changes and push your branch to GitHub when you change codes::

     (k2hr3_osnl) $ git add .
     (k2hr3_osnl) $ git commit -m "Short description of your changes."
     (k2hr3_osnl) $ git push origin my-first-contribution
    
  6. Submit a pull request through the GitHub website when you change codes.

Setup TOP Environments/Settings