Skip to content

Instantly share code, notes, and snippets.

@solotimes
Created April 4, 2012 15:53
Show Gist options
  • Save solotimes/2303141 to your computer and use it in GitHub Desktop.
Save solotimes/2303141 to your computer and use it in GitHub Desktop.
sudulog

1.系统需求

  • Ubuntu 10.10 (以下默认为使用此发布版Linux,其他版本方法类似)

  • Git

    参考安装方法:

      add-apt-repository "deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen"
      apt-get update 
      apt-get install mongodb-10gen
    
  • Ruby1.9.2

    可安装rvm 使用rvm编译ruby方便调试 地址

  • Mogodb 1.6+

    参考安装方法:

      add-apt-repository "deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen"
      apt-get update 	
      apt-get install mongodb-10gen
    
  • Redis

      参考安装方法:
    
      cd /tmp
      wget http://redis.googlecode.com/files/redis-2.2.4.tar.gz
      tar -zxf redis-2.2.4.tar.gz
      cd redis-2.2.4
      make
      sudo make install
      wget https://github.com/ijonas/dotfiles/raw/master/etc/init.d/redis-server
      wget https://github.com/ijonas/dotfiles/raw/master/etc/redis.conf
      sudo mv redis-server /etc/init.d/redis-server
      sudo chmod +x /etc/init.d/redis-server
      sudo mv redis.conf /etc/redis.conf
      sudo useradd redis
      sudo mkdir -p /var/lib/redis
      sudo mkdir -p /var/log/redis
      sudo chown redis.redis /var/lib/redis
      sudo chown redis.redis /var/log/redis
      sudo update-rc.d redis-server defaults
      sudo /etc/init.d/redis-server start
    
  • node

    参考安装方法:

     sudo apt-get install python-software-properties
     sudo add-apt-repository ppa:chris-lea/node.js
     sudo apt-get update
     sudo apt-get install nodejs
     sudo apt-get install nodejs-dev
    
  • npm (node包管理器)

     curl http://npmjs.org/install.sh | sh
    
  • juggernaut

     npm install juggernaut -g
    

2.代码

  • 预配置

    编辑~/.ssh/config

      Host  xtunes.cn
        HostName xtunes.cn
      	Port 60022
      	User root
      	ForwardAgent yes
    

请使用之前设定好的ssh public key

  • 前端rails程序

      git@xtunes.cn:sudulog.com.git
    
  • 后端node程序

      git@xtunes.cn:sudulog_backend.git
    

3. 后台进程

  • Mogodb

  • Redis

  • juggernaut

    命令行执行 juggernaut

  • 数据接收进程

    1.进入后端程序<sudulog_backend>,执行npm install 安装依赖库

    2.将shangsai_CTCC.dat tianma.dat 等地图路径文件放入根目录

    3.执行node node data_receiver.js 启动进程

    以上后台进程保持运行,调试主程序无需重启

4. rails 程序

  1. 进入rails程序目录, 找到config/mongoid.yml.example 将其复制一份并且改名为mogoid.yml , 编辑其内容,其中development:部分为开发环境的数据库设置,一般默认无需修改

  2. 复制config/settings.ymlconfig/settings.local.yml 修改其内容,其中publisher:一项 修改为后端程序中data_publisher.js的绝对路径

  3. 安装bundle gem install bundler --pre

  4. 在rails程序根目录执行 bundle install 安装依赖库

  5. (以下命令如运行有任何问题,请在之前添加 bundle exec)

  6. 执行rake db:seed 建立初始管理员账号 'admin/admin'

  7. 执行QUEUE=* bundle exec rake resque:work 启动后台队列(用于转换上传的日志文件)

  8. 执行rails server启动rails服务器,默认访问路径为http://127.0.0.1:3000

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment