Как я могу изменить wsgi.conf с AWS ElasticBeanstalk? - PullRequest
0 голосов
/ 10 апреля 2020

У меня проблемы с тем, что я не могу сохранить файлы, потому что в работе эластичного стебля отказано в разрешении. Группа WSGI не имеет разрешения на запись. Поэтому я хочу дать процессу wsgi право на запись.

Решение состоит в том, чтобы изменить wsgi.conf.

.ebextensions / 01_change_wsgi.config

container_commands:
  04_wsgireplace:
    command: "cp .ebextensions/wsgi.conf ../wsgi.conf"

Я сделал. ebextensions / wsgi.conf. У него есть опция umask.

LoadModule wsgi_module modules/mod_wsgi.so
WSGIPythonHome /opt/python/run/baselinenv
WSGISocketPrefix run/wsgi
WSGIRestrictEmbedded On

<VirtualHost *:80>

Alias /static/ /opt/python/current/app/static/
<Directory /opt/python/current/app/static/>
Order allow,deny
Allow from all
</Directory>


WSGIScriptAlias / /opt/python/current/app/application.py


<Directory /opt/python/current/app/>
  Require all granted
</Directory>

WSGIDaemonProcess my-wsgi processes=1 umask=0002 threads=15 display-name=%{GROUP} \
  python-home=/opt/python/run/venv/ \
  python-path=/opt/python/current/app user=my-wsgi group=my-wsgi \
  home=/opt/python/current/app
WSGIProcessGroup my-wsgi
</VirtualHost>

LogFormat "%h (%{X-Forwarded-For}i) %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined

После того, как я развернут, в /var/log/eb-activity.log.

[2020-04-10T10:53:36.631Z] INFO  [20557] - [Application update app-0955-200410_195235@43/AppDeployStage1] : Starting activity...
[2020-04-10T10:53:36.631Z] INFO  [20557] - [Application update app-0955-200410_195235@43/AppDeployStage1/AppDeployEnactHook] : Starting activity...
[2020-04-10T10:53:36.631Z] INFO  [20557] - [Application update app-0955-200410_195235@43/AppDeployStage1/AppDeployEnactHook/01flip.py] : Starting activity...
[2020-04-10T10:53:44.661Z] INFO  [20557] - [Application update app-0955-200410_195235@43/AppDeployStage1/AppDeployEnactHook/01flip.py] : Activity execution failed, because: httpd: stopped
  httpd: ERROR (abnormal termination)
  apache failed to start... killing all existing httpd processes and trying again
  httpd: no process found
  Semaphores owned by apache:
  Deleting apache semaphores:
  httpd: ERROR (already started)
  Traceback (most recent call last):
    File "/opt/elasticbeanstalk/hooks/appdeploy/enact/01flip.py", line 42, in <module>
      main()
    File "/opt/elasticbeanstalk/hooks/appdeploy/enact/01flip.py", line 36, in main
      config.restart_apache()
    File "/opt/elasticbeanstalk/hooks/config.py", line 251, in restart_apache
      apache_cmd('restart', should_be_running=True)
    File "/opt/elasticbeanstalk/hooks/config.py", line 258, in apache_cmd
      ensure_apache_is_running()
    File "/opt/elasticbeanstalk/hooks/config.py", line 280, in ensure_apache_is_running
      raise PythonHooksError("Apache is not running, but it's supposed to be.")
config.PythonHooksError: Apache is not running, but it's supposed to be. (ElasticBeanstalk::ExternalInvocationError)
caused by: httpd: stopped
  httpd: ERROR (abnormal termination)
  apache failed to start... killing all existing httpd processes and trying again
  httpd: no process found
  Semaphores owned by apache:
  Deleting apache semaphores:
  httpd: ERROR (already started)
  Traceback (most recent call last):
    File "/opt/elasticbeanstalk/hooks/appdeploy/enact/01flip.py", line 42, in <module>
      main()
    File "/opt/elasticbeanstalk/hooks/appdeploy/enact/01flip.py", line 36, in main
      config.restart_apache()
    File "/opt/elasticbeanstalk/hooks/config.py", line 251, in restart_apache
      apache_cmd('restart', should_be_running=True)
    File "/opt/elasticbeanstalk/hooks/config.py", line 258, in apache_cmd
      ensure_apache_is_running()
    File "/opt/elasticbeanstalk/hooks/config.py", line 280, in ensure_apache_is_running
      raise PythonHooksError("Apache is not running, but it's supposed to be.")
  config.PythonHooksError: Apache is not running, but it's supposed to be. (Executor::NonZeroExitStatus)


[2020-04-10T10:53:44.662Z] INFO  [20557] - [Application update app-0955-200410_195235@43/AppDeployStage1/AppDeployEnactHook/01flip.py] : Activity failed.
[2020-04-10T10:53:44.662Z] INFO  [20557] - [Application update app-0955-200410_195235@43/AppDeployStage1/AppDeployEnactHook] : Activity failed.
[2020-04-10T10:53:44.662Z] INFO  [20557] - [Application update app-0955-200410_195235@43/AppDeployStage1] : Activity failed.
[2020-04-10T10:53:44.662Z] INFO  [20557] - [Application update app-0955-200410_195235@43] : Completed activity. Result:

появляются сообщения об ошибках. Что делать?

...