I recently moved my MediaGoblin instance from an Amazon EC2 instance (Debian, Nginx) to my server at home, which runs ArchLinux and Apache. After getting my data moved home and the instance up and running, I really needed to create some init scripts. For a bit, I was being lazy and running the separate server pieces in tabs in screen. Which works fine until you reboot and forget to restart the services. Finally, I got around to writing those scripts.
The MediaGoblin built in server setup consists of two parts, Python Paste for the basic http serving and Celery for the task processing. You can run these parts as a single process or separately. For the best performance, they should be run as separate processes, especially when you upload video, large images and (in the future) audio. Having these processes separate (along with running Paste in CELERY_ALWAYS_EAGER=false mode) will allow uploads to be processed asynchronously. And from experience, having MediaGoblin running synchronously can kinda drag. Of course though, this was on the micro EC2 instance (limited CPU and mem), uploading and processing the Big Buck Bunny 480p trailer took quite some time. And with it being synchronous, it just sat at the add media page the whole time. When I uploaded the 1080p version, it went back to the main page and processed the video in the background. Much better experience in my opinion. Anyway, for more information about setting up MediaGoblin, check the References section at the bottom of this post.
Since I prefer to keep the two processes separate, I wanted two separate init scripts to control them. Also, for my MediaGoblin setup, I'm using the standard Paste http server (as opposed to the fcgi option) with the CELERY_ALWAYS_EAGER set to false. This runs on port 6543 which I then have a virtualhost proxypass setup for my media.jpope.org subdomain. Also, for my setup, I run both Paste and Celery as a separate user, making sure that user has read & write access where needed in the MediaGoblin web directory. I'm still fairly new to writing rc.d scripts but, they seem to be working quite well so far. For the Celery script check this link and for the Paste script check this link. If I come across any issues, I'll update this post. Also, if anyone is brave enough to try these out, let me know how they work (or not work). ;)
As far as I currently know, @chimo and I are the only ones running MediaGoblin on Arch. He has posted an init script for MediaGoblin on Arch as well. His is somewhat simpler as he is only running one process (no separate Celery) and therefore it's running synchronously. If you'd like to check out his script head over via the link.
- Python Paste
- Celery Project
- MediaGoblin Wiki
- MediaGoblin Dev Docs
- My MediaGoblin instance
- @chimo's ArchLinux-MediaGoblin init script
- my celery init script
- my paste init script
- apache proxypass example
I did some changes in your script to fit my necessities, but, it doesn't work. even the pid file isn't created. You can see both scripts here http://dpaste.com/752473/ and here http://dpaste.com/752474/