Skip to content

bitskyai/bitsky-web-app

Repository files navigation

IMPORTANT

This repo is generated by build script, only for release purpose, don't checkout and change


BitSky Web Application

This docker image includes BitSky Supplier and BitSky UI. This docker image expose 9099 port.

Configuration

Environment Variables

All TYPEORM_ are for typeorm, you can find all the environment variables from Using environment variables. For now, only tested with environemnt variables list in below, if you use other environment variables, you take your own risk

  1. TYPEORM_CONNECTION: Optional. Database connection type. Currently, available values [sqlite, mongodb]. Default will use sqlite.

  2. TYPEORM_DATABASE: Optional/Reuired. Database name. Required when your TYPEORM_CONNECTION isn't sqlite.

    For the sqlite, if you want to persist your data after docker container was killed, you can add a volumn when start docker, and configure the absolute path. For example, you did docker -v /host/shared:/mnt/shared, then you can configure this value /mnt/shared/bitsky.sql.

  3. TYPEORM_HOST: Optional/Reuired. Database host. Required when your TYPEORM_CONNECTION isn't sqlite. Example: bitsky123.mlab.com

  4. TYPEORM_PORT: Optional/Reuired. Database host port. Required when your TYPEORM_CONNECTION isn't sqlite. Example: 27017

  5. TYPEORM_USERNAME: Optional. Database username. Example: dbuser

  6. TYPEORM_PASSWORD: Optional. Database password. Example: welcome

  7. PORT: Optional. Port number for this example server. Default value is 9099, when you run it in docker mode, you can map host port to 9099

  8. LOG_FILES_PATH: Optional. The folder path that store log files

  9. LOG_LEVEL: Optional. The log level, default is info. Get more from winston logging levels

  10. LOG_MAX_SIZE: Optional. The max size of log files. Default is 50*1024*1024 (50MB), get more information from Winston File Transport - maxsize

  11. TASK_TIMEOUT_CHECK_TIME: Optional. How frequently to check whether Tasks are timeout. Default is 60000ms.

  12. TIMEOUT_VALUE_FOR_TASK: Optional. Timeout value for a Task. Default 300000ms

  13. RETAILER_STATE_CHECK_TIME: Optional. How frequently to check Retailer state. Default 10000ms

Local

If you want to run it local, make sure you already installed NodeJS and Yarn.

  1. Install node_modules. npm install
  2. Start server
    npm start
    
    It start a server on local, you can access it http://localhost:9099

You also can change Environment Variables

Docker

Here are some example snippets to help you get started creating a container

Follow examples will start server use port number 9101, so after start successfully, you can access server by visit http://localhost:9101

Use SQLite

docker run -p -d 9101:9099 bitskyai/web-app

This will use SQLite if you close docker container, then database file also will be deleted

Use SQLite and persist DB and log

docker run -it -d \
           -v /Users/neo/Downloads/bitsky-web-app:/usr/webapp \
           -e LOG_FILES_PATH=/usr/webapp/log \
           -e TYPEORM_CONNECTION=sqlite \
           -e TYPEORM_DATABASE=/usr/webapp/bitsky.sql \
           -p 9101:9099 bitskyai/web-app
  1. /Users/neo/Downloads/bitsky-web-app: The name of the volume, and is unique on a given host machine

Use MongoDB

Find detail of the environment values from Add or modify Environment Variables.

docker run -d -v /Users/neo/Downloads/bitsky-web-app:/usr/webapp \
           -e LOG_FILES_PATH=/usr/webapp/log \
           -e TYPEORM_CONNECTION=mongodb \
           -e TYPEORM_HOST=ds163410.mlab.com \
           -e TYPEORM_DATABASE=bitsky \
           -e TYPEORM_PORT=12345 \
           -e TYPEORM_USERNAME=admin \
           -e TYPEORM_PASSWORD=welcome*123 \
           -p 9101:9099 \
           bitskyai/web-app

or

docker run -d \
           -v /Users/neo/Downloads/bitsky-web-app:/usr/webapp \
           -e LOG_FILES_PATH=/usr/webapp/log \
           -e TYPEORM_CONNECTION=mongodb \
           -e TYPEORM_URL=mongodb://admin:welcome*123@ds123456.mlab.com:12345/bitsky \
           -p 9101:9099 \
           bitskyai/web-app

This is an example of connect to mlab.com, make sure you change TYPEORM_HOST, TYPEORM_DATABASE, TYPEORM_PORT, TYPEORM_USERNAME, TYPEORM_PASSWORD, or TYPEORM_URL and port mapping

Heroku

You can simply deploy this example to Heroku by click this button: Deploy