buaazp / zimg

A lightweight and high performance image storage and processing system.
http://zimg.buaa.us
BSD 3-Clause "New" or "Revised" License
2.69k stars 403 forks source link

supervise run #55

Closed zmoon111 closed 9 years ago

zmoon111 commented 9 years ago

(1) supervise run, when crash as online service;

buaazp commented 9 years ago

Maybe you need post more infomation in logs so I can find the problem.

Or tell more what's happening when zimg crashed.

zmoon111 commented 9 years ago

在 2014年12月17日,下午11:52,招牌疯子 notifications@github.com 写道:

Maybe you need post more infomation in logs so I can find the problem.

Or tell more what's happening when zimg crashed.

— Reply to this email directly or view it on GitHub https://github.com/buaazp/zimg/issues/55#issuecomment-67342293.

hi, “the crazy “

 first, sorry to post this to-do at top of your post list,  because i did not mention the ’to-do’ post thread  at bottom.

 I work at a Chinese internet company, when we deploy service online , we usually deploy it as child process of “supervisor”, this could help when binary crash (avoid losing many pv). 

 refer :http://supervisord.org/ <http://supervisord.org/> 

 further, when become online service, cdn can help a lot.

 love your work , best wishes~

— tommyzhao=

buaazp commented 9 years ago

I have used zimg via supervise in my demo server: http://demo.buaa.us/

So there's no problem.

szpapas commented 8 years ago

I tried to add zimg to supervise, but zimg exit quickly. How do you configure the supervisor for zimg?

Thanks.

buaazp commented 8 years ago

Use absolute path in your configs and set daemon false.

supervisor config:

[program:zimg]
command=/home/zippo/dev/zimg/bin/zimg /home/zippo/dev/zimg/bin/conf/debug.lua
autorestart=true
user=zippo

zimg config:

is_daemon           = 0
log_name            = '/home/zippo/dev/zimg/bin/log/zimg.log'
root_path           = '/home/zippo/dev/zimg/bin/www/index.html'
admin_path          = '/home/zippo/dev/zimg/bin/www/admin.html'
script_name         = '/home/zippo/dev/zimg/bin/script/process.lua'
img_path            = '/home/zippo/dev/zimg/bin/img'
szpapas commented 8 years ago

Thanks. It still got crash when upload image at the same time. So I duplicate the zimg.lua with different tcp port.

das@ubuntu:/etc/supervisor/conf.d$ cat app.conf [program:zimg] command=/opt/zimg/bin/zimg /opt/zimg/bin/conf/zimg.lua directory=/opt/zimg/bin autorestart=true user=root

[program:zimg2] command=/opt/zimg/bin/zimg /opt/zimg/bin/conf/zimg2.lua directory=/opt/zimg/bin autorestart=true user=root

[program:zimg3] command=/opt/zimg/bin/zimg /opt/zimg/bin/conf/zimg3.lua directory=/opt/zimg/bin autorestart=true user=root

[program:zimg4] command=/opt/zimg/bin/zimg /opt/zimg/bin/conf/zimg4.lua directory=/opt/zimg/bin autorestart=true user=root

So I have 4 zimg running on different tcp port.

root@ubuntu:/etc/supervisor/conf.d# ps -ef | grep zimg root 1146 1139 0 23:23 ? 00:00:00 /opt/zimg/bin/zimg /opt/zimg/bin/conf/zimg3.lua root 1147 1139 0 23:23 ? 00:00:00 /opt/zimg/bin/zimg /opt/zimg/bin/conf/zimg2.lua root 1148 1139 0 23:23 ? 00:00:00 /opt/zimg/bin/zimg /opt/zimg/bin/conf/zimg.lua root 1149 1139 0 23:23 ? 00:00:00 /opt/zimg/bin/zimg /opt/zimg/bin/conf/zimg4.lua root 1171 1089 0 23:24 pts/0 00:00:00 grep --color=auto zimg

Nginx for load balance.