Back

[**]rails - peatio的安装步骤, rubykube

发布时间: 2018-04-07 13:21:00

peatio我使用了  rubykube的版本.开发的活跃.文档也不错.

有几点注意:

1. 按照安装文档来

2. 无论是 peatio, 还是 peatio-trading-ui, 都需要clone 后,checkout成对应的版本.

例如  git checkout 1-6-stable  ( peatio )  和   git  checkout -b 1.6.0 1.6.0  ( trading-ui) 

3. 记得把数据库的4个变量放到 .bashrc中 (不建议这样做, 会导致服务器内的其他rails app也操作该数据库) 

# in ~/.bashrc
export DATABASE_HOST=localhost
export DATABASE_USER=root
export DATABASE_PASS=666666
# 下面要注意,要使用单引号,不能使用双引号.否则会设置不上
export DATABASE_URL='mysql2://root:666666@localhost:3306/peatio?pool=10&timeout=3000'

4. 记得设置好交易对,然后 rake db:seed  ( 记得修改  config/currencies.yml) 

5. 在Gemfile中增加 gem 'thin' ,并且在config中增加thin.yml

6. 设置nginx.   (8801,8802是UI的, 8811,8812是后台的) 

  server {
          listen       80;
          server_name  coiex.siwei.me;
          client_max_body_size       500m;
          charset utf-8;

          location ~ ^/(?:trading|trading-ui-assets)\/ {
              proxy_pass http://coiex_ui_siwei_me_servers;
              proxy_set_header    X-Forwarded-For $proxy_add_x_forwarded_for;
              proxy_set_header    X-Real-IP $remote_addr;
              proxy_set_header    Host $http_host;
              proxy_next_upstream http_502 http_504 error timeout invalid_header;
          }

          location / {

              proxy_pass          http://coiex_siwei_me_servers;
              proxy_redirect      default;
              proxy_set_header    X-Forwarded-For $proxy_add_x_forwarded_for;
              proxy_set_header    X-Real-IP $remote_addr;
              proxy_set_header    Host $http_host;
              proxy_next_upstream http_502 http_504 error timeout invalid_header;

          }
          location ~ ^/assets/ {
              root /opt/app/peatio/public;
              expires 1y;
              add_header Cache-Control public;
              add_header ETag "";
              break;
          }
  }

  upstream coiex_siwei_me_servers{
         server localhost:8811;
         server localhost:8812;
  }


  upstream coiex_ui_siwei_me_servers{
         server localhost:8801;
         server localhost:8802;
  }

7. pusher 可以不注册.  (最好注册下, 貌似google的邮箱不会很快收到邮件, 建议直接使用qq邮箱) 

需要注释掉: app/models/member.rb   把sync_update中的内容注释掉.  

#   ::Pusher["private-#{sn}"].trigger_async('members', { type: 'upd.....

这句话会引起异常

8. 认证方式, 使用google不行. 国内的服务器无法访问 google.

要使用auth0 . 还可以.

配置auth0的时候,需要注意:

config/application.yml中

  OAUTH2_SIGN_IN_PROVIDER: auth0  # google, auth0, barong'

  # Configuration variables for sign in with Google.
  # See https://github.com/zquestz/omniauth-google-oauth2
  GOOGLE_CLIENT_ID: 281665397599-6sbas1v5ot9ek2b67qlm612mm74cdnia.apps.googleusercontent.com
  GOOGLE_CLIENT_SECRET: Ige3f6VrsnvAXnckTYjINmhp
  GOOGLE_OAUTH2_REDIRECT_URL: http://coiex.siwei.me/auth/google_oauth2/callback

  # Configuration variables for sign in with Auth0.
  # See https://github.com/auth0/omniauth-auth0
  AUTH0_OAUTH2_DOMAIN: shensiwei.auth0.com
  AUTH0_OAUTH2_CLIENT_ID: N2O7RKU71UYaoC1me3ybKQK9E5slDb5E
  AUTH0_OAUTH2_CLIENT_SECRET: 3BqyuYDVrr3VCm3Qt5kWe0pct8A6G7Ee-TPJajJph7lejQSb5W6L0gZnpWe9mSP6
  AUTH0_OAUTH2_REDIRECT_URL: http://coiex.siwei.me/auth/auth0/callback

9. 登陆之后, 可以看到一系列的内容.其中币种的数量,直接在数据库中,可以修改.

10. 修改之后,  就可以交易了. 记得把 god中要求的内容都跑起来.

Back