Supervisord: Restarting and Reloading

Supervisord is a great daemon for managing application processes. However it does not have a reload option, and restart works different than we get used to. These command makes the following effects.

service supervisor restart

Restart supervisor service without making configuration changes available. It stops, and re-starts all managed applications.

supervisorctl restart <name>

Restart application without making configuration changes available. It stops, and re-starts the application.

If you create a new configuration. None of the commands above will make it available. If you want to apply your configuration changes in both existing and new configurations, start applications in new configurations, and re-start all managed applications, you should run:

service supervisor stop
service supervisor start

If you do not want to re-start all managed applications, but make your configuration changes available, use this command:

supervisorctl reread

This command only updates the changes. It does not restart any of the managed applications, even if their configuration has changed. New application configurations cannot be started, neither. (See the “update” command below)

supervisorctl update

Restarts the applications whose configuration has changed.
Note: After the update command, new application configurations becomes available to start, but do not start automatically until the supervisor service restarts or system reboots (even if autostart option is not disabled). In order to start new application, e.g app2, simply use the following command:

supervisorctl start app2

How to Run Flask Applications with Nginx Using Gunicorn

We have recently bought a VPS for İTÜ24, the online newsletter of Istanbul Technical University. The server is running on Ubuntu Server 12.04 operating system. Due to limited memory resources and performance concerns, we preferred to setup nginx as web server.

Our server will serve several web pages and applications developed in various programming languages, such as PHP, Python, Ruby (on Rails). Currently, we have one Python application, which is using Flask framework.

How we run Flask application with nginx, step by step…
Continue reading “How to Run Flask Applications with Nginx Using Gunicorn”

Resetting Your Linux Password

If you cannot remember your password on a Linux operating system, you can simply reset it within minutes. Here is how to do:

  1. The only thing you need is a bootable Linux Live CD or USB thumb drive. You will also need “sudo” command to achieve this, make sure you have root privileges on your bootable Linux media.
  2. Once you boot into your Live CD/USB, mount the disk partition which Linux is installed on.
  3. There is a (magical) Linux command: chroot. This will allow you to change your root directory to mounted partition. Open terminal and run this command.: (Change “/media/disk” to your mount location.)
    sudo chroot /media/disk
  4. When the prompt changes, run this command, and enter new password: (Change “user” to username whose password to be reset.)
    passwd user

After setting the password, you can now restart the computer (do not forget to remove Live CD/USB), and login using new password.

IMPORTANT NOTICE: PLEASE RESPECT PRIVACY OF OTHERS

İTÜ Laboratuvarlarında Dropbox Kurulumu

Dropbox, dosyalarınızı internet üzerinde barındırarak her yerden erişmenizi sağlayan harika bir bulut depolama hizmeti. İnternet tarayıcısı üzerinden dosya yüklemeniz ve yüklediğiniz dosyalara erişebilmeniz mümkün olmasına rağmen, bazı durumlarda bu seçenek kullanışsız bir işkenceye dönüşebiliyor.

Dropbox’ın istemci yazılımı, belirlediğiniz klasör içinde yaptığınız her değişikliği otomatik olarak ve anında internete gönderiyor. Bu yazılımı İTÜ’deki öğrenci bilgisayar laboratuvarlarındaki tüm bilgisayarlarda kurulu olan Fedora’ya yüklemek mümkün. Fedora’yı kullanmak için bilgisayarı düğmesine 1 saniye süreyle basarak kapatın ve tekrar açtığınızda açılış menüsünden Fedora’yı seçin. Eğer bir Dropbox hesabınız yoksa bu adresten kaydolabilirsiniz.

Dropbox yönetim aracını indirdikten sonra, Fedora menüsünden Terminal’i açın ve aşağıdaki komutu yazıp Enter tuşuna basın:

python Downloads/dropbox.py start -i

İndirme işlemi tamamlandıktan sonra Dropbox istemci yazılımı kurulacak ve çalışacak. Karşılama sihirbazı, hesabınızı yapılandırmanıza yardım edecek.

UYARI: İTÜ hesabınızın 100MB kotası olduğunu ve Dropbox ile kolayca doldurabileceğinizi unutmayın.

Compaq Armada 110 Running Linux

My roommate has an old computer that belongs to one of his relatives: Compaq Armada 110. It’s operating system was, Windows ME and since he is going to return it after few months we are not supposed to change it. However, he is in love with Linux, and it is really hard to find proper software for daily needs (browsing web, watching movies, reading/editing documents) which runs on Windows ME.

Backing up

We decided to create image of the harddrive, install Linux, and restore image before returning it back. I created disk image with dd command:

dd if=/dev/hda of=/media/externaldisk/backup.img

It took a while, (about 3 hours) so be patient. After we backed up the hard drive, we are free to be “free” 🙂

Verifying backup image

But, I wanted to be sure about the backup is not corrupt. I wanted to try it on a virtual machine using VirtualBox. First, I thought I can run a live Linux, and use dd command to restore it back to an empty virtual drive. But then, I remembered that I’ve read something about converting image files to virtual drives. I searched on Google (you should try, it is amazing!), and reached the command within seconds.

VBoxManage convertdd /media/externaldisk/backup.img /media/externaldisk/backup.vdi

Virtual machine booted up successfully, automatically installed drivers for virtual hardware (except graphics driver). But I didn’t matter for me, because I’m going to restore image to the same computer again, and a successful boot up was all I need to see.

Now, the distro!

Since Armada 110 is ten years old, performance is important. So we had to choose a light desktop environment, like XFCE. xubuntu would be the best choice. I wanted to try latest version (11.04), and started installing. It took 40 minutes, and after a restart, it was ready. Performance? It was too much higher than my expectations.