Posts

Showing posts with the label supervisord

Deploy Redmine 2.6 with Unicorn, Supervisor, and NginX

This blog post is about how to deploy Redmine 2.6, the opensourced project management software in a Ubuntu server with unicorn, supervisor and nginx. A. Install Redmine: 1. Create a mariadb database for redmine: * database name: redmine * user: redmineuser * password: redminepasswd 2. Clone the redmine's git repo: $ git clone https://github.com/redmine/redmine.git $ cd redmine $ git checkout -b 2.6-stable 3. Configure database connection: Copy config/database.yml.example to config/database.yml and edit this file in order to configure your database settings for "production" environment. production:   adapter: mysql2   database: redmine   host: localhost   username: redmineuser   password: redminepasswd (for ruby 1.9) 4. Install dependencies: $ gem install bundler $ bundle install --without development test 5. Session store secret generation: $ rake generate_secret_token 6. Database schema objects creation: $...

Running cherrymusic as a service in Ubuntu 14.04 with Supervisord

In the previous blog post, I showed you how to run a music streaming service on your computer: http://iambusychangingtheworld.blogspot.com/2014/10/build-your-own-music-streaming-website.html Today, I will guide you how to setup cherrymusic as a service using Supervisord . I love Supervisord! I got some trouble getting cherrymusic to work with Supervisord: * I first tried running cherrymusic with Python2: when clicking to the "browse files" link, it said that cannot browse files and throw this error in the backend: UnicodeDecodeError: 'ascii' codec can't decode byte 0xec in position 1: ordinal not in range(128) * Then, I switched to Python3 and also got errors, but this time, it is a fixable issue:   cherrymusic can list my albums but when I clicked to one of the album, it through this error: ... UnicodeEncodeError: 'utf-8' codec can't encode character '\udcc3' in position 7: surrogates not allowed this is a Python3's bug: h...

Docker - Install supervisord in a Trusty container

Because supervisord needs Upstart to be running but docker only runs one process at a time (When apt-get is running, upstart is not). So, to install supervisord in a docker container, I need to do some little tricks: Prerequisites # echo "deb http://archive.ubuntu.com/ubuntu trusty main universe" >> /etc/apt/sources.list # apt-get update # apt-get upgrade To avoid the error " initctl: Unable to connect to Upstart: Failed to connect to socket /com/ubuntu/upstart: Connection refused " when installing supervisor: # dpkg-divert --local --rename --add /sbin/initctl # ln -s /bin/true /sbin/initctl Install supervisord: # apt-get install supervisor # ln -s /usr/bin/supervisorctl /usr/local/bin/supervisorctl References: [0]  https://github.com/docker/docker/issues/1024 [1]  http://docs.docker.com/articles/using_supervisord/

Run celery as a daemon using root user in Ubuntu

In the latest stable version of celery (3.1.13), you cannot run a celery beat as a daemon (I used supervisord) using root user without a special environment variable. That special variable is C_FORCE_ROOT. So, in your supervisord configuration file, add this: ... environment=C_FORCE_ROOT="yes" ... This is not encouraged but in some cases like mine, I just need the system works, and avoiding any extra configuration.

Supervisord and django-celery: Stop the process properly

Just noted when I stopped the django-celery app which monitored by supervisord with: # supervisorctl stop myappcelery The status show myappcelery had stopped: # supervisorctl status myappcelery                         STOPPED    Nov 20 10:48 AM But, the python processed of django-celery were still running: # ps aux | grep celery root     25729  9.0  1.8 225676 38188 ?        S    11:07   0:00 python /mydjangoapp/manage.py celeryd --pool=eventlet -v 2 -B -s celery -E -l info root     25748  1.0  1.7 164640 36596 ?        S    11:07   0:00 python /mydjangoapp/ manage.py celeryd --pool=eventlet -v 2 -B -s celery -E Then, I take a look at the supervisord configuratio...

Supervisord - Using the built-in web interface to monitor processes

Image
Supervisord, a process control system, has a simple built-in web interface to help you manage processes. It is just so great!!! To enable it: 1. Add these line to /etc/supervisor/supervisord.conf to enable supervisord web interface in port 9001 (localhost, domain: my.domain.com): ... [inet_http_server] port=127.0.0.1:9001 username=guest password=mysecret ... +Restart supervisord: $ sudo supervisorctl reload 2. Pass requests of my.domain.com to 127.0.0.1:9001 : + Create a nginx configuration file for supervisord /etc/nginx/sites-available/supervisord : upstream supervisord { server localhost:9001 fail_timeout=0; } server {         listen 80;         server_name my.domain.com;         access_log /var/log/access_supervisor.log;         error_log /var/log/error_supervisor.log;       ...