[web2py] Re: no-email edit in profile

2018-12-18 Thread appjarbiz
Alternately, simply remove  line 3628 of gluon/tools.py

table_user['email'].writable = False



On Friday, December 14, 2018 at 10:25:10 AM UTC-6, Leonel Câmara wrote:
>
> I think this problem was caused by CAS, but there were other problems, 
> namely that it would not check the new email again if it required 
> verification. Anyway you can have my function.
>
> def change_email():
> from gluon.utils import web2py_uuid
> from gluon.tools import replace_id
> table_user = auth.table_user()
> if not auth.is_logged_in():
> redirect(auth.settings.login_url,
>  client_side=auth.settings.client_side)
> next = auth.get_vars_next()
> form = SQLFORM.factory(table_user.email)
> if form.accepts(request, session, formname='change_email', hideerror=
> auth.settings.hideerror):
> key = web2py_uuid()
> if auth.settings.registration_requires_verification:
> key = 'pending-' + key
> link = auth.url(
> auth.settings.function, args=('verify_email', key), scheme
> =True)
> table_user[auth.user_id].update_record(email=form.vars.email, 
> key=key)
> auth.user.update(table_user._filter_fields(form.vars))
> d = dict(auth.user)
> d.update(dict(key=key, link=link, firstname=auth.user.
> first_name, lastname=auth.user.last_name, username=form.vars.email))
> if not (auth.settings.mailer and auth.settings.mailer.send(
> to=form.vars.email,
> subject=auth.messages.verify_email_subject,
> message=auth.messages.verify_email % d)):
> auth.db.rollback()
> response.flash = auth.messages.unable_send_email
> return form
> session.flash = auth.messages.email_sent
> if not next:
> next = URL(args=request.args)
> else:
> next = replace_id(next, form)
> redirect(next, client_side=auth.settings.client_side)
> return form
>
> You can just stick it inside the user function in the default controller 
> and then before return dict(form=auth()) put something like:
>
>
> if request.args(0) == 'change_email':
> return dict(form=change_email())
>
> Finally add a link to change the email in the user.html view when you're 
> editing the profile:
>
> {{
> if request.args(0) == 'profile':
> form.element(_id='auth_user_email__row').append(A(I(_class='fa 
> fa-pencil'), _href=URL(c='default', f='user', args=['change_email'], vars
> ={'_next': URL(c='default', f='user', args=['profile'])}), _class="ml-1"))
> pass
> }}
>
>
> put that before the {{=form}}
>
>
>
>
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: hello and a question about deployment

2018-12-03 Thread appjarbiz
It really depends on your use case.

I've deployed production Web2py on dedicated server, Heroku, and now AWS 
Lambda (Serverless).   Heroku gives you the best metrics and ops, but If I 
had to do it again, I would do them all on AWS Lambda due to the reduced 
cost during down time and the auto-scaling during spikes.


On Monday, December 3, 2018 at 10:37:01 AM UTC-6, VP wrote:
>
> Hello Web2py users/developers,
>
> I haven't used Web2py for a while, but I'm contemplating to use it for the 
> next project (with Python 3).  What deployment setup would you recommend? 
>  I'm looking for a simple Linux-based solution (my own server) that is easy 
> to set up, reliable, hopefully maintenance-free.  Years ago, I set up 
> web2py with Apache, Nginx for various projects, but it's been a while.  I 
> am wondering what the best options are these days.
>
> By the way, I'm glad to still see web2py still around.  I remember the 
> days when people lambasted web2py for various "un-Pythonic design 
> decisions". There were dozens of web-frameworks back then.  Today, Django, 
> Flask and Web2py co-exist pretty well.
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.


[web2py] getting status of the DAL db connection pool

2018-12-02 Thread appjarbiz
Is there a way to view the status of the DAL DB connection pool from within 
a request?  I'd like to have my model write the status of the connection 
pool to the logger or to a debug function response.

This is so I can debug and adjust my pool size for different deployment 
configurations. 

Also, where is the connection pool status saved?  Is it in the web2py 
process memory or does it write a temp file on disk?  Thanks.




-- 
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.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: MySql encryption using DAL

2018-11-30 Thread appjarbiz
Thanks Massimo.

These are the steps and syntax to connect to Amazon's RDS using SSL.

*Step1:*
Download Amazons's CA certificate from here:
 https://s3.amazonaws.com/rds-downloads/rds-combined-ca-bundle.pem
and save it into 
web2py/applications/myapp/private/ssl/rds-combined-ca-bundle.pem

*Step2:*
Modify your model (db.py) as follows, using your own username, password, 
endpoint, and DB

driver_args = { 'ssl':{ 'ca': 
'applications/ads/private/ssl/rds-combined-ca-bundle.pem'} }
db_auth = 
'mysql://web2py_db_user:mypassw...@x-cluster-1.cluster-xus-east-1.rds.amazonaws.com:3306/my_db'
  
db = DAL( db_auth, 
  driver_args = driver_args )


*Step 3 (optional):*
To force SSL for this user (web2py_db_user), connect to the RDS server 
using MySQL Workbench (or any other DB client) and execute the following 
SQL. 

For MySQL 5.6 GRANT USAGE ON *.* TO 'web2py_db_user'@'%' REQUIRE SSL; 

For MySQL 5.7
ALTER USER 'web2py_db_user'@'%' REQUIRE SSL; 






On Sunday, September 2, 2018 at 12:56:06 PM UTC-5, Massimo Di Pierro wrote:
>
> For postgresql it has been there for long time:
>
> postgres://{username}:{password}@{domain}:5432/{dbname}?sslmode=require
>
> For MySQL it can also be done with current PyDAL. My understanding is that 
> MySQL requires certificates so you
>
> 1) you need to install certificates
>
> 2) on server side in my my.ini:
>
> require_secure_transport=true
> tls_version=TLSv1,TLSv1.1,TLSv1.2
> ssl-ca=*install_path*/ca-cert.pem
> ssl-cert=*install_path*/cert.pem
> ssl-key=*install_path*/key.pem
>
>
> 3) on web2py side:
>
> ssl = { 'cert': '*install_path/cert.pem*',
> 'key': '*install_path*/key.pem',
> 'ca': '*install_path*/ca-cert.pem'} 
>
> DAL('mysql://', driver_args = {'ssl': ssl})
>
> Mind I did not try this. All I am telling you is how to use driver_args to 
> pass ssl info to the mysqldb.connect( , ssl = ...) function.
>
> On Friday, 31 August 2018 22:07:54 UTC-7, appj...@gmail.com  
> wrote:
>>
>> I was curious if the ability to connect securely to a database service 
>> (without an SSH tunnel) was added to 2.17.1?  Thanks.
>>
>>
>>
>> On Wednesday, January 31, 2018 at 12:27:01 AM UTC-6, appj...@gmail.com 
>> wrote:
>>>
>>> Hi, I wanted to check back to see if there was any update on this.  
>>>
>>> With more and more database solutions moving to hosted DB services (so 
>>> no SSH tunnels), Web2Py apps do not have the ability to connect to these 
>>> securely.   
>>>
>>> We are stuck hosting a dedicated machine to server our MySQL and run an 
>>> SSH server.  We'd like to switch to Amazon Aurora for example.
>>>
>>>
>>> On Wednesday, October 11, 2017 at 11:52:02 AM UTC-5, Massimo Di Pierro 
>>> wrote:



 On Saturday, 7 October 2017 01:55:53 UTC-5, appj...@gmail.com wrote:
>
> Thank you Massimo!
>
> There is a great detailed deployment recipe for SSH tunneling to your 
> database server from a Heroku app instance (dyno). It works as of this 
> post.10/8/17
>
> https://stackoverflow.com/questions/21575582/ssh-tunneling-from-heroku/46629121#46629121
>
> There are 2 issues/questions with this though:
>
> 1) So now that I can tunnel in, I have a performance question:  Since 
> the mysql database server will be making all of its connections to 
> localhost is that a single connection rather than multiple?  Will I lose 
> database read concurrency?  If so, will either that or the SSH tunnels be 
> a 
> bottleneck and severely degrade my database performance?
>

 web2py has connection pooling. Each of connection from the pool will go 
 through the tunnel, concurrently up to the max number in the pool.

>
> 2) SSH tends to be flaky and drop connections leaving a broken Web2py 
> app instance.  Any suggestions on best practices for handling that case?
>


 No. Sorry. If others have suggestions I would like to hear them.
  

>
> It's too bad DAL doesn't support secure connections.  Encrypted 
> database connections are pretty standard nowadays and I see there are 
> python mysql connectors that do. Has anyone successfully swapped out the 
> one that ships with one of those?
>

 It would be easy to add. we will work in it.
  

>
> Cloud deployment is new to me so I really appreciate the help, and I 
> love using Web2py so thanks for making it and the ongoing support! 
>
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: AWS Lambda Deployment Recipe

2018-11-28 Thread appjarbiz
Thank you Anthony, I added the wsgibase wrapper after my initial post.  I 
was modifying gluon/main.py but I added the wrapper (lambda_handler.py) to 
avoid that.

I confirmed which environ variables are coming through as unicode and 
submitted an issue to zappa.
https://github.com/Miserlou/Zappa/issues/1713

I'll also modify the recipe to make it more clear that this is likely a 
zappa and not a web2py issue.

On Wednesday, November 28, 2018 at 8:39:51 AM UTC-6, Anthony wrote:
>
> On Tuesday, November 27, 2018 at 6:51:54 PM UTC-5, appj...@gmail.com 
>  wrote:
>>
>> I've created a first pass at an AWS Lambda deployment recipe which uses 
>> an open-source tool called Zappa.
>>
>> I welcome any comments or suggested improvements.  In particular, step 3 
>> requires modifying gluon/main.py which I would like to avoid.
>>
>
> I wouldn't say that is modifying gluon/main.py -- it is simply providing a 
> wrapper around gluon.main.wsgibase. In fact, the web2py gaehandler.py 
> handler does something very similar: 
> https://github.com/web2py/web2py/blob/master/handlers/gaehandler.py#L83.
>
> Note, according to PEP , strings passed to the server should not be 
> unicode: https://www.python.org/dev/peps/pep-/#unicode-issues.
>
> Actually, it looks like Zappa is already handling this here: 
> https://github.com/Miserlou/Zappa/blob/master/zappa/wsgi.py#L110 (see 
> also, https://github.com/Miserlou/Zappa/blob/master/zappa/wsgi.py#L110). 
> Perhaps there is still some unicode getting through from Zappa, so maybe 
> you can open an issue with Zappa.
>
> Anthony
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.


[web2py] AWS Lambda Deployment Recipe

2018-11-27 Thread appjarbiz
I've created a first pass at an AWS Lambda deployment recipe which uses an 
open-source tool called Zappa.

I welcome an comments or suggested improvements.  In particular, step 3 
requires modifying gluon/main.py which I would like to avoid.

Deployment Recipe:
https://docs.google.com/document/d/1ff_JxiZPKy1Mdck8UQbUybBtP3bRK48U1Uw-iHgr4wc/edit?usp=sharing


-- 
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.
For more options, visit https://groups.google.com/d/optout.


[web2py] How to get tickets in DB working

2018-11-23 Thread appjarbiz
I had to modify Web2Py as follows to get tickets stored in the DB 
(necessary for cloud deployment with no filesystem)

It working for tracebacks but not for snapshots. 

I needed to modify Web2Py 2.17.2 to:

1) Use JSON instead of Pickle for serialization as Pickle has errors 
serializing to MySQL (not sure about other databases)
2) Add extra error checking for the ticket-to-DB code path
3) set fake_migrate correctly when reading form and creating the error 
table.


The 2 files modified and attached to this message are:
gluon/restricted.py
applications/admin/controllers/default.py 


Hopefully someone can get it working for snapshots as well and integrate to 
the main line.

Thanks,
-Mike


-- 
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.
For more options, visit https://groups.google.com/d/optout.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
| This file is part of the web2py Web Framework
| Copyrighted by Massimo Di Pierro 
| License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)

Restricted environment to execute application's code
-
"""

import sys
from gluon._compat import pickle, ClassType, unicodeT, to_bytes
import traceback
import types
import os
import logging
import json

from gluon.storage import Storage
from gluon.http import HTTP
from gluon.html import BEAUTIFY, XML
from gluon.settings import global_settings

logger = logging.getLogger("web2py")

__all__ = ['RestrictedError', 'restricted', 'TicketStorage', 'compile2']


class TicketStorage(Storage):

"""
Defines the ticket object and the default values of its members (None)
"""

def __init__(
self,
db=None,
tablename='web2py_ticket'
):
Storage.__init__(self)
self.db = db
self.tablename = tablename

def store(self, request, ticket_id, ticket_data):
"""
Stores the ticket. It will figure out if this must be on disk or in db
"""
if self.db:
self._store_in_db(request, ticket_id, ticket_data)
else:
self._store_on_disk(request, ticket_id, ticket_data)

def _store_in_db(self, request, ticket_id, ticket_data):
self.db._adapter.reconnect()
try:
table = self._get_table(self.db, self.tablename, request.application)
ticket_data['snapshot'] = {}
json_string = json.dumps(ticket_data)
table.insert(ticket_id=ticket_id,
 ticket_data=json_string,
 created_datetime=request.now)
self.db.commit()
message = 'In FILE: %(layer)s\n\n%(traceback)s\n'
except Exception:
self.db.rollback()
message =' Unable to store in FILE: %(layer)s\n\n%(traceback)s\n'
self.db.close()
logger.error(message % ticket_data)

def _store_on_disk(self, request, ticket_id, ticket_data):
ef = self._error_file(request, ticket_id, 'wb')
try:
pickle.dump(ticket_data, ef)
finally:
ef.close()

def _error_file(self, request, ticket_id, mode, app=None):
root = request.folder
if app:
root = os.path.join(os.path.join(root, '..'), app)
errors_folder = os.path.abspath(
os.path.join(root, 'errors'))  # .replace('\\', '/')
return open(os.path.join(errors_folder, ticket_id), mode)

def _get_table(self, db, tablename, app):
tablename = tablename + '_' + app
table = db.get(tablename)
if not table:
db._lazy_tables = False
table = db.define_table(
tablename,
db.Field('ticket_id', length=100),
db.Field('ticket_data', 'text'),
db.Field('created_datetime', 'datetime'))
return table

def load(
self,
request,
app,
ticket_id,
):
if not self.db:
try:
ef = self._error_file(request, ticket_id, 'rb', app)
except IOError:
return {}
try:
return pickle.load(ef)
finally:
ef.close()
else:
table = self._get_table(self.db, self.tablename, app)
rows = self.db(table.ticket_id == ticket_id).select()
return json.loads(rows[0].ticket_data) if rows else {}


class RestrictedError(Exception):
"""
Class used to wrap an exception that occurs in the restricted environment
below. The traceback is used to log the exception and generate a ticket.
"""

def 

[web2py] Re: AWS Lambda Serverless and Zappa

2018-11-22 Thread appjarbiz
Hey arafay, Sorry for the delay. 

I plan to post a deployment recipe soon.  There are a lot of little gotchas 
I've had to work through.  I was able to do it successfully with Zappa 
(https://github.com/Miserlou/Zappa)

I'm working on doing it for another app and should be able to post my steps 
in the near future.


On Saturday, October 6, 2018 at 1:17:09 PM UTC-5, arafay...@gmail.com wrote:
>
> Hi there, 
> Can you please tell me the procedure of migrating the web2py app in AWS 
> Lamda or provide me a link that you are following ??
>
> On Saturday, September 8, 2018 at 12:30:28 PM UTC+5, appj...@gmail.com 
> wrote:
>>
>> I am trying to migrate my Web2Py app from Heroku to AWS Lambda, using 
>> Zappa.  I can get it to start running, but I'm running into errors because 
>> web2py is trying to write to the filesystem:
>>
>>
>> [Errno 30] Read-only file system: '/var/task/deposit': OSError
>> Traceback (most recent call last):
>> File "/var/task/handler.py", line 574, in lambda_handler
>> return LambdaHandler.lambda_handler(event, context)
>> File "/var/task/handler.py", line 244, in lambda_handler
>> handler = cls()
>> File "/var/task/handler.py", line 150, in __init__
>> import gluon.main
>> File "/var/task/gluon/main.py", line 64, in 
>> create_missing_folders()
>> File "C:\web2py\gluon\admin.py", line 460, in create_missing_folders
>> File "C:\web2py\gluon\admin.py", line 454, in try_mkdir
>> OSError: [Errno 30] Read-only file system: '/var/task/deposit'.  
>>
>> So I commented out the following functions from gluon/main.py
>>
>> create_missing_app_folders() 
>> and
>> create_missing_folders() 
>>
>>
>> However, now I'm getting stuck with the DB trying to create tables:
>>
>>
>> [ERROR] 2018-09-08T07:05:35.270Z 905ef1e6-b335-11e8-816d-07b31200db80 
>> Traceback (most recent call last):
>> File "/var/task/gluon/restricted.py", line 219, in restricted
>> exec(ccode, environment)
>> File "/var/task/applications/ads/models/db.py", line 72, in 
>> session.connect(request, response, db=db)
>> File "C:\web2py\gluon\globals.py", line 946, in connect
>> File "/var/task/gluon/packages/dal/pydal/base.py", line 587, in 
>> define_table
>> table = self.lazy_define_table(tablename, *fields, **args)
>> File "/var/task/gluon/packages/dal/pydal/base.py", line 621, in 
>> lazy_define_table
>> polymodel=polymodel)
>> File "/var/task/gluon/packages/dal/pydal/adapters/base.py", line 797, in 
>> create_table
>> return self.migrator.create_table(*args, **kwargs)
>> File "/var/task/gluon/packages/dal/pydal/migrator.py", line 275, in 
>> create_table
>> query), table)
>> File "/var/task/gluon/packages/dal/pydal/migrator.py", line 483, in log
>> logfile = self.file_open(table._loggername, 'ab')
>> File "/var/task/gluon/packages/dal/pydal/migrator.py", line 491, in 
>> file_open
>> fileobj = portalocker.LockedFile(filename, mode)
>> File "C:\web2py\gluon\packages\dal\pydal\contrib\portalocker.py", line 
>> 185, in __init__
>> File "C:\web2py\gluon\packages\dal\pydal\contrib\portalocker.py", line 
>> 170, in open_file
>> IOError: [Errno 2] No such file or directory: 
>> '/var/task/applications/ads/databases/sql.log'
>>
>>
>> Is this a never-ending rabbit hole or is there a way to tell web2py that 
>> it cannot write to the filesystem.  I tried 
>> global_setttings.web2py_runtime_gae=True
>>
>> but that causes a bunch of other problems because GAE resources are not 
>> present.
>>
>> I'd love to get this on AWS Lambda because my application can have 
>> temporary 1000x spikes in traffic and Serverless lets me handle this 
>> without ops and without paying for idle server time in the evenings.
>>
>> If I can get this working I will post a deployment recipe.
>>
>> Thanks,
>> -Mike
>>
>>

-- 
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.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: AWS Lambda Serverless and Zappa

2018-09-08 Thread appjarbiz


On Saturday, September 8, 2018 at 2:47:55 PM UTC-5, Anthony wrote:
>
> You can use InDBMigrator (see 
> https://groups.google.com/d/msg/web2py/lZnL4hRloSc/SSEBnIM0CQAJ). Also, 
> rather than edit main.py, you can just ensure all the folders are there to 
> begin with. Finally, make sure to put sessions in cookies or the database.
>
> Anthony
>
> On Saturday, September 8, 2018 at 3:30:28 AM UTC-4, appj...@gmail.com 
>  wrote:
>>
>> I am trying to migrate my Web2Py app from Heroku to AWS Lambda, using 
>> Zappa.  I can get it to start running, but I'm running into errors because 
>> web2py is trying to write to the filesystem:
>>
>>
>> [Errno 30] Read-only file system: '/var/task/deposit': OSError
>> Traceback (most recent call last):
>> File "/var/task/handler.py", line 574, in lambda_handler
>> return LambdaHandler.lambda_handler(event, context)
>> File "/var/task/handler.py", line 244, in lambda_handler
>> handler = cls()
>> File "/var/task/handler.py", line 150, in __init__
>> import gluon.main
>> File "/var/task/gluon/main.py", line 64, in 
>> create_missing_folders()
>> File "C:\web2py\gluon\admin.py", line 460, in create_missing_folders
>> File "C:\web2py\gluon\admin.py", line 454, in try_mkdir
>> OSError: [Errno 30] Read-only file system: '/var/task/deposit'.  
>>
>> So I commented out the following functions from gluon/main.py
>>
>> create_missing_app_folders() 
>> and
>> create_missing_folders() 
>>
>>
>> However, now I'm getting stuck with the DB trying to create tables:
>>
>>
>> [ERROR] 2018-09-08T07:05:35.270Z 905ef1e6-b335-11e8-816d-07b31200db80 
>> Traceback (most recent call last):
>> File "/var/task/gluon/restricted.py", line 219, in restricted
>> exec(ccode, environment)
>> File "/var/task/applications/ads/models/db.py", line 72, in 
>> session.connect(request, response, db=db)
>> File "C:\web2py\gluon\globals.py", line 946, in connect
>> File "/var/task/gluon/packages/dal/pydal/base.py", line 587, in 
>> define_table
>> table = self.lazy_define_table(tablename, *fields, **args)
>> File "/var/task/gluon/packages/dal/pydal/base.py", line 621, in 
>> lazy_define_table
>> polymodel=polymodel)
>> File "/var/task/gluon/packages/dal/pydal/adapters/base.py", line 797, in 
>> create_table
>> return self.migrator.create_table(*args, **kwargs)
>> File "/var/task/gluon/packages/dal/pydal/migrator.py", line 275, in 
>> create_table
>> query), table)
>> File "/var/task/gluon/packages/dal/pydal/migrator.py", line 483, in log
>> logfile = self.file_open(table._loggername, 'ab')
>> File "/var/task/gluon/packages/dal/pydal/migrator.py", line 491, in 
>> file_open
>> fileobj = portalocker.LockedFile(filename, mode)
>> File "C:\web2py\gluon\packages\dal\pydal\contrib\portalocker.py", line 
>> 185, in __init__
>> File "C:\web2py\gluon\packages\dal\pydal\contrib\portalocker.py", line 
>> 170, in open_file
>> IOError: [Errno 2] No such file or directory: 
>> '/var/task/applications/ads/databases/sql.log'
>>
>>
>> Is this a never-ending rabbit hole or is there a way to tell web2py that 
>> it cannot write to the filesystem.  I tried 
>> global_setttings.web2py_runtime_gae=True
>>
>> but that causes a bunch of other problems because GAE resources are not 
>> present.
>>
>> I'd love to get this on AWS Lambda because my application can have 
>> temporary 1000x spikes in traffic and Serverless lets me handle this 
>> without ops and without paying for idle server time in the evenings.
>>
>> If I can get this working I will post a deployment recipe.
>>
>> Thanks,
>> -Mike
>>
>>

-- 
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.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: AWS Lambda Serverless and Zappa

2018-09-08 Thread appjarbiz
Thank you Anthony!  That got me past the filesystem issues.  Now it seems 
like I'm stuck in gluon._compat and urllib.  It is having problems 
importing.

cannot import name urllib_quote_plus: ImportError
Traceback (most recent call last):
File "/var/task/handler.py", line 585, in lambda_handler
return LambdaHandler.lambda_handler(event, context)
File "/var/task/handler.py", line 255, in lambda_handler
handler = cls()
File "/var/task/handler.py", line 138, in __init__
self.app_module = importlib.import_module(self.settings.APP_MODULE)
File "/usr/lib64/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "C:\web2py\gluon\__init__.py", line 40, in 
File "C:\web2py\gluon\compileapp.py", line 44, in 
File "/var/task/gluon/rewrite.py", line 29, in 
from gluon._compat import urllib_unquote, urllib_quote, iteritems, xrange, 
urllib_quote_plus
ImportError: cannot import name urllib_quote_plus

Here is my sys.path:

['/var/task', '/var/runtime/awslambda', '/var/runtime', 
'/usr/lib/python27.zip', '/usr/lib64/python2.7', 
'/usr/lib64/python2.7/plat-linux2', '/usr/lib64/python2.7/lib-tk', 
'/usr/lib64/python2.7/lib-old', '/usr/lib64/python2.7/lib-dynload', 
'/usr/local/lib64/python2.7/site-packages', 
'/usr/local/lib/python2.7/site-packages', 
'/usr/lib64/python2.7/site-packages', '/usr/lib/python2.7/site-packages', 
'/usr/lib64/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages']

I was worried this is because the vitualenv has urllib3 a requirement for 
zappa. However, I had a similar problem on importing "reload" from 
gluon._compat as well and had to comment out that import along with its 
usage in utf8.py.





On Saturday, September 8, 2018 at 2:47:55 PM UTC-5, Anthony wrote:
>
> You can use InDBMigrator (see 
> https://groups.google.com/d/msg/web2py/lZnL4hRloSc/SSEBnIM0CQAJ). Also, 
> rather than edit main.py, you can just ensure all the folders are there to 
> begin with. Finally, make sure to put sessions in cookies or the database.
>
> Anthony
>
> On Saturday, September 8, 2018 at 3:30:28 AM UTC-4, appj...@gmail.com 
>  wrote:
>>
>> I am trying to migrate my Web2Py app from Heroku to AWS Lambda, using 
>> Zappa.  I can get it to start running, but I'm running into errors because 
>> web2py is trying to write to the filesystem:
>>
>>
>> [Errno 30] Read-only file system: '/var/task/deposit': OSError
>> Traceback (most recent call last):
>> File "/var/task/handler.py", line 574, in lambda_handler
>> return LambdaHandler.lambda_handler(event, context)
>> File "/var/task/handler.py", line 244, in lambda_handler
>> handler = cls()
>> File "/var/task/handler.py", line 150, in __init__
>> import gluon.main
>> File "/var/task/gluon/main.py", line 64, in 
>> create_missing_folders()
>> File "C:\web2py\gluon\admin.py", line 460, in create_missing_folders
>> File "C:\web2py\gluon\admin.py", line 454, in try_mkdir
>> OSError: [Errno 30] Read-only file system: '/var/task/deposit'.  
>>
>> So I commented out the following functions from gluon/main.py
>>
>> create_missing_app_folders() 
>> and
>> create_missing_folders() 
>>
>>
>> However, now I'm getting stuck with the DB trying to create tables:
>>
>>
>> [ERROR] 2018-09-08T07:05:35.270Z 905ef1e6-b335-11e8-816d-07b31200db80 
>> Traceback (most recent call last):
>> File "/var/task/gluon/restricted.py", line 219, in restricted
>> exec(ccode, environment)
>> File "/var/task/applications/ads/models/db.py", line 72, in 
>> session.connect(request, response, db=db)
>> File "C:\web2py\gluon\globals.py", line 946, in connect
>> File "/var/task/gluon/packages/dal/pydal/base.py", line 587, in 
>> define_table
>> table = self.lazy_define_table(tablename, *fields, **args)
>> File "/var/task/gluon/packages/dal/pydal/base.py", line 621, in 
>> lazy_define_table
>> polymodel=polymodel)
>> File "/var/task/gluon/packages/dal/pydal/adapters/base.py", line 797, in 
>> create_table
>> return self.migrator.create_table(*args, **kwargs)
>> File "/var/task/gluon/packages/dal/pydal/migrator.py", line 275, in 
>> create_table
>> query), table)
>> File "/var/task/gluon/packages/dal/pydal/migrator.py", line 483, in log
>> logfile = self.file_open(table._loggername, 'ab')
>> File "/var/task/gluon/packages/dal/pydal/migrator.py", line 491, in 
>> file_open
>> fileobj = portalocker.LockedFile(filename, mode)
>> File "C:\web2py\gluon\packages\dal\pydal\contrib\portalocker.py", line 
>> 185, in __init__
>> File "C:\web2py\gluon\packages\dal\pydal\contrib\portalocker.py", line 
>> 170, in open_file
>> IOError: [Errno 2] No such file or directory: 
>> '/var/task/applications/ads/databases/sql.log'
>>
>>
>> Is this a never-ending rabbit hole or is there a way to tell web2py that 
>> it cannot write to the filesystem.  I tried 
>> global_setttings.web2py_runtime_gae=True
>>
>> but that causes a bunch of other problems because GAE resources are not 
>> present.
>>
>> I'd love to get this on AWS Lambda because my application can have 
>> temporary 1000x spikes in 

[web2py] AWS Lambda Serverless and Zappa

2018-09-08 Thread appjarbiz
I am trying to migrate my Web2Py app from Heroku to AWS Lambda, using 
Zappa.  I can get it to start running, but I'm running into errors because 
web2py is trying to write to the filesystem.  I commented out

create_missing_app_folders() 
and
create_missing_folders() 

from gluon/main.py, however, now I'm getting stuck with the DB trying to 
create tables.


[ERROR] 2018-09-08T07:05:35.270Z 905ef1e6-b335-11e8-816d-07b31200db80 
Traceback (most recent call last):
File "/var/task/gluon/restricted.py", line 219, in restricted
exec(ccode, environment)
File "/var/task/applications/ads/models/db.py", line 72, in 
session.connect(request, response, db=db)
File "C:\web2py\gluon\globals.py", line 946, in connect
File "/var/task/gluon/packages/dal/pydal/base.py", line 587, in define_table
table = self.lazy_define_table(tablename, *fields, **args)
File "/var/task/gluon/packages/dal/pydal/base.py", line 621, in 
lazy_define_table
polymodel=polymodel)
File "/var/task/gluon/packages/dal/pydal/adapters/base.py", line 797, in 
create_table
return self.migrator.create_table(*args, **kwargs)
File "/var/task/gluon/packages/dal/pydal/migrator.py", line 275, in 
create_table
query), table)
File "/var/task/gluon/packages/dal/pydal/migrator.py", line 483, in log
logfile = self.file_open(table._loggername, 'ab')
File "/var/task/gluon/packages/dal/pydal/migrator.py", line 491, in 
file_open
fileobj = portalocker.LockedFile(filename, mode)
File "C:\web2py\gluon\packages\dal\pydal\contrib\portalocker.py", line 185, 
in __init__
File "C:\web2py\gluon\packages\dal\pydal\contrib\portalocker.py", line 170, 
in open_file
IOError: [Errno 2] No such file or directory: 
'/var/task/applications/ads/databases/sql.log'


Is this a never-ending rabbit hole or is there a way to tell web2py that it 
cannot write to the filesystem.  I tried 
global_setttings.web2py_runtime_gae=True

but that causes a bunch of other problems because GAE resources are not 
present.

I'd love to get this on AWS Lambda because my application can have 
temporary 1000x spikes in traffic and Serverless lets me handle this 
without ops and without paying for idle server time in the evenings.

If I can get this working I will post a deployment recipe.

Thanks,
-Mike

-- 
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.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: MySql encryption using DAL

2018-08-31 Thread appjarbiz
I was curious if the ability to connect securely to a database service 
(without an SSH tunnel) was added to 2.17.1?  Thanks.



On Wednesday, January 31, 2018 at 12:27:01 AM UTC-6, appj...@gmail.com 
wrote:
>
> Hi, I wanted to check back to see if there was any update on this.  
>
> With more and more database solutions moving to hosted DB services (so no 
> SSH tunnels), Web2Py apps do not have the ability to connect to these 
> securely.   
>
> We are stuck hosting a dedicated machine to server our MySQL and run an 
> SSH server.  We'd like to switch to Amazon Aurora for example.
>
>
> On Wednesday, October 11, 2017 at 11:52:02 AM UTC-5, Massimo Di Pierro 
> wrote:
>>
>>
>>
>> On Saturday, 7 October 2017 01:55:53 UTC-5, appj...@gmail.com wrote:
>>>
>>> Thank you Massimo!
>>>
>>> There is a great detailed deployment recipe for SSH tunneling to your 
>>> database server from a Heroku app instance (dyno). It works as of this 
>>> post.10/8/17
>>>
>>> https://stackoverflow.com/questions/21575582/ssh-tunneling-from-heroku/46629121#46629121
>>>
>>> There are 2 issues/questions with this though:
>>>
>>> 1) So now that I can tunnel in, I have a performance question:  Since 
>>> the mysql database server will be making all of its connections to 
>>> localhost is that a single connection rather than multiple?  Will I lose 
>>> database read concurrency?  If so, will either that or the SSH tunnels be a 
>>> bottleneck and severely degrade my database performance?
>>>
>>
>> web2py has connection pooling. Each of connection from the pool will go 
>> through the tunnel, concurrently up to the max number in the pool.
>>
>>>
>>> 2) SSH tends to be flaky and drop connections leaving a broken Web2py 
>>> app instance.  Any suggestions on best practices for handling that case?
>>>
>>
>>
>> No. Sorry. If others have suggestions I would like to hear them.
>>  
>>
>>>
>>> It's too bad DAL doesn't support secure connections.  Encrypted database 
>>> connections are pretty standard nowadays and I see there are python mysql 
>>> connectors that do. Has anyone successfully swapped out the one that ships 
>>> with one of those?
>>>
>>
>> It would be easy to add. we will work in it.
>>  
>>
>>>
>>> Cloud deployment is new to me so I really appreciate the help, and I 
>>> love using Web2py so thanks for making it and the ongoing support! 
>>>
>>>

-- 
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.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: heroku, web2py and gunicorn

2018-08-03 Thread appjarbiz
Thank you Stifan, that's worked! 

For reference for anyone else out there running web2py on Heroku here is my 
working production Procfile:

web:  gunicorn wsgihandler --max-requests 1000 --timeout 10 
--max-requests-jitter 
100





On Friday, August 3, 2018 at 5:11:33 AM UTC-5, 黄祥 wrote:
>
> pls try (tested on mac not on heroku and you can also change the parameter 
> with your own setting)
> pip install gunicorn
> cd path_to_web2py/
> cp handlers/wsgihandler.py ./
> gunicorn wsgihandler --max-requests 1000 --timeout 600
>
> best regards,
> stifan
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: heroku, web2py and gunicorn

2018-08-03 Thread appjarbiz
What is the syntax to do that?  I assume I need to let it know about 
web2py/wsgihandler.

My current syntax (running on Heroku) is:
python anyserver.py -s gunicorn -i 0.0.0.0 -p $PORT



On Thursday, August 2, 2018 at 5:20:15 PM UTC-5, 黄祥 wrote:
>
> had you try to run the gunicorn itself (without using anyserver.py) and 
> set the gunicorn config with the parameter you want (max-requests, timeout, 
> etc) ? 
>
> best regards,
> stifan
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: heroku, web2py and gunicorn

2018-08-02 Thread appjarbiz
Is there a syntax to pass gunicorn options like --timeout or --max-requests 
into the anyserver.py command line?

python anyserver.py -s gunicorn -i 0.0.0.0 -p $PORT --max-requests 1000 

adding the --max-requests to the command line doesn't get passed through.  
Thanks.






On Thursday, April 19, 2012 at 3:26:45 AM UTC-5, Rahul wrote:
>
> in that case, I'll try to find some information on this but on low 
> priority :(   and keep this testing on hold for some time. 
>
> Thanks Massimo.
>
> Sincerely, Rahul D
>
> On Wednesday, April 18, 2012 7:14:06 PM UTC+5:30, Massimo Di Pierro wrote:
>>
>> I experience the same issue but I have a different diagnoses. It is not 
>> ignoring -s (although it says it does). In fact it is calling the gunicorn 
>> method. The problem is that it fails when when creating an instance of the 
>> gunicorn server and I do not know way. In stead of going into the server 
>> loop is continue execution and reports a wrong error. That code comes from 
>> Bottle and I cannot find any documentation on the gunicorn web page on how 
>> to access it from API. 
>>
>> On Wednesday, 18 April 2012 03:14:48 UTC-5, Rahul wrote:
>>>
>>> I tried with the latest code in trunk - There seems to be some issue. It 
>>> ignores -s or --server= parameters. it always starts rocket server. Please 
>>> see the logs below. 
>>>
>>> *-bash-3.2$ python anyserver.py -s gunicorn*
>>> starting gunicorn on 127.0.0.1:8000...
>>> Usage: anyserver.py [options]
>>>
>>> anyserver.py: error: no such option: -s
>>>
>>> *-bash-3.2$ python anyserver.py --server=gunicorn*
>>> starting gunicorn on 127.0.0.1:8000...
>>> Usage: anyserver.py [options]
>>>
>>> anyserver.py: error: no such option: --server
>>>
>>>
>>> *-bash-3.2$ python anyserver.py -s gunicorn -i 72.3.247.225 -p 9065*
>>> starting gunicorn on 72.3.247.225:9065...
>>> Usage: anyserver.py [options]
>>>
>>>
>>> anyserver.py: error: no such option: -s
>>>
>>> *It only starts rocket server*=* This works for me but  
>>> only on rocket*
>>> -bash-3.2$ *python anyserver.py  gunicorn -i 72.3.247.225 -p 9065*
>>> starting *rocket on 72.3.247.225:9065 *...
>>>
>>> *-bash-3.2$ python anyserver.py --server="gunicorn" -i 72.3.247.225 -p 
>>> 9065*
>>> starting gunicorn on 72.3.247.225:9065...
>>> Usage: anyserver.py [options]
>>>
>>> *anyserver.py: error: no such option: --server*
>>>
>>> *-bash-3.2$ python anyserver.py -s "gunicorn" -i 72.3.247.225 -p 9065*
>>> starting gunicorn on 72.3.247.225:9065...
>>> Usage: anyserver.py [options]
>>>
>>> anyserver.py: error: no such option: -s
>>>
>>> ===Starts rocket ===
>>> *-bash-3.2$ python anyserver.py  "gunicorn" -i 72.3.247.225 -p 9065*
>>> *starting rocket on 72.3.247.225:9065...*
>>>
>>> Please suggest - 
>>>
>>> Thanks, 
>>>
>>> Sincerely, Rahul D. [www.flockbird.com]
>>> =
>>> On Tuesday, April 17, 2012 8:54:58 PM UTC+5:30, Massimo Di Pierro wrote:

 Can you try the anyserver in trunk? Looks like they changed some API.

 On Tuesday, 17 April 2012 05:43:51 UTC-5, Rahul wrote:
>
> Hi Massimo,
>  I did the typo in the "anyserver.py" file but now I am 
> getting this issue. 
>
> -bash-3.2$ *python anyserver.py -s gunicorn*
> starting gunicorn on 127.0.0.1:8000...
> Traceback (most recent call last):
>   File "anyserver.py", line 299, in 
> main()
>   File "anyserver.py", line 295, in main
> 
> run(options.server,options.ip,options.port,logging=options.logging,profiler=options.profiler)
>   File "anyserver.py", line 157, in run
> getattr(Servers,servername)(application,(ip,int(port)))
>   File "anyserver.py", line 129, in gunicorn
> gunicorn.arbiter.Arbiter(address, 4, app).run()
> TypeError: __init__() takes exactly 2 arguments (4 given)
> ===
> Same case for custom ip and port
> ===
> -bash-3.2$ *python anyserver.py -s gunicorn -i 72.3.247.225 -p 9065*
> starting gunicorn on 72.3.247.225:9065...
> Traceback (most recent call last):
>   File "anyserver.py", line 299, in 
> main()
>   File "anyserver.py", line 295, in main
> 
> run(options.server,options.ip,options.port,logging=options.logging,profiler=options.profiler)
>   File "anyserver.py", line 157, in run
> getattr(Servers,servername)(application,(ip,int(port)))
>   File "anyserver.py", line 129, in gunicorn
> gunicorn.arbiter.Arbiter(address, 4, app).run()
> TypeError: __init__() takes exactly 2 arguments (4 given)
>
> Please suggest what could be wrong. I am new to gunicorn and 
> anyserver. Also direct me to some quality documentation for anyserver.py 
>
>
> Thanks, 
> Sincerely,  Rahul D.
>
>
> On Friday, July 22, 2011 8:36:11 PM UTC+5:30, Massimo Di Pierro wrote:
>>
>> Hello everybody, 

[web2py] Re: MySql encryption using DAL

2018-01-30 Thread appjarbiz
Hi, I wanted to check back to see if there was any update on this.  

With more and more database solutions moving to hosted DB services (so no 
SSH tunnels), Web2Py apps do not have the ability to connect to these 
securely.   

We are stuck hosting a dedicated machine to server our MySQL and run an SSH 
server.  We'd like to switch to Amazon Aurora for example.


On Wednesday, October 11, 2017 at 11:52:02 AM UTC-5, Massimo Di Pierro 
wrote:
>
>
>
> On Saturday, 7 October 2017 01:55:53 UTC-5, appj...@gmail.com 
>  wrote:
>>
>> Thank you Massimo!
>>
>> There is a great detailed deployment recipe for SSH tunneling to your 
>> database server from a Heroku app instance (dyno). It works as of this 
>> post.10/8/17
>>
>> https://stackoverflow.com/questions/21575582/ssh-tunneling-from-heroku/46629121#46629121
>>
>> There are 2 issues/questions with this though:
>>
>> 1) So now that I can tunnel in, I have a performance question:  Since the 
>> mysql database server will be making all of its connections to localhost is 
>> that a single connection rather than multiple?  Will I lose database read 
>> concurrency?  If so, will either that or the SSH tunnels be a bottleneck 
>> and severely degrade my database performance?
>>
>
> web2py has connection pooling. Each of connection from the pool will go 
> through the tunnel, concurrently up to the max number in the pool.
>
>>
>> 2) SSH tends to be flaky and drop connections leaving a broken Web2py app 
>> instance.  Any suggestions on best practices for handling that case?
>>
>
>
> No. Sorry. If others have suggestions I would like to hear them.
>  
>
>>
>> It's too bad DAL doesn't support secure connections.  Encrypted database 
>> connections are pretty standard nowadays and I see there are python mysql 
>> connectors that do. Has anyone successfully swapped out the one that ships 
>> with one of those?
>>
>
> It would be easy to add. we will work in it.
>  
>
>>
>> Cloud deployment is new to me so I really appreciate the help, and I love 
>> using Web2py so thanks for making it and the ongoing support! 
>>
>>

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: MySql encryption using DAL

2017-10-23 Thread appjarbiz
I am using "autossh" which is a monitor wrapper around ssh that restarts 
the ssh connection if it gets dropped.  It appears to be working well.

On Thursday, October 12, 2017 at 4:52:49 PM UTC-5, appj...@gmail.com wrote:
>
> I'm using Heroku. Would the VPN option be more stable/reliable/performant 
> than an SSH tunnel?
>
> On Thursday, October 12, 2017 at 8:07:36 AM UTC-5, CDA wrote:
>>
>> Depending on the type of cloud service you may be able to setup VPN over 
>> internet and connect your DB via the VPN tunnel.
>>
>> On Oct 11, 2017 11:24 PM,  wrote:
>>
>>
>>
>> On Wednesday, October 11, 2017 at 11:52:02 AM UTC-5, Massimo Di Pierro 
>> wrote:
>>
>>>
>>>
>>> On Saturday, 7 October 2017 01:55:53 UTC-5, appj...@gmail.com wrote:

 Thank you Massimo!

 There is a great detailed deployment recipe for SSH tunneling to your 
 database server from a Heroku app instance (dyno). It works as of this 
 post.10/8/17

 https://stackoverflow.com/questions/21575582/ssh-tunneling-from-heroku/46629121#46629121

 There are 2 issues/questions with this though:

 1) So now that I can tunnel in, I have a performance question:  Since 
 the mysql database server will be making all of its connections to 
 localhost is that a single connection rather than multiple?  Will I lose 
 database read concurrency?  If so, will either that or the SSH tunnels be 
 a 
 bottleneck and severely degrade my database performance?

>>>
>>> web2py has connection pooling. Each of connection from the pool will go 
>>> through the tunnel, concurrently up to the max number in the pool.
>>>

 2) SSH tends to be flaky and drop connections leaving a broken Web2py 
 app instance.  Any suggestions on best practices for handling that case?

>>>
>>>
>>> No. Sorry. If others have suggestions I would like to hear them.
>>>  
>>>

 It's too bad DAL doesn't support secure connections.  Encrypted 
 database connections are pretty standard nowadays and I see there are 
 python mysql connectors that do. Has anyone successfully swapped out the 
 one that ships with one of those?

>>>
>>> It would be easy to add. we will work in it.
>>>
>>
>> Thank you!  What is the process for this? Should I open an issue in 
>> github? 
>>
>>>  
>>>

 Cloud deployment is new to me so I really appreciate the help, and I 
 love using Web2py so thanks for making it and the ongoing support! 

 -- 
>> 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+un...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>>
>>

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: MySql encryption using DAL

2017-10-12 Thread appjarbiz
I'm using Heroku. Would the VPN option be more stable/reliable/performant 
than an SSH tunnel?

On Thursday, October 12, 2017 at 8:07:36 AM UTC-5, CDA wrote:
>
> Depending on the type of cloud service you may be able to setup VPN over 
> internet and connect your DB via the VPN tunnel.
>
> On Oct 11, 2017 11:24 PM,  wrote:
>
>
>
> On Wednesday, October 11, 2017 at 11:52:02 AM UTC-5, Massimo Di Pierro 
> wrote:
>
>>
>>
>> On Saturday, 7 October 2017 01:55:53 UTC-5, appj...@gmail.com wrote:
>>>
>>> Thank you Massimo!
>>>
>>> There is a great detailed deployment recipe for SSH tunneling to your 
>>> database server from a Heroku app instance (dyno). It works as of this 
>>> post.10/8/17
>>>
>>> https://stackoverflow.com/questions/21575582/ssh-tunneling-from-heroku/46629121#46629121
>>>
>>> There are 2 issues/questions with this though:
>>>
>>> 1) So now that I can tunnel in, I have a performance question:  Since 
>>> the mysql database server will be making all of its connections to 
>>> localhost is that a single connection rather than multiple?  Will I lose 
>>> database read concurrency?  If so, will either that or the SSH tunnels be a 
>>> bottleneck and severely degrade my database performance?
>>>
>>
>> web2py has connection pooling. Each of connection from the pool will go 
>> through the tunnel, concurrently up to the max number in the pool.
>>
>>>
>>> 2) SSH tends to be flaky and drop connections leaving a broken Web2py 
>>> app instance.  Any suggestions on best practices for handling that case?
>>>
>>
>>
>> No. Sorry. If others have suggestions I would like to hear them.
>>  
>>
>>>
>>> It's too bad DAL doesn't support secure connections.  Encrypted database 
>>> connections are pretty standard nowadays and I see there are python mysql 
>>> connectors that do. Has anyone successfully swapped out the one that ships 
>>> with one of those?
>>>
>>
>> It would be easy to add. we will work in it.
>>
>
> Thank you!  What is the process for this? Should I open an issue in 
> github? 
>
>>  
>>
>>>
>>> Cloud deployment is new to me so I really appreciate the help, and I 
>>> love using Web2py so thanks for making it and the ongoing support! 
>>>
>>> -- 
> 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+un...@googlegroups.com .
> For more options, visit https://groups.google.com/d/optout.
>
>
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: MySql encryption using DAL

2017-10-11 Thread appjarbiz


On Wednesday, October 11, 2017 at 11:52:02 AM UTC-5, Massimo Di Pierro 
wrote:
>
>
>
> On Saturday, 7 October 2017 01:55:53 UTC-5, appj...@gmail.com 
>  wrote:
>>
>> Thank you Massimo!
>>
>> There is a great detailed deployment recipe for SSH tunneling to your 
>> database server from a Heroku app instance (dyno). It works as of this 
>> post.10/8/17
>>
>> https://stackoverflow.com/questions/21575582/ssh-tunneling-from-heroku/46629121#46629121
>>
>> There are 2 issues/questions with this though:
>>
>> 1) So now that I can tunnel in, I have a performance question:  Since the 
>> mysql database server will be making all of its connections to localhost is 
>> that a single connection rather than multiple?  Will I lose database read 
>> concurrency?  If so, will either that or the SSH tunnels be a bottleneck 
>> and severely degrade my database performance?
>>
>
> web2py has connection pooling. Each of connection from the pool will go 
> through the tunnel, concurrently up to the max number in the pool.
>
>>
>> 2) SSH tends to be flaky and drop connections leaving a broken Web2py app 
>> instance.  Any suggestions on best practices for handling that case?
>>
>
>
> No. Sorry. If others have suggestions I would like to hear them.
>  
>
>>
>> It's too bad DAL doesn't support secure connections.  Encrypted database 
>> connections are pretty standard nowadays and I see there are python mysql 
>> connectors that do. Has anyone successfully swapped out the one that ships 
>> with one of those?
>>
>
> It would be easy to add. we will work in it.
>

Thank you!  What is the process for this? Should I open an issue in github? 

>  
>
>>
>> Cloud deployment is new to me so I really appreciate the help, and I love 
>> using Web2py so thanks for making it and the ongoing support! 
>>
>>

-- 
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.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: MySql encryption using DAL

2017-10-07 Thread appjarbiz

>
> Thank you Massimo, but this presents 2 problems:
>>
>
1)  I am using Heroku for the app and it boots with a non-interactive 
Procfile.  If I put:

 ssh -L 3307:localhost:3306  myusern...@db.example.com 

in the procfile, it wants to prompt me for a password through stdin. I 
could use sshpass but that may not be installed and also requires a 
successful ssh first which also prompts for key acceptance on stdin.


2) What happens if the ssl connection closes?  I'd have a stale app unable 
to connect to the DB.  Is this a likely scenario?


I imagine this is a common problem with cloud deployment and a remote 
database.  What is the common solution?  

-- 
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.
For more options, visit https://groups.google.com/d/optout.


[web2py] MySql encryption using DAL

2017-10-05 Thread appjarbiz
Hello,

I have a Web2py app I'm moving from a dedicated server to the cloud but I'm 
leaving my MySQL database on the original server. 

I am connecting to mysql via the DAL:
db = DAL('mysql://username:passw...@db.example.com/', pool_size=8, migrate 
= migrate_dev, lazy_tables=True, fake_migrate=True)

I can't find any examples though on how to make this connection secure as 
it goes across the public internet.  Can someone point me at the code need 
on both the Web2py app and MySql server ends to make that happen?

Thank you so much,
-Mike

-- 
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.
For more options, visit https://groups.google.com/d/optout.