0

I can run it on dev mode but not in production mode.

I can't see any errors from the error log and the access log

Why dev works, not production?

boss version: 0.8.15

The last line in the console

2016-05-28 16:00:08.538 [info] <0.7.0> Application lager started on node letsparty@localhost
2016-05-28 16:00:08.554 [info] <0.59.0> Starting Boss in production mode....

2016-05-28 16:00:08.562 [info] <0.59.0>@boss_db:start:77 Start Database Adapter boss_db_adapter_riaks2 options [{adapter,riaks2},{cache_enable,false},{cache_prefix,db},{shards,[]},{is_master_node,true},{db_host,"127.0.0.1"},{db_port,8087}]
2016-05-28 16:00:08.635 [info] <0.59.0> Starting master services on letsparty@localhost

2016-05-28 16:00:08.672 [info] <0.7.0> Application tinymq started on node letsparty@localhost
2016-05-28 16:00:08.715 [info] <0.59.0> SSL:[{cacertfile,"ssl/cacert.pem"},{certfile,"ssl/newcert.pem"},{keyfile,"ssl/privkey.pem"},{verify,verify_peer},{fail_if_no_peer_cert,false},{ciphers,[{rsa,aes_128_cbc,sha}]}]

2016-05-28 16:00:08.724 [info] <0.59.0> Starting cowboy... on letsparty@localhost

2016-05-28 16:00:08.733 [info] <0.7.0> Application cowlib started on node letsparty@localhost
2016-05-28 16:00:08.746 [info] <0.7.0> Application ranch started on node letsparty@localhost
2016-05-28 16:00:08.770 [info] <0.7.0> Application cowboy started on node letsparty@localhost
2016-05-28 16:00:08.770 [info] <0.59.0> Starting http listener... on 0.0.0.0:8444 

2016-05-28 16:00:08.777 [notice] <0.71.0>@lager_app:132 Deprecated lager_file_backend config detected, please consider updating it
2016-05-28 16:00:08.824 [info] <0.262.0>@boss_db:start:77 Start Database Adapter boss_db_adapter_riaks2 options [{adapter,riaks2},{cache_enable,false},{cache_prefix,db},{shards,[]},{is_master_node,true},{db_host,"127.0.0.1"},{db_port,8087}]
2016-05-28 16:00:08.844 [info] <0.412.0>@boss_db:start:77 Start Database Adapter boss_db_adapter_riaks2 options [{adapter,riaks2},{cache_enable,false},{cache_prefix,db},{shards,[]},{is_master_node,true},{db_host,"127.0.0.1"},{db_port,8087}]
2016-05-28 16:00:08.864 [info] <0.562.0>@boss_db:start:77 Start Database Adapter boss_db_adapter_riaks2 options [{adapter,riaks2},{cache_enable,false},{cache_prefix,db},{shards,[]},{is_master_node,true},{db_host,"127.0.0.1"},{db_port,8087}]
2016-05-28 16:00:08.880 [info] <0.712.0>@boss_db:start:77 Start Database Adapter boss_db_adapter_riaks2 options [{adapter,riaks2},{cache_enable,false},{cache_prefix,db},{shards,[]},{is_master_node,true},{db_host,"127.0.0.1"},{db_port,8087}]
2016-05-28 16:00:08.893 [info] <0.862.0>@boss_db:start:77 Start Database Adapter boss_db_adapter_riaks2 options [{adapter,riaks2},{cache_enable,false},{cache_prefix,db},{shards,[]},{is_master_node,true},{db_host,"127.0.0.1"},{db_port,8087}]
2016-05-28 16:00:08.908 [info] <0.1012.0>@boss_db:start:77 Start Database Adapter boss_db_adapter_riaks2 options [{adapter,riaks2},{cache_enable,false},{cache_prefix,db},{shards,[]},{is_master_node,true},{db_host,"127.0.0.1"},{db_port,8087}]
2016-05-28 16:00:08.927 [info] <0.1162.0>@boss_db:start:77 Start Database Adapter boss_db_adapter_riaks2 options [{adapter,riaks2},{cache_enable,false},{cache_prefix,db},{shards,[]},{is_master_node,true},{db_host,"127.0.0.1"},{db_port,8087}]
2016-05-28 16:00:08.944 [info] <0.1312.0>@boss_db:start:77 Start Database Adapter boss_db_adapter_riaks2 options [{adapter,riaks2},{cache_enable,false},{cache_prefix,db},{shards,[]},{is_master_node,true},{db_host,"127.0.0.1"},{db_port,8087}]
2016-05-28 16:00:08.961 [info] <0.1462.0>@boss_db:start:77 Start Database Adapter boss_db_adapter_riaks2 options [{adapter,riaks2},{cache_enable,false},{cache_prefix,db},{shards,[]},{is_master_node,true},{db_host,"127.0.0.1"},{db_port,8087}]
2016-05-28 16:00:08.980 [info] <0.1612.0>@boss_db:start:77 Start Database Adapter boss_db_adapter_riaks2 options [{adapter,riaks2},{cache_enable,false},{cache_prefix,db},{shards,[]},{is_master_node,true},{db_host,"127.0.0.1"},{db_port,8087}]

It is trying to connect to riak database but it seems hanging. How can I debug this, why this works on dev mode?

Hao
  • 6,291
  • 9
  • 39
  • 88
  • This suggests that the IP/port on which the production installation is configured to listen on can't be opened by inets. I would probably add some lager logging and enable debug level as it would then log which applications and supervisors have been started properly. – Greg May 21 '16 at 09:44
  • It's the same machine.Boss production just run with "./init.sh start" – Hao May 21 '16 at 19:15
  • It's quite difficult to answer this question without some additional information. Can you access the shell? Can you query which applications are running, e.g. `application:which_applications().`? Can you add logs and see if there are any crashes? Can you post the command with arguments used to start the node in dev/production? – Greg May 21 '16 at 19:44
  • true. I changed the code to read a file from local disk. So it's not the problem of the inets. Something wrong with the connection to the riak database. Anything related to permissions? I have been messing around with the permissions - so when dev, I run as me, but on production, it might run by another user since it's spawning a new process by .... – Hao May 22 '16 at 10:00
  • OK, which riak client are you using? Can you enable logs in either the client, or riak, or both? Very likely permission errors will already be logged to one of the system files in `/var/log` (or equivalent on your OS). – Greg May 22 '16 at 11:18
  • Seem failing to connect to database. Please see the log in Boss. There is nothing in the riak log. Maybe it's never hitting Riak db at all. But why in Boss dev mode (run by init-dev.sh), it's still fine with everything. So strange. Why production running cannot connect to riak. I recompiled the adapter and restarted riak but still no go. – Hao May 28 '16 at 09:24
  • Try to change adapter back to mock. Same. Cannot connect to db in production mode. dev is ok. – Hao May 28 '16 at 09:34
  • Is `8087` port open? `netstat -an | grep 8087`? Maybe checking all listening ports `netstat -an` will tell you something? Try to check if the riak port responds, e.g. `telnet -N 127.0.0.1 8087` – Greg May 28 '16 at 13:00

1 Answers1

0

I finally found the answer to problem. It's a bug I introduced. In boss template files, I extended a parent template file which later I changed its name during development, before this release.

Even so, I run init-dev.sh OK and compile to go production all right. The only log I see is that boss can't connect to database.

Finally I start to reassemble all my code piece by piece to see at what point, boss refuses me to go production. After couple of hours trying, I finally found that template file. Actually, just try to remove some files in the src/view/lib/tag_html/ if you are using them, you got the same log.

Bad experience. Why when I compile using ./rebar compile it didn't check the template file doesn't really exist.

The template thing is not Erlang but more of boss thingy I guess.

Hao
  • 6,291
  • 9
  • 39
  • 88