Skip to content
This repository has been archived by the owner on Oct 2, 2020. It is now read-only.

Better install documentation #1

Open
barhom opened this issue Apr 17, 2019 · 11 comments
Open

Better install documentation #1

barhom opened this issue Apr 17, 2019 · 11 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@barhom
Copy link

barhom commented Apr 17, 2019

I'm assuming this is supposed to be run as a separate docker from zammad.
Its running now and I can see that emails are arriving from mailgun.

But since it is a different docker how do I make sure it goes to the correct folder/installation of zammad?

Maybe you can share your docker-compose.yml?

zammad-getmail_1  | Starting get-mail...
zammad-getmail_1  | new message
zammad-getmail_1  | token ok
zammad-getmail_1  | ----------------------------------------
zammad-getmail_1  | Exception happened during processing of request from ('172.22.0.1', 49890)
zammad-getmail_1  | Traceback (most recent call last):
zammad-getmail_1  |   File "/usr/lib/python3.5/socketserver.py", line 313, in _handle_request_noblock
zammad-getmail_1  |     self.process_request(request, client_address)
zammad-getmail_1  |   File "/usr/lib/python3.5/socketserver.py", line 341, in process_request
zammad-getmail_1  |     self.finish_request(request, client_address)
zammad-getmail_1  |   File "/usr/lib/python3.5/socketserver.py", line 354, in finish_request
zammad-getmail_1  |     self.RequestHandlerClass(request, client_address, self)
zammad-getmail_1  |   File "/usr/lib/python3.5/socketserver.py", line 681, in __init__
zammad-getmail_1  |     self.handle()
zammad-getmail_1  |   File "/usr/lib/python3.5/http/server.py", line 422, in handle
zammad-getmail_1  |     self.handle_one_request()
zammad-getmail_1  |   File "/usr/lib/python3.5/http/server.py", line 410, in handle_one_request
zammad-getmail_1  |     method()
zammad-getmail_1  |   File "server.py", line 48, in do_POST
zammad-getmail_1  |     pipe.write(message.encode('utf-8'))
zammad-getmail_1  | AttributeError: 'NoneType' object has no attribute 'encode'
zammad-getmail_1  | ----------------------------------------
zammad-getmail_1  | Could not locate Gemfile or .bundle/ directory
@totoCZ
Copy link
Owner

totoCZ commented Apr 17, 2019

Hi,

my setup is something like this

ExecStart=/usr/bin/podman run --name get-mail \
    --ip 192.168.88.xx \  
    -v /var/containers/zammad/data:/opt/zammad \
    -e MAILGUN_API_KEY=xx \
    localhost/get-mail

What's happening there is you're sharing the entire zammad folder into this image and then mails get piped in by running the bundle command from that folder in https://github.com/TomHetmer/get-mail/blob/master/server.py#L45

@barhom
Copy link
Author

barhom commented Apr 17, 2019

Thanks for the quick reply,

I got a bit further by doing this,

cat docker-compose.override.yml
version: '2'
services:

  zammad-nginx:
    ports:
      - "5002:80"
  zammad-getmail:
    image: get-mail
    ports:
      - "5003:1337"
    environment:
      - MAILGUN_API_KEY=MYMAILGUN_KEY
    volumes:
      - zammad-data:/opt/zammad

Now the following error happens,

new message
token ok
----------------------------------------
Exception happened during processing of request from ('172.21.0.1', 40416)
Traceback (most recent call last):
  File "/usr/lib/python3.5/socketserver.py", line 313, in _handle_request_noblock
    self.process_request(request, client_address)
  File "/usr/lib/python3.5/socketserver.py", line 341, in process_request
    self.finish_request(request, client_address)
  File "/usr/lib/python3.5/socketserver.py", line 354, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/usr/lib/python3.5/socketserver.py", line 681, in __init__
    self.handle()
  File "/usr/lib/python3.5/http/server.py", line 422, in handle
    self.handle_one_request()
  File "/usr/lib/python3.5/http/server.py", line 410, in handle_one_request
    method()
  File "server.py", line 48, in do_POST
    pipe.write(message.encode('utf-8'))
AttributeError: 'NoneType' object has no attribute 'encode'
----------------------------------------
bundler: failed to load command: rails (/usr/local/bundle/bin/rails)
Bundler::GemNotFound: Could not find rake-12.3.2 in any of the sources
  /usr/local/lib/ruby/gems/2.4.0/gems/bundler-1.16.6/lib/bundler/spec_set.rb:91:in `block in materialize'
  /usr/local/lib/ruby/gems/2.4.0/gems/bundler-1.16.6/lib/bundler/spec_set.rb:85:in `map!'
  /usr/local/lib/ruby/gems/2.4.0/gems/bundler-1.16.6/lib/bundler/spec_set.rb:85:in `materialize'
  /usr/local/lib/ruby/gems/2.4.0/gems/bundler-1.16.6/lib/bundler/definition.rb:171:in `specs'
  /usr/local/lib/ruby/gems/2.4.0/gems/bundler-1.16.6/lib/bundler/definition.rb:238:in `specs_for'
  /usr/local/lib/ruby/gems/2.4.0/gems/bundler-1.16.6/lib/bundler/definition.rb:227:in `requested_specs'
  /usr/local/lib/ruby/gems/2.4.0/gems/bundler-1.16.6/lib/bundler/runtime.rb:108:in `block in definition_method'
  /usr/local/lib/ruby/gems/2.4.0/gems/bundler-1.16.6/lib/bundler/runtime.rb:20:in `setup'
  /usr/local/lib/ruby/gems/2.4.0/gems/bundler-1.16.6/lib/bundler.rb:107:in `setup'
  /usr/local/lib/ruby/gems/2.4.0/gems/bundler-1.16.6/lib/bundler/setup.rb:20:in `<top (required)>'
  /usr/local/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:59:in `require'
  /usr/local/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:59:in `require'

Doesn't seem like it likes it when I run https://github.com/TomHetmer/get-mail/blob/master/server.py#L45 from inside the get-email docker. Any idea?
I'd like to see if I can get this working without using podman

@totoCZ
Copy link
Owner

totoCZ commented Apr 17, 2019

It's nothing to do with podman, for some reason your rails isn't working the same way. I don't remember if I had to do 'bundle install' or something like that. It was a lot of experimenting when I was writing the script.

Maybe https://stackoverflow.com/questions/23801899/bundlergemnotfound-could-not-find-rake-10-3-2-in-any-of-the-sources can help? If you run it from zammad console to try to fix the dependency issues with rake.

Keep trying till you get "bundle exec rails" running from there :)

@barhom
Copy link
Author

barhom commented Apr 17, 2019

If I try to enter "zammad-nginx" and run "bundle" inside /opt/zammad it runs fine.
However, if I run the same thing inside "zammad-getmail" it instead tries to download bundles but fails.
Did I miss adding some volumes to getmail?

@barhom
Copy link
Author

barhom commented Apr 17, 2019

Keep trying till you get "bundle exec rails" running from there :)

Will do thanks!

@totoCZ
Copy link
Owner

totoCZ commented Apr 17, 2019

Strange. Especially since my script is not much different from https://github.com/mraerino/zammad-smtp-receiver that uses the same method and it says it works with docker-compose.

Here "bundle" from get-mail gives me

Bundle complete! 93 Gemfile dependencies, 139 gems now installed.
Gems in the groups test, development and mysql were not installed.
Bundled gems are installed into /usr/local/bundle

and there's no other volumes mounted.

@totoCZ
Copy link
Owner

totoCZ commented Apr 17, 2019

What if you removed "bundle exec" and ran rails directly? Like here mraerino/zammad-smtp-receiver@2e55401#diff-168726dbe96b3ce427e7fedce31bb0bcL30

either with just rails or bin/rails

@barhom
Copy link
Author

barhom commented Apr 17, 2019

Strange. Especially since my script is not much different from https://github.com/mraerino/zammad-smtp-receiver that uses the same method and it says it works with docker-compose.

Here "bundle" from get-mail gives me

Bundle complete! 93 Gemfile dependencies, 139 gems now installed.
Gems in the groups test, development and mysql were not installed.
Bundled gems are installed into /usr/local/bundle

and there's no other volumes mounted.
Are you running the latest do zammad-docker-compose?

ok, so I tried something different this time.
I added server.py inside the container that does work with "bundle".

python3 server.py
Starting get-mail...
new message
token ok
----------------------------------------
Exception happened during processing of request from ('172.21.0.1', 51050)
Traceback (most recent call last):
  File "/usr/lib/python3.5/socketserver.py", line 313, in _handle_request_noblock
    self.process_request(request, client_address)
  File "/usr/lib/python3.5/socketserver.py", line 341, in process_request
    self.finish_request(request, client_address)
  File "/usr/lib/python3.5/socketserver.py", line 354, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/usr/lib/python3.5/socketserver.py", line 681, in __init__
    self.handle()
  File "/usr/lib/python3.5/http/server.py", line 422, in handle
    self.handle_one_request()
  File "/usr/lib/python3.5/http/server.py", line 410, in handle_one_request
    method()
  File "server.py", line 48, in do_POST
    pipe.write(message.encode('utf-8'))
AttributeError: 'NoneType' object has no attribute 'encode'
----------------------------------------
I, [2019-04-17T23:34:00.318367 #679-46965672136540]  INFO -- : Setting.set('product_logo', "c6ade61974c60e27bb42bd2fc238bc2a.png")
I, [2019-04-17T23:34:02.662115 #679-46965672136540]  INFO -- : read main from STDIN

Still doesnt work, unsure what this is,

AttributeError: 'NoneType' object has no attribute 'encode'

@totoCZ
Copy link
Owner

totoCZ commented Apr 18, 2019 via email

@totoCZ
Copy link
Owner

totoCZ commented Apr 28, 2019

Did you get it to run? :)

@totoCZ totoCZ changed the title Interesting project! - Almost got it to run! Better install documentation Apr 28, 2019
@totoCZ totoCZ added good first issue Good for newcomers enhancement New feature or request labels Apr 28, 2019
@barhom
Copy link
Author

barhom commented May 2, 2019

Did you get it to run? :)

I did actually! Thanks. I was able to get it to run by adding ".mime" to mailgun POST url.
However, I never got it to run in its own container. So I ended up fetching email via IMAP instead.

Maybe I will try to get "get-mail" working again again in the future ;)

Thanks

@barhom barhom closed this as completed May 2, 2019
@totoCZ totoCZ pinned this issue May 7, 2019
@totoCZ totoCZ reopened this May 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants