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

tutorial deployment fails #145

Closed
metaperl opened this issue Oct 21, 2018 · 8 comments
Closed

tutorial deployment fails #145

metaperl opened this issue Oct 21, 2018 · 8 comments
Labels
Milestone

Comments

@metaperl
Copy link
Contributor

The deployment tutorial

first fails because reahl.mailutil is not provided. I think I can fix this by adding a new dep and re-uploading.

(helloanywhere) 14:02 ~ $ reahl createdb etc
Traceback (most recent call last):
  File "/home/schemelab/.virtualenvs/helloanywhere/bin/reahl", line 11, in <module>
    sys.exit(ReahlCommandline.execute_one())
  File "/home/schemelab/.virtualenvs/helloanywhere/lib/python3.5/site-packages/reahl/component/shelltools.py", line 208, in execute_one
    result = cls().do(sys.argv[1:])
  File "/home/schemelab/.virtualenvs/helloanywhere/lib/python3.5/site-packages/reahl/component/shelltools.py", line 110, in do
    return self.execute(args)
  File "/home/schemelab/.virtualenvs/helloanywhere/lib/python3.5/site-packages/reahl/component/shelltools.py", line 234, in execute
    return super(ReahlCommandline, self).execute(args)
  File "/home/schemelab/.virtualenvs/helloanywhere/lib/python3.5/site-packages/reahl/component/shelltools.py", line 169, in execute
    return command.do(args.command_args)
  File "/home/schemelab/.virtualenvs/helloanywhere/lib/python3.5/site-packages/reahl/component/shelltools.py", line 110, in do
    return self.execute(args)
  File "/home/schemelab/.virtualenvs/helloanywhere/lib/python3.5/site-packages/reahl/commands/prodshell.py", line 172, in execute
    super(CreateDB, self).execute(args)
  File "/home/schemelab/.virtualenvs/helloanywhere/lib/python3.5/site-packages/reahl/commands/prodshell.py", line 41, in execute
    self.create_context(args.config_directory)
  File "/home/schemelab/.virtualenvs/helloanywhere/lib/python3.5/site-packages/reahl/commands/prodshell.py", line 46, in create_context
    self.context = ExecutionContext.for_config_directory(config_directory)
  File "/home/schemelab/.virtualenvs/helloanywhere/lib/python3.5/site-packages/reahl/component/context.py", line 44, in for_config_directory
    config.configure()
  File "/home/schemelab/.virtualenvs/helloanywhere/lib/python3.5/site-packages/reahl/component/config.py", line 281, in configure
    self.configure_components()
  File "/home/schemelab/.virtualenvs/helloanywhere/lib/python3.5/site-packages/reahl/component/config.py", line 298, in configure_components
    egg.read_config(self)
  File "/home/schemelab/.virtualenvs/helloanywhere/lib/python3.5/site-packages/reahl/component/eggs.py", line 135, in read_config
    config.read(self.configuration_spec)
  File "/home/schemelab/.virtualenvs/helloanywhere/lib/python3.5/site-packages/reahl/component/config.py", line 320, in read
    exec(compile(f.read(), file_path, 'exec'), globals(), locals_dict)
  File "etc/web.config.py", line 4, in <module>
    from helloanywhere import HelloUI
  File "/home/schemelab/.virtualenvs/helloanywhere/lib/python3.5/site-packages/helloanywhere.py", line 4, in <module>
    from reahl.web.ui import HTML5Page, P
  File "/home/schemelab/.virtualenvs/helloanywhere/lib/python3.5/site-packages/reahl/web/ui.py", line 42, in <module>
    from reahl.mailutil.rst import RestructuredText
ImportError: No module named 'reahl.mailutil'
(helloanywhere) 14:04 ~ $ 
@metaperl
Copy link
Contributor Author

The next reason for failure is:

reahl.component.config.ConfigurationException: mail.smtp_port in /home/schemelab/etc/mailutil.config.py is using a dangerous default setting: 8025

I'm tracking down why it thinks port 8025 is dangerous.

@metaperl
Copy link
Contributor Author

metaperl commented Oct 21, 2018

The reported directory for mailutil.config.py (/home/schemelab/etc/mailutil.config.py) is incorrect - there is no such file in ~/etc/ on my pythonanywhere virtual machine.

2018-10-21 14:21:33,915: Error running WSGI application
2018-10-21 14:21:33,967: reahl.component.config.ConfigurationException: mail.smtp_port in /home/schemelab/etc/mailutil.config.py is using a dangerous default setting: 8025
2018-10-21 14:21:33,967:   File "/var/www/schemelab_pythonanywhere_com_wsgi.py", line 5, in <module>
2018-10-21 14:21:33,967:     application = ReahlWSGIApplication.from_directory('%s/etc' % os.environ['HOME'])
2018-10-21 14:21:33,968: 
2018-10-21 14:21:33,968:   File "/home/schemelab/.virtualenvs/helloanywhere/lib/python3.5/site-packages/reahl/web/fw.py", line 2589, in from_directory
2018-10-21 14:21:33,968:     config.configure()
2018-10-21 14:21:33,968: 
2018-10-21 14:21:33,968:   File "/home/schemelab/.virtualenvs/helloanywhere/lib/python3.5/site-packages/reahl/component/config.py", line 283, in configure
2018-10-21 14:21:33,969:     self.validate_components()
2018-10-21 14:21:33,969: 
2018-10-21 14:21:33,969:   File "/home/schemelab/.virtualenvs/helloanywhere/lib/python3.5/site-packages/reahl/component/config.py", line 304, in validate_components
2018-10-21 14:21:33,969:     egg.validate_config(self)
2018-10-21 14:21:33,970: 
2018-10-21 14:21:33,970:   File "/home/schemelab/.virtualenvs/helloanywhere/lib/python3.5/site-packages/reahl/component/eggs.py", line 139, in validate_config
2018-10-21 14:21:33,970:     config.validate_required(self.configuration_spec)
2018-10-21 14:21:33,970: 
2018-10-21 14:21:33,971:   File "/home/schemelab/.virtualenvs/helloanywhere/lib/python3.5/site-packages/reahl/component/config.py", line 356, in validate_required
2018-10-21 14:21:33,971:     src_config.validate_contents(full_filename, composite_key, self.in_production)
2018-10-21 14:21:33,971: 
2018-10-21 14:21:33,971:   File "/home/schemelab/.virtualenvs/helloanywhere/lib/python3.5/site-packages/reahl/component/config.py", line 196, in validate_contents
2018-10-21 14:21:33,972:     raise ConfigurationException('%s in %s is using a dangerous default setting: %s' % (composite_name, filename, config_item.default))
2018-10-21 14:21:33,972: ***************************************************
2018-10-21 14:21:33,973: If you're seeing an import error and don't know why,
2018-10-21 14:21:33,973: we have a dedicated help page to help you debug: 
2018-10-21 14:21:33,973: https://help.pythonanywhere.com/pages/DebuggingImportError/
2018-10-21 14:21:33,973: ***************************************************

@metaperl
Copy link
Contributor Author

Removing the strict_validation check in reahl/component/config.py allows the default application to serve - http://schemelab.pythonanywhere.com/

But there are some TODO ITEMS HERE:

  1. reahl-mailutil should have been a part of the project file
  2. the reported directory for the configuration file is incorrect.

Until these are fixed, please do not close this.

@metaperl
Copy link
Contributor Author

How do you configure the mailport to avoid this error. Specifically:

  1. what port to use?
  2. what file to configure this in
  3. what exact syntax to use in that file to configure it.

@IwanVosloo
Copy link
Member

IwanVosloo commented Oct 21, 2018

Ok, the file it reports is the correct filename even though it is not there. It assumes default settings when the file is not there, or when the specific setting is not set in the file.

So, to fix, you just need to create the config file and specify that setting.

It thinks 8025 is dangerous because that is the default value and it is a default chosen for use in development, normally you'd use 25 in prod. But what you decide to set it to does not matter at all. It will shut up if you just give it any value.

The exact syntax would be:
mail.smtp_port = 8025
(or any number you want...with the assumption an smtp server is listening on that port)

I forgot - we made it actually break instead of just giving a warning when it determines that you are in production.

@IwanVosloo
Copy link
Member

There are issues now to deal with what came out of this, but I am leaving this issue here (and marking it as a bug) so that reahl-mailutil can be added to that example.

@craig-reahl
Copy link
Member

craig-reahl commented Nov 13, 2018

The problem is not with the deployment examples. The problem is that reahl.web.ui imports RestructuredText from reahl.mailutil

image

Either add a runtime dependency or move the ReStructuredText class elsewhere (reahl.component?)

@IwanVosloo
Copy link
Member

Ok, I get it, so we need to add a dependency from reahl-web to reahl-mailutil...

IwanVosloo added a commit that referenced this issue Nov 22, 2018
…-web-145

fixes #145 - moved reahl.mailutil from test to run dependency as required
@IwanVosloo IwanVosloo modified the milestones: 4.1, 4.0.3 Nov 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants