From 98a8fbcfb6647ebc76413460b55dca7840e30c23 Mon Sep 17 00:00:00 2001 From: danielvincent Date: Wed, 20 Oct 2010 10:37:00 -0700 Subject: [PATCH 1/6] request badge text color fix --- public/stylesheets/sass/application.sass | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/public/stylesheets/sass/application.sass b/public/stylesheets/sass/application.sass index 064017959..56a781be5 100644 --- a/public/stylesheets/sass/application.sass +++ b/public/stylesheets/sass/application.sass @@ -733,6 +733,11 @@ h1.big_text :display inline :float right + form + :margin + :right 0 + :top 0 + .back :font :size 12px @@ -936,6 +941,7 @@ h1.big_text :color #333 :border-radius 5px + :color #ccc a :color #ccc From 9c8e514642751eda55acc2963b82a7a7a5c52788 Mon Sep 17 00:00:00 2001 From: Raphael Date: Wed, 20 Oct 2010 12:15:13 -0700 Subject: [PATCH 2/6] Adding a spec for a mass-assignment attack through profile update --- spec/controllers/users_controller_spec.rb | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/spec/controllers/users_controller_spec.rb b/spec/controllers/users_controller_spec.rb index 502353f6a..f00a519db 100644 --- a/spec/controllers/users_controller_spec.rb +++ b/spec/controllers/users_controller_spec.rb @@ -24,17 +24,26 @@ describe UsersController do before do @user.person.profile.image_url = "http://tom.joindiaspora.com/images/user/tom.jpg" @user.person.profile.save + + @params = {"profile"=> + {"image_url" => "", + "last_name" => @user.person.profile.last_name, + "first_name" => @user.person.profile.first_name}} end it "doesn't overwrite the profile photo when an empty string is passed in" do image_url = @user.person.profile.image_url - put("update", :id => @user.id, "user"=> {"profile"=> - {"image_url" => "", - "last_name" => @user.person.profile.last_name, - "first_name" => @user.person.profile.first_name}}) + put("update", :id => @user.id, "user" => @params) @user.person.profile.image_url.should == image_url end + it "doesn't overwrite random attributes" do + new_user = Factory.create(:user) + @params[:owner_id] = new_user.id + person = @user.person + put('update', :id => @user.id, "user" => @params) + Person.find(person.id).owner_id.should == @user.id + end end context 'should allow the user to update their password' do From 61122b83d041216b3a12dc2bbf8ce6b3ac0b4dda Mon Sep 17 00:00:00 2001 From: danielvincent Date: Wed, 20 Oct 2010 12:19:06 -0700 Subject: [PATCH 3/6] make profile button on photo show page. (removed clean hash on usercontroller) --- app/controllers/users_controller.rb | 17 ++-------------- app/models/user.rb | 2 +- app/views/photos/show.html.haml | 5 ++++- public/javascripts/view.js | 13 +++++++++++- public/stylesheets/sass/application.sass | 26 ++++++++++++++++++++++++ 5 files changed, 45 insertions(+), 18 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index a0f03877d..aacff8504 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -36,10 +36,8 @@ class UsersController < ApplicationController flash[:error] = "Password Change Failed" end else - data = clean_hash params[:user] - prep_image_url(data) - - if @user.update_profile data + prep_image_url(params[:user]) + if @user.update_profile params[:user][:profile] flash[:notice] = "Profile updated" else flash[:error] = "Failed to update profile" @@ -120,15 +118,4 @@ class UsersController < ApplicationController end end - def clean_hash(params) - return { - :profile => - { - :first_name => params[:profile][:first_name], - :last_name => params[:profile][:last_name], - :image_url => params[:profile][:image_url] - } - } - end - end diff --git a/app/models/user.rb b/app/models/user.rb index cc9531c8c..0e28357f2 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -281,7 +281,7 @@ class User ########### Profile ###################### def update_profile(params) - if self.person.update_attributes(params) + if self.person.profile.update_attributes(params) push_to_aspects profile, :all true else diff --git a/app/views/photos/show.html.haml b/app/views/photos/show.html.haml index 8fe22cc9b..12b6a1af1 100644 --- a/app/views/photos/show.html.haml +++ b/app/views/photos/show.html.haml @@ -76,7 +76,10 @@ %div{:id => @photo.id} #show_photo - = linked_scaled_photo @photo, @album + .edit_pane + .controls{:data=>{:actor=>"#{@photo.person.owner.id}",:image_url=>"#{@photo.url(:thumb_medium)}"}} + = link_to 'make profile photo', '#', :class => "make_profile_photo" + = linked_scaled_photo @photo, @album .caption -if current_user.owns? @photo -if @photo.caption and @photo.caption != "" diff --git a/public/javascripts/view.js b/public/javascripts/view.js index 1096b532c..575007819 100644 --- a/public/javascripts/view.js +++ b/public/javascripts/view.js @@ -67,7 +67,6 @@ $(document).ready(function(){ }; }); - });//end document ready @@ -105,3 +104,15 @@ function openVideo(type, videoid, link) { $(container).slideDown('fast', function() { }); link.onclick = function() { $(container).slideToggle('fast', function() { } ); } } + +$(".make_profile_photo").live("click", function(){ + var user_id = $(this).closest(".controls").attr('data-actor'); + photo_url = $(this).closest(".controls").attr('data-image_url'); + + $.ajax({ + type: "PUT", + url: '/users/'+user_id, + data: {"user":{"profile":{ "image_url": photo_url }}}, + success: window.location.reload() + }); +}); diff --git a/public/stylesheets/sass/application.sass b/public/stylesheets/sass/application.sass index 56a781be5..716c4e238 100644 --- a/public/stylesheets/sass/application.sass +++ b/public/stylesheets/sass/application.sass @@ -1089,3 +1089,29 @@ header img :height 27px :width 27px + + +.edit_pane + :display inline + :position relative + + .controls + :display none + :background + :color rgba(51,51,51,0.9) + :padding 10px + :position absolute + :right 0 + + a + :font + :weight bold + :color #eee + :text-shadow 0 1px #000 + + &:hover + :color #fff + + &:hover + .controls + :display inline From 4d81583533d4b241f2d0792268f71771299c2491 Mon Sep 17 00:00:00 2001 From: Raphael Date: Wed, 20 Oct 2010 12:29:36 -0700 Subject: [PATCH 4/6] Backfill spec on mass-assignment in aspect update --- spec/controllers/aspects_controller_spec.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/spec/controllers/aspects_controller_spec.rb b/spec/controllers/aspects_controller_spec.rb index 81571fb54..c69954d17 100644 --- a/spec/controllers/aspects_controller_spec.rb +++ b/spec/controllers/aspects_controller_spec.rb @@ -46,4 +46,17 @@ describe AspectsController do end end end + + describe "#update" do + before do + @aspect = @user.aspect(:name => "Bruisers") + end + it "doesn't overwrite random attributes" do + new_user = Factory.create :user + params = {"name" => "Bruisers"} + params[:user_id] = new_user.id + put('update', :id => @aspect.id, "aspect" => params) + Aspect.find(@aspect.id).user_id.should == @user.id + end + end end From e9ced7b2e6d748920cd9a6a91b088ec1d134f358 Mon Sep 17 00:00:00 2001 From: danielvincent Date: Wed, 20 Oct 2010 12:35:16 -0700 Subject: [PATCH 5/6] changing photo now updates all user images in page --- app/helpers/application_helper.rb | 2 +- app/views/photos/show.html.haml | 2 +- public/javascripts/view.js | 7 ++++++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 73ee0ec79..4e9f94c24 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -60,7 +60,7 @@ module ApplicationHelper image_location = person.profile.image_url image_location ||= "/images/user/default.png" - image_tag image_location, :class => "avatar", :alt => person.real_name, :title => person.real_name + image_tag image_location, :class => "avatar", :alt => person.real_name, :title => person.real_name, "data-person_id" => person.id end def person_image_link(person) diff --git a/app/views/photos/show.html.haml b/app/views/photos/show.html.haml index 12b6a1af1..58f6a97bd 100644 --- a/app/views/photos/show.html.haml +++ b/app/views/photos/show.html.haml @@ -77,7 +77,7 @@ %div{:id => @photo.id} #show_photo .edit_pane - .controls{:data=>{:actor=>"#{@photo.person.owner.id}",:image_url=>"#{@photo.url(:thumb_medium)}"}} + .controls{:data=>{:actor=>"#{@photo.person.owner.id}",:actor_person=>"#{@photo.person.id}",:image_url=>"#{@photo.url(:thumb_medium)}"}} = link_to 'make profile photo', '#', :class => "make_profile_photo" = linked_scaled_photo @photo, @album .caption diff --git a/public/javascripts/view.js b/public/javascripts/view.js index 575007819..74687f668 100644 --- a/public/javascripts/view.js +++ b/public/javascripts/view.js @@ -107,12 +107,17 @@ function openVideo(type, videoid, link) { $(".make_profile_photo").live("click", function(){ var user_id = $(this).closest(".controls").attr('data-actor'); + person_id = $(this).closest(".controls").attr('data-actor_person'); photo_url = $(this).closest(".controls").attr('data-image_url'); $.ajax({ type: "PUT", url: '/users/'+user_id, data: {"user":{"profile":{ "image_url": photo_url }}}, - success: window.location.reload() + success: function(){ + $("img[data-person_id='"+ person_id +"']").each( function() { + $(this).attr('src', photo_url); + }); + } }); }); From 03f637eca9e4f61e35ca1a9a68ab7a71ca9931e3 Mon Sep 17 00:00:00 2001 From: Alec Leamas Date: Wed, 20 Oct 2010 20:19:49 +0200 Subject: [PATCH 6/6] Polishing up after git mess... --- config/app_config.yml.example | 3 +- pkg/fedora/README.md | 11 ++-- pkg/fedora/diaspora-setup | 5 +- pkg/fedora/diaspora-wsd | 4 +- pkg/fedora/diaspora.spec | 6 ++ pkg/fedora/dist/.gitkeep | 0 pkg/fedora/make-dist.sh | 1 - pkg/ubuntu/README.md | 32 ++++------- pkg/ubuntu/diaspora-install | 6 +- pkg/ubuntu/diaspora-setup | 4 +- pkg/ubuntu/diaspora-wsd | 102 ---------------------------------- pkg/ubuntu/diaspora-wsd.conf | 17 ++++++ pkg/ubuntu/dist/.gitkeep | 0 script/websocket_server.rb | 22 +++++++- 14 files changed, 73 insertions(+), 140 deletions(-) create mode 100644 pkg/fedora/dist/.gitkeep delete mode 100755 pkg/ubuntu/diaspora-wsd create mode 100644 pkg/ubuntu/diaspora-wsd.conf create mode 100644 pkg/ubuntu/dist/.gitkeep diff --git a/config/app_config.yml.example b/config/app_config.yml.example index 0bd3771f7..00dcb0b5f 100644 --- a/config/app_config.yml.example +++ b/config/app_config.yml.example @@ -7,6 +7,7 @@ default: debug: false socket_debug : false socket_host: 0.0.0.0 + socket_pidfile: "log/diaspora-wsd.pid" socket_port: 8080 socket_collection_name: 'websocket' pubsub_server: 'https://pubsubhubbub.appspot.com/' @@ -18,7 +19,7 @@ default: smtp_authentication: 'plain' smtp_username: 'no-reply@example.com' smtp_password: 'secret' - + development: diff --git a/pkg/fedora/README.md b/pkg/fedora/README.md index e294302ce..7c5c9e3a2 100644 --- a/pkg/fedora/README.md +++ b/pkg/fedora/README.md @@ -12,11 +12,11 @@ aimed for packaging purposes. Prerequisites: - ruby-1.8, rubygem, git and rake as described in - http://github.com/diaspora/diaspora/wiki/Rpm-installation-on-fedora - or http://github.com/diaspora/diaspora/wiki/Installing-on-CentOS-Fedora + [RPM installation Fedora](http://github.com/diaspora/diaspora/wiki/Rpm-installation-on-fedora) + or [Installing-on-CentOS-Fedora](http://github.com/diaspora/diaspora/wiki/Installing-on-CentOS-Fedora) - A personal environment to build RPM:s, also described in - http://github.com/diaspora/diaspora/wiki/Rpm-installation-on-fedora + [RPM installation Fedora](http://github.com/diaspora/diaspora/wiki/Rpm-installation-on-fedora) Install g++ (possibly unnnecessary?): % yum install gcc-c++ @@ -46,7 +46,7 @@ Start development server: cd /usr/share/diaspora/master ./script/server -See http://github.com/diaspora/diaspora/wiki/Using-apache for +See [Using Apache](http://github.com/diaspora/diaspora/wiki/Using-apache) for apache/passenger setup. After configuration, start with: /sbin/service diaspora-wsd start /sbin/service httpd restart @@ -120,7 +120,8 @@ directory, copy-paste previous version nr. It will be updated. This has been confirmed to start up and provide basic functionality both using the thin webserver and apache passenger, on 32/64 bit systems and in the -mock build environment. +mock build environment. Irregular nightly builds are available form time to time +at [ftp://mumin.dnsalias.net/pub/leamas/diaspora/builds](ftp://mumin.dnsalias.net/pub/leamas/diaspora/builds) #### Implementation diff --git a/pkg/fedora/diaspora-setup b/pkg/fedora/diaspora-setup index 0fa90dc9e..0214e419a 100755 --- a/pkg/fedora/diaspora-setup +++ b/pkg/fedora/diaspora-setup @@ -39,10 +39,11 @@ else exit 1 fi -# %attr(0777, diaspora, diaspora) doesn't work in specfile due to umask 022. -chmod 777 /var/lib/diaspora/uploads chown -R diaspora /var/log/diaspora +sed -i '/socket_pidfile:/s|:.*|: /var/run/diaspora/diaspora-wsd.pid|' \ + config/app_config.yml + hostname=$( awk '/pod_url:/ { print $2; exit }' > dirs && mv -f dirs files sed -i -e '\|.*/master/config.ru"$|d' \ -e '\|.*/master/config/environment.rb"$|d' \ + -e '\|.*/run/diaspora"$|d' \ + -e '\|.*/pkg/fedora/dist"$|d' \ -e 's|%{buildroot}||' -e 's|//|/|' -e '/""/d' \ files @@ -101,6 +104,7 @@ sed -i -e '\|.*/master/config.ru"$|d' \ %post wsd /sbin/chkconfig --add diaspora-wsd || : + %preun wsd if [ $1 -eq 0 ] ; then service diaspora-wsd stop &>/dev/null || : @@ -117,9 +121,11 @@ rm -fr $RPM_BUILD_ROOT %doc AUTHORS README.md GNU-AGPL-3.0 COPYRIGHT README-Fedora.md %attr(-, diaspora, diaspora) %{_datadir}/diaspora/master/config.ru %attr(-, diaspora, diaspora) %{_datadir}/diaspora/master/config/environment.rb +%attr(-, diaspora, diaspora) %{_datadir}/diaspora/master/pkg/fedora/dist %attr(-, diaspora, diaspora) %{_localstatedir}/log/diaspora %attr(-, diaspora, diaspora) %{_localstatedir}/lib/diaspora/uploads %attr(-, diaspora, diaspora) %{_localstatedir}/lib/diaspora/tmp +%attr(-, diaspora, diaspora) %{_localstatedir}/run/diaspora %{_datadir}/diaspora/master/tmp %{_datadir}/diaspora/master/public/uploads diff --git a/pkg/fedora/dist/.gitkeep b/pkg/fedora/dist/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/pkg/fedora/make-dist.sh b/pkg/fedora/make-dist.sh index 6777ae773..ce450a3a7 100755 --- a/pkg/fedora/make-dist.sh +++ b/pkg/fedora/make-dist.sh @@ -181,7 +181,6 @@ function make_bundle() # Usage: make_bundle [ commit, defaults to HEAD] # { -set -x checkout ${1:-'HEAD'} >/dev/null bundle_id=$( git_id dist/diaspora/Gemfile) bundle_name="diaspora-bundle-$VERSION-$bundle_id" diff --git a/pkg/ubuntu/README.md b/pkg/ubuntu/README.md index 15a4947dc..44e83c79b 100644 --- a/pkg/ubuntu/README.md +++ b/pkg/ubuntu/README.md @@ -5,6 +5,7 @@ work as a first step towards packaging, but should be usable as is. ### Synopsis + Bootstrap the distribution from git: % sudo apt-get install git-core % git clone git://github.com/diaspora/diaspora.git @@ -34,13 +35,18 @@ The normal procedure to update is to just $ ./make-dist.sh bundle $ ./make-dist.sh source -And then use diaspora-install and diaspora-install-bundle as above. +and then use diaspora-install and diaspora-install-bundle as above. It's necessary to always have the correct bundle. The *./make-dist.sh bundle* above will use a cached bundle if it's still valid, else build a new. In most cases only source will need to be built, which is fast. ### Notes +The diaspora websocket service can be comtrolled through upstart. +To start/stop: + % sudo service diaspora-wsd start + % sudo service diaspora-wsd stop + ./make-dist.sh bundle|source occasionally fails on bad Gemfile.lock. The root cause is a bad Gemfile.lock in the git repo. Possible fixes includes using a older version known to work: @@ -51,16 +57,6 @@ or forcing a complete update of Gemfile.lock using 'bundle update' (a potentially problematic operation): % ./make-dist.sh -f bundle -./make-dist.sh bundle|source occasionally fails on bad Gemfile.lock. The -root cause is a bad Gemfile.lock in the git repo. Possible fixes includes -using a older version known to work: - % ./make-dist.sh -c c818885b6 bundle - % ./make-dist.sh -c c818885b6 source - -or forcing a complete update of Gemfile.lock using 'bundle update' (a -potential problematic operation): - % ./make-dist.sh -f bundle - The application lives in /usr/share/diaspora/master. All writable areas (log, uploads, tmp) are links to /var/lib/diaspora. The config file lives in /etc/diaspora. All files in /usr/share are read-only, owned by root. @@ -79,19 +75,11 @@ dependencies lives in the application - nothing is installed by user or on system level. This has been tested on a Ubuntu 32-bit 10.10 , clean server and on 10.04 -Lucid desktop, also clean installation. +Lucid desktop, also clean installation. Irregular nightly builds are +available from time to time at +[ftp://mumin.dnsalias.net/pub/leamas/diaspora/builds](ftp://mumin.dnsalias.net/pub/leamas/diaspora/builds) mongodb is having problems occasionally. Sometimes the dependencies are not installed, and mongod refuses to start. invoke */usr/bin/mongod -f /etc/mongodb.conf* to test. The lockfile /var/lib/mongodb/mongod.conf is also a potential problem. Remove to make it start again. - -The diaspora-wsd is just placeholder FTM, it does **not** work. - - - - - - - - diff --git a/pkg/ubuntu/diaspora-install b/pkg/ubuntu/diaspora-install index e7cef8f31..7f7fd8c23 100755 --- a/pkg/ubuntu/diaspora-install +++ b/pkg/ubuntu/diaspora-install @@ -30,9 +30,8 @@ sed -i '/BUNDLE_PATH/s|:.*|: /usr/lib/diaspora-bundle/bundle|' \ cp master/GNU-AGPL-3.0 master/COPYRIGHT master/README.md master/AUTHORS . cp master/config/app_config.yml.example ./app_config.yml -cp master/pkg/ubuntu/diaspora-wsd /etc/init.d +cp master/pkg/ubuntu/diaspora-wsd.conf /etc/init -sed -i '/^cd /s|.*|cd /usr/share/diaspora/master|' /etc/init.d/diaspora-wsd cp master/pkg/ubuntu/diaspora.logrotate /etc/logrotate.d/diaspora @@ -41,8 +40,8 @@ cp master/pkg/ubuntu/diaspora-setup . mkdir -p /var/log/diaspora mkdir -p /var/lib/diaspora/uploads mkdir -p /var/lib/diaspora/tmp +mkdir -p /var/run/diaspora mkdir -p /etc/diaspora -mkdir -p /usr/share/diaspora/master/pkg/ubuntu/dist ln -sf /var/log/diaspora ./master/log cp master/config/app_config.yml.example /etc/diaspora/app_config.yml @@ -65,5 +64,6 @@ chown diaspora:diaspora /var/log/diaspora chown diaspora:diaspora /var/lib/diaspora/uploads chown diaspora:diaspora /var/lib/diaspora/tmp chown diaspora:diaspora /var/lib/diaspora +chown diaspora:diaspora /var/run/diaspora chown diaspora:diaspora /usr/share/diaspora/master/pkg/ubuntu/dist diff --git a/pkg/ubuntu/diaspora-setup b/pkg/ubuntu/diaspora-setup index 3f2c0266c..32293a2d2 100755 --- a/pkg/ubuntu/diaspora-setup +++ b/pkg/ubuntu/diaspora-setup @@ -43,9 +43,11 @@ else exit 1 fi -chmod 777 /var/lib/diaspora/uploads chown -R diaspora /var/log/diaspora +sed -i '/socket_pidfile:/s|:.*|: /var/run/diaspora/diaspora-wsd.pid|' \ + config/app_config.yml + hostname=$( awk '/pod_url:/ { print $2; exit }' >$logfile 2>&1 &" - RETVAL=$? - echo - if test $RETVAL = 0; then - touch $lockfile - pgrep -f "$ruby_cmd" > $pidfile || { - echo "Warning: cannot find running diaspora-webserver" - exit 7 - } - fi -} - -stop() { - [ $UID -eq 0 ] || exit 4 - echo -n $"Stopping $prog: " - killproc -p $pidfile $exec - RETVAL=$? - [ $RETVAL -eq 0 ] && rm -f $lockfile - echo -} - -# -# See how we were called. -# -case "$1" in - start) - start - ;; - stop) - stop - ;; - force-reload|restart) - stop - sleep 1 - start - RETVAL=$? - ;; - condrestart|try-restart) - if [ -f $lockfile ]; then - stop - sleep 3 - start - fi - ;; - status) - status -p $pidfile $exec - RETVAL=$? - ;; - *) - echo $"Usage: $0 {condrestart|try-restart|start|stop|restart|force-reload|status}" - RETVAL=2 - [ "$1" = 'usage' ] && RETVAL=0 -esac - -exit $RETVAL diff --git a/pkg/ubuntu/diaspora-wsd.conf b/pkg/ubuntu/diaspora-wsd.conf new file mode 100644 index 000000000..02956ebd9 --- /dev/null +++ b/pkg/ubuntu/diaspora-wsd.conf @@ -0,0 +1,17 @@ +# Ubuntu upstart file at /etc/init/diaspora-wsd.conf + +start on runlevel [5] +stop on runlevel [06] + +script + if [ -f /etc/default/diaspora ]; then + . /etc/default/diaspora; + fi; + cd /usr/share/diaspora/master; + start-stop-daemon --start \ + --chuid diaspora:diaspora \ + --chdir $PWD \ + --exec "/usr/local/bin/bundle" \ + -- exec ruby -C $PWD script/websocket_server.rb; + +end script diff --git a/pkg/ubuntu/dist/.gitkeep b/pkg/ubuntu/dist/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/script/websocket_server.rb b/script/websocket_server.rb index 65199175e..3b458118b 100644 --- a/script/websocket_server.rb +++ b/script/websocket_server.rb @@ -5,6 +5,25 @@ require File.dirname(__FILE__) + '/../config/environment' require File.dirname(__FILE__) + '/../lib/diaspora/websocket' +at_exit do + begin + File.delete(PID_FILE) + rescue + puts 'Cannot remove pidfile: ' + (PID_FILE ? PID_FILE : "NIL") + end +end + +def write_pidfile + begin + f = File.open(PID_FILE, "w") + f.write(Process.pid) + f.close + rescue => e + puts "Can't write to pidfile!" + puts e.inspect + end +end + CHANNEL = Magent::GenericChannel.new('websocket') def process_message if CHANNEL.queue_count > 0 @@ -36,7 +55,8 @@ begin ws.onclose { Diaspora::WebSocket.unsubscribe(ws.request['Path'].gsub('/',''), sid) } } end - + PID_FILE = APP_CONFIG[:socket_pidfile] + write_pidfile puts "Websocket server started." process_message }