[web2py] Re: Webfaction Deployment and Tuning Web2py Slice.

2012-12-16 Thread HittingSmoke
How do you do this on Webfaction (use web2py/uwsgi with the native nginx 
instance)? I've asked for this specifically and been told by Webfaction 
staff that it's not actually possible to use a framework with the native 
nginx instance, only with static and PHP apps.

Right now I'm using a custom nginx/uwsgi install script.

On Wednesday, November 7, 2012 11:07:11 AM UTC-8, Neil wrote:
>
> I'm certainly no expert, but I'm also on webfaction and you may want to 
> consider using nginx/uwsgi. At least in my case, there was very little I 
> needed to worry about in terms of configuration/memory management. Just two 
> tricks:
>
> - no need to install nginx, as you can just use webfaction's nginx 
> instance (there is a recipe floating around that has you build/install a 
> local copy. there may be some advantages to this, but I found it to 
> be unnecessary)
> - make sure to use uwsgi's "reload-on-rss" option to make sure the process 
> doesn't keep consuming more and more memory - webfaction kill your 
> processes if you go over your limit. There's a number of posts on this 
> topic in this forum.
>
> In general, it's a fast server and relatively straightforward set up. 
> Might be more suitable for your needs than fiddling with apache config 
> files.
>
> Neil
>
> On Tuesday, November 6, 2012 5:52:52 PM UTC, Mark Graves wrote:
>>
>> Dear Fellow Web2py Developers,
>>
>> Sorry for the extended email, I wanted to introduce myself and give some 
>> background.
>>
>> I am enjoying web2py tremendously.  Two years ago, I came to web2py from 
>> php where I had hacked together multiple web applications, despite a 
>> non-programming background.  I am a second year medical student in Chicago, 
>> and I've always had some ideas as to how to make people's lives better 
>> through technology.  Now, I'm taking some time off from school to try to do 
>> exactly that.
>>
>> It has been a wonderful learning experience for programming and web 
>> application development.  I even managed to help three people who had never 
>> written a single line of code begin writing web applications that they had 
>> always dreamed about and never believed they could. (btw Massimo, if you 
>> happen to see this, one is a bio major from Depaul)
>>
>> Now, I am trying to give back to my community.  Specifically, as I am 
>> preparing to deploy an application for a production environment, I have 
>> been learning about hosting, the most frustrating part of my learning 
>> curve. Getting a local copy of web2py up and going is one thing.  Having a 
>> fully functional, web deployed app is another. (I know this may sound 
>> irresponsible - to put potentially insecure applications on the web, and I 
>> believe empowerment, open information, and experience are the keys)
>>
>> I chose webfaction as my hosting environment because I had heard about 
>> them on this board.  Now, I am trying to write a web2py slice to document 
>> my process of going from local development to production with multiple 
>> developers in a professional hosting environment.  It is both a learning 
>> experience for me and an opportunity to give other non-programmers a better 
>> understanding of the process, which I would have appreciated in the process.
>>
>> I am soliciting your help to try to offer this help better than I can.
>>
>> The areas I want to cover for webfaction are:
>> 1.) 1 click web2py instance deployment script -- DONE(already on their 
>> wiki)
>> 2.) Version control using hg -- WORKING (using hgweb as a separate 
>> application)
>> 3.) Apache Optimization/mod_wsgi / Memory management  -- WORKING 
>> (following the book and Graham Dumpleton's suggestions on the server)
>> 4.) exposed /admin with ssh - WORKING
>> 5.) Version control from admin interface - WORKING
>> 6.) deployment under subdomain / sub url
>>
>> The area where I'd like the most help is the Apache/memory management 
>> stuff.  Apache/mod_wsgi are confusing as a newbie non programmer.  I don't 
>> think it has to be. I want to make production web application development 
>> UNDERSTANDABLE for non programmers, to attract more people like myself to 
>> the field and to the framework.
>>
>> If you are willing to lend your expertise please let me know, so we can 
>> make this community better for everyone.
>>
>> Sincerely,
>>
>> Mark Graves
>> GravesMedical Founder
>>
>>

-- 





Re: [web2py] Re: Webfaction Deployment and Tuning Web2py Slice.

2012-11-07 Thread Vasile Ermicioi
PS: I also have websites on webfaction

-- 





Re: [web2py] Re: Webfaction Deployment and Tuning Web2py Slice.

2012-11-07 Thread Vasile Ermicioi
I prefer using built in uwsgi webserver - very fast and low memory usage

-- 





[web2py] Re: Webfaction Deployment and Tuning Web2py Slice.

2012-11-07 Thread Neil
I'm certainly no expert, but I'm also on webfaction and you may want to 
consider using nginx/uwsgi. At least in my case, there was very little I 
needed to worry about in terms of configuration/memory management. Just two 
tricks:

- no need to install nginx, as you can just use webfaction's nginx instance 
(there is a recipe floating around that has you build/install a local copy. 
there may be some advantages to this, but I found it to be unnecessary)
- make sure to use uwsgi's "reload-on-rss" option to make sure the process 
doesn't keep consuming more and more memory - webfaction kill your 
processes if you go over your limit. There's a number of posts on this 
topic in this forum.

In general, it's a fast server and relatively straightforward set up. Might 
be more suitable for your needs than fiddling with apache config files.

Neil

On Tuesday, November 6, 2012 5:52:52 PM UTC, Mark Graves wrote:
>
> Dear Fellow Web2py Developers,
>
> Sorry for the extended email, I wanted to introduce myself and give some 
> background.
>
> I am enjoying web2py tremendously.  Two years ago, I came to web2py from 
> php where I had hacked together multiple web applications, despite a 
> non-programming background.  I am a second year medical student in Chicago, 
> and I've always had some ideas as to how to make people's lives better 
> through technology.  Now, I'm taking some time off from school to try to do 
> exactly that.
>
> It has been a wonderful learning experience for programming and web 
> application development.  I even managed to help three people who had never 
> written a single line of code begin writing web applications that they had 
> always dreamed about and never believed they could. (btw Massimo, if you 
> happen to see this, one is a bio major from Depaul)
>
> Now, I am trying to give back to my community.  Specifically, as I am 
> preparing to deploy an application for a production environment, I have 
> been learning about hosting, the most frustrating part of my learning 
> curve. Getting a local copy of web2py up and going is one thing.  Having a 
> fully functional, web deployed app is another. (I know this may sound 
> irresponsible - to put potentially insecure applications on the web, and I 
> believe empowerment, open information, and experience are the keys)
>
> I chose webfaction as my hosting environment because I had heard about 
> them on this board.  Now, I am trying to write a web2py slice to document 
> my process of going from local development to production with multiple 
> developers in a professional hosting environment.  It is both a learning 
> experience for me and an opportunity to give other non-programmers a better 
> understanding of the process, which I would have appreciated in the process.
>
> I am soliciting your help to try to offer this help better than I can.
>
> The areas I want to cover for webfaction are:
> 1.) 1 click web2py instance deployment script -- DONE(already on their 
> wiki)
> 2.) Version control using hg -- WORKING (using hgweb as a separate 
> application)
> 3.) Apache Optimization/mod_wsgi / Memory management  -- WORKING 
> (following the book and Graham Dumpleton's suggestions on the server)
> 4.) exposed /admin with ssh - WORKING
> 5.) Version control from admin interface - WORKING
> 6.) deployment under subdomain / sub url
>
> The area where I'd like the most help is the Apache/memory management 
> stuff.  Apache/mod_wsgi are confusing as a newbie non programmer.  I don't 
> think it has to be. I want to make production web application development 
> UNDERSTANDABLE for non programmers, to attract more people like myself to 
> the field and to the framework.
>
> If you are willing to lend your expertise please let me know, so we can 
> make this community better for everyone.
>
> Sincerely,
>
> Mark Graves
> GravesMedical Founder
>
>

-- 





[web2py] Re: Webfaction deployment

2010-07-30 Thread mdipierro
of course ;-)

appadmin sets

session.secure()

which turns the session cookie into a secure cookie and it cannot go
over http, only https.

You can disable this by commenting session.secure() in appadmin.py

Massimo

On Jul 30, 10:14 am, Iceberg  wrote:
> webfaction day2: the auto-logout problem and why
> 
>
> Many coincidence lead to the "auto-logout (lost session)" problem.
> Here is a how-to which you shall not follow. :-)
>
> Problem: Even the web2py welcome app on webfaction tends to ask me to
> re-login often, due to something is wrong with the session.
>
> How to reproduce the problem:
>
> 1. Follow the official "latest stable source" install script [1] to
> setup web2py as normal.
>
> 2. Setup an http site for normal use, and an httpS site for admin. And
> as usual, both sites map "/" as URL path to the same web2py instance.
>
> 3. Due to lack of domain resource at the beginning, I setup both sites
> with the same only domain I have, MY_ACCOUNT.webfactional.com.  (This
> is coincidence 1. I should better use different domain names, such 
> aswww.top_level_domain.comfor normal site, and
> admin.top_level_domain.com for the admin site.) (And, later I know
> that I can use the ip string as a second domain, to avoid all later
> problem.)
>
> 4. Visithttp://MY_ACCOUNT.webfactional.com/welcome/default/index,
> register a new web2py welcome account, then login, you will see a
> "Welcome your_first_name" at the upper-right corner.
>
> 5. Use SAME browser, open a new tab, to 
> visithttps://MY_ACCOUNT.webfactional.com/appadmin/index, page shows up
> fine. (This is coincidence 2. If I use another browser to open a new
> window hence a new session, I should be fine.)
>
> 6. At this moment, the session file is somehow replaced, so when you
> use your same browser to 
> visithttp://MY_ACCOUNT.webfactional.com/welcome/default/index
> , you will notice you have been automatically logout.
>
> Now you see, two coincidence together lead to the auto-logout problem.
> No wonder few webfaction-web2py users met same problem. But it did
> cost me several hours to trace down the culprit. What a day2 lesson in
> my webfactoin life. :-/
>
> Sincerely,
>              Iceberg, 2010-Jul-30, 22:22(PM), Fri
>
> [1]http://wiki.webfaction.com/wiki/Web2py-LatestSource


[web2py] Re: Webfaction deployment

2010-07-30 Thread Iceberg
webfaction day2: the auto-logout problem and why


Many coincidence lead to the "auto-logout (lost session)" problem.
Here is a how-to which you shall not follow. :-)

Problem: Even the web2py welcome app on webfaction tends to ask me to
re-login often, due to something is wrong with the session.

How to reproduce the problem:

1. Follow the official "latest stable source" install script [1] to
setup web2py as normal.

2. Setup an http site for normal use, and an httpS site for admin. And
as usual, both sites map "/" as URL path to the same web2py instance.

3. Due to lack of domain resource at the beginning, I setup both sites
with the same only domain I have, MY_ACCOUNT.webfactional.com.  (This
is coincidence 1. I should better use different domain names, such as
www.top_level_domain.com for normal site, and
admin.top_level_domain.com for the admin site.) (And, later I know
that I can use the ip string as a second domain, to avoid all later
problem.)

4. Visit http://MY_ACCOUNT.webfactional.com/welcome/default/index ,
register a new web2py welcome account, then login, you will see a
"Welcome your_first_name" at the upper-right corner.

5. Use SAME browser, open a new tab, to visit
https://MY_ACCOUNT.webfactional.com/appadmin/index, page shows up
fine. (This is coincidence 2. If I use another browser to open a new
window hence a new session, I should be fine.)

6. At this moment, the session file is somehow replaced, so when you
use your same browser to visit 
http://MY_ACCOUNT.webfactional.com/welcome/default/index
, you will notice you have been automatically logout.

Now you see, two coincidence together lead to the auto-logout problem.
No wonder few webfaction-web2py users met same problem. But it did
cost me several hours to trace down the culprit. What a day2 lesson in
my webfactoin life. :-/

Sincerely,
 Iceberg, 2010-Jul-30, 22:22(PM), Fri

[1] http://wiki.webfaction.com/wiki/Web2py-LatestSource


[web2py] Re: Webfaction deployment

2010-07-29 Thread Iceberg
On Jul 30, 12:29 am, iceb...@21cn.com wrote:
> Hi pals,
>
> Today I start my day 1 with webfaction. Here come some experience and 
> thoughts to share.
>
> a. web2py installation will be smooth if you use these install script [1] & 
> [2], and follow its docstring instructions. (One bug in [2] is found and 
> fixed today.)
>
> b. If you use the "latest stable source" install script [1], you will be 
> trapped because your web2py admin is unable to upload any app, just giving 
> out a unhelpful message "unable to install application your_app". (To 
> Massimo: It is unhelpful because gluon/admin.py 's most helper functions 
> absorb all exception but give no meaningful feedback -- not a good practice I 
> think.)
>
> Real cause and solution: Use ssh to login and then:
>         mkdir ~/webapps/your_chosen_name/web2py/deposit
>
> Besides, you are unable to import any module until you:
>         touch ~/webapps/your_chosen_name/web2py/applications/__init__.py
>
> (To Massimo: These are easy to be fixed in web2py_src.zip, aren't they?)
>
> c. If you are using the "hg trunk install", pay attention 
> tohttp://groups.google.com/group/web2py/msg/1937fae4b080e4ef
>
> Now the thoughts and questions.
>
> Which wsgi mode is webfaction using to serve web2py according to this setup 
> script [1] and [2]?  Is it "embedded mode" or "daemon mode"? (See more about 
> the two modes athttp://groups.google.com/group/web2py/msg/2ebe817c9bd2b0bb)
>
> How many web2py process are actually running? I saw 3 apache are running. I 
> guess they are one parent for listening and two children for real job?
>
> If there are more than one web2py process, what caveat need to be aware? 
> AFAIK:
>
> 1. cache.ram() still works, but is not that effective because content are not 
> shared by 2 (or more) web2py processes, so need to use cache.disk or 
> cache.memcache instead. More discussion is available 
> here.http://groups.google.com/group/web2py/browse_frm/thread/9993d61782c9b11d
>
> 2. The cron. According to [3], I'd better setup external cron. Fine, but are 
> the 2 wsgi web2py processes already running in soft cron mode by default? And 
> if yes, how to disable them to avoid conflict?
>
> 3. Anything else I missed?
>
> I hope to form some guidelines for new comers who, just like me, are not wsgi 
> expert.
>
> Thanks in advance!
>
> [1]http://wiki.webfaction.com/wiki/Web2py-LatestSource
> [2]http://wiki.webfaction.com/wiki/Web2pyHgTrunkInstall
> [3]http://web2py.com/book/default/section/4/17?search=cron
>
> Sincerely,
>              Iceberg, 2010-Jul-29, 22:04(PM), Thu


One more big problem, my app on webfaction keeps asking me to re-login
within every few minutes.  Why is that?  @_@

Anybody who is using webfaction can share some info?

Thanks


[web2py] Re: Webfaction deployment

2010-07-29 Thread Iceberg
On Jul 30, 1:40 am, Vasile Ermicioi  wrote:
> I think you don't need that a install script for web2py
>
> I would recommend
>
> 1. Create from your panel an application:
>           - category:  mod_wsgi
>           - type:  mod_wsgi 3.2 / python2.6
> 2. Use mod_wsgi deployment 
> recipeshttp://web2py.com/book/default/chapter/11#mod_wsgi
>
> notes:
> - don't forget to use the port of your application (webfaction app that you
> just created) when configuring httpd.conf

I used to think webfaction's one-click installer would be handy for
noob like me. Turns out its apache conf is quite different than the
one suggested in http://web2py.com/book/default/chapter/11#mod_wsgi

The webfaction apache http.conf is as below.

$ cat ../conf/httpd.conf
ServerRoot "/home//webapps/web2py_1_81_5/apache2"

LoadModule dir_module modules/mod_dir.so
LoadModule env_module modules/mod_env.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule mime_module modules/mod_mime.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule wsgi_module modules/mod_wsgi.so

DirectoryIndex index.py
DocumentRoot /home//webapps/web2py_1_81_5/htdocs
KeepAlive Off
Listen 53400
LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\"
\"%{User-Agent}i\"" combined
CustomLog /home//logs/user/access_web2py_1_81_5.log combined
ErrorLog /home//logs/user/error_web2py_1_81_5.log
ServerLimit 1 # I just change it from 2 to 1
#ServerLimit 2

SetEnvIf X-Forwarded-SSL on HTTPS=1

WSGIScriptAlias / /home//webapps/web2py_1_81_5/web2py/
wsgihandler.py