[web2py] Re: Letsencrypt, docker and apache

2019-02-22 Thread Oasis Agano
If I switch it back to the self generated cert it can connect to the 
database;

Did someone face a the same issue?

Regards.

Oasis

On Wednesday, February 20, 2019 at 9:13:48 PM UTC+9, Oasis Agano wrote:
>
>
> Hello,
>
> Is there a quick way to setup lets encrypt  to work with web2py inside a 
> docker container running apache?
>
> I have generated certs inside the apache+web2py container using:
>
> sudo certbot --apache certonly -w /home/www-data/web2py/ -d domainname.com
>
>
> but I don't know where to add it in the container so that it can be served 
> on the host computer.
>
>
> Any help is welcome.
>
>
> Oasis
>

-- 
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: Letsencrypt, docker and apache

2019-02-22 Thread Oasis Agano
Actually i changed the certificate and after that W2P can't connect to the 
postgresql container.

It returns connection refused error.

 Failure to connect, tried 5 times: 
Traceback (most recent call last): File 
"/home/www-data/web2py/gluon/packages/dal/pydal/base.py", line 455, in 
__init__ self._adapter = adapter(**kwargs) File 
"/home/www-data/web2py/gluon/packages/dal/pydal/adapters/postgres.py", line 
27, in __call__ return AdapterMeta.__call__(cls, *args, **kwargs) File 
"/home/www-data/web2py/gluon/packages/dal/pydal/adapters/__init__.py", line 
40, in __call__ obj = super(AdapterMeta, cls).__call__(*args, **kwargs) 
File "/home/www-data/web2py/gluon/packages/dal/pydal/adapters/postgres.py", 
line 50, in __init__ driver_args, adapter_args, do_connect, 
after_connection) File 
"/home/www-data/web2py/gluon/packages/dal/pydal/adapters/base.py", line 
369, in __init__ super(SQLAdapter, self).__init__(*args, **kwargs) File 
"/home/www-data/web2py/gluon/packages/dal/pydal/adapters/base.py", line 53, 
in __init__ self.reconnect() File 
"/home/www-data/web2py/gluon/packages/dal/pydal/helpers/classes.py", line 
181, in _reconnect_and_configure self._connection_reconnect() File 
"/home/www-data/web2py/gluon/packages/dal/pydal/connection.py", line 172, 
in reconnect self.connection = self.connector() File 
"/home/www-data/web2py/gluon/packages/dal/pydal/adapters/postgres.py", line 
114, in connector return self.driver.connect(**self.driver_args) File 
"/home/www-data/web2py/gluon/contrib/pg8000/__init__.py", line 336, in 
connect user, host, unix_sock, port, database, password, ssl) File 
"/home/www-data/web2py/gluon/contrib/pg8000/core.py", line 969, in __init__ 
raise InterfaceError("communication error", exc_info()[1]) InterfaceError: 
('communication error', error(111, 'Connection refused'))Version
web2py™ Version 2.17.2-stable+timestamp.2018.10.06.18.54.02

Did you face any issue like that?

On Thursday, February 21, 2019 at 2:22:56 PM UTC+9, 黄祥 wrote:
>
> perhaps you can use docker mount volume (-v)
> *e.g. (not tested)*
> docker -v 
> generated_letsencrypt_path_in_host:apache_cert_path_configuration_in_docker
>
> note change the value with your own path:
> - generated_letsencrypt_path_in_host
> - apache_cert_path_configuration_in_docker
>
> 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: Letsencrypt, docker and apache

2019-02-22 Thread Dave S


On Wednesday, February 20, 2019 at 8:26:56 PM UTC-8, Oasis Agano wrote:
>
> Thank you for your reply,
>
> I am trying to replace the self generated certificate inside the container 
> with the new letsencrypt one.
>
> I am using this image https://hub.docker.com/r/scinnovation/web2py/
>
> I already generated the certificate now I want to add them to the config 
> so that it replaces the self generated one.
> I don't know where to add it, whether in apache or somewhere in w2p files.
>
> Any resource about how to do it would be great.
>
> Oasis
>

If the certificate is for the apache webserver, then it needs to be where 
Apache will use it.  I have a full VM (I'm a slow learner with Docker),
and using NginX, but my certs end up in /etc/letsencrypt/live [and the 
archive] and my /etc/nginx/nginx.conf references that; I believe that 
reference was  added by certbot and there's a comment supporting that.

If the certificate is for the host, I'm not sure how you manage that.

/dps


> On Thursday, February 21, 2019 at 8:06:59 AM UTC+9, Dave S wrote:
>>
>>
>>
>> On Wednesday, February 20, 2019 at 4:13:48 AM UTC-8, Oasis Agano wrote:
>>>
>>>
>>> Hello,
>>>
>>> Is there a quick way to setup lets encrypt  to work with web2py inside a 
>>> docker container running apache?
>>>
>>> I have generated certs inside the apache+web2py container using:
>>>
>>> sudo certbot --apache certonly -w /home/www-data/web2py/ -d 
>>> domainname.com
>>>
>>>
>>> but I don't know where to add it in the container so that it can be 
>>> served on the host computer.
>>>
>>>
>>> Any help is welcome.
>>>
>>>
>>> Oasis
>>>
>>
>> I don't understand what you are trying to do.  Why would it be "served on 
>> the host computer"?  The Apache inside the container is handling the 
>> requests, and the host is merely piping. 
>>
>> /dps
>>
>>

-- 
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] SQLFORM with specific record

2019-02-22 Thread Christian Varas
Thanks Duncan

My fault! :P
I was pointing to another table and I was missing the ".select()" and at
the end... stupid me haha
like this: record = db((db.*lugar*.id == request.args(0)) & (db.*ruta*.user_id
== auth.user['id']))

Whit this works perfect:
record = db((db.lugar.lugar_id == request.args(0)) & (db.lugar.user_id ==
auth.user['id'])).select()[0]
form_edit_ruta = SQLFORM(db.lugar, record)

Cheers.
Chris.

El vie., 22 feb. 2019 a las 9:56, Ben Duncan ()
escribió:

> Are you trying to join to db's ?
> If not, then try :
>
> ROW = db(db.lugar.user_id == auth.user['id']).select()
> or
> ROW = db.lugar[auth_user['id']]
>
> See:
>
> http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Shortcuts
>
> *Ben Duncan*
> DBA / Chief Software Architect
> Mississippi State Supreme Court
> Electronic Filing Division
>
>
> On Thu, Feb 21, 2019 at 10:04 PM Christian Varas 
> wrote:
>
>> Hello !
>> I'm trying to get a sqlform that display a specific entry, i've been able
>> to get it work like in the book but just with one condition
>> like this: record = db.rutas(request.args(0))
>>
>> i need to do something like this:
>> record = db.rutas.id == request.args(0) and db.lugar.user_id ==
>> auth.user['id']
>>
>> I've tried:
>> record = db(db.rutas.id == request.args(0) and db.lugar.user_id ==
>> auth.user['id'])
>> record = db((db.rutas.id == request.args(0)) & (db.lugar.user_id ==
>> auth.user['id']))
>> but it doesn't work.
>> i'm getting this error:
>> * argument of type 'Query' is not iterable*
>>
>> this is my function
>> @auth.requires_login()
>> def EditarRutaIngresada():
>> record = db.rutas.id == request.args(0) and db.lugar.user_id ==
>> auth.user['id']
>> form_edit_ruta = SQLFORM(db.rutas, record)
>>
>> return dict(form_edit_ruta=form_edit_ruta)
>>
>> anybody knows how to do this right ?
>>
>>
>> Thanks in advanced.
>> Cheers.
>> Chris.
>>
>> --
>> 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.
>>
> --
> 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.
>

-- 
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] SQLFORM with specific record

2019-02-22 Thread Ben Duncan
Are you trying to join to db's ?
If not, then try :

ROW = db(db.lugar.user_id == auth.user['id']).select()
or
ROW = db.lugar[auth_user['id']]

See:
http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Shortcuts

*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Thu, Feb 21, 2019 at 10:04 PM Christian Varas 
wrote:

> Hello !
> I'm trying to get a sqlform that display a specific entry, i've been able
> to get it work like in the book but just with one condition
> like this: record = db.rutas(request.args(0))
>
> i need to do something like this:
> record = db.rutas.id == request.args(0) and db.lugar.user_id ==
> auth.user['id']
>
> I've tried:
> record = db(db.rutas.id == request.args(0) and db.lugar.user_id ==
> auth.user['id'])
> record = db((db.rutas.id == request.args(0)) & (db.lugar.user_id ==
> auth.user['id']))
> but it doesn't work.
> i'm getting this error:
> * argument of type 'Query' is not iterable*
>
> this is my function
> @auth.requires_login()
> def EditarRutaIngresada():
> record = db.rutas.id == request.args(0) and db.lugar.user_id ==
> auth.user['id']
> form_edit_ruta = SQLFORM(db.rutas, record)
>
> return dict(form_edit_ruta=form_edit_ruta)
>
> anybody knows how to do this right ?
>
>
> Thanks in advanced.
> Cheers.
> Chris.
>
> --
> 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.
>

-- 
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: Update web2py manually

2019-02-22 Thread Константин Комков
I rename my new project to old project name which worked, and new project 
work. It means that there is sometging in iis settings, but I can't find 
that.

-- 
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.