Deploy cherrymusic using Nginx, Supervisord and Virtualenv on Ubuntu

Cherrymusic is a music streaming server written in python.

We assume the deployment is done in /home/user/music.domain.com

Cherrymusic

1. Go to the deployment folder and clone the cherrymusic repo

cd /home/user/music.domain.com
git clone https://github.com/devsnd/cherrymusic

2. Create and enable the virtualenv

python3 -m venv music_env
source music_env/bin/activate

3. Test if the cherrymusic server starts and stop it afterwords

python cherrymusic --setup --port 8080
(ctrl+c)

4. If you executed this commands under another user than the one under which you want to run cherrymusic

(eg: you ran the commands as root but you want to run under the user `user`)

mkdir -p /home/user/.config/cherrymusic
cp ~/.config/cherrymusic/cherrymusic.conf /home/user/.config/cherrymusic/

5. Edit cherrymusic.conf from the `user`’s home and set the `basedir` with the path where your music collection is stored.
eg: /var/music

Continue reading Deploy cherrymusic using Nginx, Supervisord and Virtualenv on Ubuntu

Switch between branches using Nginx

For some of my projects, most of the time I use two branches: master and dev and I work mostly in dev. If I need to send the url to some clients with some dev/beta features I should create another (sub)domain like dev.myproject.com and sometimes, if I forget to change some configurations about the domain name (specially with some “very intelligent” CMSes that keeps the configuration in the database) I will get an email back saying “the new feature is not working” 🙂

Continue reading Switch between branches using Nginx