Git Product home page Git Product logo

flat-server's Introduction

Agora Flat Server

Project flat-server is a Node.js server for the Agora Flat open source classroom.

δΈ­ζ–‡

Features

  • Login via
  • Wechat
  • Github
  • Google
  • Room scheduling
    • Ordinary rooms
    • Periodic rooms
  • Signing tokens for Whiteboard, Real-time video/audio chat(RTC), Real-time messaging(RTM)
  • Cloud recording and replaying
  • Cloud Storage for multi-media courseware

Develop Locally

Execute the following steps to run flat-server:

Installation

yarn install --frozen-lockfile

Setup Environment

  1. Create files development.local.yaml.
  2. Add environment variables following the config/defaults.yaml format.

Run the Project

  1. Execute at project root:
   yarn run start
  1. Open another terminal and execute at project root:
   node ./dist/index.js

You should see ready on http://0.0.0.0:80 if everything is OK.

Deployment

Deployment is not needed for local development. If you want to bring the server up online, deploy anyway you like.

Environment Variables Reference

server:
    # Server port
    port: 80

redis:
    # Redis host
    host:
    # Redis port
    port:
    # Redis username
    username:
    # Redis password
    password:
    # Redis db name
    db:

mysql:
    # MySQL host
    host:
    # MySQL port
    port:
    # MySQL username
    username:
    # MySQL password
    password:
    # MySQL database
    db:

jwt:
    # JWT secret
    secret:
    # JWT crypto algorithms, see: https://github.com/auth0/node-jsonwebtoken/tree/d71e383862fc735991fd2e759181480f066bf138#algorithms-supported
    algorithms:

# Front-end address
website: https://flat-web-dev.whiteboard.agora.io

log:
    # Log path name, see: https://github.com/netless-io/flat-server/blob/main/src/utils/EnvVariable.ts
    pathname: "{{PROJECT_DIR}}/logs"
    # Log file name, see: https://github.com/netless-io/flat-server/blob/main/src/utils/EnvVariable.ts
    filename: "{{DAY_DATE}}"

cloud_storage:
    # Maximum count of Cloud Storage uploading files. Default: 3
    concurrent: 3
    # Maximum size of a Cloud Storage file. Default: 500M
    single_file_size: 524288000
    # Maximum Cloud Storage size of a user. Default: 2G
    total_size: 2147483648
    # Cloud Storage upload path prefix. Default: cloud-storage (No / prefix or suffix)
    prefix_path: cloud-storage
    # Cloud Storage supported file extensions
    allow_file_suffix:
        - ppt
        - pptx
        - doc
        - docx
        - pdf
        - png
        - jpg
        - jpeg
        - gif
        - mp3
        - mp4
        - ice
    # Cloud Storage supported file url extensions
    url_file_suffix:
        - vf

login:
    wechat:
        # See: https://developers.weixin.qq.com/doc/oplatform/Website_App/WeChat_Login/Wechat_Login.html
        web:
            # Whether to enable WeChat login on the web/desktop side
            enable: false
            # App ID
            app_id:
            # App Secret
            app_secret:
        # See: https://developers.weixin.qq.com/doc/oplatform/Mobile_App/WeChat_Login/Development_Guide.html
        mobile:
            # Whether to enable WeChat login on the mobile side
            enable: false
            # App ID
            app_id:
            # App Secret
            app_secret:
    # See: https://docs.github.com/cn/developers/apps/building-oauth-apps/authorizing-oauth-apps
    github:
        # Whether to enable GitHub login
        enable: false
        # GitHub Client ID
        client_id:
        # GitHub Client Secret
        client_secret:
    # In development, see: https://developers.google.com/identity/protocols/oauth2
    google:
        # Whether to enable Google login
        enable: false
        # Google Client ID
        client_id:
        # Google Client Secret
        client_secret:
        # Redirect URI
        redirect_uri:
    apple:
        # Whether to enable Apple login
        enable: false
    # Not open to the public at the moment
    agora:
        # Whether to enable Agora login
        enable: false
        # Agora Client ID
        clientId:
        # Agora Client Secret
        clientSecret:

agora:
    # For RTC and RTM. See: https://docs.agora.io/en/Agora%20Platform/get_appid_token?platform=All%20Platforms
    app:
        # Agora App ID
        id:
        # Agora App Certificate
        certificate:
    # For classroom replaying. See: https://docs.agora.io/en/cloud-recording/faq/restful_authentication?platform=All%20Platforms
    restful:
        # Agora RESTful ID
        id:
        # Agora RESTful Secret
        secret:
    # For storing RTC Cloud Recording media files. See: https://docs.agora.io/en/cloud-recording/restfulapi/
    # Path: Cloud Recording Start -> Schema -> clientRequest -> storageConfig
    oss:
        access_id:
        access_secret:
        vendor:
        region:
        bucket:
        folder:
        prefix:

# See: https://docs.agora.io/en/whiteboard/generate_whiteboard_token_at_app_server?platform=RESTful
whiteboard:
    # Whiteboard AK
    access_key:
    # Whiteboard SK
    secret_access_key:

# Storage Service
storage_service:
    # Currently, only supported OSS
    type: oss
    oss:
        # Hangzhou, China Configuration
        zh_hz:
            access_key:
            secret_key:
            endpoint:
            bucket:
            region:
        # Silicon Valley Configuration
        us_sv:
            access_key:
            secret_key:
            endpoint:
            bucket:
            region:
        # Singapore Configuration
        sg:
            access_key:
            secret_key:
            endpoint:
            bucket:
            region:
        # Mumbai, India Configuration
        in_mum:
            access_key:
            secret_key:
            endpoint:
            bucket:
            region:
        # London, England Configuration
        gb_lon:
            access_key:
            secret_key:
            endpoint:
            bucket:
            region:

If deployment is required then you need to ensure that the following variables are present in the environment variables for deployment:

Variable Name Description Note
METRICS_ENABLED Whether to enable metrics monitoring
METRICS_ENDPOINT metrics url path e.g.: /metrics
METRICS_PORT metrics port e.g.: 9193

Tech Stack

Disclaimer

You may use Flat for commercial purposes but please note that we do not accept customizational commercial requirements and deployment supports. Nor do we offer customer supports for commercial usage. Please head to Flexible Classroom for such requirements.

flat-server's People

Contributors

alwaysmavs avatar blackhole1 avatar cheerego7 avatar crimx avatar dependabot[bot] avatar hyrious avatar leavesster avatar leooeloel avatar ooeyuna avatar rhnsharma avatar shunyue1320 avatar snyk-bot avatar

Watchers

 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.