bjnortier / shapesmith.deprecated

Open source HTML5 3D modelling
http://www.shapesmith.net
Other
160 stars 25 forks source link

What do I need to change to set it to a production enviroment? #72

Closed AdmiralOOM closed 11 years ago

AdmiralOOM commented 11 years ago

Hi, the tutorial listed is very good. Im actually able to install it with very little knowledge of Ubuntu (linux in general hehe)

I've installed it on a VPS, so I can not go to http://localhost:8000 to test it. It should be http://91.207.159.71:8000 but there is nothing there, and when I visit only the IP without :8000 it shows "Welcome to nginx!"

Could someone explain to me what I need to change? I see there are two different places with address info in them: ../nodes/start-session.sh

cd dirname $0 exec erl -config session -pa $PWD/apps//ebin $PWD/deps//ebin -name 'master@127.0.0.1' -s reloader -s lager -s worker_master -s worker -s api

and in ../nodes/session.config [{api, [{auth_module, api_session_auth}, {port, 8002}, {host, "http://session.shapesmith.net:8002"}]}].

Which brings me to my next question, is it possible to authenticate the users up towards the Drupal 7 user database?

bjnortier commented 11 years ago

The session config uses session authentication (i.e. a user needs to create an account and sign in). That's what the config line

{auth_module, api_session_auth}

means. Compare that to the default (in nodes/apps/api/src/api.app.src):

{auth_module, api_local_auth}

which uses no authentication for users.

The {host, ...} configuration specifies the redirect url that a user will be sent to of they access anything and they are not logged in.

I.e. what you can do is change is {host, "http://91.207.159.71:8000"} and the port should be the same. i.e. {port. 8000}.

That implies that you have port 8000 open on your VPS. Sounds like you're running nginx on that machine, so a standard deployment configuration is to run nginx and have a reverse proxy to the application. Then the {host, ...} value would not have the port at the end.

For example, the nginx config for cloud.shapesmith.net is:

server {

    location / {
        proxy_pass http://127.0.0.1:8002/;
    }

}

and the config is

{api, [{auth_module, api_session_auth}, {port, 8002}, {host, "https://cloud.shapesmith.net"}

which means when a user goed to http://cloud.shapesmith.net, the request is actually forwarded onto the application running on port 8002.

You can test that the application is running on the VPS with curl, i.e.

$ curl http://localhost:8002

On the Drupal auth - If you want to authenticate users to a different system, you will need to write an authentication module similar to api_session_auth.erl. So yes in theory the authentication system is pluggable, but someone would need to write a module for that system....

AdmiralOOM commented 11 years ago

Thank you for answer :)

However, I am now getting this error

Uncaught error in rebar_core: {'EXIT',{{badmatch,{error,badfile}}, [{rebar_core,select_modules,3}, {rebar_core,acc_modules,4}, {rebar_core,process_dir0,6}, {rebar_core,process_dir,4}, {rebar_core,process_each,5}, {rebar_core,process_dir0,6}, {rebar_core,process_dir,4}, {rebar_core,process_commands,2}]}}

When running $ ./rebar compile eunit ct skip_deps=true

I've tried googling a correct answer to fix this, but alas no luck. Do you have any points I could try out?

bjnortier commented 11 years ago

Yes. The rebar that is packages with shapesmith doesn't always work on other environments, since version of Erlang may differ or there could be platform differences.

Try downloading it from here: https://github.com/basho/rebar

Or if that doesn't work, build it and replace the 'rebar' executable with the new one. Let me know if it works so I can update the install instructions

AdmiralOOM commented 11 years ago

Hi. The https://github.com/basho/rebar worked good. But after fixing that issue, we found out that the erlang that comes with the build was also wrong. Anyway, we have it set up now at www.youblob.com :)