Giter Site home page Giter Site logo

oss's Introduction

OSS

A REST api for gcoin rpc.

Installation

Requirement

  • Python 2.7
  • virtualenv

Setup

./setup_venv.sh

Configuration

Set up setting.py

cp oss_server/oss_server/settings/setting.py.default oss_server/oss_server/settings/setting.py

Modify setting.py

Secret key

<SECRET_KEY>

This is used to provide cryptographic signing, and should be set to a unique, unpredictable value.

Environment

<ENV>

Fill in develop will enable oss_server/oss_server/settings/develop.py for debug information while running the project.

test: oss_server/oss_server/settings/test.py

It is designed for a standalone unit test process using a in-memory database.

production: oss_server/oss_server/settings/production.py

It disable debug information for production environment.

Allowed hosts

<ALLOW_DOMAIN>

Replacing it with * means it allowed requests from everywhere.

Use * for develop and subdomain format for production environment.

Gcoin rpc

Set up connection of gcoin rpc

GCOIN_RPC = {
    'user': '<GCOIN_RPC_USER>',
    'password': '<GCOIN_RPC_PASSWORD>',
    'host': '<GCOIN_RPC_HOST>',
    'port': '<GCOIN_RPC_PORT>',
}

Database

OSS uses mariadb to store blockchain data. Make sure to create a database named the same as <EXPLORER_DB_NAME>, then migrate with:

./manage.py migrate

DATABASES = {
    'default': {
        'NAME': '<EXPLORER_DB_NAME>',
        'ENGINE': 'django.db.backends.mysql',
        'HOST': '<EXPLORER_DB_HOST>',
        'PORT': '<EXPLORER_DB_PORT>',
        'USER': '<EXPLORER_DB_USER>',
        'PASSWORD': '<EXPLORER_DB_PSSWORD>',
        'CONN_MAX_AGE': 20
    }
}

Sync database with blockchain

<BLK_DIR>

The data forlder, which are usually located under ~/.gcoin/main/blocks

It is the key point for entire OSS project. The Django command called blockupdate will read all the blockchain data under this forlder every second by default and save these data to specified database.

Run ./manage.py blockupdate to sync blockchain indefinitely.

Run unit test

Run ./manage.py test --settings=oss_server.settings.test for a standalone unit test.

Run ./manage.py test will create a test database specified in setting.py and destroy it after compeleting the test.

Run server

Start server

./oss_server/manage.py runserver <address>:<port>

Start services

./manage.py blockupdate
./manage.py txnotify
./manage.py addressnotify

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.