scragg0x / realms-wiki

Git based wiki inspired by Gollum
http://realms.io
GNU General Public License v2.0
831 stars 90 forks source link

Realms-wiki docker container doesn't work due to missing cleancss #171

Closed webpigeon closed 6 years ago

webpigeon commented 8 years ago

Hello,

The docker instance now boots, which is good news :), however, upon visiting the page in the browser (http://servername:5000) I am greeted with a 500 error.

docker logs realms-wiki shows the following:

[2016-08-11 14:10:16 +0000] [17] [ERROR] Error handling request
Traceback (most recent call last):
  File "/home/wiki/realms-wiki/.venv/local/lib/python2.7/site-packages/gunicorn/workers/async.py", line 52, in handle
    self.handle_request(listener_name, req, client, addr)
  File "/home/wiki/realms-wiki/.venv/local/lib/python2.7/site-packages/gunicorn/workers/ggevent.py", line 159, in handle_request
    super(GeventWorker, self).handle_request(*args)
  File "/home/wiki/realms-wiki/.venv/local/lib/python2.7/site-packages/gunicorn/workers/async.py", line 105, in handle_request
    respiter = self.wsgi(environ, resp.start_response)
  File "/home/wiki/realms-wiki/realms/__init__.py", line 51, in __call__
    return super(Application, self).__call__(environ, start_response)
  File "/home/wiki/realms-wiki/.venv/local/lib/python2.7/site-packages/flask/app.py", line 1836, in __call__
    return self.wsgi_app(environ, start_response)
  File "/home/wiki/realms-wiki/.venv/local/lib/python2.7/site-packages/flask/app.py", line 1820, in wsgi_app
    response = self.make_response(self.handle_exception(e))
  File "/home/wiki/realms-wiki/.venv/local/lib/python2.7/site-packages/flask/app.py", line 1410, in handle_exception
    return handler(e)
  File "/home/wiki/realms-wiki/realms/__init__.py", line 161, in error_handler
    traceback=tb)
  File "/home/wiki/realms-wiki/.venv/local/lib/python2.7/site-packages/flask/templating.py", line 128, in render_template
    context, ctx.app)
  File "/home/wiki/realms-wiki/.venv/local/lib/python2.7/site-packages/flask/templating.py", line 110, in _render
    rv = template.render(context)
  File "/home/wiki/realms-wiki/.venv/local/lib/python2.7/site-packages/jinja2/environment.py", line 989, in render
    return self.environment.handle_exception(exc_info, True)
  File "/home/wiki/realms-wiki/.venv/local/lib/python2.7/site-packages/jinja2/environment.py", line 754, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/home/wiki/realms-wiki/realms/templates/errors/error.html", line 1, in top-level template code
    {% extends "layout.html" %}
  File "/home/wiki/realms-wiki/realms/templates/layout.html", line 14, in top-level template code
    {% assets bundle %}
  File "/home/wiki/realms-wiki/.venv/local/lib/python2.7/site-packages/webassets/ext/jinja2.py", line 186, in _render_assets
    urls = bundle.urls()
  File "/home/wiki/realms-wiki/.venv/local/lib/python2.7/site-packages/webassets/bundle.py", line 787, in urls
    urls.extend(bundle._urls(new_ctx, extra_filters, *args, **kwargs))
  File "/home/wiki/realms-wiki/.venv/local/lib/python2.7/site-packages/webassets/bundle.py", line 746, in _urls
    *args, **kwargs)
  File "/home/wiki/realms-wiki/.venv/local/lib/python2.7/site-packages/webassets/bundle.py", line 600, in _build
    force, disable_cache=disable_cache, extra_filters=extra_filters)
  File "/home/wiki/realms-wiki/.venv/local/lib/python2.7/site-packages/webassets/bundle.py", line 524, in _merge_and_apply
    kwargs=item_data)
  File "/home/wiki/realms-wiki/.venv/local/lib/python2.7/site-packages/webassets/merge.py", line 276, in apply
    return self._wrap_cache(key, func)
  File "/home/wiki/realms-wiki/.venv/local/lib/python2.7/site-packages/webassets/merge.py", line 218, in _wrap_cache
    content = func().getvalue()
  File "/home/wiki/realms-wiki/.venv/local/lib/python2.7/site-packages/webassets/merge.py", line 251, in func
    getattr(filter, type)(data, out, **kwargs_final)
  File "/home/wiki/realms-wiki/.venv/local/lib/python2.7/site-packages/webassets/filter/cleancss.py", line 37, in input
    self.subprocess(args, out, _in)
  File "/home/wiki/realms-wiki/.venv/local/lib/python2.7/site-packages/webassets/filter/__init__.py", line 516, in subprocess
    raise FilterError('Program file not found: %s.' % argv[0])
FilterError: Program file not found: cleancss.

The steps used to create the docker container are:

docker pull realms/realms-wiki
docker run --name realms-wiki -p 5000:5000 -d realms/realms-wiki
webpigeon commented 8 years ago

short term fix: Remote into the docker container as root: docker exec -u 0 -it realms-wiki /bin/bash

install clean-css from npm npm install -g clean-css

Refreshing the page in the web browser then results in the realms wiki page (all be it without icons) and some javascript errors - it seems to be trying to load stuff from file paths rather than relative to the url in the stylesheet:

@font-face {
    font-family:'Glyphicons Halflings';
    src:url(/home/wiki/realms-wiki/realms/static/vendor/bootswatch-dist/fonts/glyphicons-halflings-regular.eot);
    src:url(/home/wiki/realms-wiki/realms/static/vendor/bootswatch-dist/fonts/glyphicons-halflings-regular.eot?#iefix) format('embedded-opentype'),url(/home/wiki/realms-wiki/realms/static/vendor/bootswatch-dist/fonts/glyphicons-halflings-regular.woff2) format('woff2'),url(/home/wiki/realms-wiki/realms/static/vendor/bootswatch-dist/fonts/glyphicons-halflings-regular.woff) format('woff'),url(/home/wiki/realms-wiki/realms/static/vendor/bootswatch-dist/fonts/glyphicons-halflings-regular.ttf) format('truetype'),url(/home/wiki/realms-wiki/realms/static/vendor/bootswatch-dist/fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular) format('svg')
}
webpigeon commented 8 years ago

I'm guessing that chaging line 9 of the dockerfile from: npm install -g bower to npm install -g bower clean-css

might fix the missing cleancss problem

uxDaniel commented 8 years ago

Indeed, I had the same issue and went ahead to solve it: PR #175

scragg0x commented 8 years ago

pulled #175

RheaUN commented 7 years ago

I can confim. The issue is still present and can be reproduced by:

docker run --name realms-wiki -p 5000:5000 -d realms/realms-wiki

bhavicp commented 7 years ago

This is still happening.

scragg0x commented 7 years ago

Sorry about this. I am confirming the docker image is busted. I have done some work on a new one that will be automatically updated on commit. There is an issue that requires some code changes as well.

RheaUN commented 7 years ago

Hello scragg0x, THX for the short info. It is definitively a nice piece of code. Thumbs up!

roycepope commented 7 years ago

Was this ever resolved? I am still running into the Internal Server Error message even after trying the steps listed above.

Here is my output:

[roycepope:~]$ docker run --name realms-wiki -p 5000:5000 -d realms/realms-wiki ccf51c85ea7b94728cbe9a12ba4fb12724f2b0e7a4e72d562a6e01fcf0375877

[roycepope:~]$ docker exec -u 0 -it realms-wiki /bin/bash

root@ccf51c85ea7b:/home/wiki/realms-wiki# npm install -g clean-css npm http GET https://registry.npmjs.org/clean-css npm http 200 https://registry.npmjs.org/clean-css npm http GET https://registry.npmjs.org/clean-css/-/clean-css-4.1.1.tgz npm http 200 https://registry.npmjs.org/clean-css/-/clean-css-4.1.1.tgz npm WARN engine clean-css@4.1.1: wanted: {"node":">= 4.0"} (current: {"node":"v0.10.25","npm":"1.3.10"}) npm http GET https://registry.npmjs.org/source-map npm http 200 https://registry.npmjs.org/source-map npm http GET https://registry.npmjs.org/source-map/-/source-map-0.5.6.tgz npm http 200 https://registry.npmjs.org/source-map/-/source-map-0.5.6.tgz clean-css@4.1.1 /usr/local/lib/node_modules/clean-css └── source-map@0.5.6

root@ccf51c85ea7b:/home/wiki/realms-wiki# exit

chjohnst commented 6 years ago

that did the trick!

eric-schleicher commented 6 years ago

Is it possible to get a push of the docker image? the fix from the recent commits don't appear to have been updates in the docker repo.

scragg0x commented 6 years ago

Should be resolved, try the latest docker image