Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1ewwKe-00079b-Rt for pgadmin-hackers@arkaria.postgresql.org; Fri, 16 Mar 2018 20:52:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ewwKd-0001tc-Py for pgadmin-hackers@arkaria.postgresql.org; Fri, 16 Mar 2018 20:52:07 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1ewwKd-0001tT-Ik for pgadmin-hackers@lists.postgresql.org; Fri, 16 Mar 2018 20:52:07 +0000 Received: from mail-wr0-x244.google.com ([2a00:1450:400c:c0c::244]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ewwKa-0003fZ-6o for pgadmin-hackers@lists.postgresql.org; Fri, 16 Mar 2018 20:52:07 +0000 Received: by mail-wr0-x244.google.com with SMTP id d10so12882133wrf.3 for ; Fri, 16 Mar 2018 13:52:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=9UEbMN2WxhHOc/lNGKAVg9fS6P/Wvz3VacrJmwphLPw=; b=uM6hdoAaV4HGTs3iNKyfrP0mUF/kOtO0932DIZYXVours4icaO5cx6aNgSs5PR5abS iYxAQA9LQ138cmVgmf4aO16oU30yZ1cZzm9zGNOo113msaC3G1YfkxanN9xjzpEvzpu/ pG6KOhiRqWA5Igdwq2zXpJlslEiflvNvz5oH7AuyZpw/MbxK1imM8T500M5kdI8wOfbX kmC2ayWjaNWo9JMDWd90Ry7z4qWEudipPQSvYxWIQhuSqyG/K6gCLi3H3pfgkdmklClv hCjqiipUHfxzv/UAokSLt10vm0CsavVdS26HZ1oz8j66DHdpLSmO+ANl5bGycAh9Ok/O iFFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=9UEbMN2WxhHOc/lNGKAVg9fS6P/Wvz3VacrJmwphLPw=; b=bJLzD+a5PxV/8L79CuxzPfys7eCl4J64jRXPeqlQUjcEw+7a2FoBwVTTszzkBpq+Lh 2XCHYf2fYshI5uxZqkhIZu3KtImP/htWQbxYzSreYPXZCAR2ROU6P4EQ4weVmGVRs64b S+3GVPSfWBd0uc/0A6vHmDCcCCBquhRg2CxO9JfnA4m2jIu5rBhnRT3cUfAUzKgkvCgO WxHf5kOjayRSaIh6Z7Bh3IiskeWRJcZcQJDe+wZD6BuPUW980GWgw6CSWKMbFU4yKZYu hlW/2qmC2ijlFAWsM01Pm3Nbg/hvPur0D7HeGMqex0Q2wFEjOMGrAzyGoGN6SUmXdwPD C+dQ== X-Gm-Message-State: AElRT7G+tbk5HqHkOAUxHp+JyOvwPV2fZPc9B2DiQ3QpdvLOgL9BC5HF 6azQqReQZjsAK1Sri4gxnO7xtBh/GEvOzsFg5PA= X-Google-Smtp-Source: AG47ELuDRcx6XzkxVhYKm+ubR+DrGHTfhZypeP0Jj2GfvdT8Jm1WL072NRCc8s0idPkDfjpj0W45/Bo3+PvIb3lIzJQ= X-Received: by 10.223.187.199 with SMTP id z7mr2929941wrg.58.1521233523325; Fri, 16 Mar 2018 13:52:03 -0700 (PDT) MIME-Version: 1.0 Received: by 10.28.9.9 with HTTP; Fri, 16 Mar 2018 13:52:02 -0700 (PDT) In-Reply-To: References: From: =?UTF-8?B?0JzQsNC60YHQuNC8INCa0L7Qu9GM0YbQvtCy?= Date: Fri, 16 Mar 2018 23:52:02 +0300 Message-ID: Subject: Re: Proposal for changes in official Docker image To: Dave Page Cc: pgadmin-hackers@lists.postgresql.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 2018-02-26 13:46 GMT+03:00 Dave Page : > Hi > > On Mon, Feb 26, 2018 at 10:09 AM, =D0=9C=D0=B0=D0=BA=D1=81=D0=B8=D0=BC = =D0=9A=D0=BE=D0=BB=D1=8C=D1=86=D0=BE=D0=B2 wrote: >> >> 2018-02-25 20:59 GMT+03:00 Dave Page : >> > Hi >> > >> > On Sat, Feb 24, 2018 at 9:04 PM, =D0=9C=D0=B0=D0=BA=D1=81=D0=B8=D0=BC = =D0=9A=D0=BE=D0=BB=D1=8C=D1=86=D0=BE=D0=B2 >> > wrote: >> >> >> >> Hi >> >> >> >> 2018-02-19 12:13 GMT+03:00 Dave Page : >> >> > Hi >> >> > >> >> > On Sun, Feb 18, 2018 at 5:41 PM, =D0=9C=D0=B0=D0=BA=D1=81=D0=B8=D0= =BC =D0=9A=D0=BE=D0=BB=D1=8C=D1=86=D0=BE=D0=B2 >> >> > wrote: >> >> >> >> >> >> Hi! >> >> >> >> >> >> I accidentially sent this email to pgsql-hackers yesterday, sorry! >> >> >> >> >> >> First of all, thanks for the great app :) >> >> >> >> >> >> I started using PgAdmin with docker image (dpage/pgadmin4) a few >> >> >> weeks >> >> >> ago, however I thought that it had some issues, so I decided to ma= ke >> >> >> my own image. Some of the advantages: >> >> >> >> >> >> - Use alpine linux instead of centos to greatly reduce image size >> >> >> (170MB vs 560MB) >> >> >> - Use lightweight pure-python HTTP server waitress instead of heav= y >> >> >> apache/mod_wsgi >> >> >> - Use python 3.6 >> >> >> >> >> >> You can test the image at >> >> >> https://hub.docker.com/r/maksbotan/pgadmin4/ >> >> >> Readme contains more detailed explanation and usage instructions. >> >> >> >> >> >> The Dockerfile is hosted at github: >> >> >> https://github.com/maksbotan/pgadmin4_docker >> >> >> >> >> >> If you find my work useful, I'd love to make a contribution with >> >> >> these >> >> >> scripts, after some discussion with pgadmin developers and further >> >> >> improvements. >> >> > >> >> > >> >> > Please feel free to submit patches to the existing code. I have no >> >> > objection >> >> > to the any of the alternate design decisions you've made (in >> >> > principal), >> >> > except for the intentional lack of SSL support. >> >> > >> >> > Thanks, Dave. >> >> >> >> I updated my image to simplify installing of Python packages. I >> >> decided I do not need a separate build step after all. >> >> Can you point me at documentation on submitting patches to pgadmin? >> > >> > >> > There are some docs on the git repo and mailing list at >> > https://www.pgadmin.org/development/resources/. To submit a patch, sen= d >> > an >> > email to the hackers list describing the patch and attaching the "git >> > diff" >> > formatted patch file. >> > >> >> >> >> >> >> What are your points in including SSL support into container? This ca= n >> >> be done by using, for example, gunicorn instead of waitress, >> >> but I believe that this should be handled by reverse-proxy, like >> >> nginx, in production environment. In non-production environment, i.e. >> >> on developer's localhost, you do not need SSL at all. >> >> >> >> By the way, in my opinion, on production there is one more task to be >> >> handled by reverse-proxy - static files. By that I mean that all >> >> static, not-changing files accessible at '/static/' URL should be >> >> extracted from the container and served by nginx from a local folder. >> >> This does not mean we shouldn't keep them in the image -- it's very >> >> convenient for localhost usage. I haven't found a way to extract >> >> all Flask's static files yet. >> > >> > >> > Well that additional complexity is a very good reason why using two >> > containers for this is overkill. Having two containers to run pgAdmin >> > makes >> > things unnecessarily complex in my opinion, especially given that it c= an >> > (and is in the current container) achieved with the simple addition of= a >> > config snippet for Apache and mod_ssl. The current trend for micro >> > services >> > can easily be taken too far - we should keep the KISS principle in min= d. >> >> I did not mean to run two containers. I mean that pgadmin image, as I >> picture it, may serve two purposes: >> >> - localhost deployment on developer's machine to ease interaction with >> postgres DB, local or remote. >> In this mode container serves it's own static files and is >> accessible via plain HTTP >> - Deployment in enterprise production environment, for many users, >> possibly accessible from the Internet. >> In this mode container should only serve the API, possibly running >> in several replicas. static files and SSL >> termination should be done by _existing_ nginx or something else >> present in that organisation. For that I'd wish >> to have a way to extract static files from the container for >> deployment, but not changing anything in the image. > > > As I see it, that does essentially mean two containers (or 1 container an= d a > VM or whatever). Either way, it adds a lot of complexity for the user. > >> >> >> > Another reason for including SSL support, is that users have asked for >> > it. >> >> In my humble opinion, if users want SSL support in application >> container, they are doing something wrong and are >> asking for troubles. But I respect this choice and I'm ready to allow >> for it. I'll integrate gunicorn server in the image, which >> supports SSL. > > > Doing it that way gives them both options (well, we'd still need to figur= e > out the static file extraction). Those that want a quick and easy SSL > solution can do it with one container, those running on localhost can use > plain HTTP, and those who want an external reverse proxy to add SSL would > also have that option. I think this would be the most flexible and > convenient for users. I've switched to Gunicorn, adding SSL support. It has the same interface as the original container: PGADMIN_ENABLE_TLS, /certs/server.key and /certs/server.cert. I also incorporated building of sphinx manual in Dockerfile, so now the image should be complete. I noticed that I can't use gunicorn forking worker with pgadmin4, this is probably caused by session implementation, but I'm not sure. You can investigate this by using e.g. `-w 4` in entrypoint.sh, otherwise it's working fine with single-process threaded worker. I will make my work into a patch and send it to the mail list soon. Meanwhile, it'd be great if you tested the updated image at https://hub.docker.com/r/maksbotan/pgadmin4/ > Thanks, Dave. > > -- > Dave Page > Blog: http://pgsnake.blogspot.com > Twitter: @pgsnake > > EnterpriseDB UK: http://www.enterprisedb.com > The Enterprise PostgreSQL Company