AWS でウェブサイトをセットアップしようとしましたが、問題なく実行eb init
しeb create
て設定を選択した後、次のエラーが発生しました。
エラー: [インスタンス: i-f8e3c005 モジュール: AWSEBAutoScalingGroup ConfigSet: null] インスタンスでコマンドが失敗しました。戻りコード: 1 出力: (TRUNCATED)...conn = _connect(dsn, connection_factory=connection_factory, async=async) django.db.utils.OperationalError: サーバーに接続できませんでした: 接続が拒否されました サーバーはホスト "localhost で実行されています" (127.0.0.1) ポート 5432 で TCP/IP 接続を受け入れますか?.
接続を拒否する理由はわかりませんが、セキュリティ設定に関係があると思われます。これは少し漠然としていますが、以前にこの問題に遭遇した人はいますか?どうやって最終的に解決しましたか?
完全な出力は次のとおりです。
INFO: createEnvironment is starting.
INFO: Using elasticbeanstalk-us-east-1-671186898336 as Amazon S3 storage bucket for environment data.
INFO: Created security group named: sg-96efb5f2
INFO: Created load balancer named: awseb-e-v-AWSEBLoa-12ABLMPELT72Q
INFO: Created security group named: awseb-e-v6mwzkkgjw-stack-AWSEBSecurityGroup-JEYPGZP3YJJG
INFO: Created Auto Scaling launch configuration named: awseb-e-v6mwzkkgjw-stack-AWSEBAutoScalingLaunchConfiguration-17DLMC0THMKW
INFO: Created Auto Scaling group named: awseb-e-v6mwzkkgjw-stack-AWSEBAutoScalingGroup-FBCJ1LFH8U38
INFO: Waiting for EC2 instances to launch. This may take a few minutes.
INFO: Created Auto Scaling group policy named: arn:aws:autoscaling:us-east-1:671186898336:scalingPolicy:9e2df788-3cee-4f47-917f-a11179972c69:autoScalingGroupName/awseb-e-v6mwzkkgjw-stack-AWSEBAutoScalingGroup-FBCJ1LFH8U38:policyName/awseb-e-v6mwzkkgjw-stack-AWSEBAutoScalingScaleDownPolicy-P6J45PB8N1XA
INFO: Created Auto Scaling group policy named: arn:aws:autoscaling:us-east-1:671186898336:scalingPolicy:e5a18684-1f95-446d-be29-ad560db7e3e6:autoScalingGroupName/awseb-e-v6mwzkkgjw-stack-AWSEBAutoScalingGroup-FBCJ1LFH8U38:policyName/awseb-e-v6mwzkkgjw-stack-AWSEBAutoScalingScaleUpPolicy-1IV5PENRNB785
INFO: Created CloudWatch alarm named: awseb-e-v6mwzkkgjw-stack-AWSEBCloudwatchAlarmHigh-K0258EMNK9O3
INFO: Created CloudWatch alarm named: awseb-e-v6mwzkkgjw-stack-AWSEBCloudwatchAlarmLow-15Z0Z4KVYDGEC
ERROR: [Instance: i-f8e3c005 Module: AWSEBAutoScalingGroup ConfigSet: null] Command failed on instance. Return code: 1 Output: (TRUNCATED)...conn = _connect(dsn, connection_factory=connection_factory, async=async)
django.db.utils.OperationalError: could not connect to server: Connection refused
Is the server running on host "localhost" (127.0.0.1) and accepting
TCP/IP connections on port 5432?.
EBExtension container_command 01_migrate failed. For more detail, check /var/log/eb-activity.log using console or EB CLI.
INFO: Command execution completed on all instances. Summary: [Successful: 0, Failed: 1].
INFO: Added EC2 instance 'i-f8e3c005' to Auto Scaling Group 'awseb-e-v6mwzkkgjw-stack-AWSEBAutoScalingGroup-FBCJ1LFH8U38'.
更新: eb-activity.log のコード
execute_from_command_line(sys.argv)
File "/opt/python/run/venv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 385, in execute_from_command_line
utility.execute()
File "/opt/python/run/venv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 354, in execute
django.setup()
File "/opt/python/run/venv/local/lib/python2.7/site-packages/django/__init__.py", line 21, in setup
apps.populate(settings.INSTALLED_APPS)
File "/opt/python/run/venv/local/lib/python2.7/site-packages/django/apps/registry.py", line 108, in populate
app_config.import_models(all_models)
File "/opt/python/run/venv/local/lib/python2.7/site-packages/django/apps/config.py", line 202, in import_models
self.models_module = import_module(models_module_name)
File "/usr/lib64/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/opt/python/bundle/2/app/paypaladaptive/models.py", line 126, in <module>
class Payment(PaypalAdaptive):
File "/opt/python/bundle/2/app/paypaladaptive/models.py", line 178, in Payment
def process(self, receivers, preapproval=None, **kwargs):
アップデート:
ニックの提案を試した後、同じエラーが発生しました:
ERROR: [Instance: i-d05e9b2f Module: AWSEBAutoScalingGroup ConfigSet: null] Command failed on instance. Return code: 1 Output: (TRUNCATED)...conn = _connect(dsn, connection_factory=connection_factory, async=async)
django.db.utils.OperationalError: could not connect to server: Connection refused
Is the server running on host "localhost" (127.0.0.1) and accepting
TCP/IP connections on port 5432?.
EBExtension container_command 01_migrate failed. For more detail, check /var/log/eb-activity.log using console or EB CLI.