Preview button doesn't work in studio

1,518 views
Skip to first unread message

Pan Luo

unread,
Dec 4, 2013, 9:09:36 PM12/4/13
to edx-...@googlegroups.com
Just installed fresh copy of edx. When I finish authoring the course, click on Preview button on the right hand side, an new tab popped up with an URL like this "courses/UBC/CS101/2014W1/courseware/0f0e6e59931945009168a5ff1f1450de/57ca8c29cd7f45ccb4681250bd7e130a/3". The server part is missing. Did I need to set up anything else?

BTW: I used a fresh copy of Ubuntu 12.04 and used the instruction here: https://github.com/edx/configuration/wiki/edX-Ubuntu-12.04-Installation


Any suggestion? Thanks.

Cheers,
Pan

Puntxo

unread,
Dec 5, 2013, 3:34:09 AM12/5/13
to edx-...@googlegroups.com
Hi Pan, yo need to put the server name in the PREVIEW_LMS_BASE variable, in cms.env.json and lmd.env.json files.

Regards
Javi

Pan Luo

unread,
Dec 5, 2013, 2:13:43 PM12/5/13
to edx-...@googlegroups.com
Thanks Javi. Got it working by setting PREVIEW_LMS_BASE. Strange it's not mentioned anywhere in the doc.

The next problem is preview server(process) is not up. I have no idea how to bring it up. Could you point it to me? Thanks.

Cheers,
Pan

Chris Dodge

unread,
Dec 5, 2013, 2:56:11 PM12/5/13
to edx-...@googlegroups.com
I'll add to the FAQ section.

Sukrit Kalra

unread,
Dec 6, 2013, 1:59:39 PM12/6/13
to edx-...@googlegroups.com
Hi!

I changed the JSON file, but the changes are not being reflected. What steps should I take now?

Thanks!

Pan Luo

unread,
Dec 6, 2013, 3:11:58 PM12/6/13
to Sukrit Kalra, edx-...@googlegroups.com

Restart the server? not sure if it is necessary but I did it.

Sukrit Kalra

unread,
Dec 6, 2013, 11:49:04 PM12/6/13
to edx-...@googlegroups.com, Sukrit Kalra
What would be the command to restart the server? I may need to do a couple of more changes too which require a restart, so I'm looking for a command to restart the services. 

Pan Luo

unread,
Dec 7, 2013, 1:02:36 AM12/7/13
to Sukrit Kalra, edx-...@googlegroups.com
I used the following command:
sudo /edx/bin/supervisorctl restart all

PS: I used the playbook to install the server. if you used different method, your path may be different.


Cheers,
Pan

billyb

unread,
Dec 10, 2013, 11:36:08 AM12/10/13
to edx-...@googlegroups.com, Sukrit Kalra
Hello,

I am having a similar problem with my preview. I used the same installation guide as Pan Luo. When I click the Preview button, I get forwarded to http://preview.edxpilot1.school.edu/courses/JamesBond/JB204/2014_T1/courseware/1a23228cc4c14c148c40571c2667c299/6ace17f9f87e4d73b7128b3e333adcca/1 however I get a 502 bad gateway error. This is what is in the nginx error logs:

2013/12/10 08:26:51 [error] 29762#0: *73578 connect() failed (111: Connection refused) while connecting to upstream, client: <CLIENT_IP>, server: preview.*, request: "GET /courses/JamesBond/JB204/2014_T1/courseware/1a23228cc4c14c148c40571c2667c299/6ace17f9f87e4d73b7128b3e333adcca/1 HTTP/1.1", upstream: "http://127.0.0.1:8020/courses/JamesBond/JB204/2014_T1/courseware/1a23228cc4c14c148c40571c2667c299/6ace17f9f87e4d73b7128b3e333adcca/1", host: "preview.edxpilot1.school.edu", referrer: "http://studio.edxpilot1.school.edu/unit/JamesBond.JB204.2014_T1/branch/draft/block/vertical414"

I also do not see anything listening on port 8020 in netstat.

Does anyone have any ideas as to why this is not working?

Thanks

amorcombe

unread,
Dec 10, 2013, 4:22:31 PM12/10/13
to edx-...@googlegroups.com
We are having the same issue with our install. I've updated all the files mentioned with the preview url. Our config is as follows:

/edx/app/edxapp/lms.env.json:        "PREVIEW_LMS_BASE": "preview.learn.domain.com",
/edx/app/edxapp/edx-platform/cms/envs/test.py:FEATURES['PREVIEW_LMS_BASE'] = "preview"
/edx/app/edxapp/edx-platform/cms/envs/devstack.py:FEATURES['PREVIEW_LMS_BASE'] = "preview." + LMS_BASE
/edx/app/edxapp/edx-platform/cms/envs/dev_shared_preview.py:FEATURES['PREVIEW_LMS_BASE'] = "preview.localhost:8000"
/edx/app/edxapp/edx-platform/cms/envs/dev.py:FEATURES['PREVIEW_LMS_BASE'] = "localhost:8000"
/edx/app/edxapp/edx-platform/cms/djangoapps/contentstore/views/component.py:        preview_lms_base = settings.FEATURES.get('PREVIEW_LMS_BASE')
/edx/app/edxapp/edx-platform/cms/djangoapps/contentstore/utils.py:            lms_base = settings.FEATURES.get('PREVIEW_LMS_BASE')
/edx/app/edxapp/cms.env.json:        "PREVIEW_LMS_BASE": "preview.learn.domain.com",

Our dns is set to learn.domain.com

Any attempts at a preview give page not found errors in the browser (specific code is "client closed request":

/edx/var/log/nginx/access.log-20131210:166.137.176.167 - - [10/Dec/2013:02:25:43 +0000] "GET /event?event_type=page_close&event=&page=http%3A%2F%2Flearn.domain.com%3A18000%2Fcourses%2FMyCourseLearn%2FWAPP101%2F2013f%2Fcourseware%2Fc4ad58cbd8a341ac859bc252ec39f5e6%2F6c925a37c53f4bc2ad7e78f6730dd3e0%2F HTTP/1.1" 499 0 "http://learn.domain.com:18000/courses/ApigeeLearn/WAPP101/2013f/courseware/c4ad58cbd8a341ac859bc252ec39f5e6/6c925a37c53f4bc2ad7e78f6730dd3e0/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36"

Definitely seems a config issue. Anyone have a working config that I can reference. Much thanks. 

amorcombe

unread,
Dec 11, 2013, 6:04:02 PM12/11/13
to edx-...@googlegroups.com
Further investigation revealed no connections established for port 8020. Restarting did not fix the issue. The outcome is that we see a 502 bad gateway when connecting to the underlying port (18020). If we scan the list of processes we see everything seemingly in order, but there is no gunicorn process spawned for preview. 

E.g., I would expect to see something like the following:

www-data 18936  0.0  0.2 156688 43984 ?        S    22:40   0:00 /edx/app/edxapp/venvs/edxapp/bin/python /edx/app/edxapp/venvs/edxapp/bin/gunicorn --preload -b 127.0.0.1:8020 -w 16 --timeout=300 --pythonpath=/edx/app/edxapp/lms-preview lms-preview.wsgi

So now the question is why this process isn't starting up (their should be 2 spawned if I'm reading the config correctly). Where would this startup failure typically be logged?

Philabian Lindo

unread,
Jan 7, 2014, 12:10:58 PM1/7/14
to edx-...@googlegroups.com
I had this problem and fixed it by setting these variables

PREVIEW_LMS_BASE
CMS_BASE
LMS_BASE

in cms.env.json and lms.env.json, then restarting using sudo /edx/bin/supervisorctl restart all

Ashwini Kumar

unread,
Dec 10, 2014, 8:57:53 AM12/10/14
to edx-...@googlegroups.com, amor...@apigee.com
you'l have to change
preview_lms_base
lms_base
cms_base
in the files cms.env.json & lms.env.json. Then restart both the services for the new config to be picked up.
Also, I got by, by hard-coding the actual url...in your case it would be learn.domain.com (not localhost or 0.0.0.0)
Reply all
Reply to author
Forward
0 new messages