First step to install/run Airtime via NGINX based on Airtime 2.0 beta files
  • Install script is airtime-full-install-nginx(place it in full_install/ubuntu/here)
    php-fpm pool config is airtime.conf(place it in full_install/php5-fpm/here)
    nginx virtual host config file is airtime-vhost(place it in full_install/nginx/here)
    P.S moderators please remove attachment called airtime-full-install(I don't have permission to remove my own attachment)
    Post edited by Martin Konecny at 2013-02-07 15:13:06
    *hopes airtime will be refactored and moved to python/django from php sometime..*
  • 31 Comments sorted by
  • Vote Up1Vote Down Albert FRAlbert FR
    Posts: 1,978Member, Airtime Moderator
    @Andrey+Podshivalov on debian/ubuntu you can choose with dpkg the dependency you want satisfy (for php for example, or others packages).
    Why not for airtime too ?
  • Vote Up0Vote Down Albert FRAlbert FR
    Posts: 1,978Member, Airtime Moderator
    Hi Eugene,

    Have you noticed less load system with nginx ?
    or that's only for compatibility reasons with your current install ?
    Post edited by Albert FR at 2011-12-05 10:10:42
  • @Albert+FR: Highload sites always using nginx coz it's much faster than apache. and also nginx offers nice features like load balancing and great proxying. we can even proxy icecast server via nginx and insert more user stats in useragent string via GeoIP module. Lets say would be great to have listeners map!
    And yes nginx eats much less CPU/RAM
    Post edited by Eugene MechanisM at 2011-12-05 10:23:15
    *hopes airtime will be refactored and moved to python/django from php sometime..*
  • Very soon I'll update this message with virtualhost conf file and php-fpm pool config.
    *hopes airtime will be refactored and moved to python/django from php sometime..*
  • @Eugene

    We integrated your script into code base and indicated your contribution on each file.

    # NGINX changes are contributed by Eugene MechanisM
    # Link to the post:
    # http://forum.sourcefabric.org/discussion/13563/first-step-to-run-airtime-via-nginx-based-on-airtime-2.0-beta-files


    Thank you for your contribution.
  • I'm just added nginx vhost config file.
    Post edited by Eugene MechanisM at 2011-12-15 00:10:38
    *hopes airtime will be refactored and moved to python/django from php sometime..*
  • Vote Up0Vote Down Albert FRAlbert FR
    Posts: 1,978Member, Airtime Moderator
    One question

    for the next versions of airtime do you purpose apache or nginx in the install process ?
  • Vote Up0Vote Down Andrey PodshivalovAndrey Podshivalov
    Posts: 1,526Member, Administrator, Sourcefabric Team
    I suggest you to keep using apache
  • Reply to @Eugene+MechanisM:

    Thanks for the Christmas present!  And happy holidays to you.  Happy holidays to the Airtime Teams as well.
  • Reply to @Albert+FR: I agree NGINX is very fast and smart server. And all highload sites using it. Some ppl(like me) didn't installed Airtime for one reason: it's requires slow apache. Now I'm adapted install scripts and configs for NGINX and can successfully use Airtime without touching apache.
    P.S.: Btw I'm even using custom compiled nginx with modules like nginx-concat, nginx-redis, nginx-push-stream etc - A lot of feature like WebSocket chats etc can be handled just via nginx + modules.
    Post edited by Eugene MechanisM at 2011-12-15 09:15:45
    *hopes airtime will be refactored and moved to python/django from php sometime..*
  • Vote Up0Vote Down Albert FRAlbert FR
    Posts: 1,978Member, Airtime Moderator
    Ok Eugene+MechanisM ;)
    I'm supposing you're using nginx-push-stream with icecast2 ? and have a statistic system integrated in nginx with that isn't ?
    I'm not an expert with nginx (and perhaps I'm not the only one here ;)
    Can you do a howto/tutorial for us ?

    Thank you
  • Vote Up0Vote Down Andrey PodshivalovAndrey Podshivalov
    Posts: 1,526Member, Administrator, Sourcefabric Team

    Albert FR said:

    I'm not an expert with nginx (and perhaps I'm not the only one here ;)



    that's why I'm recommending to use apache. In any case the airtime packages will support properly only apache server

  • Vote Up0Vote Down Albert FRAlbert FR
    Posts: 1,978Member, Airtime Moderator
    that's not really the same thing
    a lot of people (not me, I'm a power apache user ;) install airtime with no knowledge of apache configuration
    why not, in this case, during the install process ask to choose between apache and nginx ?
    That's not incompatibly :D
  • Vote Up0Vote Down Andrey PodshivalovAndrey Podshivalov
    Posts: 1,526Member, Administrator, Sourcefabric Team
    we don't need a lot of new questions about nginx from dummies. Who familiar with nginx has no any problem to configure nginx to use with airtime from scratch but most of people nothing knows about nginx.
  • Ehhh.. I have so lots words to say and examples to show. and just wonder why sourcefabric don't organized IRC rooms for products or common one. So ppl can connect and share ideas and examples with developers and community and share some links with examples, get instant support from developers and other users who good with airtime or neswcoop. For some reasons I don't wanna share links to my devserver here.
    *hopes airtime will be refactored and moved to python/django from php sometime..*
  • Vote Up0Vote Down Albert FRAlbert FR
    Posts: 1,978Member, Airtime Moderator
    I'm agree with you @Eugene+MechanisM (and I'm not asking you any links, only an howto for integrate all features you integrate into nginx ;)

    Post edited by Albert FR at 2011-12-15 09:48:25
  • Vote Up0Vote Down Albert FRAlbert FR
    Posts: 1,978Member, Airtime Moderator
    @Andrey but it's the same thing for apache, some peoples here don't really know Apache...
    And if nginx allows us to install airtime on less powerful machine, It is a good thing, no ?
  • Vote Up0Vote Down Jakub GórnickiJakub Górnicki
    Posts: 134Member, Administrator, Sourcefabric Team
    Guys,

    first of all thanks for your contributions! Really amazing stuff,

    Our community is not that big (yet!) but rapidly growing everyday. This is why from January onwards we will be redoing some of our websites and adding new ways to enable you to share your code and communicate better. I am happy to listen to your ideas and talk them through before we introduce new things. For now, we have changed the forum and we try to all fit in here :)
  • Vote Up0Vote Down Albert FRAlbert FR
    Posts: 1,978Member, Airtime Moderator
    This us who say thanks to you @Jakub !
    A lot of things let's to do, that's sure ;)
    perhaps an api to use soon ?
    :D
  • Vote Up0Vote Down Andrey PodshivalovAndrey Podshivalov
    Posts: 1,526Member, Administrator, Sourcefabric Team
    no, apache is a good server for any machine where airtime could be installed. Nginx is recommended only for high load public sites but Airtime is a back end applications instead, where can not be high loading. Apache is more comfortable for any other php projects (wordpress, joomla, drupal). That's why apache is used as primary server on most servers. Some time the best is enemy of good (russian saying) ;)
    Post edited by Andrey Podshivalov at 2011-12-15 10:03:26
  • Vote Up0Vote Down Albert FRAlbert FR
    Posts: 1,978Member, Airtime Moderator
    Some time the best is enemy of good (russian saying)

    we said that also in France :

    Quelquefois le meilleur est l'ennemi du bien ;)

    But it's only a purpose, I don't want to break airtime install ;)
    only have choise. And in fact Nginx is not the only one ;)
    Post edited by Albert FR at 2011-12-15 10:15:03
  • Proxy icecast2 via nginx with attaching GeoIP data to useragent string:
    it's virtualhost config for nginx so your radio stream will be accessible via port 80. at url from example is: http://radio.yoursite.com 

    server { 
            listen               80; 
            server_name radio.yoursite.com; 

            location / { 
                proxy_buffering           off; 
                proxy_ignore_client_abort off; 
                proxy_intercept_errors    on; 
                proxy_next_upstream       error timeout invalid_header; 
                proxy_redirect            off; 
                proxy_set_header          X-Host $http_host; 
                proxy_set_header          X-Forwarded-For $remote_addr;
                #proxy_set_header          Icy-MetaData 1;
                proxy_set_header          User-agent $geoip_city_country_code,$geoip_city_country_name,$geoip_city,$geoip_latitude,$geoip_longitude,$http_user_agent;
                proxy_connect_timeout     60; 
                proxy_send_timeout        21600; 
                proxy_read_timeout        21600; 
                proxy_pass http://url_to_your_icecast_server:port;
            }
            location /radio_status {
                stub_status on;
                access_log off;
            }
    }

    don't forget to open nginx.conf and add geoIP database config:

    http {
    #should be inside http tag:
    geoip_country /server/geoip/GeoIP.dat; # change to your path
    geoip_city /server/geoip/GeoLiteCity.dat; # change to your path
    }

    With geoIP data preattached you'll have listener's country and city in icecast2 logs, in icecast admin etc. And need to just parse useragent string to get such data. Listeners maps via google maps api can be done easily etc.
    Post edited by Eugene MechanisM at 2011-12-15 23:44:56
    *hopes airtime will be refactored and moved to python/django from php sometime..*
  • Also I did some custom theme for icecast:
    image

    This one with some geoIP stats:

    image

    it's old screenshots(taken from dev server so there's not hundreds of listeners lol), now it's looks much better and showing listeners map etc.
    Used jquerymobile framework(so works on mobiles too)
    and yep all played tracks being scrobbled to last.fm which offers great stats.

    Btw I'll recommend to install airtime with Icecast2.3.2 - kh-30 version. For info look here:
    Post edited by Eugene MechanisM at 2011-12-16 00:30:50
    *hopes airtime will be refactored and moved to python/django from php sometime..*
  • this is file json.xsl:

    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"><xsl:output omit-xml-declaration="yes" method="text" indent="no" encoding="UTF-8"/><xsl:strip-space elements="*"/><xsl:template match="/icestats"><!-- <xsl:param name="callback" /> <xsl:value-of select="$callback" /> -->{"Copyright":"<xsl:value-of select="admin"/>","Location":"<xsl:value-of select="location"/>","total_listeners":"<xsl:value-of select="listeners"/>","stationlogo":"http://i.imgur.com/L4qoo.gif","mounts":[<xsl:for-each select="source">{"mount":"<xsl:value-of select="@mount"/>","server_name":"<xsl:value-of select="server_name"/>","listeners":"<xsl:value-of select="listeners"/>","description":"<xsl:value-of select="server_description" />","title":"<xsl:if test="artist"><xsl:value-of select="artist" /> - </xsl:if><xsl:value-of select="title" />","genre":"<xsl:value-of select="genre" />","bitrate":"<xsl:value-of select="bitrate" />","url":"<xsl:value-of select="server_url" />"}<xsl:if test="position() != last()"><xsl:text>,</xsl:text></xsl:if></xsl:for-each>]}</xsl:template></xsl:stylesheet>

    place it inside icecast's web folder. and this file will generate some json with stats. so you can get it with jquery at some other sites.
    Post edited by Eugene MechanisM at 2011-12-16 00:31:39
    *hopes airtime will be refactored and moved to python/django from php sometime..*
  • Sorry for spamming useful stuff in wrong topic.
    *hopes airtime will be refactored and moved to python/django from php sometime..*
  • Vote Up0Vote Down Albert FRAlbert FR
    Posts: 1,978Member, Airtime Moderator
    I like that !!!!

    thanks !
  • Reply to @Eugene+MechanisM:

    Those screenshots look great!!! Are you willing to share the html/css?

    And thanks for linking  to the icecast2 KH branch....we've been discussing using a modified icecast for sometime, we'll be taking this one into consideration.
    Airtime Pro Hosting: http://airtime.pro
  • I forgot mention that if you going to use nginx with geoip module, you need to install nginx-extras package instead of nginx. nginx-extras offers nginx compiled with some additional 3rd party modules. Debian, DotDeb.org, nginx official and ubuntu repos should offer this package.

    Reply to @Martin+Konecny: Currently I have some custom icecast2 build. Icecast2 code is modified by me. my icecast2 talks with database(redis(incl. pub/sub) and postgres(for long living stats)) and with geoip directly. Also I removed xsl and xml functions(not needed to bother icecast("the working horse") while it's posts data to database and we can ask database for info instead). The screenshot I posted is old and I'll try to find my old archives for these files or I can reproduce it in my free time(with any style maybe jquery ui or twitter's bootstrap etc).
    Post edited by Eugene MechanisM at 2011-12-16 16:42:25
    *hopes airtime will be refactored and moved to python/django from php sometime..*
  • Is the nginx-install-script for ubuntu only? I tried it on debian, but it doesn't work for me. Could someone be so kind and write it for Debian, so I can use it on my ngnix? I think I am not the only one who would like to see that. Debian is one of greatest and widest distributions on the server market.

    Also I would like to see this scripts and the ability to install airtime with nginx in the wiki/manuals.
    Post edited by theradialactive at 2012-06-19 12:09:02
  • Reply to @theradialactive:

    If you tell us why it didn't work we can try and help you.
    Airtime Pro Hosting: http://airtime.pro

  • Reply to @theradialactive:


    If you tell us why it didn't work we can try and help you.


    So to get some idea how to solve the problem with debian I just installed a new Ubuntu instance on a local computer and started to install airtime via .tar.gz. I run the full-install script and at one of the first lines it says to me:
    "airtime-2.1.2/install_full/ubuntu/airtime-full-install-nginx: line 30: [: Ubuntu: integer expression expected"

    So I didn't know what to do and commented out the if-part with debian sources and brought the server links with nano in the source.list.

    I looked in the output and found something strange:
    "----------------------------------------------------
    2.1 NGINX Config File
    ----------------------------------------------------
    NGINX config for Airtime already exists...
    ----------------------------------------------------
    2.2 Airtime php pool file
    ----------------------------------------------------
    Airtime php pool file already exists...
    ----------------------------------------------------
    3. Enable Icecast
    ----------------------------------------------------
    Starting icecast2:
    ----------------------------------------------------
    4. Enable Monit
    ----------------------------------------------------
    ----------------------------------------------------
    5. Run Airtime Install
    ----------------------------------------------------[...]"

    Every part had an "subtitle", but not the Monit. Is that a problem?
    After I tried to install it again, at the end of the check it says that everything failed that shall be running.

    So I hope these information could solve the problems.