• @lana 这....,还真是网络环境的问题。

    用手机开个热点,用4G居然就可以了。

    宽带和手机都是移动的,然而把路由器重启也不行。难道要用ssh我只得开热点了,这操作真是...。

    搞不懂上网都是正常的,偏偏ssh用不起,难道是移动做了什么限制。

    @ThxFly 没有开代理。

  • @pynix 是国内的。

    @nightire-v 的日志

    ubuntu@ubuntupc:~$ ssh deploy@IP -v
    OpenSSH_7.6p1 Ubuntu-4, OpenSSL 1.0.2n  7 Dec 2017
    debug1: Reading configuration data /etc/ssh/ssh_config
    debug1: /etc/ssh/ssh_config line 19: Applying options for *
    debug1: Connecting to IP [IP] port 22.
    debug1: connect to address IP port 22: Connection timed out
    ssh: connect to host IP port 22: Connection timed out
    

    vim /etc/ssh/ssh_config

    Host *
        SendEnv LANG LC_*
        HashKnownHosts Yes
        GSSAPIAuthentication Yes
        GssAPIDelegateCredentials no
    

    vim /etc/ssh/sshd_config (不好意思,网页端无法粘贴)

  • 解决办法

    将配置文件中自定义asset_path注释掉,不知道为什么。

    config/initializers/ckeditor.rb

    Ckeditor.setup do |config|
      # config.asset_path = 'http://static.xxx.com'
    end
    

    carrierwave.rb 如果设置aliyun_private_read = true,自定义aliyun_host会不起作用,仍然返回aliyun本身的地址。(不影响使用)

    config/initializers/carrierwave.rb

    config.aliyun_access_id  = "XXX"
    config.aliyun_access_key = 'XXX'
    config.aliyun_bucket     = "XXXicom"
    config.aliyun_internal   = false
    config.aliyun_area     = "cn-shenzhen"
    config.aliyun_host       = "http://static.XXX.com"
    config.aliyun_private_read = true
    

    另外的问题

    如果设置OSS为私有,CKeditor上传图片成功后,返回的地址带有Expires,这样直接将图片地址插入内容中是行不通的,失效时间一到,图片就不能访问了。除非使用以下方式访问,才会生成新的访问地址:

    ckeditor_asset.file.url
    

    但CKeditor是把url硬编进内容的,目前想到办法:

    1. 把OSS设成公共读
    2. show content 时,遍历内容中的图片地址,然后替换。

    方法2太麻烦了,目前还没想到更好的解决办法。

  • @jasl

    又换CKeditor (为什么是又呢)

    用了ckeditor,在生成环境下编译后的 application.js 文件高达780K。 虽然有turbolinks,但直接影响到首次打开网页的速度。

    app/assets/javascripts/javascript.js

    //= require jquery
    //= require jquery_ujs
    //= require turbolinks
    //= require bootstrap-sprockets
    //= require ckeditor/init
    

    ckeditor的说明

    To reduce the asset precompilation time, you can limit plugins and/or languages to those you need:

    # in config/initializers/ckeditor.rb
    Ckeditor.setup do |config|
      config.assets_languages = ['en', 'fr']
      config.assets_plugins = ['image', 'smiley']
    end
    

    设置后js文件大小没变,请高手指点下,有什么好的优化方案吗?

  • @jasl 谢谢回复,重新找了个markdown编辑器 md_simple_editor 。

  • @jasl @cysh

    在开发环境下,一切正常。部署在生产环境下,编辑框显示不出来。

    production.log 有如下提示

    ...
    ActionController::RoutingError (No route matches [GET] "/assets/ueditor/lang/zh-cn/zh-cn.js"):
    ...
    ActionController::RoutingError (No route matches [GET] "/assets/ueditor/themes/default/ueditor.css"): 
    ...
    

    好像是资源引用地址有问题,在ueditor_config.js.erb中有如下配置

    //语言配置项,默认是zh-cn。
    //,lang:'zh-cn'
    //,langPath:URL +"lang/"
    
    //主题配置项,默认是default。
    , theme: 'default', themePath: "<%= asset_path 'assets/ueditor/themes/' %>"
    

    以前用kindeditor时,在生产环境时,需要先执行

      rails kindeditor:assets
    # Precompiling assets不再自动从vendor/assets和lib/assets拷贝非JS/CSS文件. 
    # 此方法可将kindeditor自动拷贝到你的public/assets目录.
    

    请问该怎么解决这个问题,谢谢了。

  • 已填表,请查收,谢谢。

  • 应该是ssh的原因 @xiaohesong

    ssh-add 
    Could not open a connection to your authentication agent. 
    

    目前直接跳过 mina setup 直接 mina deploy,然后在 config/deploy.rb 做了如下修改

    set :term_mode, nil
    # 不使用ssh,直接使用https方式clone
    #set :repository, 'git@github.com:gxlonline/daquan.git'
    set :repository, 'https://github.com/gxlonline/daquan'
    

    然后手动把 database.yml 和 secrets.yml 复制到服务器上。 曲线救国总算可以用了。

  • 直接运行 mina deploy 结果如下

    ➜  meirizhi git:(master) ✗ mina deploy  -v                                                                                                                                 
    deploy@115.28.150.205's password:                                                                                                                                        
    -----> Creating a temporary build path                                                                                                                                   
           $ touch "deploy.lock"                                                                                                                                             
           $ mkdir -p "$build_path"                                                                                                                                          
           $ cd "$build_path"                                                                                                                                                
    -----> Using RVM environment "ruby-2.3.3@default"                                                                                                                        
           $ if [[ ! -s "/usr/local/rvm/scripts/rvm" ]]; then                                                                                                                
               echo "! Ruby Version Manager not found"                                                                                                                       
               echo "! If RVM is installed, check your :rvm_use_path setting."                                                                                               
               exit 1                                                                                                                                                        
             fi                                                                                                                                                              
           $ source /usr/local/rvm/scripts/rvm                                                                                                                               
           $ rvm use "ruby-2.3.3@default" --create                                                                                                                           
           Using /usr/local/rvm/gems/ruby-2.3.3       
    -----> Cloning the Git repository                                                                                                                                        
           $ git clone "git@github.com:gxlonline/daquan.git" "/home/deploy/meirizhi.com/scm" --bare                                                                          
           Cloning into bare repository '/home/deploy/meirizhi.com/scm'...                                                                                                   
           Warning: Permanently added the RSA host key for IP address '192.30.253.113' to the list of known hosts.                                                           
           Permission denied (publickey).                                                                                                                                    
           fatal: Could not read from remote repository.                                                                                                                     
    
           Please make sure you have the correct access rights                                                                                                               
           and the repository exists.                                                                                                                                        
     !     ERROR: Deploy failed.                                                                                                                             
    -----> Cleaning up build                                                                                                                                                 
           $ rm -rf "$build_path"                                                                                                                                            
           Unlinking current                                                                                                                                                 
           $ rm -f "deploy.lock"                                                                                                                                             
           OK                                                                                                                                                                
           Connection to 115.28.150.205 closed.                                                                                                                              
    
     !     Run Error                          
    
  • @easonlovewan 在coding.net的webIDE上写的, 缩进确实有问题。实在看不下去了再clone到本地格式化一下。