遇到了新问题…SSL 证书不能刷新了…开了新帖,大佬啥时候有空的话看看吧。。
执行
$ sudo make console
[sudo] password for aaron67:
Starting homeland_redis ... done
Starting homeland_postgresql ...
Starting homeland_elasticsearch ... done
Loading production environment (Rails 5.2.2.1)
irb(main):001:0> Topic.__elasticsearch__.create_index!
=> nil
irb(main):002:0> Topic.import
Traceback (most recent call last):
1: from (irb):2
NoMethodError (undefined method `bytesize' for nil:NilClass)
irb(main):003:0> User.__elasticsearch__.create_index!
=> {"acknowledged"=>true, "shards_acknowledged"=>true, "index"=>"users"}
irb(main):004:0> User.import
=> 0
irb(main):005:0> Page.__elasticsearch__.create_index!
=> {"acknowledged"=>true, "shards_acknowledged"=>true, "index"=>"pages"}
irb(main):006:0> Page.import
=> 0
irb(main):007:0>
搜索功能已经 OK 了,感谢感谢
等您有空的时候 Fix 了 我再更新一哈
好的 十分感谢
是的 我觉得不是 compose 端口的问题 原来搜索是可用的
另外,我加了 --trace 发现个挺神奇的地方
rake aborted!
Faraday::ConnectionFailed: Failed to open TCP connection to localhost:9200 (Network unreachable - connect(2) for "localhost" port 9200)
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/faraday-0.15.4/lib/faraday/adapter/net_http.rb:87:in `perform_request'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/faraday-0.15.4/lib/faraday/adapter/net_http.rb:43:in `block in call'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/faraday-0.15.4/lib/faraday/adapter/net_http.rb:92:in `with_net_http_connection'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/faraday-0.15.4/lib/faraday/adapter/net_http.rb:38:in `call'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/faraday-0.15.4/lib/faraday/rack_builder.rb:143:in `build_response'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/faraday-0.15.4/lib/faraday/connection.rb:387:in `run_request'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/elasticsearch-transport-5.0.5/lib/elasticsearch/transport/transport/http/faraday.rb:23:in `block in perform_request'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/elasticsearch-transport-5.0.5/lib/elasticsearch/transport/transport/base.rb:262:in `perform_request'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/elasticsearch-transport-5.0.5/lib/elasticsearch/transport/transport/http/faraday.rb:20:in `perform_request'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/elasticsearch-transport-5.0.5/lib/elasticsearch/transport/client.rb:131:in `perform_request'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/elasticsearch-api-5.0.5/lib/elasticsearch/api/namespace/common.rb:21:in `perform_request'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/elasticsearch-api-5.0.5/lib/elasticsearch/api/actions/indices/delete.rb:44:in `delete'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/elasticsearch-model-5.0.2/lib/elasticsearch/model/indexing.rb:269:in `delete_index!'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/elasticsearch-model-5.0.2/lib/elasticsearch/model/indexing.rb:229:in `create_index!'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/elasticsearch-model-5.0.2/lib/elasticsearch/model/importing.rb:116:in `import'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/elasticsearch-rails-5.0.2/lib/elasticsearch/rails/tasks/import.rb:63:in `block (3 levels) in <main>'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/rake-12.3.2/exe/rake:27:in `<top (required)>'
/usr/local/bundle/bin/bundle:23:in `load'
/usr/local/bundle/bin/bundle:23:in `<main>'
Caused by:
Errno::ENETUNREACH: Failed to open TCP connection to localhost:9200 (Network unreachable - connect(2) for "localhost" port 9200)
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/faraday-0.15.4/lib/faraday/adapter/net_http.rb:87:in `perform_request'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/faraday-0.15.4/lib/faraday/adapter/net_http.rb:43:in `block in call'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/faraday-0.15.4/lib/faraday/adapter/net_http.rb:92:in `with_net_http_connection'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/faraday-0.15.4/lib/faraday/adapter/net_http.rb:38:in `call'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/faraday-0.15.4/lib/faraday/rack_builder.rb:143:in `build_response'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/faraday-0.15.4/lib/faraday/connection.rb:387:in `run_request'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/elasticsearch-transport-5.0.5/lib/elasticsearch/transport/transport/http/faraday.rb:23:in `block in perform_request'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/elasticsearch-transport-5.0.5/lib/elasticsearch/transport/transport/base.rb:262:in `perform_request'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/elasticsearch-transport-5.0.5/lib/elasticsearch/transport/transport/http/faraday.rb:20:in `perform_request'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/elasticsearch-transport-5.0.5/lib/elasticsearch/transport/client.rb:131:in `perform_request'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/elasticsearch-api-5.0.5/lib/elasticsearch/api/namespace/common.rb:21:in `perform_request'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/elasticsearch-api-5.0.5/lib/elasticsearch/api/actions/indices/delete.rb:44:in `delete'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/elasticsearch-model-5.0.2/lib/elasticsearch/model/indexing.rb:269:in `delete_index!'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/elasticsearch-model-5.0.2/lib/elasticsearch/model/indexing.rb:229:in `create_index!'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/elasticsearch-model-5.0.2/lib/elasticsearch/model/importing.rb:116:in `import'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/elasticsearch-rails-5.0.2/lib/elasticsearch/rails/tasks/import.rb:63:in `block (3 levels) in <main>'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/rake-12.3.2/exe/rake:27:in `<top (required)>'
/usr/local/bundle/bin/bundle:23:in `load'
/usr/local/bundle/bin/bundle:23:in `<main>'
Caused by:
Errno::ENETUNREACH: Network unreachable - connect(2) for "localhost" port 9200
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/faraday-0.15.4/lib/faraday/adapter/net_http.rb:87:in `perform_request'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/faraday-0.15.4/lib/faraday/adapter/net_http.rb:43:in `block in call'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/faraday-0.15.4/lib/faraday/adapter/net_http.rb:92:in `with_net_http_connection'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/faraday-0.15.4/lib/faraday/adapter/net_http.rb:38:in `call'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/faraday-0.15.4/lib/faraday/rack_builder.rb:143:in `build_response'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/faraday-0.15.4/lib/faraday/connection.rb:387:in `run_request'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/elasticsearch-transport-5.0.5/lib/elasticsearch/transport/transport/http/faraday.rb:23:in `block in perform_request'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/elasticsearch-transport-5.0.5/lib/elasticsearch/transport/transport/base.rb:262:in `perform_request'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/elasticsearch-transport-5.0.5/lib/elasticsearch/transport/transport/http/faraday.rb:20:in `perform_request'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/elasticsearch-transport-5.0.5/lib/elasticsearch/transport/client.rb:131:in `perform_request'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/elasticsearch-api-5.0.5/lib/elasticsearch/api/namespace/common.rb:21:in `perform_request'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/elasticsearch-api-5.0.5/lib/elasticsearch/api/actions/indices/delete.rb:44:in `delete'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/elasticsearch-model-5.0.2/lib/elasticsearch/model/indexing.rb:269:in `delete_index!'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/elasticsearch-model-5.0.2/lib/elasticsearch/model/indexing.rb:229:in `create_index!'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/elasticsearch-model-5.0.2/lib/elasticsearch/model/importing.rb:116:in `import'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/elasticsearch-rails-5.0.2/lib/elasticsearch/rails/tasks/import.rb:63:in `block (3 levels) in <main>'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/rake-12.3.2/exe/rake:27:in `<top (required)>'
/usr/local/bundle/bin/bundle:23:in `load'
/usr/local/bundle/bin/bundle:23:in `<main>'
Tasks: TOP => elasticsearch:import:model
说连不上本地 9200 端口…
我看了下 compose file,对 elasticsearch 端口的写法是
ports:
- '9200'
- '9300'
并没有显示指定,我以为是这里的问题… 调整成了
ports:
- '9200:9200'
- '9300:9300'
但依旧报同样的错误,调整后的 container
f34d63688977 elasticsearch:5-alpine "/docker-entrypoint.…" 12 minutes ago Up 12 minutes 0.0.0.0:9200->9200/tcp, 0.0.0.0:9300->9300/tcp homeland_elasticsearch
app.local.env配置文件的内容
#
# Global settings
#
RAILS_ENV=production --trace
SECRET_KEY_BASE=production
DATABASE_URL=postgres://postgres@postgresql:5432/homeland
REDIS_URL=redis://redis:6379/1
ELASTICSEARCH_HOST=elasticsearch:9200
谢谢回复
三条均报类似下面的错误
$ docker-compose run app bundle exec rake elasticsearch:import:model CLASS=User FORCE=y
Starting homeland_postgresql ... done
Starting homeland_redis ...
Starting homeland_elasticsearch ... done
rake aborted!
NameError: uninitialized constant User
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/active_support.rb:74:in `block in load_missing_constant'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/active_support.rb:8:in `without_bootsnap_cache'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/active_support.rb:74:in `rescue in load_missing_constant'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/active_support.rb:56:in `load_missing_constant'
(eval):1:in `block (3 levels) in <main>'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/elasticsearch-rails-5.0.2/lib/elasticsearch/rails/tasks/import.rb:49:in `eval'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/elasticsearch-rails-5.0.2/lib/elasticsearch/rails/tasks/import.rb:49:in `block (3 levels) in <main>'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/rake-12.3.2/exe/rake:27:in `<top (required)>'
/usr/local/bundle/bin/bundle:23:in `load'
/usr/local/bundle/bin/bundle:23:in `<main>'
Caused by:
NameError: uninitialized constant User
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/active_support.rb:58:in `block in load_missing_constant'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/active_support.rb:16:in `allow_bootsnap_retry'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/active_support.rb:57:in `load_missing_constant'
(eval):1:in `block (3 levels) in <main>'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/elasticsearch-rails-5.0.2/lib/elasticsearch/rails/tasks/import.rb:49:in `eval'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/elasticsearch-rails-5.0.2/lib/elasticsearch/rails/tasks/import.rb:49:in `block (3 levels) in <main>'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/rake-12.3.2/exe/rake:27:in `<top (required)>'
/usr/local/bundle/bin/bundle:23:in `load'
/usr/local/bundle/bin/bundle:23:in `<main>'
Tasks: TOP => elasticsearch:import:model
(See full trace by running task with --trace)
测试图片上传

收到 十分感谢
无耻的圈一下开发大佬… @huacnlee
感谢分享
FYI 改了个域名…
看到 Rei 发的文章 都不敢说话了。。。
悄悄顶一下…
我来这里安利一下社区 专注区块链技术本身 也有地方讨论各种代币 … https://hiblockchain.io/
好大……
我貌似也遇到了这个问题…
我是直接 Docker 部署的 物理机内存占用 66%
只是个人比较看好 BCH 所以买了这个域名…然后直接用了 社区不是只限于 BCH 的… 各代币和底层技术讨论 是最初的方向 从现有的帖子能看出来
不不…请忽略域名…

已经暂时使用custom_head_html来设置 favicon 问题关闭…
感谢大佬回复
是的 直接在custom_head_html里添加一段 icon 的设置确实能解决问题
但是这样改后直接访问虚机IP/favicon.ico依旧是红宝石 icon 其实还是访问到了原来的 icon
只是在 head 里设置之后 覆盖掉了 不知道我的理解对不对
另外 我的新思路 自己 clone 出来 repo 修改 Dockerfile 的方法 是不是思路有什么问题呢…
在用 Hexo…
感谢分享 学习了 真的是每个领域都有大世界
WOW 支持大佬 电子书看的不爽 来凑波热闹
我配过一个 apache + passenger + sinatra 的。。。 看起来有点小儿科了。。。
感觉各种语言的类似行为都是从 C 的 strcmp「继承」来的…
Ruby 爱好者。。门外汉。。可以报名么。。