Setup Mail

Hey,
i am part of an NGO in germany and we are going to build a foodcoop. I am the guy who is administrating the NGOs servers, and i am quite new to ruby.
I was able to setup the software according to the, well lets say unfinished, documentation but i am unable to configure the mailing with an external postfix server.
I was able to find the env variables in the sourcecode and added them to the docker env but still i get a error when i request a token to set a new password. The token gets generated but when your software tries to generate an email it throws errors. here are the config and errors. Perhaps someone can help me to set this up. On the day i set this up the new docker image was released on docker hub, which is not working at all i am using version 4.6

THE DOCKER COMMAND:
docker run --name foodsoft_web5 -p 3001 -e SECRET_KEY_BASE=X*32 -e DATABASE_URL=“mysql2://foodcoop_debug:xxxxxxxxx@xxxxxxxxx:3306/footcoop_db02?encoding=utf8” -e REDIS_URL=“redis://xxxxxxxxxxxxxxx:6379” -e RAILS_FORCE_SSL=false -e SMTP_ADDRESS=“mail.xxxxxxxxxxx.de” -e SMTP_PORT=“587” -e SMTP_DOMAIN=“xxxxxxxx.de” -e SMTP_USER_NAME=“foodcoop” -e SMTP_PASSWORD=“xxxxxxxx” -e SMTP_AUTHENTICATION=“login” -e SMTP_ENABLE_STARTTLS_AUTO=“true” -e SMTP_OPENSSL_VERIFY_MODE=“peer” -e EMAIL_SENDER="foodcoop@xxxxx.de" -v “/etc/footsoft/config/app_config.yml:/usr/src/app/config/app_config.yml:ro” foodcoops/foodsoft:latest-release

stdout container:

Redirected to http://XXX.xxx.XXX.xxx:3001/XXXX/login
Filter chain halted as :authenticate rendered or redirected
Completed 302 Found in 4ms (ActiveRecord: 1.0ms)
Started GET “/XXXX/login” for 172.17.0.1 at 2020-03-26 15:08:04 +0000
Processing by SessionsController#new as HTML
Parameters: {“foodcoop”=>“XXXX”}
Set locale to de
Deface: [WARNING] No :original defined for ‘public_frontpage’, you should change its definition to include:
:original => ‘cf955bb7fa18a67d51becb035057c3d00650eff1’
Deface: [WARNING] No :original defined for ‘insert_link’, you should change its definition to include:
:original => ‘cf955bb7fa18a67d51becb035057c3d00650eff1’
Rendered sessions/new.html.haml within layouts/login (6.4ms)
Rendered layouts/_footer.html.haml (4.5ms)
Rendered layouts/_header.html.haml (9.8ms)
Completed 200 OK in 36ms (Views: 27.0ms | ActiveRecord: 6.1ms)
Started GET “/XXXX/login/forgot_password” for 172.17.0.1 at 2020-03-26 15:08:36 +0000
Processing by LoginController#forgot_password as HTML
Parameters: {“foodcoop”=>“XXXX”}
Set locale to de
Rendered login/forgot_password.html.haml within layouts/login (5.5ms)
Rendered layouts/_footer.html.haml (3.4ms)
Rendered layouts/_header.html.haml (6.1ms)
Completed 200 OK in 32ms (Views: 14.1ms | ActiveRecord: 6.3ms)
Started POST “/XXXX/login/reset_password” for 172.17.0.1 at 2020-03-26 15:08:39 +0000
Processing by LoginController#reset_password as HTML
Parameters: {“utf8”=>“✓”, “authenticity_token”=>“pCzWZGHJD4TTF2EC8fqRW+AetMREktmnB6YmLFujD84iJHudqDKFroT/YP4OXrEZD0vuDAFkyRtuTfrMUlJ6cg==”, “user”=>{“email”=>“nonextistendmember@email.tld”}, “commit”=>“Neues Passwort anfordern”, “foodcoop”=>“XXXX”} here email is not tied to user nor exists —> get redirected to login screen
Set locale to de
Redirected to http://XXX.xxx.XXX.xxx:3001/XXXX/login
Completed 302 Found in 6ms (ActiveRecord: 1.9ms)
Started GET “/XXXX/login” for 172.17.0.1 at 2020-03-26 15:08:39 +0000
Processing by SessionsController#new as HTML
Parameters: {“foodcoop”=>“XXXX”}
Set locale to de
Rendered sessions/new.html.haml within layouts/login (3.9ms)
Rendered layouts/_footer.html.haml (3.3ms)
Rendered layouts/_header.html.haml (5.7ms)
Completed 200 OK in 15ms (Views: 7.3ms | ActiveRecord: 4.7ms)
Started GET “/XXXX/login/forgot_password” for 172.17.0.1 at 2020-03-26 15:08:49 +0000
Processing by LoginController#forgot_password as HTML
Parameters: {“foodcoop”=>“XXXX”}
Set locale to de
Rendered login/forgot_password.html.haml within layouts/login (3.6ms)
Rendered layouts/_footer.html.haml (3.1ms)
Rendered layouts/_header.html.haml (5.4ms)
Completed 200 OK in 17ms (Views: 8.2ms | ActiveRecord: 4.6ms)
Started POST “/XXXX/login/reset_password” for 172.17.0.1 at 2020-03-26 15:08:53 +0000
Processing by LoginController#reset_password as HTML
Parameters: {“utf8”=>“✓”, “authenticity_token”=>“tlvnSTxEnE60qBMbvI5afv6VsU5NbZeTjlf0trgmsdQwU0qw9b8WZONAEudDKno8EcDrhgibhy/nvChWsdfEaA==”, “user”=>{“email”=>“xxxxx@xxxxxx.de”}, “commit”=>“Neues Passwort anfordern”, “foodcoop”=>“XXXX”} here user is admin with real email adress → it crashes
Set locale to de
Completed 500 Internal Server Error in 84ms (ActiveRecord: 65.2ms)

ActionController::UrlGenerationError (No route matches {:action=>“new_password”, :controller=>“login”, :id=>1, :token=>“lifreshychafibirdywibigaxedudicaphafra”} missing required keys: [:foodcoop]): → ruby error
app/mailers/mailer.rb:19:in reset_password' app/models/user.rb:135:in request_password_reset!’
app/controllers/login_controller.rb:18:in reset_password' app/controllers/application_controller.rb:228:in set_currency’
app/controllers/application_controller.rb:216:in `set_time_zone’

Processing by ErrorsController#show as HTML
Parameters: {“utf8”=>“✓”, “authenticity_token”=>“tlvnSTxEnE60qBMbvI5afv6VsU5NbZeTjlf0trgmsdQwU0qw9b8WZONAEudDKno8EcDrhgibhy/nvChWsdfEaA==”, “user”=>{“email”=>“elias@eliashaisch.de”}, “commit”=>“Neues Passwort anfordern”, “foodcoop”=>“XXXX”}
Set locale to de
Completed 500 Internal Server Error in 3ms (ActiveRecord: 0.7ms)
Error during failsafe response: No config for this environment (XXXX) available!
/usr/src/app/lib/foodsoft_config.rb:212:in set_config' /usr/src/app/lib/foodsoft_config.rb:79:in select_foodcoop’
/usr/src/app/app/controllers/errors_controller.rb:17:in select_foodcoop' /usr/src/app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.10/lib/active_support/callbacks.rb:432:in block in make_lambda’
/usr/src/app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.10/lib/active_support/callbacks.rb:164:in block in halting' /usr/src/app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.10/lib/active_support/callbacks.rb:504:in block in call’
/usr/src/app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.10/lib/active_support/callbacks.rb:504:in each' /usr/src/app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.10/lib/active_support/callbacks.rb:504:in call’
/usr/src/app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.10/lib/active_support/callbacks.rb:92:in __run_callbacks__' /usr/src/app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.10/lib/active_support/callbacks.rb:778:in _run_process_action_callbacks’
/usr/src/app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.10/lib/active_support/callbacks.rb:81:in run_callbacks' /usr/src/app/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.10/lib/abstract_controller/callbacks.rb:19:in process_action’
/usr/src/app/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.10/lib/action_controller/metal/rescue.rb:29:in process_action' /usr/src/app/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.10/lib/action_controller/metal/instrumentation.rb:32:in block in process_action’
/usr/src/app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.10/lib/active_support/notifications.rb:164:in block in instrument' /usr/src/app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.10/lib/active_support/notifications/instrumenter.rb:20:in instrument’
/usr/src/app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.10/lib/active_support/notifications.rb:164:in instrument' /usr/src/app/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.10/lib/action_controller/metal/instrumentation.rb:30:in process_action’
/usr/src/app/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.10/lib/action_controller/metal/params_wrapper.rb:250:in process_action' /usr/src/app/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.10/lib/active_record/railties/controller_runtime.rb:18:in process_action’
/usr/src/app/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.10/lib/abstract_controller/base.rb:137:in process' /usr/src/app/vendor/bundle/ruby/2.3.0/gems/actionview-4.2.10/lib/action_view/rendering.rb:30:in process’
/usr/src/app/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.10/lib/action_controller/metal.rb:196:in dispatch' /usr/src/app/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.10/lib/action_controller/metal/rack_delegation.rb:13:in dispatch’
/usr/src/app/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.10/lib/action_controller/metal.rb:237:in block in action' /usr/src/app/vendor/bundle/ruby/2.3.0/gems/gaffe-1.2.0/lib/gaffe.rb:22:in block in enable!’
/usr/src/app/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.10/lib/action_dispatch/middleware/show_exceptions.rb:47:in render_exception' /usr/src/app/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.10/lib/action_dispatch/middleware/show_exceptions.rb:35:in rescue in call’
/usr/src/app/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.10/lib/action_dispatch/middleware/show_exceptions.rb:29:in call' /usr/src/app/vendor/bundle/ruby/2.3.0/gems/railties-4.2.10/lib/rails/rack/logger.rb:38:in call_app’
/usr/src/app/vendor/bundle/ruby/2.3.0/gems/railties-4.2.10/lib/rails/rack/logger.rb:20:in block in call' /usr/src/app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.10/lib/active_support/tagged_logging.rb:68:in block in tagged’
/usr/src/app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.10/lib/active_support/tagged_logging.rb:26:in tagged' /usr/src/app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.10/lib/active_support/tagged_logging.rb:68:in tagged’
/usr/src/app/vendor/bundle/ruby/2.3.0/gems/railties-4.2.10/lib/rails/rack/logger.rb:20:in call' /usr/src/app/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.10/lib/action_dispatch/middleware/request_id.rb:21:in call’
/usr/src/app/vendor/bundle/ruby/2.3.0/gems/rack-1.6.8/lib/rack/methodoverride.rb:22:in call' /usr/src/app/vendor/bundle/ruby/2.3.0/gems/rack-1.6.8/lib/rack/runtime.rb:18:in call’
/usr/src/app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.10/lib/active_support/cache/strategy/local_cache_middleware.rb:28:in call' /usr/src/app/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.10/lib/action_dispatch/middleware/static.rb:120:in call’
/usr/src/app/vendor/bundle/ruby/2.3.0/gems/rack-1.6.8/lib/rack/sendfile.rb:113:in call' /usr/src/app/vendor/bundle/ruby/2.3.0/gems/railties-4.2.10/lib/rails/engine.rb:518:in call’
/usr/src/app/vendor/bundle/ruby/2.3.0/gems/railties-4.2.10/lib/rails/application.rb:165:in call' /usr/src/app/vendor/bundle/ruby/2.3.0/gems/rack-1.6.8/lib/rack/content_length.rb:15:in call’
/usr/src/app/vendor/bundle/ruby/2.3.0/gems/thin-1.5.1/lib/thin/connection.rb:81:in block in pre_process' /usr/src/app/vendor/bundle/ruby/2.3.0/gems/thin-1.5.1/lib/thin/connection.rb:79:in catch’
/usr/src/app/vendor/bundle/ruby/2.3.0/gems/thin-1.5.1/lib/thin/connection.rb:79:in pre_process' /usr/src/app/vendor/bundle/ruby/2.3.0/gems/thin-1.5.1/lib/thin/connection.rb:54:in process’
/usr/src/app/vendor/bundle/ruby/2.3.0/gems/thin-1.5.1/lib/thin/connection.rb:39:in receive_data' /usr/src/app/vendor/bundle/ruby/2.3.0/gems/eventmachine-1.0.9.1/lib/eventmachine.rb:193:in run_machine’
/usr/src/app/vendor/bundle/ruby/2.3.0/gems/eventmachine-1.0.9.1/lib/eventmachine.rb:193:in run' /usr/src/app/vendor/bundle/ruby/2.3.0/gems/thin-1.5.1/lib/thin/backends/base.rb:63:in start’
/usr/src/app/vendor/bundle/ruby/2.3.0/gems/thin-1.5.1/lib/thin/server.rb:159:in start' /usr/src/app/vendor/bundle/ruby/2.3.0/gems/rack-1.6.8/lib/rack/handler/thin.rb:19:in run’
/usr/src/app/vendor/bundle/ruby/2.3.0/gems/rack-1.6.8/lib/rack/server.rb:287:in start' /usr/src/app/vendor/bundle/ruby/2.3.0/gems/railties-4.2.10/lib/rails/commands/server.rb:80:in start’
/usr/src/app/vendor/bundle/ruby/2.3.0/gems/railties-4.2.10/lib/rails/commands/commands_tasks.rb:80:in block in server' /usr/src/app/vendor/bundle/ruby/2.3.0/gems/railties-4.2.10/lib/rails/commands/commands_tasks.rb:75:in tap’
/usr/src/app/vendor/bundle/ruby/2.3.0/gems/railties-4.2.10/lib/rails/commands/commands_tasks.rb:75:in server' /usr/src/app/vendor/bundle/ruby/2.3.0/gems/railties-4.2.10/lib/rails/commands/commands_tasks.rb:39:in run_command!’
/usr/src/app/vendor/bundle/ruby/2.3.0/gems/railties-4.2.10/lib/rails/commands.rb:17:in <top (required)>' bin/rails:4:in require’
bin/rails:4:in `’

Browser gives 500

Thanks in advance

are you trying to run multiple food coops on the same server or just one? (see the multi setting in config/app_config.yml).

i also suspect you may be running an out of date version, as the error no longer has the right line number. can you try checking it on the master branch - i see our last release was 3 years ago!

https://github.com/foodcoops/foodsoft/blob/master/lib/foodsoft_config.rb#L221

i recall having a similar issue. perhaps this will give you some clues. https://github.com/foodcoops/foodsoft/issues/634

i use postmarkapp.com to send email, i was going to send you a configuration example but i think i have customised it too much. if you can post your configuration file but instead of using XXXX replace with the something unique so the config still makes sense.

i did try the docker build a few times - and i can appreciate your frustration with the documentation. there are only a few developers working on this project, and our food-coop work are side projects (we all help run our own food-coops)

tom

Thank you for the reply!
I was trying this config:

Don’t forget to setup databases for each foodcoop. See also MULTI_COOP_INSTALL

multi_coop_install: false

If multi_coop_install you have to use a coop name, which you you wanna be selected by default

default_scope: ‘peter’

name of this foodcoop

name: peter

foodcoop contact information (used for FAX messages)

contact:
street: Zum Peter
zip_code: “12345”
city: Peterstadt
country: Deutschland
email: info@peter.de
phone: 12345678

Homepage

homepage: https://foodcoop.peter.de

foodsoft documentation URL

help_url: https://github.com/foodcoops/foodsoft/wiki/Doku

documentation URL for the apples&pears work system

applepear_url: https://github.com/foodcoops/foodsoft/wiki/Äpfel-u.-Birnen

custom foodsoft software URL (used in footer)

foodsoft_url: https://foodcoops.github.io

Default language

#default_locale: de

By default, foodsoft takes the language from the webbrowser/operating system.

In case you really want foodsoft in a certain language by default, set this to true.

When members are logged in, the language from their profile settings is still used.

#ignore_browser_locale: false

Default timezone, e.g. UTC, Amsterdam, Berlin, etc.

time_zone: Berlin

Currency symbol, and whether to add a whitespace after the unit.

currency_unit: €
currency_space: true

price markup in percent

price_markup: 2.0

default vat percentage for new articles

tax_default: 7.0

tolerance order option: If set to false, article tolerance values do not count

for total article price as long as the order is not finished.

tolerance_is_costly: false

Ordergroups, which have less than 75 apples should not be allowed to make new orders

Comment out this option to activate this restriction

#stop_ordering_under: 75

Comment out to completely hide apple points (be sure to comment stop_ordering_under)

use_apple_points: true

ordergroups can only order when their balance is higher than or equal to this

not fully enforced right now, since the check is only client-side

minimum_balance: 0

how many days there are between two periodic tasks

#tasks_period_days: 7

how many days upfront periodic tasks are created

tasks_upfront_days: 49

default order schedule, used to provide initial dates for new orders

(recurring dates in ical format; no spaces!)

#order_schedule:

ends:

recurr: FREQ=WEEKLY;INTERVAL=2;BYDAY=MO

time: ‘9:00’

# reference point, this is generally the first pickup day; empty is often ok

#initial:

When use_nick is enabled, there will be a nickname field in the user form,

and the option to show a nickname instead of full name to foodcoop members.

Members of a user’s groups and administrators can still see full names.

use_nick: false

Most plugins can be enabled/disabled here as well. Messages and wiki are enabled

by default and need to be set to false to disable. Most other plugins needs to

be enabled before they do anything.

use_wiki: true
use_messages: true

Base font size for generated PDF documents

pdf_font_size: 12

Page size for generated PDF documents

pdf_page_size: A4

Some documents (like group and article PDFs) can include page breaks

after each sublist.

pdf_add_page_breaks: true

Alternatively, this can be set for each document.

pdf_add_page_breaks:
order_by_groups: true
order_by_articles: true

Page footer (html allowed). Default is a Foodsoft footer. Set to blank for no footer.

#page_footer: FC Test is supported by Hoster.

Custom CSS for the foodcoop

#custom_css: ‘body { background-color: #fcffba; }’

Uncomment to add tracking code for web statistics, e.g. for Piwik. (Added to bottom of page)

#webstats_tracking_code: |

email address to be used as sender

email_sender: <%= ENV[‘EMAIL_SENDER’] %>

domain to be used for reply emails

reply_email_domain: peter.de

If your foodcoop uses a mailing list instead of internal messaging system

#mailing_list: list@example.org
#mailing_list_subscribe: list-subscribe@example.org

Config for the exception_notification plugin

notification:
error_recipients: <%= (ENV[‘ERROR_RECIPIENTS’] || ‘’).split %>
sender_address: <%= “\“Foodsoft Error\” <#{ENV[‘EMAIL_SENDER’]}>” %>
email_prefix: “[Foodsoft (latest)]”

http config for this host to generate links in emails (uses environment config when not set)

protocol: https
host: <%= ENV[‘HOSTNAME’] %>
#port: 3000

Access to sharedlists, the external article-database.

This allows a foodcoop to subscribe to a selection of a supplier’s full assortment,

and makes it possible to share data with several foodcoops. Using this requires installing

an additional application with a separate database.

#shared_lists: <%= ENV[‘SHAREDLISTS_DATABASE_URL’] %>

don’t remove this, required to run the app

production:
<<: *defaults

with from git master branch with the included dockerfile.

same error but i get a ssl error when loggin in with the admin user now so at least its trying to connect to the mail server. but this is a diffrent error.

ActionController::UrlGenerationError (No route matches {:action=>“new_password”, :controller=>“login”, :id=>1, :token=>“lifreshychafibirdywibigaxedudicaphafra”} missing required keys: [:foodcoop]):

this one is persistent.

I appreciate your work! Dokumentation is a difficult thing i know from some closed source projects, but there i get payed for writing it. So no offense from my side, only simply tried to not look to stupid while being to stupid to deploy a foodcoop.

best wishes in these difficult times

peter

Hey, that error message was also raised in https://github.com/foodcoops/foodsoft/issues/634. The work-around for now is to set multi_coop: true! This was fixed since then but I think a new release has to be made to make that available. I just went through a big fight with my foodsoft / mail server setup and now things are working, so I can help out.