Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

leaflet v1.0 #243

Merged
merged 8 commits into from
Jan 12, 2018
Merged

leaflet v1.0 #243

merged 8 commits into from
Jan 12, 2018

Conversation

jywarren
Copy link
Member

@jywarren jywarren commented Jan 4, 2018

Plus LeafletDistortableImage v0.1.3 -- using the new leaflet toolbar... !

@jywarren jywarren mentioned this pull request Jan 4, 2018
3 tasks
@jywarren
Copy link
Member Author

jywarren commented Jan 4, 2018

Testing this locally before merging

@jywarren
Copy link
Member Author

jywarren commented Jan 5, 2018

@icarito - i can't seem to get this running on my local, due to some mysql issues. Can you either share a db dump w me or stand this up on a vm I can access so we can just test out the interface before merging this? Thanks.

@icarito
Copy link
Member

icarito commented Jan 5, 2018

I'm stuck here:

icarito@tycho:/srv/mapknitter_branch1/mapknitter$ docker-compose exec web rake assets:precompile                                              /usr/local/bin/ruby /usr/local/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets
rake aborted!
Sprockets::FileNotFound: couldn't find file 'leaflet-omnivore/leaflet-omnivore.min.js'
  (in /app/app/assets/javascripts/application.js:25)                                                                                          
Tasks: TOP => assets:precompile:primary
(See full trace by running task with --trace)
rake aborted!
Command failed with status (1): [/usr/local/bin/ruby /usr/local/bin/rake as...]

Tasks: TOP => assets:precompile
(See full trace by running task with --trace)                                                                                                 icarito@tycho:/srv/mapknitter_branch1/mapknitter$ 

@jywarren
Copy link
Member Author

jywarren commented Jan 5, 2018

I'm very close here... i think we need:

  • rmagick, gdal, and imagemagick -- and other prerequisites installed in the container as in the main MapKnitter container -- documented in the readme
  • some resolution for the ReCaptcha problem, but this is not essential and can be addressed in followup
    • it keeps returning the error (roughly) recaptcha_tags not found even though I've run bundle install and confirmed gem list shows the recaptcha gem is installed.
    • docker-compose -f docker-compose.yml logs -f --tail=500 shows the error, when visiting http://laboratoriopublico.org:11000/maps/new

Then we should be all right!

@icarito
Copy link
Member

icarito commented Jan 8, 2018

Actually I was looking inside the container (with docker-compose exec web bash ) and I find gdal, imagemagick and rmagick are installed.

Further debugging from logs then:

[paperclip] saving warpables/1/censarbol.png
Completed 500 Internal Server Error in 500.1ms

TypeError (no implicit conversion of nil into String):
  app/controllers/images_controller.rb:83:in `+'
  app/controllers/images_controller.rb:83:in `url_upload_not_found'

@icarito
Copy link
Member

icarito commented Jan 8, 2018

Here's the full error log actually:

Started POST "/maps/titicaca/warpables" for 200.121.220.175 at 2018-01-06 13:43:15 +0000
Processing by ImagesController#create as JSON
  Parameters: {"utf8"=>"✓", "authenticity_token"=>"sQazoNTqsTRXkCFXpmc8/XDK1L6DF1INIGSqwlhETl0=", "map_id"=>"titicaca", "uploaded_data"=>#<ActionDispatch::Http::UploadedFile:0x0055bc4fdea8a8 @original_filename="censarbol.png", @content_type="image/png", @headers="Content-Disposition: form-data; name=\"uploaded_data\"; filename=\"censarbol.png\"\r\nContent-Type: image/png\r\n", @tempfile=#<Tempfile:/tmp/RackMultipart20180106-8-rbl607>>}
Command :: file -b --mime '/tmp/5574b1622fa9ee7e60978a6064b5b09d20180106-8-x6t5m5.png'
Command :: identify -format '%wx%h,%[exif:orientation]' '/tmp/5574b1622fa9ee7e60978a6064b5b09d20180106-8-c9n8yn.png[0]' 2>/dev/null
Command :: identify -format %m '/tmp/5574b1622fa9ee7e60978a6064b5b09d20180106-8-c9n8yn.png[0]'
Command :: convert '/tmp/5574b1622fa9ee7e60978a6064b5b09d20180106-8-c9n8yn.png[0]' -auto-orient -resize "500x375" '/tmp/5574b1622fa9ee7e60978a6064b5b09d20180106-8-c9n8yn20180106-8-1kteqjb'
Command :: file -b --mime '/tmp/5574b1622fa9ee7e60978a6064b5b09d20180106-8-c9n8yn20180106-8-1kteqjb'
Command :: identify -format '%wx%h,%[exif:orientation]' '/tmp/5574b1622fa9ee7e60978a6064b5b09d20180106-8-c9n8yn.png[0]' 2>/dev/null
Command :: identify -format %m '/tmp/5574b1622fa9ee7e60978a6064b5b09d20180106-8-c9n8yn.png[0]'
Command :: convert '/tmp/5574b1622fa9ee7e60978a6064b5b09d20180106-8-c9n8yn.png[0]' -auto-orient -resize "240x180" '/tmp/5574b1622fa9ee7e60978a6064b5b09d20180106-8-c9n8yn20180106-8-15uzgic'
Command :: file -b --mime '/tmp/5574b1622fa9ee7e60978a6064b5b09d20180106-8-c9n8yn20180106-8-15uzgic'                                          Command :: identify -format '%wx%h,%[exif:orientation]' '/tmp/5574b1622fa9ee7e60978a6064b5b09d20180106-8-c9n8yn.png[0]' 2>/dev/null
Command :: identify -format %m '/tmp/5574b1622fa9ee7e60978a6064b5b09d20180106-8-c9n8yn.png[0]'
Command :: convert '/tmp/5574b1622fa9ee7e60978a6064b5b09d20180106-8-c9n8yn.png[0]' -auto-orient -resize "100x100>" '/tmp/5574b1622fa9ee7e60978a6064b5b09d20180106-8-c9n8yn20180106-8-aafaf0'
Command :: file -b --mime '/tmp/5574b1622fa9ee7e60978a6064b5b09d20180106-8-c9n8yn20180106-8-aafaf0'
Command :: file -b --mime '/tmp/5574b1622fa9ee7e60978a6064b5b09d20180106-8-1xh8wmu.png'
[paperclip] saving warpables/1/censarbol.png
Completed 500 Internal Server Error in 500.1ms

TypeError (no implicit conversion of nil into String):
  app/controllers/images_controller.rb:83:in `+'
  app/controllers/images_controller.rb:83:in `url_upload_not_found'

@icarito
Copy link
Member

icarito commented Jan 8, 2018

Going to run each of those commands by hand and see what is.

@icarito
Copy link
Member

icarito commented Jan 8, 2018

Okay here's what I have learned from running each of the Imagemagick commands by hand: All of the commands work, excepting the first and last file commands which oddly are looking for a different filename than the operations in between. Looks like a bug to me.

@icarito
Copy link
Member

icarito commented Jan 8, 2018

Actually it's confusing because I see no difference with production logs, in production logs look the same, without the 500. I'll try temporary disabling the exception rescue procedure in app/controllers/images_controller.rb to see where the actual error is.

@icarito
Copy link
Member

icarito commented Jan 8, 2018

Aha!:

Errno::ENOENT (No such file or directory @ rb_sysopen - config/amazon_s3.yml):                                                                                                   
  app/controllers/images_controller.rb:51:in `block in create'                                                                                                                   
  app/controllers/images_controller.rb:50:in `create'                                                                                                                            

@icarito
Copy link
Member

icarito commented Jan 8, 2018

Naively I put a dummy .yml amazon config file but found:

AWS::Errors::MissingCredentialsError
Missing Credentials.
Unable to find AWS credentials.  You can configure your AWS credentials
a few different ways:                                                                                                                                                                                     

Created #245 to document how to setup without relying on the big A.

@icarito
Copy link
Member

icarito commented Jan 8, 2018

Level up, next error:

Completed 500 Internal Server Error in 393.5ms                                                                                                                                                                                                                                                                                                                    Paperclip::AdapterRegistry::NoHandlerError (No handler found for "/system/images/1/original/sand_tileset.png"):                                                                  
  app/models/warpable.rb:49:in `save_dimensions'                                                                                                                                   app/controllers/images_controller.rb:51:in `block in create'                                                                                                                     app/controllers/images_controller.rb:50:in `create'                                                                                                                            

@icarito
Copy link
Member

icarito commented Jan 8, 2018

Commented this out too, need better fix (related to #245):

#if Rails.env.production?
#  geo = Paperclip::Geometry.from_file(Paperclip.io_adapters.for(self.image.url)) # s3 version
#else
geo = Paperclip::Geometry.from_file(Paperclip.io_adapters.for(self.image).path) # local filesystem version
#end

@jywarren
Copy link
Member Author

jywarren commented Jan 8, 2018 via email

@icarito
Copy link
Member

icarito commented Jan 8, 2018

Okay please test http://laboratoriopublico.org:11000/maps/test

@jywarren
Copy link
Member Author

jywarren commented Jan 8, 2018 via email

@jywarren
Copy link
Member Author

jywarren commented Jan 8, 2018

Oy, i still can't make any progress on this recaptcha thing. Not hyper urgent but if you have any great detective insights, I think that's the last thing!

@jywarren
Copy link
Member Author

jywarren commented Jan 8, 2018

@jywarren
Copy link
Member Author

jywarren commented Jan 12, 2018

I believe this is ready for deployment to MapKnitter.org -- it'll need bower install, bower update, bundle update -- and this line (and key name changes) will need to be added to the recaptcha.rb file:

https://github.com/jywarren/mapknitter/blob/e28933a5f6dbcdfc539002fadcc9eac57a6ed313/config/initializers/recaptcha.rb#L3-L5

@jywarren jywarren merged commit da920d1 into publiclab:master Jan 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants