That's great to know. Thanks Vincent!

- Cyrus

On Wed, Nov 22, 2017 at 9:19 AM, Vincent Meijer <[email protected]>
wrote:

> For future reference (but not yet directly relevant for Andy's use case):
>
> If you run AWS EC2 instances behind an Elastic Load Balancer, you also
> need to add the EC2 instance's private IP (and potentially its public
> hostname) to the ALLOWED_HOSTS setting.
> This is because the load balancer uses the private IP to address your EC2
> instances for health checks, instead of the hostname you chose.
>
> Here is how to do that. Simply add this to your settings.py:
>
> # Fix for AWS ELB returning false bad health: ELB contacts EC2 instances
> through their private ip.
> # An AWS service is called to get this private IP of the current EC2 node.
> Then the IP is added to ALLOWS_HOSTS so that Django answers to it.
> EC2_PRIVATE_IP = None
> try:
> EC2_PRIVATE_IP = requests.get('http://169.254.169.254/latest/meta-data/
> local-ipv4', timeout=0.01).text
> except requests.exceptions.RequestException:
> pass
> if EC2_PRIVATE_IP:
> ALLOWED_HOSTS.append(EC2_PRIVATE_IP)
> EC2_PUBLIC_HOSTNAME = None
> try:
> EC2_PUBLIC_HOSTNAME = requests.get('http://169.254.
> 169.254/latest/meta-data/public-hostname', timeout=0.01).text
> except requests.exceptions.RequestException:
> pass
> if EC2_PUBLIC_HOSTNAME:
> ALLOWED_HOSTS.append(EC2_PUBLIC_HOSTNAME)
>
>
>
> On Wednesday, 8 November 2017 12:42:58 UTC-5, Adam Cox wrote:
>>
>> Hey Andy, that's great, glad to hear it's working well. Good note about
>> the Projects folder too. It is a small detail, but could trip someone up
>> for a minute if they are looking for an exact replica of the installation
>> instructions.
>>
>> Adam
>>
>> On Wed, Nov 8, 2017 at 10:53 AM, Andy Graham <[email protected]> wrote:
>>
>>> Thanks much Adam, very helpful.
>>>
>>> The AMI worked great and didn't have any issues once I updated.  Only
>>> thing I would point out is that the AMI doesn't nest the arches and ENV
>>> folder in a Projects folder as recommended in the installation
>>> instructions.  Not that big of a deal, just thought I would point it out.
>>> Once again, thanks for the help.
>>>
>>> Andy
>>>
>>> On Tuesday, November 7, 2017 at 4:26:38 PM UTC-8, Adam Cox wrote:
>>>>
>>>> Hey Andy, great question. ALLOWED_HOSTS is actually a variable that you
>>>> can define in your settings.py or settings_local.py file. It should be a
>>>> list, so something like
>>>>
>>>> ALLOWED_HOSTS = ["12.34.56.78","arches4.andygraham.com"]
>>>>
>>>> would be a valid entry. You can also use ["*"] to allow all hosts. Not
>>>> recommended for production of course, but could get past a the problem in a
>>>> pinch if you ip or domain is changing a lot...
>>>>
>>>> I am glad to hear you were able to use that AMI. I made it a while ago,
>>>> so it could probably stand some updates. Let me know if you find any
>>>> problems with dependencies and such.
>>>>
>>>> Adam
>>>>
>>>> On Nov 7, 2017 4:53 PM, "Andy Graham" <[email protected]> wrote:
>>>>
>>>>> Attempted to install Arch V4 to test out some of the features.  Set up
>>>>> an instance on AWS, downloaded the Arches 4 community instance that I 
>>>>> think
>>>>> Adam put up there a while ago.  Once that was set up I went through and 
>>>>> and
>>>>> followed the Developer Installation instruction to make sure everything 
>>>>> was
>>>>> up to date and set up correctly.  I then ran the runsever command, went to
>>>>> the website (public IP:8000) and got an error page that said
>>>>> "DisallowedHost at /    Invalid HTTP_HOST header: 'xx.xx.xx.xx.:8000'. You
>>>>> may need to add u'xx.xx.xx.xx' to ALLOWED_HOSTS.", with the xx as my 
>>>>> public
>>>>> IP.  Based on additional information I went to the request.py file in
>>>>> ENV/lib/python2.7/site-packages/django/http and edited the
>>>>> "allowed_hosts" on line 102 to include my IP.  Everything worked fine 
>>>>> after
>>>>> that but I am guessing that this isn't standard protocol.  Any suggestions
>>>>> on what I did wrong and how to fix it so I don't have to add that info 
>>>>> when
>>>>> spin up another instance?  Thanks.
>>>>>
>>>>> Andy
>>>>>
>>>>> --
>>>>> -- To post, send email to [email protected]. To unsubscribe,
>>>>> send email to [email protected]. For more information,
>>>>> visit https://groups.google.com/d/forum/archesproject?hl=en
>>>>> ---
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "Arches Project" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>>> an email to [email protected].
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>> --
>>> -- To post, send email to [email protected]. To unsubscribe,
>>> send email to [email protected]. For more information,
>>> visit https://groups.google.com/d/forum/archesproject?hl=en
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "Arches Project" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> --
> -- To post, send email to [email protected]. To unsubscribe,
> send email to [email protected]. For more
> information, visit https://groups.google.com/d/forum/archesproject?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Arches Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- To post, send email to [email protected]. To unsubscribe, send 
email to [email protected]. For more information, 
visit https://groups.google.com/d/forum/archesproject?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Arches Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to