Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sZdVG-002NQL-1j for pgsql-hackers@arkaria.postgresql.org; Thu, 01 Aug 2024 21:38:30 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1sZdVC-00DZqO-UP for pgsql-hackers@arkaria.postgresql.org; Thu, 01 Aug 2024 21:38:26 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sZdVC-00DZou-Iv for pgsql-hackers@lists.postgresql.org; Thu, 01 Aug 2024 21:38:26 +0000 Received: from mail-qv1-xf2c.google.com ([2607:f8b0:4864:20::f2c]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sZdV9-002fhW-5z for pgsql-hackers@lists.postgresql.org; Thu, 01 Aug 2024 21:38:25 +0000 Received: by mail-qv1-xf2c.google.com with SMTP id 6a1803df08f44-6b7b28442f9so83950746d6.3 for ; Thu, 01 Aug 2024 14:38:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dunslane-net.20230601.gappssmtp.com; s=20230601; t=1722548300; x=1723153100; darn=lists.postgresql.org; h=content-transfer-encoding:in-reply-to:autocrypt:content-language :from:references:cc:to:subject:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=D4L9UMMMNqXdLk1Qqs1byyqcgohTVUUAOfqgwsORkCs=; b=I0xaqWLup1qYtTreOgC+LwSOV/glw6gcPxfIupN3NL25RA1yVXd1Yx1gU25FbYOjvL VhRC8oXdue0gx1+TgUSe2wJPkuX8VRR/oVR9QMayav0iM4wdp8jgbbHp4I8vjHXIMTPF W6UtKAKWabOVx9yHI6XnbNmszV/94KM+2OcwyddMy0b+gNEWQrCoQeVKIUwFL2IaQvgv wPTrJVulVw+7t1GHOCJLFJTwfmfwLWGj/L2vFN865ejTKVXSkY7iP3XJkFoM5SvkfvEQ ivQjFC4BrsdXYBS7M0B0mqw7vrKbKuT97t2EAbDouss5S6BDMZ4fdueUDmfz5dvQphY6 DNCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722548300; x=1723153100; h=content-transfer-encoding:in-reply-to:autocrypt:content-language :from:references:cc:to:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=D4L9UMMMNqXdLk1Qqs1byyqcgohTVUUAOfqgwsORkCs=; b=i7rESWlq4vfIRScrx+cyf06aa5z0t/6pp13QMksxyHAmQ72/KYMjLzp1v+9WpsvNID SuLRR6P6/mS8A1/ipznfMQ9MizyUFygj+0XmCv9VqPtlFX60isyxv2K++8h+8i+8Ln8L laNRv1LjmtR3CRbv4IeX37/S+iGfPIt0EIiIXs+MILh9ROwbcSMIHZL/r/jyVYrWDMuI Tr0LPc6YR7gr2ntfQPOdnUNNZ1yzRLiMMxCM1GtxRobCmsJ8HFCr3QTYSGmBtaYo0y1C GzIhS6KKvF/6UTAOHsJmH9e/Ye/aLUJFOkaQYwnxBESd3aLPtyNsmR9qKX6irULDAhMz 7G2A== X-Forwarded-Encrypted: i=1; AJvYcCXe+gLgmra41uBGu8WTX7OU+WbVB/2trz/1W/7220M0+mTYEA6XaHZGXofTiv5TBvyxLfgghC0zCM9VhqrStVOA7Xf5h7c3LA3VL3gOhTb8ndSz X-Gm-Message-State: AOJu0YzLEuLBJnqtOTpJ3KQOXSAMMIXEcGj6/nc2iDK4UWCK3Vsr8Ncq sfiXSYlLB08e2CoK+LvuVron7dmYUzBpceDg3QURssBODDUxrTZ9iZ1IiqGrjUY= X-Google-Smtp-Source: AGHT+IFYLEl8IrSUWgOTLpdBqkJ3oi2NadzxKK36vDtZDsiimocru3nX0bsU4U88Sva9bBH9AhmDvQ== X-Received: by 2002:a05:6214:5405:b0:6b5:468e:d417 with SMTP id 6a1803df08f44-6bb983ad64fmr19202766d6.23.1722548300544; Thu, 01 Aug 2024 14:38:20 -0700 (PDT) Received: from ?IPV6:2605:a601:9180:9800::2bb? ([2605:a601:9180:9800::2bb]) by smtp.googlemail.com with ESMTPSA id 6a1803df08f44-6bb9c864e6dsm681546d6.108.2024.08.01.14.38.19 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 01 Aug 2024 14:38:19 -0700 (PDT) Message-ID: <57c12c52-123c-4a13-a258-02639473fa17@dunslane.net> Date: Thu, 1 Aug 2024 17:38:17 -0400 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Official devcontainer config To: Junwang Zhao , PostgreSQL Hackers Cc: Andrey Borodin , Jelte Fennema-Nio References: From: Andrew Dunstan Content-Language: en-US Autocrypt: addr=andrew@dunslane.net; keydata= xsBNBE7KWFkBCAClridxur2AIc7eW2AR7izbfp3EnNefie2HbLF0izW5Ik5UjX2HBXBx4syI gY6b0ugohXrr274+baoAlvSbq6cAoQuEVrk5IZFzt20b1Xkx65FwGSEj526yiKLocqkJceSq Xr9xcA5SGY+FZv441chh5SU92v4q6z+6LPpoHOh97ptAVXZYNTtU0LevyvD5lja0TzbvJm6C eFXitJfnm1pLEr0DGJCR/iUOl/N62Kh4855zZC7NHIjQHPOvV5Stz/l5ilDhvGVk+xkXFPys SjZoUr1rXhYLpiyi5sR0X9FHXT0KnGuz1F5ERO7ZTLSSQ6fJwPj6gOk9K+vvoKvoeql5ABEB AAHNJEFuZHJldyBEdW5zdGFuIDxhbmRyZXdAZHVuc2xhbmUubmV0PsLAmwQTAQgARQIbAwIX gAIZAQULCQgHAgMiAgEGFQoJCAsCBBYCAwECHgcWIQTkPlhGHfx8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6tKqcsVJs0dzF0oKTmFFmUAqTdJO12LBuNA1rlqrR3EtpYk8B/wtS 5dIMD7Q8hwQpL+4C6GNpb6ZKnPkLi47pDOLhz2qBrqN+rqUEsT3YnExYpzj5yOBi+FlmV1Hw 49QYe1sn2ZPs In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2024-08-01 Th 10:56 AM, Junwang Zhao wrote: > Stack Overflow 2024 developer survey[1] said VSCode > is the most used development environment. > > In a PostgreSQL Hacker Mentoring discussion, we talked > about how to use vscode to debug and running postgres, > Andrey(ccd) has tons of tips for new developers, and > I post my daily used devcontainer config[2] , Jelte(ccd) > suggested that it might be a good idea we integrate the > config into postgres repo so that the barrier to entry for > new developers will be much lower. > > **Note** > > This is not intended to change the workflow of experienced > hackers, it is just hoping to make the life easier for > beginner developers. > > **How to use** > > Open VSCode Command Palette(cmd/ctrl + shift + p), > search devcontainer, then choose something like > `Dev containers: Rebuild and Reopen in Container`, you are > good to go. > > **About the patch** > > devcontainer.json: > > The .devcontainer/devcontainer.json is the entry point for > VSCode to *open folder to develop in a container*, it will build > the docker image for the first time you open in container, > this will take some time. > > There are some parameters(runArgs) for running the container, > we need some settings and privileges to run perf or generate > core dumps. > > It has a mount point mapping the hosts $HOME/freedom > to container's /opt/freedom, I chose the name *freedom* > because the container is kind of a jail. > > It also installed some vscode extensions and did some > customizations. > > After diving into the container, the postCreateCommand.sh > will be automatically called, it will do some configurations > like git, perf, .vscode, core_pattern, etc. It also downloads > michaelpq's pg_plugins and FlameGraph. > > Dockerfile: > > It is based on debian bookworm, it installed dependencies > to build postgres, also IPC::Run to run TAP tests I guess. > > It also has a .gdbinit to break elog.c:errfinish for elevel 21, > this will make the debugging easier why error is logged. > > gdbpg.py is adapted from https://github.com/tvondra/gdbpg, > I think putting it here will make it evolve as time goes. > > tasks.json: > > This is kind of like a bookkeeping for developers, it has > the following commands: > > - meson debug setup > - meson release setup > - ninja build > - regression tests > - ninja install > - init cluster > - start cluster > - stop cluster > - install pg_bsd_indent > - pgindent > - apply patch > - generate flamegraph > > launch.json: > > It has one configuration that makes it possible to attach > to one process(e.g. postgres backend) and debug > with vscode. > > PFA and please give it a try if you are a VSCode user. > > [1]: https://survey.stackoverflow.co/2024/technology#1-integrated-development-environment > [2]: https://github.com/atomicdb/devcontainer/tree/main/postgres > Not totally opposed, and I will probably give it a try very soon, but I'm wondering if this really needs to go in the core repo. We've generally shied away from doing much in the way of editor / devenv support, trying to be fairly agnostic. It's true we carry .dir-locals.el and .editorconfig, so that's not entirely true, but those are really just about supporting our indentation etc. standards. Also, might it not be better for this to be carried in a separate repo maintained by people using vscode? I don't know how may committers do. Maybe lots do, and I'm just a dinosaur. If vscode really needs .devcontainer to live in the code root, maybe it could be symlinked. Another reason not carry the code ourselves is that it will make it less convenient for people who want to customize it. Without having tried it, looks like a nice effort though. Well done. cheers andrew -- Andrew Dunstan EDB: https://www.enterprisedb.com