Peatio 1.5.0 (March 20, 2018)

Overview

This release is focused on:

  1. Extraction of trading UI to separate application.

  2. Full dynamic support of currencies from database and full removal of any currency-specific code from Peatio.

  3. Ability to develop & install Peatio plugins.

  4. General fixes & improvements.

Breaking changes

  • #449: Extract trading UI to separate component.

The patch moves trading UI assets and views to separate component called peatio-trading-ui. The extracted component lives at GitHub repository and is based on Rails 5.1.

Migration steps include (we assume your Peatio is deployed at peatio.tech):

  • You will need to add NGINX to your stack.
  • Review NGINX configuration which can be found at ci/nginx/server.conf.
  • The trick is that both Peatio and Trading UI are deployed on the same domain but are served conditionally by NGINX reverse proxy depending on the request path.
  • Another trick is that both apps share the same cookies because they live on the same domain (however, trading UI doesn't do any decode/encode operations so there is not need for sharing SECRET_KEY_BASE between two apps).
  • Trading UI app has separate asset prefix: /trading-ui-assets. So all requests which match /\A\/trading-ui-assets\// must be routed to trading UI app.
  • The path to page with markets has also been changes from /markets/:id to /trading/:market_id. All requests which satisfy /\A\/trading\// must be routed to trading UI app.
  • The trading UI app will first download variables for specified market_id (like btcusd) from Peatio by issuing HTTP GET https://peatio.tech/markets/btcusd.json, and then render Rails views according to received variables.
  • The member is kept authenticated because trading UI app sends cookies via HTTP header to https://peatio.tech/markets/btcusd.json.
  • The variable which controls Peatio root URL is called PLATFORM_ROOT_URL. Check more trading UI configuration variables at config/templates/application.yml.erb.
  • We updated .travis.yml at Peatio so it automatically deploys trading UI locally with Docker and runs Selenium specs. Study .travis.yml for detailed examples on how to run & use trading UI.

    • #687: Refactor environment variables for Pusher.

The patch simplifies Pusher configuration and adds new variables for easy migration to Pusher Slanger.

The renamed variables:

  • PUSHER_KEY => PUSHER_CLIENT_KEY.
  • PUSHER_WS_PORT => PUSHER_CLIENT_WS_PORT.
  • PUSHER_WSS_PORT => PUSHER_CLIENT_WSS_PORT.
  • PUSHER_ENCRYPTED => PUSHER_CLIENT_ENCRYPTED.

The added variables:

  • PUSHER_SCHEME: protocol used for publishing event from backend to Pusher.
  • PUSHER_CLIENT_WS_HOST: to which WebSocket host should client connect.
  • PUSHER_CLIENT_HTTP_HOST: alternative to WebSocket (polling).

The removed variables:

  • PUSHER_CLUSTER: this variable doesn't fit well in context of Pusher Slanger. You should now use PUSHER_HOST, PUSHER_CLIENT_WS_HOST, and PUSHER_CLIENT_HTTP_HOST for configuration.

Check config/application.yml for more details and default values.

  • #694: Unify currency-specific models, controllers, routes, locales, stylesheets, and other components into type-specific.

The patch continues and fully finishes work from #488 – Move currencies.yml to database:

  • All controllers (including user & admin) which stand for specific currency (like BitcoinsController, DuffsController) are now unified into FiatsController and CoinsController depending on currency type.
  • The same store for models, views, locales, stylesheets and routes: Deposits::Fiat, Deposits::Coin, Withdraws::Fiat, Withdraws::Coin.
  • The patch removes field Currency#key as it is not more needed. You must remove key from config/seed/currencies.yml.
  • Peatio now adds much more attention to Currency#type and uses it smarter.

These changes are the first step to multifiat feature. Now Peatio is fully ready for adding any number of currencies by just issuing query to database.

Once we will add support for ERC20 tokens to Peatio it will be possible to add 500+ token-based currencies to Peatio by just populating database! Now you can do the same trick with any Bitcoin-compatiable currency. The one requirement for dynamically adding currencies to database is presence of currency API client (CoinAPI).

New features

  • #698: Clear user session stored in Redis via API call DELETE /api/v2/sessions.

The patch adds ability for deleting all member sessions which are stored in Redis. This feature is useful for SPA which use JWT & OAuth server for solving identity question.

To use this feature issue HTTP DELETE request at /api/v2/sessions and provide valid JWT.

IMPORTANT: Your session is only and only deleted if server returns status 200, in other cases assume session is not fully deleted so you may be still signed in Peatio.

IMPORTANT: This is very important security feature so it was backported at older Peatio branches: 1.1, 1.2, and 1.3.

  • #708: Add ability to install plugins.

The patch introduces very simple plugin for Peatio:

  • Use config/plugins.yml to list wanted plugins. Each plugin is constructed from name, Git repository URL, commit hash, and path to file which should be required (optional, defaults to index.rb).
  • Use bin/install_plugins to install listed plugins from config/plugins.yml to vendor/plugins.
  • Use bin/uninstall_plugins to remove all installed plugins in vendor/plugins.

Get more information about plugin installation at config/plugins.yml.

Find example plugin at peatio-plugin-example.

Enhancements

  • #689: Add development-related files to .dockerignore.

The patch adds several paths to .dockerignore which reduces time needed to build an image and it's size.

  • #696: Drop Account#in & Account#out fields.

The patch removes unused fields from table accounts (put in «Enhancements» since it doesn't break anything).

  • #702: Update the nginx.conf and passenger.conf.

The patch updates NGINX & Passenger configuration files to support type of installation without Docker. Please, keep in mind: we don't support this type of Peatio installation. We support Docker-only setups. So we may remove all non-Docker docs soon.

Thanks to @shiftctrl-io.

  • #688: Set collation on database.yml.

The patch sets collation: utf8_general_ci directly in config/database.yml.

Fixes

  • #700: Fix broken authentication in WS.

The patch fixes retrieving of authentication token in APIv2::WebSocketProtocol.

This was a regression after #629.

Now access key is fetched from payload (parameter is called jwt) instead of headers.