-
-
Notifications
You must be signed in to change notification settings - Fork 289
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add daemonize option to 'docker-sync start', closes #51, replaces #65 #229
Add daemonize option to 'docker-sync start', closes #51, replaces #65 #229
Conversation
Rebased on the latest master, fixed merge conflicts 😄 |
Hey @masterful great! could you make a PR rather on the release/0.2.0 branch? i need the master for 0.1.x stable fixes right now, esp for the upcoming 0.1.6 release. I will switch to a proper master/dev/feature/release branch layout very soon, so this gets not to confusing! Sorry for coming out with this so late! |
If i can change the dest branch from this PR, tell me how, not able to find it :) |
I was able to do so by clicking |
Great I will review this a bit this we an merge it. Great contribution! |
Hey @masterful , could you add some basic docs at https://github.com/EugenMayer/docker-sync/wiki/Docker-sync-demonized-mode on how to configure it, where to find the pid/logs, how to stop/start and so on. Just so we can bootstrap users to test it and get started with all this :) Thanks! |
@masterful also due to a other merge, could you rebase so the conflict is resolved! thank you. Looking really forward to merge that one in |
@EugenMayer - rebased 😄 |
@masterful thank you for the docs and all the hard work. This will be the main feature of 0.2.0 and you pulled it of! i would love to offer you a contributor/collaborator spot on docker-sync, are you by any means interested. You did such a huge, detailed work that and you could really help out polishing your baby over time. You could consider the daemon mode of of your segments, answering questions, polishing it, adjusting whats needed - this would help a lot in general terms, but also it will make this you very own feature, will it :) In any way, let me know and thank you for the patience! |
Thank you @EugenMayer! I'd be happy to help as a contributor 😄 |
I invited you and added you on the yet pretty short list of main contributors: https://github.com/EugenMayer/docker-sync/tree/release/0.2.0 - welcome to the team! |
This PR builds on the excellent initial work by @midN in #65 - but extends it to allow for running multiple sync daemons in an easier manner, ensures that before daemonizing the script we have a running + synchronized container, prevents the same configuration from starting twice, and switches the default logs/pid folder to live alongside the location from which the script was invoked.
This modifies the
start
command to allow for the following options:--daemon
(-d
), Run in the background (default: false)--app_name
(--name
), The name to use in the filename for thepid
andoutput
files (default: 'daemon')--dir
, The directory to place thepid
andoutput
files (default: './.docker-sync')--logd
, Whether or not to log the output (default: true)This also adds the
stop
command to stop the background process. It also takes the--app_name
and--dir
arguments.Notes:
New directory:
This will now create a
.docker-sync
directory alongside wherever you invoke the command (if you're asking it to run in the background). You will likely want to add this directory to your.gitignore
file (or equivalent).Invoking with the --config option
I imagine most users will be invoking
docker-sync
without specifying an alternate path to the config file, but it's worth mentioning that if that's your current setup, you should also consider using theapp_name
option or thedir
option to ensure that yourpid
file won't conflict with other invocations of docker-sync - otherwise you'll get a message saying that it's already running.What does it look like when you run it?
Instead of running
docker-sync start
- and then needing to run everything else in a separate tab/session, you can now rundocker-sync start -d
and continue using the same tab/session. If there are any errors you'll see them when it attempts to do the first sync before it goes into the background. If you'd like to see the logs for docker-sync, they default to:.docker-sync/daemon.output
If you're currently relying on using
docker-sync-stack start
- you can continue to do so, or if you prefer to manage your services fromdocker-compose
on an individual basis, you can now:docker-sync start -d docker-compose up #[options]