socketmaster

Zero downtime restarts for your apps

  • 所有者: zimbatm/socketmaster
  • 平台:
  • 许可证: MIT License
  • 分类:
  • 主题:
  • 喜欢:
    0
      比较:

Github星跟踪图

socketmaster(1) -- Zero downtime restart for your apps

SYNOPSIS

socketmaster [-listen=URI] [-command=PATH] [-start=MILLIS] [-syslog]

DESCRIPTION

socketmaster is a generic solution to the restart problem: you want to restart
your app but neither lose any active connection nor refuse new connections.

socketmaster opens the socket you want to listen on and passes it onto your
program. Because socketmaster is simple enough it doesn't need to be restarted
and can keep your file-descriptor indefinitely open.

  • -command=PATH:
    Defines the location of the program to execute and pass the file-descriptor
    onto. If you need to add arguments to the program, use -- before the command specific
    arguments or use a wrapper script.

    e.g.
    socketmaster -command -- -arg1 -arg2

  • -listen=URI:
    One of the following schemes are accepted: tcp, tcp4, tcp6 and unix.
    Example: tcp4://localhost:8945 or unix:///tmp/myapp.sock

  • -start=MILLIS:
    Determines how long socketmaster waits before signaling the old process.
    If MILLIS is set to zero that feature is disabled.

  • -syslog:
    Tells socketmaster to log to syslog.

  • -user=LOGIN:
    Sets the child process's uid/gid to the given user (looked up in /etc/passwd).
    This command only works when socketmaster is run as root.

HOW IT WORKS

On start:

  • socketmaster open the -listen port
  • socketmaster starts the -command with the socket on fd 3 and EINHORN_FDS=3
  • as soon as all child processes are gone, socketmaster stops as well

On SIGHUP:

  • socketmaster starts a new -command
  • waits for -start milliseconds
  • sends a SIGTERM to the other child processes

Your server is responsible for:

  • opening the socket passed on fd 3
  • not crashing
  • gracefully shutdown on SIGTERM (close the listener, wait for the child
    connections to close)

ENVIRONMENT

  • EINHORN_FDS:
    This variable is set by socketmaster and passed onto the children. Its
    value is always 3 and meant for einhorn compatibility.

SIGNALS

On SIGHUP, socketmaster starts a new child process, waits for -start and sends a
HUP to the old process.

SIGINT, SIGTERM and SIGQUIT are forwarded to the child processes.

BUGS & CODE

Bug reports and other contributions are welcome!
The project's source and issue tracker is located at
https://github.com/zimbatm/socketmaster/

socketmaster is Copyright (C) 2012 PandaStream http://pandastream.com

Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
“Software”), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

主要指标

概览
名称与所有者zimbatm/socketmaster
主编程语言Go
编程语言Makefile (语言数: 3)
平台
许可证MIT License
所有者活动
创建于2012-11-09 15:22:37
推送于2023-12-02 11:03:32
最后一次提交2023-12-02 12:03:28
发布数9
最新版本名称v1.0.71 (发布于 )
第一版名称v1.0.7 (发布于 )
用户参与
星数650
关注者数23
派生数48
提交数74
已启用问题?
问题数5
打开的问题数4
拉请求数11
打开的拉请求数1
关闭的拉请求数3
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?