From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id DCCAA28781 for ; Fri, 9 Aug 2019 09:42:54 -0400 (EDT) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 3rSl4q2Y0pFv for ; Fri, 9 Aug 2019 09:42:54 -0400 (EDT) Received: from smtp63.i.mail.ru (smtp63.i.mail.ru [217.69.128.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id 4569E28654 for ; Fri, 9 Aug 2019 09:42:54 -0400 (EDT) Date: Fri, 9 Aug 2019 16:42:51 +0300 From: Konstantin Osipov Subject: [tarantool-patches] Re: [PATCH] Make `tarantoolctl start` work withiout box.cfg in init script Message-ID: <20190809134251.GA6081@atlas> References: <20190809081022.1237-1-m.melentiev@corp.mail.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190809081022.1237-1-m.melentiev@corp.mail.ru> Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-Help: List-Unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-Subscribe: List-Owner: List-post: List-Archive: To: tarantool-patches@freelists.org Cc: Max Melentiev * Max Melentiev [19/08/09 11:12]: > `box.cfg` may not be called inside init script and tarantool > will not be daemonized (forcing `background = true` in hijacked `box.cfg`), > so we need to fork tarantool before running this script. > > To find out the moment when tarantool finishes startup it waits for `READY=1` > message on NOTIFY_SOCKET which is emitted after init script is finished. Thanks for the patch. Most of this patch has to be done on the server level. Please prepare a patch that allows a user to override box.cfg with environment variables. Since this is a user-visible change, it needs an issue at github. Basically I should be able to say: setenv TARANTOOL_WAL_DIR="path" and this would override box.cfg setting, if any. The same is true for all variables which are overrides in /etc/default: https://github.com/tarantool/tarantool/blob/master/extra/dist/default/tarantool.in Alternatively, you could have a single environment variable to force box.cfg to look at /etc/default/tarantool file, or some other file, for these defaults: TARANTOOL_DEFAULT_FILE= Please check with the solutions team which approach is better - I prefer the second one, since it requires less maintenance when new defaults are added to /etc/default. Once this patch is in place, tarantoolctl should be changed to exec() instance file, not dofile() it. This will solve most of the problems reflected this patch tries to address (and a few more). The next patch should split daemon features away from box.cfg, so that it would be possible to become daemon before calling box.cfg. We already can configure logger before box.cfg, and on the road of making listen independent of box.cfg. Daemon is an easy step in the same direction. This patch is also against the core server,not against tarantoolctl. It is easy to do, take a look here: https://github.com/tarantool/tarantool/blob/master/src/main.cc#L387 This function needs to become available via io.daemon(pid_file_path). io.daemon() should fail and do nothing if the logging subsystem is not initialized. There should be a test case in app-tap. Please feel free to solicit help from the core team for this patch. If io.daemon() has been called, box.cfg.background=true/false should be ignored when box.cfg is called. io.daemon() should respect sysctl events if sysctl socket is provided. -- Konstantin Osipov, Moscow, Russia