Re: [web2py] Re: Server error when accessing admin

2020-05-01 Thread Ian W. Scott
Okay, I'm narrowing down what the problem might be. The site is presently 
using webfaction's shared SSL certificate for https, which browsers don't 
recognize as secure. Could that be causing the admin interface to throw the 
500 error?



On Thursday, April 30, 2020 at 3:02:58 PM UTC-4, Ian W. Scott wrote:
>
> Unfortunately I don't know anything about nginx. I've always worked with 
> apache2. Can anyone suggest how to debug this? I'm really at the end of my 
> rope here.
>
> On Thursday, April 30, 2020 at 10:37:58 AM UTC-4, Ian W. Scott wrote:
>>
>> Thanks very much
>>
>> Ian W. Scott, PhD
>> Associate Professor of New Testament
>> Tyndale Seminary, Toronto, Canada
>> www.ianwscott.com
>> *Paul's Way of Knowing: Story Experience and the Spirit* (Baker Academic 
>> [Mohr Siebeck], 2006)
>> *The Online Critical Pseudepigrapha* (SBL, 2006-; pseudepigrapha.org)
>> Sent from Mailspring, the best free email app for work
>> On Apr 30 2020, at 10:33 am, 'Annet' via web2py-users <
>> web2py@googlegroups.com> wrote:
>>
>> Hi Ian,
>>
>> I do have a copy of the script, it's a bit old, but I'll attach
>> it anyway, maybe it's of help.
>>
>>
>> Kind regards,
>>
>> Annet
>>
>> --
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> ---
>> You received this message because you are subscribed to a topic in the 
>> Google Groups "web2py-users" group.
>> To unsubscribe from this topic, visit 
>> https://groups.google.com/d/topic/web2py/kWdHdAv2jj0/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to 
>> web2py+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/web2py/07767cc2-5691-4c76-b310-bd409b735ea2%40googlegroups.com
>>  
>> 
>> .
>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/4fb814a0-efbb-4caa-8a09-abd6a5df7014%40googlegroups.com.


Re: [web2py] Re: Server error when accessing admin

2020-04-30 Thread Ian W. Scott
Unfortunately I don't know anything about nginx. I've always worked with 
apache2. Can anyone suggest how to debug this? I'm really at the end of my 
rope here.

On Thursday, April 30, 2020 at 10:37:58 AM UTC-4, Ian W. Scott wrote:
>
> Thanks very much
>
> Ian W. Scott, PhD
> Associate Professor of New Testament
> Tyndale Seminary, Toronto, Canada
> www.ianwscott.com
> *Paul's Way of Knowing: Story Experience and the Spirit* (Baker Academic 
> [Mohr Siebeck], 2006)
> *The Online Critical Pseudepigrapha* (SBL, 2006-; pseudepigrapha.org)
> Sent from Mailspring, the best free email app for work
> On Apr 30 2020, at 10:33 am, 'Annet' via web2py-users <
> web2py@googlegroups.com> wrote:
>
> Hi Ian,
>
> I do have a copy of the script, it's a bit old, but I'll attach
> it anyway, maybe it's of help.
>
>
> Kind regards,
>
> Annet
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to a topic in the 
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit 
> https://groups.google.com/d/topic/web2py/kWdHdAv2jj0/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to 
> web2py+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/web2py/07767cc2-5691-4c76-b310-bd409b735ea2%40googlegroups.com
>  
> 
> .
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/49989d0e-3c7b-45d7-8f8b-d576b615b71a%40googlegroups.com.


Re: [web2py] Re: Server error when accessing admin

2020-04-30 Thread Ian W. Scott
Thanks very much

Ian W. Scott, PhD
Associate Professor of New Testament
Tyndale Seminary, Toronto, Canada
www.ianwscott.com (http://www.ianwscott.com)

Paul's Way of Knowing: Story Experience and the Spirit (Baker Academic [Mohr 
Siebeck], 2006)
The Online Critical Pseudepigrapha (SBL, 2006-; pseudepigrapha.org 
(https://pseudepigrapha.org))

Sent from Mailspring, the best free email app for work

On Apr 30 2020, at 10:33 am, 'Annet' via web2py-users  
wrote:
> Hi Ian,
>
> I do have a copy of the script, it's a bit old, but I'll attach
> it anyway, maybe it's of help.
>
>
>
> Kind regards,
>
> Annet
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to a topic in the Google 
> Groups "web2py-users" group.
> To unsubscribe from this topic, visit 
> https://groups.google.com/d/topic/web2py/kWdHdAv2jj0/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to 
> web2py+unsubscr...@googlegroups.com 
> (mailto:web2py+unsubscr...@googlegroups.com).
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/web2py/07767cc2-5691-4c76-b310-bd409b735ea2%40googlegroups.com
>  
> (https://groups.google.com/d/msgid/web2py/07767cc2-5691-4c76-b310-bd409b735ea2%40googlegroups.com?utm_medium=email_source=footer).

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/E7A34CC5-5119-447C-A0BF-A0C70FB7884A%40getmailspring.com.


[web2py] Re: Server error when accessing admin

2020-04-30 Thread 'Annet' via web2py-users
Hi Ian,

I do have a copy of the script, it's a bit old, but I'll attach
it anyway, maybe it's of help.


Kind regards,

Annet

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/07767cc2-5691-4c76-b310-bd409b735ea2%40googlegroups.com.
#!/bin/env python2.7

"""
Web2py install/uninstall script for WebFaction using the latest stable source
code from http://www.web2py.com/examples/static/web2py_src.zip.

This installs web2py for Python 2.7, served via Nginx 1.8.0 and uWSGI 2.0.10.

The web2py files are found in ~/webapps//web2py.

IMPORTANT: Remember to set the Admin password in the extra_info field.

Caveats
---

* Web2py won't work properly if it is mounted to a sub-URL like
http://domain.com/web2py/. Instead, it must be mounted to the website root,
e.g. http://domain.com/

* For the administrative interface to work, the web2py app must be mounted to and
accessed through an HTTPS-enabled site. You would usually mount the app to two
websites - HTTPS-disabled one for normal access, and HTTPS-enabled one for admin
logins.

"autostart": not applicable
"extra info": Password for administrative interface
"""

import sys
import xmlrpclib

def hash_password(plaintext):
"""Standardized method for hashing password"""
from hashlib import md5
return md5(plaintext).hexdigest()

def create(server, session_id, account, username, app_name, autostart, extra_info, password):
# Create application.
app = server.create_app(session_id, app_name, 'custom_app_with_port')
appname = app['name']
port = app['port']

# install Nginx
cmd = """
mkdir -p {bin,nginx,src,tmp,lib/python2.7}
cd /home/%(username)s/webapps/%(appname)s/src
wget -q 'http://nginx.org/download/nginx-1.8.0.tar.gz'
tar -xzf nginx-1.8.0.tar.gz
cd nginx-1.8.0
./configure \
  --prefix=/home/%(username)s/webapps/%(appname)s/nginx \
  --error-log-path=/home/%(username)s/logs/user/error_%(appname)s.log \
  --http-log-path=/home/%(username)s/logs/user/access_%(appname)s.log \
  > /dev/null
make > /dev/null
make install > /dev/null
""" % locals()
server.system(session_id, cmd)

# install uwsgi
cmd = """
cd /home/%(username)s/webapps/%(appname)s/src
wget -q 'http://projects.unbit.it/downloads/uwsgi-2.0.10.tar.gz'
tar -xzf uwsgi-2.0.10.tar.gz
cd uwsgi-2.0.10
python2.7 uwsgiconfig.py --build > /dev/null
mv ./uwsgi /home/%(username)s/webapps/%(appname)s/bin
ln -s /home/%(username)s/webapps/%(appname)s/nginx/sbin/nginx /home/%(username)s/webapps/%(appname)s/bin

mkdir -p /home/%(username)s/webapps/%(appname)s/nginx/tmp/nginx/client

cat << EOF > /home/%(username)s/webapps/%(appname)s/nginx/conf/nginx.conf
worker_processes  1;

events {
worker_connections  1024;
}

http {
access_log  /home/%(username)s/logs/user/access_%(appname)s.log combined;
error_log   /home/%(username)s/logs/user/error_%(appname)s.log  crit;

include mime.types;
sendfile on;

server {
listen 127.0.0.1:%(port)d;

location / {
include uwsgi_params;
uwsgi_pass unix:///home/%(username)s/webapps/%(appname)s/uwsgi.sock;
}
}
}
EOF
""" % locals()
server.system(session_id, cmd)

# install web2py
cmd = """
cd /home/%(username)s/webapps/%(appname)s/src
wget -q 'http://www.web2py.com/examples/static/web2py_src.zip'
cd ..
unzip -qq src/web2py_src.zip
cp ./web2py/handlers/./wsgihandler.py ./web2py/
""" % locals()
server.system(session_id, cmd)

# create paramaters_80.py
assert extra_info
server.system(session_id, "echo 'password=\"%s\"' > web2py/parameters_80.py" % hash_password(extra_info))

# make the start, stop, and restart scripts
cmd = """
cat << EOF > /home/%(username)s/webapps/%(appname)s/bin/start
#!/bin/bash

# Start uwsgi
/home/%(username)s/webapps/%(appname)s/bin/uwsgi \\
  --uwsgi-socket "/home/%(username)s/webapps/%(appname)s/uwsgi.sock" \\
  --master \\
  --workers 1 \\
  --max-requests 1 \\
  --harakiri 60 \\
  --daemonize /home/%(username)s/logs/user/uwsgi_%(appname)s.log \\
  --pidfile /home/%(username)s/webapps/%(appname)s/uwsgi.pid \\
  --vacuum \\
  --chdir /home/%(username)s/webapps/%(appname)s \\
  --python-path /home/%(username)s/webapps/%(appname)s/lib/python2.7 \\
  --wsgi-file /home/%(username)s/webapps/%(appname)s/web2py/wsgihandler.py \\

# Start nginx
/home/%(username)s/webapps/%(appname)s/bin/nginx
EOF

cat << EOF > /home/%(username)s/webapps/%(appname)s/bin/stop

[web2py] Re: Server error when accessing admin

2020-04-30 Thread Ian W. Scott
Thanks Annet for your help. Webfaction doesn't seem currently to make that 
install script available when you're creating a new application in a 
server. Web2py doesn't appear anywhere on the list of available application 
types. Do you know if it's available somewhere else on their service?

Thanks too for the pointer about subdomains and ssl. I was aware of those 
and they don't seem to be the problem.

On Thursday, April 30, 2020 at 5:39:06 AM UTC-4, Annet wrote:
>
> Why didn't you use the web2py install/unstall script that webfaction 
> provides?
> It installs web2py served via nginx and uWSGI.
>
> The script mentions 2 caveats:
>
> Web2py won't work properly if it is mounted to a sub-URL like
> http://domain.com/web2py/. Instead, it must be mounted to the
> website root, e.g. http://domain.com/
>
> For the administrative interface to work, the web2py app must be
> mounted to and accessed through an HTTPS-enabled site. You would
> usually mount the app to two websites - HTTPS-disabled one for
> normal access, and HTTPS-enabled one for admin logins
>
>
> Kind regards,
>
> Annet
>
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/7893bb4f-9170-4c86-99f3-0ac3f3b42413%40googlegroups.com.


[web2py] Re: Server error when accessing admin

2020-04-30 Thread 'Annet' via web2py-users
Why didn't you use the web2py install/unstall script that webfaction 
provides?
It installs web2py served via nginx and uWSGI.

The script mentions 2 caveats:

Web2py won't work properly if it is mounted to a sub-URL like
http://domain.com/web2py/. Instead, it must be mounted to the
website root, e.g. http://domain.com/

For the administrative interface to work, the web2py app must be
mounted to and accessed through an HTTPS-enabled site. You would
usually mount the app to two websites - HTTPS-disabled one for
normal access, and HTTPS-enabled one for admin logins


Kind regards,

Annet


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/759adea9-76fd-4ec9-b223-19b82e1d1d9d%40googlegroups.com.