hostmonster

    git for hostmonster

    02 May 2010

    前段时间对网站做了些更新,于是在本地修改了代码,再git push,谁知却得到bash: git-receive-pack: command not found的error,我的git repository是放在hostmonster服务器上面的,之前都是正常的,于是提交ticket给hostmonster的support,得到的答复是他们升级的openssh,通过git+ssh不会再读取.bashrc或.ssh/environment文件,也就是说通过git+ssh没有办法修改PATH了。

    没办法了,只能手动将命令的路径补全了,对于git pull/git ps来说,只需要在输入命令的时候增加参数,比如

    git clone --upload-pack=/home1/huangzhi/git/bin/git-upload-pack
    git push --receive-pack=/home1/huangzhi/git/bin/git-receive-pack

    不过每次都输入参数实在麻烦,直接写到配置文件.git/config

    [remote "origin"]
    uploa...
    Read More

    Tags 


    Hostmonster升级到Rails2.3.3

    25 Jul 2009

    前两天Hostmonster把Rails升级到2.3.3,导致我的网站无法访问。查看日志,Dispatcher failed to catch: undefined method read' for classFCGI::Stream' (NameError),给Hostmonster提交了ticket,到现在都还没有结果,没办法,只能靠自己了。

    google了一下,可能是rack中的一段代码的问题。

    首先,安装好自己的gem repository,并且在environment.rb中指定:

    ENV['GEM_PATH'] = '/home7/huangzhi/ruby/gems:/usr/lib/ruby/gems/1.8'

    然后,指定app的rails为2.3.3:

    RAILS_GEM_VERSION = '2.3.3' unless defined? RAILS_GEM_VERSION

    最后,修改gem中rack-1.0.0/lib/rack/handler/fastcgi.rb文件,将第7行注释掉

    #  alias _...
    Read More

    Tags 


    在hostmonster上搭建git server

    14 Jun 2009

    hostmonster本身并不支持git,不过还好它提供了ssh,我们可以ssh上去编译git。

    首先,ssh到hostmonster上,编译安装git

    $ mkdir git
    $ cd git
    $ wget http://kernel.org/pub/software/scm/git/git-1.6.3.2.tar.gz
    $ tar -zxvf git-1.6.3.2.tar.gz
    $ cd git-1.6.3.2/
    $ ./configure --prefix=$HOME/git
    $ make  make install

    修改~/.bashrc,设置环境变量

    export GIT_HOME=$HOME/git
    export PATH=$GIT_HOME/bin/:$GIT_HOME/lib/libexec/git-core/:$PATH

    验证结果

    $ source ~/.bashrc
    $ git --version

    我们在本地新建一个rails app来使用git server

    $ rails home -d mysql
    $ cd home
    $ git ...
    Read More

    Tags 


    通过Capistrano部署Rails App到Hostmonster

    06 Jun 2009

    贴贴我通过Capistrano自动发布到Hostmonster的deploy.rb文件吧

    set :application, "huangzhimin.com"
    set :repository,  "GIT_REPOSITORY"
    set :user, "huangzhi"
    set :scm, :git
    set :deploy_to, "DEPLOY_DIRECTORY"
    
    role :app, "www.huangzhimin.com"
    role :web, "www.huangzhimin.com"
    role :db,  "www.huangzhimin.com", :primary => true
    
    set :use_sudo, false
    set :run_method, :run
    
    namespace(:deploy) do
      task :after_update_code, :roles => :app do
        run "ln -s #{shared_path}/config/database.yml #{current_release}/config/da...
    Read More

    Tags 


    解决rubygems冲突的问题

    23 May 2009

    在hostmonster上面手动编译了ruby和rubygems,不过今天在尝试rake gems:unpack的时候报错,说是调用了nil.version,一跟踪,原来是找不到gem的spec。不过明明是装好没问题的呀,奇怪了。于是去irb中尝试:

    require 'rubygems'
    => true
    require 'spec'
    => no such file to load -- spec

    看来是rubygems路径的问题。可能是和hostmonster默认的rubygems路径冲突了,于是在.bashrc中显示指定GEM_PATH

    export GEM_HOME=$HOME/ruby/gems
    export GEM_PATH=$GEM_HOME:/usr/lib/ruby/gems/1.8

    重新在irb中执行require 'spec'返回true,执行rake gems:unpack也OK了!

    Read More

    Tags