[Study Notes * original] local installation of ruby-China website source code package

Source: Internet
Author: User
Tags install mongodb cpanel install redis

1. Ruby-China website source code package: https://github.com/huacnlee/ruby-china

$ cd ~/workspace$ git clone https://github.com/huacnlee/ruby-china.git

2. If you want to worry about it, do not try to install it in windows. Last night, it took 30 minutes to install it in windows, and the GIT Windows client was installed. Various errors have been solved. Later, it was too late to go to bed.

3. Use Ubuntu Linux 11.10 for installation today. It took half an hour in the morning. In the evening, it took nearly two hours to install and study. All deployment has been completed locally, and no problems have been found during the test. (Install log here: http://ruby-china.org/topics/1398)

========================================================== ==============

The next step is to organize the entire installation process.

1. Create a directory under/home/yourname/and put the source code of ruby-China. Edit gemfile: Add execjs and therubyracer

$ cd ~/project$ git clone https://github.com/huacnlee/ruby-china.git
$ vi ~/project/ruby-china/GemFile 

Join
Gem 'execjs'

Gem 'therubyracer'

2. Install MongoDB :(MongoDBIs a file-oriented database: http://zh.wikipedia.org/zh/MongoDB)

Sudo apt-Get install MongoDB

After installation, you do not need to configure too much. However, you need to manually create the/data/DB Directory: sudo mkdir-P/data/DB & sudo chmod 755-r/data/DB

Test (start sudo mongod, and the system will automatically start each boot)

$ mongo> db.foo.save( { a : 1 } )> db.foo.find()  

3. Install redis :(RedisIs an open-source log-type, key-value database http://zh.wikipedia.org/wiki/Redis written in ansi c language, supporting network, memory-based and persistent)

Sudo apt-Get install redis-Server

Too many configurations are not required. Test (

niuniuqiu@niuniuqiu:~/projects/ruby-china$ redis-cliredis 127.0.0.1:6379> set foo barOKredis 127.0.0.1:6379> get foo"bar"

Redis commands refer to Simplified Chinese version (http://redis.readthedocs.org/en/latest/index.html)

4. Follow the official documents:

CP config/config. yml. Default config/config. yml
CP config/consumer ID. yml. Default config/consumer ID. yml
CP config/redis. yml. Default config/redis. yml

Bundle install
Bundle update rails

Rake assets: precompile
Thin start-o-c config/thin. yml

Possible requirements: chmod + X./script/resque
./Script/resque start

Bundle exec rake sunspot: SOLR: Start

5. Install Python-setuptools

Sudo apt-Get install Python-setuptools

6. Continue to follow the official documents:

Sudo easy_install pygments # or sudo Pip install pygments

7. Install the database

Rake DB: migrate

8. The statement for inserting Code related to DB/seeds. Rb in the source code package of the ruby-China website I downloaded has been commented out?

As a result, you can select the topic type when posting. Submit: node cannot be a NULL Character

After removing the comment, run rake DB: seed to insert the data.

BTW: Now I suddenly think that the reason why this part of data is commented out is that the Administrator should maintain this part of data from the background. However, users cannot be created or administrator users cannot be created now? Seems to have become a paradox?

8 insert initialization data:

Rake DB: Seed

9. You can start the Web server at this time.

Rails server (rails S)

10. A bug?

Found that the user can not exit, the http://ruby-china.org/topics/1364 said (after the user login, I want to log out, point to the user name, drop-down menu to quit), according to the method specified in the reply, restore to normal.

[Quakewang: It looks like this is caused by precompile's asset. You can clear public/assets and then clear the browser cache to restore the normal state. The application. js content requested in the development environment should not contain other Js .]

11. log on to the admin background.

Register an ordinary user in the front-end user registration and remember the email address. Then modify admin_emails: "likeyu@gmail.com likeyulikeme@gmail.com" in config/config. yml (two lines are written in the source code, which seems to need to be moved to the same line, and multiple users can be separated by spaces ),

A common user is an administrator user. Go to the background management interface http: // localhost: 3000/cpanel.

Code for administrator Detection: Projects/ruby-China/APP/controllers/cpanel/application_controller.rb (ROR is so concise)

before_filter :require_admindef require_admin  if not Setting.admin_emails.include?(current_user.email)    render_404  endend

12. This is almost the case. Deploy is used only when the Internet environment is deployed. Do not run in the learning environment. Config/config. yml has some other configuration options, which you can understand at a glance.

Finally, I would like to thank everyone in the ruby-china.org community. For more information, see.

 


 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.