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

Bug#657405: installing on wheezy



On Sat, Aug 09, 2014 at 07:24:36PM -0400, Simon Fondrie-Teitler wrote:
> Thanks a lot for this! 

Thank YOU for all the effort in packaging this!

> Matija Nalis <mnalis-debianbug@voyager.hr> writes:
> > - "sudo -u postgres createdb -E UNICODE -O mediagoblin mediagoblin"
> >   complains with:
> >   "createdb: database creation failed: ERROR:  new encoding (UTF8) is
> >    incompatible with the encoding of the template database (SQL_ASCII)
> >    HINT:  Use the same encoding as in the template database, or use
> >    template0 as template."
> >
> >   So I did: "sudo -u postgres createdb -E UNICODE -T template0 -O mediagoblin mediagoblin" 
> >   which didn't complain. Hopefully it did the right thing :)
> 
> That's strange. It works for me, and psql -c '\list' shows the encoding
> of template1 as UTF8 on both a wheezy machine and a jessie machine. Is
> this a fresh install?

No, it was upgrade from squeeze (and possibly woody before that, but probably squeeze was 
first install).

But even on fresh jessie debootstrap(8) install, it shows for me:
$ psql -c '\list'
                                List of databases
    Name     |    Owner    | Encoding  | Collate | Ctype |   Access privileges   
-------------+-------------+-----------+---------+-------+-----------------------
 mediagoblin | mediagoblin | UTF8      | C       | C     | 
 postgres    | postgres    | SQL_ASCII | C       | C     | 
 template0   | postgres    | SQL_ASCII | C       | C     | =c/postgres          +
             |             |           |         |       | postgres=CTc/postgres
 template1   | postgres    | SQL_ASCII | C       | C     | =c/postgres          +
             |             |           |         |       | postgres=CTc/postgres
(4 rows)

it might be different if installed through debian installer, and user choose something 
other than "C" locale. I usually choose "C" on servers and even rarely install locales 
package at all, unless I need it.

> It looks like I wasn't seeing that since python-webtest recommends
> python-lxml. You're right, it should be a depends. 

Yes, I always try to build (preferably on clean chroot/virtual
machine) with 'apt-get --install no-install-recommends', to check if
some "recommends/suggests" should be "depends" instead.

> Again, thanks a lot for going over this package. The updated version
> can be found on mentors here:
> https://mentors.debian.net/package/mediagoblin

Thanks a lot! Ok, I tried with:
http://mentors.debian.net/debian/pool/main/m/mediagoblin/mediagoblin_0.6.1-1+dfsg1.dsc

and clean jessie chroot system (created via debootstrap(8)) - so it would be closer to targeted 
distribution (I'll try wheezy again when I get it to work in jessie):

- "sudo -u postgres createuser mediagoblin" does not ask any of the questions:
   > Shall the new role be a superuser? (y/n) n
   > Shall the new role be allowed to create databases? (y/n) n
   > Shall the new role be allowed to create more new roles? (y/n) n

  but seems to create user ok. So something to that effect probably should be in docs: 
  "if you're asked the following questions, the correct answers are..."

- "sudo -u postgres createdb -E UNICODE -O mediagoblin mediagoblin" still fails:
  createdb: database creation failed: ERROR:  new encoding (UTF8) is incompatible with the encoding of the template database (SQL_ASCII)
  HINT:  Use the same encoding as in the template database, or use template0 as template.

  I guess it might be related to system using default C locale, and not something
  utf8-based, but I don't really know. Anyway workaround with adding "-T template0"
  seems to work and db is created. I think we should mention that workaround in README.Debian 
  if the user encounters the bug.

- "3. Add the following to the [mediagoblin] in /etc/mediagoblin.ini:"
  correct path is /etc/mediagoblin/mediagoblin.ini

- "$ su - [mediagoblin]"
  we should drop the square brackets around 'mediagoblin', they're confusing (and don't work).
  So make it just: '$ su - mediagoblin'

- on "/usr/bin/gmg -cf /etc/mediagoblin/mediagoblin.ini dbupdate"  step, it warns:
  WARNING:mediagoblin.init.config:When setting up config section, could not import 'mediagoblin.media_types.image'
  -> Initializing main mediagoblin tables... done.
     + Laying foundations for Privilege table

  if that warning is OK, we should mention in docs that it should be ignored.
  If it isn't, we'll need to find out what is the problem (maybe depends on mime.types handler or something?)

- "7. Restart nginx, most likely with $ /etc/init.d/nginx restart"

  As we're still running as mediagoblin user in this step, we should indicate 
  that restarting should be done as root (not as user as '$' suggest);
  or change the order of commands (so we can say "$ sudo /etc/init.d/nginx restart")

- starting still doesn't work:
  PYTHONPATH=/usr/share/mediagoblin/ CELERY_ALWAYS_EAGER=false\
   /usr/bin/paster serve /etc/mediagoblin/mediagoblin/paste.ini\
     --pid-file=/home/mediagoblin/mediagoblin.pid  --server-name=fcgi\
     fcgi_host=127.0.0.1 fcgi_port=26543

Until that is solved, we should indicate in README.Debian that due to
some bug they MUST NOT be in directory  containing *.egg-info files
(and not default ~mediagoblin, in which they most probably will be if
they follow instructions)

however, even when I change directory to for example /tmp, it still 
doesn't work.

Command from README.Debian.gz is:
PYTHONPATH=/usr/share/mediagoblin/ CELERY_ALWAYS_EAGER=false
   /usr/bin/paster serve /etc/mediagoblin/mediagoblin/paste.ini\
     --pid-file=/home/mediagoblin/mediagoblin.pid
     --server-name=fcgi\
     fcgi_host=127.0.0.1 fcgi_port=26543

but:
1) "/etc/mediagoblin/mediagoblin/paste.ini" should be "/etc/mediagoblin/paste.ini"
2) there is no /home/mediagoblin (user was created with "/usr/share/mediagoblin" as non-writeable home)

So I did this command:

"cd /tmp; PYTHONPATH=/usr/share/mediagoblin/ CELERY_ALWAYS_EAGER=false\
   /usr/bin/paster serve /etc/mediagoblin/paste.ini\
     --pid-file=/tmp/mediagoblin.pid\
     --server-name=fcgi\
     fcgi_host=127.0.0.1 fcgi_port=26543"

This fails with new error:

2014-08-18 13:28:57,606 INFO    [mediagoblin.app] GNU MediaGoblin 0.6.1 main server starting
2014-08-18 13:28:57,611 WARNING [mediagoblin.init.config] When setting up config section, could not import 'mediagoblin.media_types.image'
Traceback (most recent call last):
  File "/usr/bin/paster", line 4, in <module>
    command.run()
  File "/usr/lib/python2.7/dist-packages/paste/script/command.py", line 104, in run
    invoke(command, command_name, options, args[1:])
  File "/usr/lib/python2.7/dist-packages/paste/script/command.py", line 143, in invoke
    exit_code = runner.run(args)
  File "/usr/lib/python2.7/dist-packages/paste/script/command.py", line 238, in run
    result = self.command()
  File "/usr/lib/python2.7/dist-packages/paste/script/serve.py", line 284, in command
    relative_to=base, global_conf=vars)
  File "/usr/lib/python2.7/dist-packages/paste/script/serve.py", line 321, in loadapp
    **kw)
  File "/usr/lib/python2.7/dist-packages/paste/deploy/loadwsgi.py", line 247, in loadapp
    return loadobj(APP, uri, name=name, **kw)
  File "/usr/lib/python2.7/dist-packages/paste/deploy/loadwsgi.py", line 272, in loadobj
    return context.create()
  File "/usr/lib/python2.7/dist-packages/paste/deploy/loadwsgi.py", line 710, in create
    return self.object_type.invoke(self)
  File "/usr/lib/python2.7/dist-packages/paste/deploy/loadwsgi.py", line 203, in invoke
    app = context.app_context.create()
  File "/usr/lib/python2.7/dist-packages/paste/deploy/loadwsgi.py", line 710, in create
    return self.object_type.invoke(self)
  File "/usr/lib/python2.7/dist-packages/paste/deploy/loadwsgi.py", line 144, in invoke
    **context.local_conf)
  File "/usr/lib/python2.7/dist-packages/paste/deploy/util.py", line 55, in fix_call
    val = callable(*args, **kw)
  File "/usr/lib/python2.7/dist-packages/paste/urlmap.py", line 28, in urlmap_factory
    app = loader.get_app(app_name, global_conf=global_conf)
  File "/usr/lib/python2.7/dist-packages/paste/deploy/loadwsgi.py", line 350, in get_app
    name=name, global_conf=global_conf).create()
  File "/usr/lib/python2.7/dist-packages/paste/deploy/loadwsgi.py", line 710, in create
    return self.object_type.invoke(self)
  File "/usr/lib/python2.7/dist-packages/paste/deploy/loadwsgi.py", line 146, in invoke
    return fix_call(context.object, context.global_conf, **context.local_conf)
  File "/usr/lib/python2.7/dist-packages/paste/deploy/util.py", line 55, in fix_call
    val = callable(*args, **kw)
  File "/usr/share/mediagoblin/mediagoblin/app.py", line 277, in paste_app_factory
    mgoblin_app = MediaGoblinApp(mediagoblin_config)
  File "/usr/share/mediagoblin/mediagoblin/app.py", line 74, in __init__
    setup_crypto()
  File "/usr/share/mediagoblin/mediagoblin/tools/crypto.py", line 86, in setup_crypto
    create_key(key_dir, key_filepath)
  File "/usr/share/mediagoblin/mediagoblin/tools/crypto.py", line 59, in create_key
    os.makedirs(key_dir) 
  File "/usr/lib/python2.7/os.py", line 150, in makedirs
    makedirs(head, mode) 
  File "/usr/lib/python2.7/os.py", line 157, in makedirs
    mkdir(name, mode)               
OSError: [Errno 13] Permission denied: '/etc/mediagoblin/user_dev'
Removing PID file /tmp/mediagoblin.pid

/etc/mediagobin is writeable only by root, as it probably should be.
So I created it myself as root:
- "install -d -m 0755 -g mediagoblin -o mediagoblin /etc/mediagoblin/user_dev"

running it again, we get little further:
2014-08-18 13:33:09,572 INFO    [mediagoblin.app] GNU MediaGoblin 0.6.1 main server starting
2014-08-18 13:33:09,577 WARNING [mediagoblin.init.config] When setting up config section, could not import 'mediagoblin.media_types.image'
2014-08-18 13:33:09,590 INFO    [mediagoblin.tools.crypto] Created /etc/mediagoblin/user_dev/crypto
2014-08-18 13:33:09,592 INFO    [mediagoblin.tools.crypto] Saved new key for It's Dangerous
2014-08-18 13:33:09,647 INFO    [mediagoblin.app] Setting up plugins.
2014-08-18 13:33:09,647 INFO    [mediagoblin.init.plugins] Importing plugin module: mediagoblin.plugins.geolocation
2014-08-18 13:33:09,647 INFO    [mediagoblin.init.plugins] Importing plugin module: mediagoblin.plugins.basic_auth
2014-08-18 13:33:09,647 INFO    [mediagoblin.init.plugins] Importing plugin module: mediagoblin.media_types.image
Traceback (most recent call last):
  File "/usr/bin/paster", line 4, in <module>
    command.run()
  File "/usr/lib/python2.7/dist-packages/paste/script/command.py", line 104, in run
    invoke(command, command_name, options, args[1:])
  File "/usr/lib/python2.7/dist-packages/paste/script/command.py", line 143, in invoke
    exit_code = runner.run(args)
  File "/usr/lib/python2.7/dist-packages/paste/script/command.py", line 238, in run
    result = self.command()
  File "/usr/lib/python2.7/dist-packages/paste/script/serve.py", line 284, in command
    relative_to=base, global_conf=vars)
  File "/usr/lib/python2.7/dist-packages/paste/script/serve.py", line 321, in loadapp
    **kw)
  File "/usr/lib/python2.7/dist-packages/paste/deploy/loadwsgi.py", line 247, in loadapp
    return loadobj(APP, uri, name=name, **kw)
  File "/usr/lib/python2.7/dist-packages/paste/deploy/loadwsgi.py", line 272, in loadobj
    return context.create()
  File "/usr/lib/python2.7/dist-packages/paste/deploy/loadwsgi.py", line 710, in create
    return self.object_type.invoke(self)
  File "/usr/lib/python2.7/dist-packages/paste/deploy/loadwsgi.py", line 203, in invoke
    app = context.app_context.create()
  File "/usr/lib/python2.7/dist-packages/paste/deploy/loadwsgi.py", line 710, in create
    return self.object_type.invoke(self)
  File "/usr/lib/python2.7/dist-packages/paste/deploy/loadwsgi.py", line 144, in invoke
    **context.local_conf)
  File "/usr/lib/python2.7/dist-packages/paste/deploy/util.py", line 55, in fix_call
    val = callable(*args, **kw)
  File "/usr/lib/python2.7/dist-packages/paste/urlmap.py", line 28, in urlmap_factory
    app = loader.get_app(app_name, global_conf=global_conf)
  File "/usr/lib/python2.7/dist-packages/paste/deploy/loadwsgi.py", line 350, in get_app
    name=name, global_conf=global_conf).create()
  File "/usr/lib/python2.7/dist-packages/paste/deploy/loadwsgi.py", line 710, in create
    return self.object_type.invoke(self)
  File "/usr/lib/python2.7/dist-packages/paste/deploy/loadwsgi.py", line 146, in invoke
    return fix_call(context.object, context.global_conf, **context.local_conf)
  File "/usr/lib/python2.7/dist-packages/paste/deploy/util.py", line 55, in fix_call
    val = callable(*args, **kw)
  File "/usr/share/mediagoblin/mediagoblin/app.py", line 277, in paste_app_factory
    mgoblin_app = MediaGoblinApp(mediagoblin_config)
  File "/usr/share/mediagoblin/mediagoblin/app.py", line 89, in __init__
    setup_plugins()
  File "/usr/share/mediagoblin/mediagoblin/init/plugins/__init__.py", line 56, in setup_plugins
    __import__(plugin_module)
  File "/usr/share/mediagoblin/mediagoblin/media_types/image/__init__.py", line 20, in <module>
    from mediagoblin.media_types.image.processing import sniff_handler, \
  File "/usr/share/mediagoblin/mediagoblin/media_types/image/processing.py", line 20, in <module>
    import Image
ImportError: No module named Image
Removing PID file /tmp/mediagoblin.pid


Hmmm, I'm stuck there. It seems maybe like that "could not import
'mediagoblin.media_types.image'" was not a harmless warning afterall,
but we miss depending on something there?

I've commented out "[[mediagoblin.media_types.image]]" in /etc/mediagoblin/mediagoblin.ini and rerun 
 "/usr/bin/gmg -cf /etc/mediagoblin/mediagoblin.ini dbupdate", which finally managed to start it:

$ cd /tmp; PYTHONPATH=/usr/share/mediagoblin/ CELERY_ALWAYS_EAGER=false\
>    /usr/bin/paster serve /etc/mediagoblin/paste.ini\
>      --pid-file=/tmp/mediagoblin.pid\
>      --server-name=fcgi\
>      fcgi_host=127.0.0.1 fcgi_port=26543
2014-08-18 13:39:25,476 INFO    [mediagoblin.app] GNU MediaGoblin 0.6.1 main server starting
2014-08-18 13:39:25,544 INFO    [mediagoblin.app] Setting up plugins.
2014-08-18 13:39:25,545 INFO    [mediagoblin.init.plugins] Importing plugin module: mediagoblin.plugins.geolocation
2014-08-18 13:39:25,545 INFO    [mediagoblin.init.plugins] Importing plugin module: mediagoblin.plugins.basic_auth
2014-08-18 13:39:25,630 INFO    [mediagoblin.init.celery] Setting celery configuration from object "mediagoblin.init.celery.dummy_settings_module"
Starting server in PID 19196.

I can create and confirm account. Of course, when I try to add any
image I get "Sorry, I don't support that file type :(" but that is
due to above problem.  I think anything on which
"mediagoblin.media_types.image" depends should be hard "Depends" for
mediagobling package (as it is most basic type we need to support),
while mediagoblin.media_types.video and others might be
recommends/suggests as needed.


This is very close to be easily installable on Jessie. After it works
by the docs without any issues on a clean system or two, we can try
to help to ease some of those manual steps (for example prepare
config files for apache/nginx so they can be enabled more easily;
package /etc/init.d script, auto create user on install (if not
found), create subpackages for mediagoblin-pgsql/mediagoblin-sqlite3
which would do further automation, ask questions and run gmg on
package (re-)configure etc).  I can help with some of that, probably.

Cheers,
Matija

-- 
Opinions above are GNU-copylefted.


Reply to: