samizdat-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

samizdat from the command line: no success so far :(


From: boud
Subject: samizdat from the command line: no success so far :(
Date: Mon, 14 May 2007 02:19:28 +0200 (CEST)

hi all,


PROBLEM:

In

 models/content.rb

and its earlier equivalent in the pre-20070501 versions of samizdat, there is this suggestion:



  # re-render html_full and html_short for all messages
  #
  # command line:
  #
  # SAMIZDAT_SITE=samizdat SAMIZDAT_URI=/ ruby -r samizdat/engine -e 
'Content.regenerate_all_html'
  #
  def Content.regenerate_all_html
    db.select_all('SELECT id FROM Message WHERE content IS NOT NULL') do |id,|
      Content.regenerate_html(id)
    end
    cache.flush
  end


i have never (so far) got this to work from the command line.


RELEVANCE:

Not only would the  regenerate_html  method be nice in itself, but i'd
like to be able to do command line samizdat in order to implement a
pipeline:

mobile phone: SMS -> MTA [-> MTA...]
                  -> MDA
                  -> .procmailrc
                  -> pipe the email through a samizdat controller
                     which publishes the subject + body as a message,
                     if various checks (e.g. that it's an sms) are satisfied.

[MMS (multi-media MS, = SMS + photo/audio/video) can come later.]

So i was thinking of calling samizdat from the command line instead of through the web.

Hmmm... i guess it could also be possible to use procmail + formail to
add new messages in some directory without interacting with samizdat,
and add something to (e.g.) frontpage_controller which checks if that
directory is non-empty, and if yes, then it publishes them as messages
and then removes them from the directory.

Any suggestions on which of these two approaches would be better? (My guess is probably the second.)


Anyway, command line samizdat would still be nice to get functioning
independently of sms2message.


WHAT I TRIED:

(1)

After doing  su www-data, i tried

 SAMIZDAT_SITE=samizdat SAMIZDAT_URI=/ ruby -r samizdat/engine -e 
'Content.regenerate_all_html'

and got the error:


/usr/lib/ruby/1.8/DBD/Pg/Pg.rb:111:in `initialize': FATAL:  IDENT authentication failed 
for user "www-data" (DBI::OperationalError)
        from /usr/lib/ruby/1.8/DBD/Pg/Pg.rb:55:in `new'
        from /usr/lib/ruby/1.8/DBD/Pg/Pg.rb:55:in `connect'
        from /usr/lib/ruby/1.8/dbi/dbi.rb:584:in `connect'
        from /usr/lib/ruby/1.8/dbi/dbi.rb:384:in `connect'
        from /usr/lib/ruby/1.8/samizdat/engine/deployment.rb:294:in `db'
        from /usr/lib/ruby/1.8/samizdat/engine/deployment.rb:292:in 
`fetch_or_add'
        from /usr/lib/ruby/1.8/samizdat/engine/deployment.rb:237:in 
`fetch_or_add'
        from /usr/lib/ruby/1.8/samizdat/engine/deployment.rb:292:in `db'
        from /usr/lib/ruby/1.8/samizdat/models/content.rb:195:in 
`regenerate_all_html'
        from -e:1


My understanding of this first problem is that USER=www-data and so
this prevents config['db']['user'] = 'samizdat' from being used in line 294
of deployment.rb:

(ENV['USER'] or config['db']['user']),


and this leads to a failure to get into psql.


(2)

So i tried:


SAMIZDAT_SITE=samizdat SAMIZDAT_URI=/ USER=samizdat ruby -r samizdat/engine -e 
'Content.regenerate_all_html'


and got:

/usr/lib/ruby/1.8/drb/drb.rb:1647:in `current_server': DRb::DRbServerNotFound 
(DRb::DRbConnError)
        from /usr/lib/ruby/1.8/drb/drb.rb:1709:in `to_id'
        from /usr/lib/ruby/1.8/drb/drb.rb:1045:in `initialize'
        from /usr/lib/ruby/1.8/drb/drb.rb:639:in `new'
        from /usr/lib/ruby/1.8/drb/drb.rb:639:in `make_proxy'
        from /usr/lib/ruby/1.8/drb/drb.rb:556:in `dump'
        from /usr/lib/ruby/1.8/drb/drb.rb:602:in `send_request'
        from /usr/lib/ruby/1.8/drb/drb.rb:903:in `send_request'
        from /usr/lib/ruby/1.8/drb/drb.rb:1190:in `send_message'
         ... 14 levels...
        from /usr/lib/ruby/1.8/dbi/dbi.rb:671:in `execute'
        from /usr/lib/ruby/1.8/dbi/dbi.rb:671:in `select_all'
        from /usr/lib/ruby/1.8/samizdat/models/content.rb:195:in 
`regenerate_all_html'
        from -e:1


The command
 psql samizdat samizdat
works fine in the same shell.


(3)  i tried:

/etc/init.d/samizdat stop

SAMIZDAT_SITE=samizdat SAMIZDAT_URI=/ USER=samizdat ruby -r samizdat/engine -e 
'Content.regenerate_all_html'

and got:

/usr/lib/ruby/1.8/drb/drb.rb:733:in `open': druby://localhost:9000 - 
#<Errno::ECONNREFUSED: Connection refused - connect(2)> (DRb::DRbConnError)
        from /usr/lib/ruby/1.8/drb/drb.rb:726:in `each'
        from /usr/lib/ruby/1.8/drb/drb.rb:726:in `open'
        from /usr/lib/ruby/1.8/drb/drb.rb:1185:in `initialize'
        from /usr/lib/ruby/1.8/drb/drb.rb:1165:in `new'
        from /usr/lib/ruby/1.8/drb/drb.rb:1165:in `open'
        from /usr/lib/ruby/1.8/drb/drb.rb:1082:in `method_missing'
        from /usr/lib/ruby/1.8/drb/drb.rb:1081:in `with_friend'
        from /usr/lib/ruby/1.8/drb/drb.rb:1081:in `method_missing'
         ... 9 levels...
        from /usr/lib/ruby/1.8/dbi/dbi.rb:671:in `execute'
        from /usr/lib/ruby/1.8/dbi/dbi.rb:671:in `select_all'
        from /usr/lib/ruby/1.8/samizdat/models/content.rb:195:in 
`regenerate_all_html'
        from -e:1




(4) i tried the -d -v options in ruby - it gave various additional exceptions
which i presume are not that important, but didn't solve the problem.


SAMIZDAT_SITE=samizdat SAMIZDAT_URI=/ USER=samizdat ruby -dv -r samizdat/engine 
-e 'Content.regenerate_all_html'
ruby 1.8.2 (2005-04-11) [i386-linux]
Warning: $KCODE is NONE.
Exception `LoadError' at /usr/lib/ruby/1.8/tmpdir.rb:12 - no such file to load 
-- Win32API
/usr/lib/ruby/1.8/samizdat/sanitize.rb:22: warning: method redefined; 
discarding old to_string
/usr/lib/ruby/1.8/samizdat/engine.rb:38: warning: redefine escapeHTML
/usr/lib/ruby/1.8/samizdat/engine.rb:57: warning: method redefined; discarding 
old callersrc
/usr/lib/ruby/1.8/redcloth.rb:626: warning: ambiguous first argument; put 
parentheses or even spaces
/usr/lib/ruby/1.8/redcloth.rb:846: warning: ambiguous first argument; put 
parentheses or even spaces
/usr/lib/ruby/1.8/redcloth.rb:1051: warning: ambiguous first argument; put 
parentheses or even spaces
/usr/lib/ruby/1.8/redcloth.rb:829: warning: method redefined; discarding old 
inline_markdown_link
Exception `DBI::NotSupportedError' at /usr/lib/ruby/1.8/DBD/Pg/Pg.rb:274 - 
Option 'quote_boolean' not supported
Exception `DRb::DRbServerNotFound' at /usr/lib/ruby/1.8/drb/drb.rb:1647 - 
DRb::DRbServerNotFound
Exception `DRb::DRbServerNotFound' at /usr/lib/ruby/1.8/drb/drb.rb:1647 - 
DRb::DRbServerNotFound
Exception `DRb::DRbServerNotFound' at /usr/lib/ruby/1.8/drb/drb.rb:1647 - 
DRb::DRbServerNotFound
Exception `TypeError' at /usr/lib/ruby/1.8/drb/drb.rb:554 - no marshal_dump is 
defined for class Proc
Exception `DRb::DRbServerNotFound' at /usr/lib/ruby/1.8/drb/drb.rb:1647 - 
DRb::DRbServerNotFound
Exception `DRb::DRbServerNotFound' at /usr/lib/ruby/1.8/drb/drb.rb:1647 - 
DRb::DRbServerNotFound
Exception `DRb::DRbConnError' at /usr/lib/ruby/1.8/drb/drb.rb:605 - 
DRb::DRbServerNotFound
Exception `DRb::DRbConnError' at /usr/lib/ruby/1.8/dbi/dbi.rb:721 - 
DRb::DRbServerNotFound
/usr/lib/ruby/1.8/drb/drb.rb:1647:in `current_server': DRb::DRbServerNotFound 
(DRb::DRbConnError)
        from /usr/lib/ruby/1.8/drb/drb.rb:1709:in `to_id'
        from /usr/lib/ruby/1.8/drb/drb.rb:1045:in `initialize'
        from /usr/lib/ruby/1.8/drb/drb.rb:639:in `new'
        from /usr/lib/ruby/1.8/drb/drb.rb:639:in `make_proxy'
        from /usr/lib/ruby/1.8/drb/drb.rb:556:in `dump'
        from /usr/lib/ruby/1.8/drb/drb.rb:602:in `send_request'
        from /usr/lib/ruby/1.8/drb/drb.rb:903:in `send_request'
        from /usr/lib/ruby/1.8/drb/drb.rb:1190:in `send_message'
         ... 14 levels...
        from /usr/lib/ruby/1.8/dbi/dbi.rb:671:in `execute'
        from /usr/lib/ruby/1.8/dbi/dbi.rb:671:in `select_all'
        from /usr/lib/ruby/1.8/samizdat/models/content.rb:195:in 
`regenerate_all_html'
        from -e:1


This is all on sarge.

cheers
boud




reply via email to

[Prev in Thread] Current Thread [Next in Thread]