syndicate-storage / syndicate

Internet-scale software-defined storage system
Apache License 2.0
56 stars 10 forks source link

Running MS Locally #14

Closed iychoi closed 11 years ago

iychoi commented 11 years ago

I have a question on running MS locally.

I ran the server and created a new volume.

But the status page shows that the volume I created is not activated.

How do I activate this volume?

and how do I register the UG? Is this the same as https://localhost/debug/setup/test?ug_action=create&username=bugsoda@gmail.com&ug_name=jsyndicatefs&ug_host=128.196.142.90&ug_port=32780

Thank you for your time

johnwhelchel commented 11 years ago

To activate it, you can go to it's volume settings page, type in the volume password and click 'activate'. Although currently, having the volume be inactive/active has no effect on it's actual behavior. I haven't yet created a UG handler for the MS, but looking at the code in ms/tests/setup.py, something similar to that should work. Try copy\pasting this into your browser when running MS locally.

localhost:8080/debug/setup/test?ug_action=create&username=bugsoda@gmail.com&ug_name=jsyndicatefs&ug_host=128.196.142.90&ug_port=32780

iychoi commented 11 years ago

What I saw was old version of MS front page. After I recompile MS, I could see that volume setting page and buttons :-) thanks

iychoi commented 11 years ago

I created Volume & activated it.

But when I tried to create UG, I met another problem.

I used below url to create UG, http://localhost:8080/debug/setup/test?ug_action=create&username=iychoi@email.arizona.edu&ug_name=jsyndicatefs&ug_host=localhost&ug_port=32780

I used planet lab ID as a username, but failed.

Here's return message.

Invalid username iychoi@email.arizona.edu

johnwhelchel commented 11 years ago

I just pushed a new system for creating UG's using POSTs to the url localhost:8080/syn/UG/create (or /delete). I've pasted some info on how it works. I'm also working on making it work temporarily with pure URL's ala what you did above, that should be done a little later today. Regarding the error you got, did you run the generic setup from before to ensure your username was in the db (did you login)? You can go to localhost:8000/ to view the admin page, and in the datastore viewer see what users are in the datastore.

To create a UG via the handler, you must already be logged in to a valid session (i.e. go to the home page and log in.) To send posts quickly and easily, I used the google chrome extension Postman (just until the URL version is up).

Create:

johnwhelchel commented 11 years ago

Ok I'm about to push the ability to create UG's with just a URL in the following format:

localhost:8080/syn/create///// localhost:8080/syn/delete//

iychoi commented 11 years ago

Nice, I'm going to test this new features :-)

johnwhelchel commented 11 years ago

Great, let me know if anything breaks!

johnwhelchel commented 11 years ago

Whoops that previous comment didn't render right.

create/volume_name/ug_name/ug_password/host/port delete/ug_name/ug_password

iychoi commented 11 years ago

When I create, I met this message

Forbidden (403) CSRF verification failed. Request aborted. Help Reason given for failure: CSRF cookie not set.

In general, this can occur when there is a genuine Cross Site Request Forgery, or when Django's CSRF mechanism has not been used correctly. For POST forms, you need to ensure: Your browser is accepting cookies. The view function uses RequestContext for the template, instead of Context. In the template, there is a {% csrf_token %} template tag inside each POST form that targets an internal URL. If you are not using CsrfViewMiddleware, then you must use csrf_protect on any views that use the csrf_token template tag, as well as those that accept the POST data. You're seeing the help section of this page because you have DEBUG = True in your Django settings file. Change that to False, and only the initial error message will be displayed. You can customize this page using the CSRF_FAILURE_VIEW setting.

I guess this is because cookie or session is not properly set.

I logged in and posted key-value pairs.

iychoi commented 11 years ago

After logged in, launching chrome extension (Postman) and sending new request doesn't use existing session that I made eairler.

johnwhelchel commented 11 years ago

Is this on local MS? I'm not getting the same issue. On Jul 2, 2013, at 4:55 PM, Illyoung Choi wrote:

After logged in, launching chrome extension (Postman) and sending new request doesn't use existing session that I made eairler.

— Reply to this email directly or view it on GitHub.

iychoi commented 11 years ago

Yeah, I think it's not the problem on code.

It's just a session problem. Let me test more.

johnwhelchel commented 11 years ago

If you want, comment out the four lines in ms/django_ug/views.py that say

@authenticate

to skip the session verification. You'll need to manually insert a username about three lines below in each case, however.

iychoi commented 11 years ago

hm.. commenting @authenticate doesn't help to solve authenticate problem.

I commented it and manually put my username to username variable.

Also I removed views.pyc file to remove precompiled module.

I don't know why I can't evade.

johnwhelchel commented 11 years ago

Are you still getting CSRF error or login error?

iychoi commented 11 years ago

It's CSRF error.

Hm.. do you know how to keep the session for continuous requests in POSTMAN extension?

iychoi commented 11 years ago

I meet slightly different CSRF error message after pull the last update.

I tried to create new UG through localhost:8080/syn/create and post parameters.

Here's detailed message.

Forbidden (403) CSRF verification failed. Request aborted. Help Reason given for failure: CSRF token missing or incorrect.

In general, this can occur when there is a genuine Cross Site Request Forgery, or when Django's CSRF mechanism has not been used correctly. For POST forms, you need to ensure: Your browser is accepting cookies. The view function uses RequestContext for the template, instead of Context. In the template, there is a {% csrf_token %} template tag inside each POST form that targets an internal URL. If you are not using CsrfViewMiddleware, then you must use csrf_protect on any views that use the csrf_token template tag, as well as those that accept the POST data. You're seeing the help section of this page because you have DEBUG = True in your Django settings file. Change that to False, and only the initial error message will be displayed. You can customize this page using the CSRF_FAILURE_VIEW setting.

johnwhelchel commented 11 years ago

You said you removed .pyc, no? The strange thing is that they are all marked csrf exempt, and I'm not getting the same error at all. It's also working fine for me right now on the live version, using different browsers. I'm about to push comparable code for creating AGs and RGs, using the same syntax. I'll try and make a GUI tonight or tomorrow morning at the latest so you can get past this and just manually make them. Sorry, Illyoung!

iychoi commented 11 years ago

@johnwhelchel New GUI was great help to solve the problem. Thank you John. Btw, I have another problem. While initialize the UG, how should I specify the local ms? I mean, it seems the MS opens ports 8080 (I guess), so I tried to put this port on ms_url parameter. But not working. I used this configuration for UG.

ms_url : http://localhost:8080 (should I put port 8080 to here?) user name : iychoi@email.arizona.edu password : sniff (is this user password? or UG password?) volume_name : SyndicateHadoop volume_secret : sniff port : 32780

And could you let me know the next update of MS, https://syndicate-metadata.appspot.com?

johnwhelchel commented 11 years ago

Great. I'm not sure what you mean by specify the local MS? If you're using the local MS gui, it is attached to the local MS. I can't recall if the GUI is on the live version or not, but if you do it there it's attached to the live version. The host and port parameter for making a UG is so that the MS knows how to talk to the UG, not the other way around. The password is for the UG, so you can modify UG settings and verify the UG is who it says it is when it talks to other UG's/MS. That's not very clear, I'll make that better. Yeah I will let you know, probably after dinner tonight!

iychoi commented 11 years ago

I should put MS url as a parameter while UG initialization.

Because I run MS locally, I put "http://localhost" to ms_url. But it seems UG can't reach to MS. If I don't provide port number to ms_url parameter, it means 80 port by default right?

johnwhelchel commented 11 years ago

The live app has been updated, btw. I think with port on localhost you should be using 8080, because that's what google app engine uses. On live I think you're right it should default to 80, but I don't think my creation UI let's you not specify.

I'm a little confused about the MS url you're talking about (perhaps @jcnelson can elaborate) but the MS is only storing the location of the UG for itself to be able to reach it. The UG creation tool on MS right now doesn't actually set one up on a slice somewhere; as far as I know the idea is a UG is started on a slice independently, and then it can notify the MS of its creation and parameters.