Gitlab setup notes

It has been a long time I didn’t update my blog. This is my gitlab setup notes 3 month ago. Hope you find it useful.

  1. follow the guide
  2. change the gitlab.yml for localhost
  3. if need to add extra url, need to change gitlab.yml and unicorn.rb in config
  4. restart /etc/init.d/gitlab restart, and nginx
  5. if ssh for git not work, go to gitlab-shell and change config in localhost.

Default login account : login………admin@local.host    password……5iveL!fe

  •  exactly follow the guide: https://github.com/gitlabhq/gitlabhq/blob/5-0-stable/doc/install/installation.md
  • if you do a git clone and got the following errors

It’s probably the host setting in gitlab-shell is wrong. look at gitlab-shell/config.yml, change gitlab_url to the right host

  • if you want to change the host name, you need to change the following place:

  •  if you want to add special url for gitlab:

(NOTE: somehow, I still get error when doing clone from http)

  • Important:

after every changes on gitlab, restart gitlab service

 

2013年计划

新的一年都过了快2个月了,现在才写计划,是不是晚了点?不过,我也好久没有写过计划了。所以,什么时候写不重要,写什么也不重要。重要的是,一点一点的做,认真的做好。到最后,能不能全部完成,也不那么重要了。

最重要的,当然是照顾好老婆,带好娃。自己也要锻炼身体,每周至少锻炼2次。

再剩下的就是个人发展方面的了:

  1. 少看微博,多读技术文章。始终控制关注数在100以内,否则,实在看不过来。有些非技术类的朋友,对不起,实在没办法关注你们了。每天读一篇技术文章。
  2. 学一些machine learning的知识。个人感觉,5年后machine learning会像算法一样,成为CS本科生的必备知识。为了不落后,有空学一些,练一练。
  3. 读3本书,什么书还没定。现在读的《黑客与画家》,刚开始看,感觉一般。还应该看《Refactoring》,之前看了一段,没坚持下来,今年应该坚持看完。还有一本,目前还不知道。有推荐的再说。
  4. 自己再做一个网站。这次,不光要上线,还要坚持维护半年。熟悉一下如果自己经营一个站点,如何维护和迭代。
  5. 学一门新语言,erlang,或者scala,lisp。也没想好学什么。体验一下不同的语言。
  6. 读一个开源项目的代码。自己写代码,读别人的代码,看书,思考。这四个环节,缺任何一个,都会降低对知识的理解程度。想找个轻量级的框架,学习一下。有什么推荐吗?

就这么多吧。个人感觉,已经够多了。努力。

新家第一篇 @ jiaming.me

博客记得断断续续,从PhD时代到现在,风格和内容也在改变。之前MSN space和csdn的博客都整合在这里。但有些格式可能有问题,将就看把。

这里还不知道应该记点什么。不管怎么说,先把jiaming.me这个域名占上。其他的,以后再说把。可能主要记录一些我的技术心得。主要分为“闲聊”,“瞎逛”,和“胡搞”三大系列。

顺便,有没有墙内的能帮我鉴定一下这个域名能打开吗?

backbone on rails example

Reference: http://arturadib.com/hello-backbonejs/docs/5.html http://thomasdavis.github.com/2011/02/01/backbone-introduction.html and

http://backbonetutorials.com/

app/views/items/index.html

Source code: https://github.com/jimmyntu/backbone_on_rails_example

Django + Celery + Rabbitmq setting

The async tasks django framework should be handled by RabbitMQ. Celery is the better one to fit in between.
Before I dump the d*** Ubuntu 11.10, I need to document something here to record the setting of celery for django.

It’s very simple for setup and config celery for django. Please refer to Celery documents: http://django-celery.readthedocs.org/en/latest/getting-started/first-steps-with-django.html
But in the tutorial, they missed one line in the setting.py:

 

You can refer for more details about the setting in http://stackoverflow.com/questions/4643065/why-does-celery-work-in-python-shell-but-not-in-my-django-views-import-proble/6899753#6899753

PS: Don’t upgrade to Ubuntu 11.10, unless you are sure that is what u want!!!

execjs error when upgrade rails from 3.0.x to 3.1.0 [problem solved]

When I upgrade the rails from 3.0.x to 3.1.0, the old app can’t work. Even the new one will give the error like:

 

To solve the problem, we need to do following steps:

And add the following line in the Gemfile for the new RoR applications:

 

In the 3.1.0, the default place for holding javascript is changed from 3.0.x. The old app can’t find the right javascript under the new framework. Need to move the old js files to the new place.

Please refer to: http://stackoverflow.com/questions/6282307/rails-3-1-execjs-and-could-not-find-a-javascript-runtime

 

To enable video streaming on nginx

The most important post is

http://onlyzq.blog.51cto.com/1228/558800

If you are working on ubuntu, and install the nginx from nginx source (not the default one), the flv module is auto installed. The yamdi part seems not necessary. I didn’t find any problem without convert the video file.

By following that post, I only set the limit rate part in nginx default.conf. The other parts are nice to have but not necessary.

To compile the modules for nginx please refer to:

1. http://69.168.53.49/Modules and

http://wiki.nginx.org/NginxInstallOptions

2. http flv stream module in nginx:

http://69.168.53.49/HttpFlvStreamModule

 

The way to enable django + uwsgi + nginx

Currently, django prefers wsgi. I’m not familiar with the difference between things like fastcgi, scgi, wsgi. So can’t tell the reason for now. Anyway, since a lot of ppl recommend me to try nginx for streaming web application, I’d like to give it a try.
The mod_wsgi for apache is not avaible in nginx. For nginx, it has another option, uwsgi. Again, I don’t know the difference. Just have a try.

To install nginx, refer to: http://wiki.nginx.org/Install

To install and set uwsgi, refere to:

http://stackoverflow.com/questions/7081462/problem-with-nginx-uwsgi-in-vhost-mode-running-django-app

http://projects.unbit.it/uwsgi/wiki/Example

My finding in the setup:

  • in /etc/nginx/conf.d/default, the location can be set more simpler on top of the default setting:

 

os.environ['DJANGO_SETTINGS_MODULE'] = ‘groupbuy.settings’import django.core.handlers.wsgiapplication = django.core.handlers.wsgi.WSGIHandler()

The 2nd system path I add is for include django in the library path. Otherwise, uwsgi won’t find the django.core.handlers.wsgi module

 

  • To restart nginx:

 

  • edit the django project wsgi configure module file. Name it as django_wsgi.py in PATH_OF_YOUR_SITE.

 

The 2nd sys path is for uwsgi to find the django.core.handlers.wsgi. I installed django with python 2.6. But the uwsgi is installed with python 2.7. That’s the reason why uwsgi can’t find the module when I run it.

  • command to run uwsgi

Or use the xml format in file mydjango.xml as in

http://projects.unbit.it/uwsgi/wiki/Example

 

and run with command: