Bad Request (400) - AWS EC2

33 views
Skip to first unread message

seitam

unread,
Sep 17, 2017, 10:08:56 PM9/17/17
to opentreemap-user
Hello, 

I got stuck in the installation step number 7/8 of the wiki. I am running this OTM installation on a computer with different environment variables than the otm-vagrant. I am not sure if I have configured the upstart scripts correctly: 

If the services (ecoservice, celeryd, otm-unicorn and tiler) are initialized without modifications an error 502 appears on the localhost:80 and on the nginx log the following kind of errors appear: 

2017/09/17 23:38:53 [error] 9525#0: *36 connect() failed (111: Connection refused) while connecting to upstream, client: x.x.x.x, server: , request: "HEAD http://y.y.y.y:80/phpmyadmin2014/ HTTP/1.1", upstream: "http://127.0.0.1:12000/phpmyadmin2014/", host: "y.y.y.y"

Moreover, celeryd fails to start: 

Error: when performing "sudo celeryd restart" 
stop: unkown instance
start: Job failed to start

In order to solve these issues the following steps have been done:

First of all, I replaced the  line "start on vagrant-mounted" by "start on runlevel [2345]". 
Then, I added the Environment variables for tiler.conf and ecoservice.conf as follows:

description "OTM2 Map Tile Server"
start on runlevel [2345]
stop on shutdown
respawn
respawn limit 50 5

chdir /usr/local/tiler

env HOME="/home/ubuntu"
env OTM_DB_USER="MyUser"
env OTM_DB_PASSWORD="MyPass"
env OTM_DB_NAME="MyDbName"
env OTM_DB_HOST="localhost"
env OTM_DB_PORT="5432"
env OTM_CACHE_HOST="127.0.0.1"
env OTM_CACHE_PORT="6379"

exec node server.js

----

description "Eco benefit service"

start on runlevel [2345]
stop on shutdown

respawn
respawn limit 50 5

kill timeout 5

chdir /usr/local/ecoservice/ecoservice

env OTM_DB_USER="MyUser"
env OTM_DB_PASSWORD="MyPass"
env OTM_DB_NAME="MyDbName"
env OTM_DB_HOST="localhost"

exec ./ecobenefits 2>&1 1>/var/log/ecoservice


In addition, I had to remove the "setuid otm" from the celeryd.conf in order to obtain a clean start.

Now, when performing initialization of the services all of them run correctly:

$:/home/ubuntu# service redis-server restart
Stopping redis-server: redis-server.
Starting redis-server: redis-server.
$:/home/ubuntu# service otm-unicorn restart
otm-unicorn stop/waiting
otm-unicorn start/running, process 2843
$:/home/ubuntu# service celeryd restart
celeryd stop/waiting
celeryd start/running, process 2853
$:/home/ubuntu# service tiler restart
tiler stop/waiting
tiler start/running, process 2863
$:/home/ubuntu# service ecoservice restart
ecoservice stop/waiting
ecoservice start/running, process 2874


However, when accessing to the localhost:80 the Bad Request (400) error appears.
No error messages appear on the nginx server. 

Could anybody please shed some light about this issues?

Thank you,

seitam

unread,
Sep 18, 2017, 6:31:07 AM9/18/17
to opentreemap-user
Ok, I found my error. In case that anybody runs into the same problem:

The local_settings ALLOWED_HOSTS should include ("*", localhost) if the page wants to be accessible from over the world. 
Now I am getting an error when Google Maps loads, but I think that is related with the API Key (On the Installation steps no modification over the default installation value has been done). 

Thanks!

seitam

unread,
Sep 18, 2017, 7:39:27 AM9/18/17
to opentreemap-user
Just for completeness: the env variable GOOGLE_MAPS_KEY was missing on the /etc/init upstart scripts! Now it runs!

BR
Reply all
Reply to author
Forward
0 new messages