Git Product home page Git Product logo

Comments (9)

windy avatar windy commented on August 11, 2024

@Zhangsm 你列一下 /home/deploy/web/wblog/current 下面是否有文件? 估计还没有链接成功.

from wblog.

windy avatar windy commented on August 11, 2024

@Zhangsm 我这两天更新了 deploy.rb 脚本, 依赖更少了, 还支持了英文博客. 你可以看下.

from wblog.

shuiiiiiimu avatar shuiiiiiimu commented on August 11, 2024

@windy 按照部署流程,bundle install自后就是建立软链接,再就是Unicorn之类的操作。但mina部署失败之后,他会马上回滚上一步操作,也就是unicorn启动失败后就会删除软链接。

我建立ruby用户,重新部署下看看。

from wblog.

windy avatar windy commented on August 11, 2024

@Zhangsm 嗯, 你如果有需要可以加我 skype, 我可以及时回复你.

from wblog.

windy avatar windy commented on August 11, 2024

@Zhangsm 我 skype 是 lyfi2003

from wblog.

shuiiiiiimu avatar shuiiiiiimu commented on August 11, 2024

嗯嗯,为了帮助更多的人。我还是把部署中遇到的一些小问题在这里说明吧!!哈哈。。。

首先,非常感谢 @windy 开源这个项目。我列下我遇到的问题吧,不要见怪。。。

1.就是deploy.rb中:

task :environment do
  # queue! %[source /usr/local/rvm/scripts/rvm]
 ###其实很多人测试环境不一样,这里要注意改动###
  queue! %[source /home/#{user}/.rvm/scripts/rvm]
  queue! %[rvm use 2.1.2]
end

2.首次部署的时候,bundle install 都会从https://rubygems.orgfetch gem,总会莫名其妙的报些SSL connection rest这样的错误。。。然后mina task终止。。。然后再重新mina deploy -v有时候有可以。。。反正bundle install 就是没那么轻松。。。哈哈。。。

-----> Installing gem dependencies using Bundler
$ mkdir -p "/home/ruby/wblog/shared/bundle"
$ mkdir -p "./vendor"
$ ln -s "/home/ruby/wblog/shared/bundle" "./vendor/bundle"
$ bundle install --without development:test --path "./vendor/bundle" --deployment
Using rake 10.4.2
Using i18n 0.7.0

3.到启动unicorn的时候,也会报错:

-----> Starting Unicorn...
/home/ruby/wblog/releases/1 not found
-----> Done. Deployed v1

于是,我修改下mina-unicorngem包源码,打印该语句出来看看

-----> Starting Unicorn...
/home/ruby/wblog/current
BUNDLE_GEMFILE= RAILS_ENV=production bundle exec unicorn -c /home/ruby/wblog/current/config/unicorn/zh.rb -E production -D
/home/ruby/wblog/releases/2 not found
-----> Done. Deployed v2

发现BUNDLE_GEMFILE读取不到,为空。在unicorn相关配置中找到

before_exec do |server|
  ENV["BUNDLE_GEMFILE"] = "#{app_path}/Gemfile"
end

不知道神马原因为空,改成set :bundle_gemfile = "#{app_path}/Gemfile"会不会好点呢?于是我人肉启动:

BUNDLE_GEMFILE=/home/ruby/wblog/current/Gemfile RAILS_ENV=production bundle exec unicorn -c /home/ruby/wblog/current/config/unicorn/zh.rb -E production -D

启动成功了。于是就产生了/tmp/unicorn_wblog_zh.sock这个文件。
到这一步,接着配置nginx,应该就没有什么问题了吧。

这是一个优秀的项目,值得去学习!只不过我遇到的问题多了一点。。。。

from wblog.

windy avatar windy commented on August 11, 2024

@Zhangsm bundle 的问题不能怪别人哈, 谁让我们国内的网络封了 rubygems.org 呢...
但也有其他方法, 比如 wblog Gemfile 里其实添加了 RUBY_TAOBAO 的环境变量, 如果你的环境在国内, 就修改一下 deploy.rb

task :environment do
export RUBY_TAOBAO=1

....

end

这样就会用 taobao 的源来 bundle.

unicorn 的问题, 你也可以用 mina uniorn:restart -S 来查看脚本内容.

mina 是个好东西, 第一次布署遇到类似问题很正常, 以后就方便多了.

from wblog.

shuiiiiiimu avatar shuiiiiiimu commented on August 11, 2024

如果在deploy.rb中加入这个set :term_mode, nil就更加妥妥的了。哈哈。。。。

from wblog.

windy avatar windy commented on August 11, 2024

@Zhangsm 这个要看你用的啥终端:) mac 下默认的显示效果非常好.

我把这个 issue 先关了, 为了方便其他人找到这里, 我把链接加到 wiki 里了, 也谢谢你的布署分享 👍

from wblog.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.