Skip to content
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.

Database routes are incorrect or missing custom port. #802

Closed
SheriefAlaa opened this issue Nov 14, 2016 · 4 comments
Closed

Database routes are incorrect or missing custom port. #802

SheriefAlaa opened this issue Nov 14, 2016 · 4 comments

Comments

@SheriefAlaa
Copy link

Expected behavior:

To login into Hospital run.

Actual behavior:

jquery.js:9536 POST http://10.4.4.58/db/_session 404 (Not Found).

Steps to reproduce:

Setup couchdb, change the ip and port (mine are 10.4.4.58:8888)
edit server/config.js to have something similar to this:

  couchDbServer: '10.4.4.58',
  couchDbPort: '8888',
  couchDbUseSsl: false,
  couchDbChangesSince: 'now',
  couchAdminUser: 'sherief',
  couchAdminPassword: '991199',
  googleClientId: 'FOR GOOGLE SSO; GOOGLE CLIENT ID GOES HERE',
  googleClientSecret: 'FOR GOOGLE SSO; GOOGLE CLIENT SECRET GOES HERE',
  serverPort: '4200',
  server: '10.4.4.58',
  useGoogleAuth: false,
  useSSL: false

Setup Hospital run (that includes ./script/initcouch.sh sherief 991199 which was successful), build it, run it through nginx.

OS and Browser:

Vagrant/Ubuntu 14.04, Chrome.

@jkleinsc
Copy link
Member

@SheriefAlaa I just tested this and it works correctly for me. The one thing that stands out for me is that the POST is going to port 80 instead of port 4200? According to your config, your app is running on port 4200, so the post to the DB should be http://10.4.4.58:4200/db/_session

Can you further debug this issue by adding the following lines to the bottom of your config.js?

console.log('CouchDB URL:'+config.couchDbURL);
console.log('CouchAuthDbURL URL:'+config.couchAuthDbURL);
console.log('Server URL: '+config.serverURL);

One you startup your app (eg ember serve), you should see output similar to the following:

CouchDB URL:http://localhost:8888
CouchAuthDbURL URL:http://hradmin:test@localhost:8888
Server URL: http://localhost:4200
Livereload server on http://localhost:49152
Serving on http://localhost:4200/

Build successful - 20031ms.

Also make sure you wait until you see the "Build successful" message before trying to login. This build can take a while and if you try to login before the build is complete, it won't work.

@SheriefAlaa
Copy link
Author

@jkleinsc Using ember serve I was able to run Hospital Run but when I logged in there was nothing to do. I clicked the + sign next to Hospital Run and nothing happened. Also, the nav left nav bar has no elements.

Here's the output of the console.log messages:

CouchDB URL:http://10.4.4.58:8888
CouchAuthDbURL URL:http://sherief:[email protected]:8888
Server URL: http://10.4.4.58:80
Livereload server on http://localhost:49152
Serving on http://localhost:4200/

I have provided few screenshots to clarify:
https://www.dropbox.com/sh/vi4sea2fk87w8de/AAB9Ctw2lz7vVw8eo6bhq88Sa?dl=0

Question: I am eventually going to run Hospital run on a production server that has another existing app that uses nginx. I will use the same nginx site to run both apps, give Hospital-run a location and point it to a directory. Which version should I use? frontend (take dist/, install CouchDB) or use Hospitalrun-server?

Thanks for your help so far.

@jkleinsc
Copy link
Member

@SheriefAlaa you should use https://github.com/HospitalRun/hospitalrun-server for production use. It uses node.js for the webserver but if you really want to run it through nginx I'm sure you could proxy it through nginx. https://github.com/HospitalRun/hospitalrun-frontend is just the frontend of HospitalRun and really you only should be running ember serve for development purposes.

As far as you particular issue is concerned, the problem is you changed serverPort to 80, but ember serve defaults to port 4200. If you want to run ember serve on port 80, with server 10.4.4.58, use the following command: sudo ember serve --port 80 --host 10.4.4.58

When you do that in your output you should see:

Server URL: http://10.4.4.58:80
Livereload server on http://localhost:49152
Serving on http://10.4.4.58:80/

@SheriefAlaa
Copy link
Author

SheriefAlaa commented Nov 14, 2016

@jkleinsc Alright, thanks a ton for your timely replies.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants