puffinrocks / puffin

lightweight webapp catalog based on containers, with user interface à la mobile app store
GNU Affero General Public License v3.0
89 stars 20 forks source link

Internal server error when trying to run application #5

Closed bigdoods closed 7 years ago

bigdoods commented 7 years ago

Hi Jarek,

I am trying to run my own app. I am getting the following error in the broswer when I select the app from the catalogue:

Internal Server Error

The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.

When I get the logs of the puffin container the error is:

ERROR [puffin] Exception on /application/3d-repo.html [GET]
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1817, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1477, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1381, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python3.6/site-packages/flask/_compat.py", line 33, in reraise
raise value
File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1475, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1461, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/usr/src/app/puffin/gui/view.py", line 59, in application
application_image_version = docker.get_application_image_version(client, application)
File "/usr/src/app/puffin/core/docker.py", line 129, in get_application_image_version
image = client.images.get(image_name)
File "/usr/local/lib/python3.6/site-packages/docker/models/images.py", line 190, in get
return self.prepare_model(self.client.api.inspect_image(name))
File "/usr/local/lib/python3.6/site-packages/docker/utils/decorators.py", line 19, in wrapped
'Resource ID was not provided'
docker.errors.NullResource: Resource ID was not provided

After I upload my app, I build the docker-compose image in the puffin apps/ directory. I also rebuilding puffin before I click the app.

Any ideas what could be the reason for this error?

Thanks

loomchild commented 7 years ago

Thanks for the report. Could you clarify which version of puffin you are running (hash)? Also could you provide docker-compose.yml (or part of it) for your app?

I think the problem might be that you specified "build: ." instead of "image:" property in your app compose file. Puffin needs and image, you'll need to push your app image to dockerhub (or some other repository, haven't tested). For my part I will try to improve the error message.

loomchild commented 7 years ago

In fact this code seems to be already improved on master branch:

try:
    image = client.images.get(image_name)
except docker.errors.ImageNotFound:
    return None

To me it seems that either image property is empty in your app docker-compose.yml or your image doesn't exist on the server. In the latter case you either need to build it (in app home dir on the server):

docker build -t [org]/[name] .

or pull it if it's on dockerhub or other registry (better solution in general):

docker pull [org]/[name]

(where [org] is your organization name and [name] is the project name, for example puffinrocks/puffin)

loomchild commented 7 years ago

Looking again at the error: docker.errors.NullResource: Resource ID was not provided to me it seems that the former hypothesis is true. I will improve the error handling.

bigdoods commented 7 years ago

version: 8a9b625666bf5cc8954a5797eacf5c4dde1d847c

The fix for this was to push the built version of this to dockerhub and replace build property in the docker-compose file with image property and it worked.

Thanks!

loomchild commented 7 years ago

Improved error message. Closing the issue.

bigdoods commented 6 years ago

I just ran into this error again.

Might be useful for someone but the cause was naming the 'main' service in the docker-compose file something other than 'main'.

loomchild commented 6 years ago

Yeah, it needs to be main at the moment, thanks for sharing.