This URL hosts a Git repository (ie. git clone https://steady.supply/git/hotfix
will work). For your convenience,
the file README.md
from this repository is rendered below.
DISCLAIMER: This package is pre v1.x and very much not stable
hotfix
dumb file sync/transfer to your labelled pods
go get steady.supply/go/hotfix
if you don’t have a go compiler, releases are also tagged in git and various
builds are uploaded to
https://steady.supply/git/hotfix/release/
command line options are -v
, etc for
glog, and -c
to specify a
configuration file, eg.
namespace: xyz
ignore:
- "*.tmp"
- "*.{html,css,js}"
include:
- "*.py"
shell: ash
path: src:/app
target:
- label: service in (web, api)
- label: service=postgres
path: src/database:/app/database
- label: service=chrome
shell: bash
- label: service=static
include:
- "*.{html,css,js}"
which specifes defaults for the namespace
to work in, the transfer path
s
(in standard local:remote
format), the
globs to be ignore
d / include
d and
the shell
offered by the default container in matched pods. this
configuration will be used for each target
, having
label
filter
and being able to specify any of namespace
, shell
and path
. see below for
discussion on how ignore
and include
rules are evalulated.
for each target
the local path is
watched, and when a file changes, that
file is streamed to all the pods matching the label
specification.
the dumb part is how we stream files; the method is essentially
cat local_file | cat > remote_file
. this is perfectly sufficient since, when
writing code (unless you’re an octopus), you probably only write to handful of
files at a given time and you probably don’t write to files more frequently
than every few seconds (unless you’re a hummingbird).
ignore
and include
when hotfix
receives a file change event, both the “outer” and “inner”
ignore
and include
rules for a particular target are evaluated against the
path that is the subject of the event.
include
takes precedence over ignore
hotfix
there are already too many tools on the market that attempt to scratch the same
itch; “i miss docker run -v $(pwd):/app
”.
yes, quite. perhaps a more pertinent question would be “why not any of the others?”. let’s enumerate
ksync
seems rather complicated
for a noddy development tool, and doesn’t quite workkubectl-warp
is also complicated and
requires rsync
on the remotedevspace sync
is pretty nice (they somewhat built their own rsync
-a-like
lib), but it’s part of an ecosystem i don’t want and has
odd
behavioursoc rsync
doesn’t watch files for menone of the above let you spam files out based on labels (eg. you want to send a file out to all the pods in a deployment) and all of the above require either special software on your containers or additional pods in your cluster.
hotfix
is a simple solution to a simple problem.
drop a line to git@steady.supply
:)
Copyright (c) 2020 Steady Supply Ltd. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
* Neither the name of Steady Supply Ltd. nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.