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 1f2Jlb-0002T7-S1 for pgadmin-hackers@arkaria.postgresql.org; Sat, 31 Mar 2018 16:54:12 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1f2Jla-0000fW-Ea for pgadmin-hackers@arkaria.postgresql.org; Sat, 31 Mar 2018 16:54:10 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1f2Jla-0000fN-3w for pgadmin-hackers@lists.postgresql.org; Sat, 31 Mar 2018 16:54:10 +0000 Received: from mail-wr0-x242.google.com ([2a00:1450:400c:c0c::242]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1f2JlW-0001R1-IC for pgadmin-hackers@lists.postgresql.org; Sat, 31 Mar 2018 16:54:08 +0000 Received: by mail-wr0-x242.google.com with SMTP id n2so6897935wrj.7 for ; Sat, 31 Mar 2018 09:54:05 -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=0a7cbjqikD4bRk6WXkWn+jv2Fn5Fn01f+3Xd53Mau3Q=; b=gtJ74FKuhS6qEvmMlANil9g1S3yiiLmBbIwaTkUUxRFwTHqmvF6tporyYlV1+YmD0L 58odM2/RIMtpMxF66rjNY4yP3qnU2QBRSGQh62m1lJgwN+bdKP5caQnq64R+V9/epDLw oL4zhcCbAqNZSCU8IGgF3S2tCd87t7mRCn54lOAEHYPbhPA8X+VMhaRa73JRAr31L3AB I8kwrhS1TJP24lTM4UdPoo89VMfxypfC04qDzb+U41FEf5VXMSrGYe1z55O6wL2zxYwH 0Fs7Lkb744ry1X8U+ED24ko937nGiiIdlzWdgrZpe7dA8Bdoc4uCM1KXu42UJoEXBgLt acFQ== 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=0a7cbjqikD4bRk6WXkWn+jv2Fn5Fn01f+3Xd53Mau3Q=; b=UE3mQLN+/9Ax8U5HvlbGCkckO/QHDrfHNqSLScyC3mFfK2fgRwFEyWSg3KJzzE9El4 /t5WUu89UyBMPrgPg7kl+GT2ei6QKgXOpN3Qch/5n/ZWBsWfaN+UDcWSWx8meKCRiTsf h943nqkPkbnxruEzf3jX4A0xiyZ4bvYGMVh9yye0tc0HcOaZ5I0xYHDj1B7b0CbgOOax rJZfjd1tqi6PyzRFMoGJjDe9euJPGkmOAKccwRMsym7zvUOlvOCB1nqSWBgKrPp8uR4a AHroxVJP9pCAH8OntmESk44DvY2uPeZvs/CjzEa+t92hWlNcmfGCtGuNOiU8wKRemDkw UjYg== X-Gm-Message-State: AElRT7EZBnwceW/JvkrL96Rxe9q9JxCUt5fVc9rOHK3xFS/jLBONkx+Y Ivi130UoIqk/3bmTZl4pxFojlJp1skUH0QgRE3yHyHkh X-Google-Smtp-Source: AIpwx48l0jIMcoXVeFSsgl2s3evvnYyA54F+7kxiH9uKVy7u+xJO4WnXXPqtaSyoHKyy0BU8+sRrfa6nMKifp1mNuio= X-Received: by 10.223.163.25 with SMTP id c25mr2431505wrb.58.1522515244373; Sat, 31 Mar 2018 09:54:04 -0700 (PDT) MIME-Version: 1.0 Received: by 10.28.9.19 with HTTP; Sat, 31 Mar 2018 09:54:03 -0700 (PDT) In-Reply-To: References: From: =?UTF-8?B?0JzQsNC60YHQuNC8INCa0L7Qu9GM0YbQvtCy?= Date: Sat, 31 Mar 2018 19:54:03 +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-03-19 17:55 GMT+03:00 Dave Page : > Hi > > On Mon, Mar 19, 2018 at 11:19 AM, Dave Page wrote: >> >> Hi >> >> On Fri, Mar 16, 2018 at 8:52 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: >>> >>> >>> 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. >> >> >> Nice! >> >>> >>> >>> 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. >> >> >> This is expected, and the reason why is explained here: >> https://www.pgadmin.org/docs/pgadmin4/2.x/server_deployment.html#require= ments >> >>> >>> >>> 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/ >> >> >> I'll try to take a look later in the week (busy prepping for a release a= t >> the moment). > > > I actually found some time for this today. It's looking pretty good - TLS > vs. non-TLS seems to work well. The couple of things I did notice were: > > - PGADMIN_SERVER_NAME doesn't appear to be supported. This was added at u= ser > request, for security reasons (to help ensure the connection is going whe= re > expected). I'm not entirely convinced of the value of that, but if it's > fairly painless to add, it may well be worth it. Can you explain the meaning of this option, or maybe give me a link to original feature request? As far as I understand, Apache uses this to identify virtual hosts based on HTTP Host header, but there are no virtual hosts in Gunicorn, so no need for this. > - If you don't map /var/lib/pgadmin (in my case, to a directory already > containing a config), then I was seeing the following error. I would expe= ct > it to init within the container if the config directory isn't mapped: > > piranha:web dpage$ docker logs affectionate_spence > sh: -z: unknown operand > NOTE: Configuring authentication for SERVER mode. > > Enter the email address and password to use for the initial pgAdmin user > account: > > Traceback (most recent call last): > File "run_pgadmin.py", line 4, in > from pgAdmin4 import app > File "/pgadmin4/pgAdmin4.py", line 67, in > app =3D create_app() > File "/pgadmin4/pgadmin/__init__.py", line 306, in create_app > db_upgrade(app) > File "/pgadmin4/pgadmin/setup/db_upgrade.py", line 25, in db_upgrade > flask_migrate.upgrade(migration_folder) > File "/usr/local/lib/python3.6/site-packages/flask_migrate/__init__.py"= , > line 244, in upgrade > command.upgrade(config, revision, sql=3Dsql, tag=3Dtag) > File "/usr/local/lib/python3.6/site-packages/alembic/command.py", line > 254, in upgrade > script.run_env() > File "/usr/local/lib/python3.6/site-packages/alembic/script/base.py", l= ine > 427, in run_env > util.load_python_file(self.dir, 'env.py') > File "/usr/local/lib/python3.6/site-packages/alembic/util/pyfiles.py", > line 81, in load_python_file > module =3D load_module_py(module_id, path) > File "/usr/local/lib/python3.6/site-packages/alembic/util/compat.py", l= ine > 83, in load_module_py > spec.loader.exec_module(module) > File "/pgadmin4/pgadmin/setup/../../migrations/env.py", line 94, in > > run_migrations_online() > File "/pgadmin4/pgadmin/setup/../../migrations/env.py", line 87, in > run_migrations_online > context.run_migrations() > File "", line 8, in run_migrations > File > "/usr/local/lib/python3.6/site-packages/alembic/runtime/environment.py", > line 836, in run_migrations > self.get_context().run_migrations(**kw) > File > "/usr/local/lib/python3.6/site-packages/alembic/runtime/migration.py", li= ne > 330, in run_migrations > step.migration_fn(**kw) > File "/pgadmin4/migrations/versions/fdc58d9bd449_.py", line 112, in > upgrade > email, password =3D user_info() > File "/pgadmin4/pgadmin/setup/user_info.py", line 55, in user_info > email =3D input("Email address: ") > EOFError: EOF when reading a line > [2018-03-19 14:50:59 +0000] [1] [INFO] Starting gunicorn 19.7.1 > [2018-03-19 14:50:59 +0000] [1] [INFO] Listening at: http://0.0.0.0:8080 = (1) > [2018-03-19 14:50:59 +0000] [1] [INFO] Using worker: threads > [2018-03-19 14:50:59 +0000] [14] [INFO] Booting worker with pid: 14 > [2018-03-19 14:50:59 +0000] [14] [ERROR] Exception in worker process > Traceback (most recent call last): > File "/usr/local/lib/python3.6/site-packages/gunicorn/arbiter.py", line > 578, in spawn_worker > worker.init_process() > File "/usr/local/lib/python3.6/site-packages/gunicorn/workers/gthread.p= y", > line 109, in init_process > super(ThreadWorker, self).init_process() > File "/usr/local/lib/python3.6/site-packages/gunicorn/workers/base.py", > line 126, in init_process > self.load_wsgi() > File "/usr/local/lib/python3.6/site-packages/gunicorn/workers/base.py", > line 135, in load_wsgi > self.wsgi =3D self.app.wsgi() > File "/usr/local/lib/python3.6/site-packages/gunicorn/app/base.py", lin= e > 67, in wsgi > self.callable =3D self.load() > File "/usr/local/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", > line 65, in load > return self.load_wsgiapp() > File "/usr/local/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", > line 52, in load_wsgiapp > return util.import_app(self.app_uri) > File "/usr/local/lib/python3.6/site-packages/gunicorn/util.py", line 35= 2, > in import_app > __import__(module) > File "/pgadmin4/run_pgadmin.py", line 4, in > from pgAdmin4 import app > File "/pgadmin4/pgAdmin4.py", line 67, in > app =3D create_app() > File "/pgadmin4/pgadmin/__init__.py", line 309, in create_app > schema_version =3D version.value > AttributeError: 'NoneType' object has no attribute 'value' > [2018-03-19 14:50:59 +0000] [14] [INFO] Worker exiting (pid: 14) > [2018-03-19 14:50:59 +0000] [1] [INFO] Shutting down: Master > [2018-03-19 14:50:59 +0000] [1] [INFO] Reason: Worker failed to boot. Yeah, that was shell quoting issue, should be fixed. I will send a patch for review later this evening. > > Thanks! > > -- > Dave Page > Blog: http://pgsnake.blogspot.com > Twitter: @pgsnake > > EnterpriseDB UK: http://www.enterprisedb.com > The Enterprise PostgreSQL Company