Skip to content
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

Merged
merged 7 commits into from
Feb 14, 2017
Merged

Add daemonize option to 'docker-sync start', closes #51, replaces #65 #229

merged 7 commits into from
Feb 14, 2017

Conversation

masterful
Copy link
Contributor

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 the pid and output files (default: 'daemon')
  • --dir, The directory to place the pid and output 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 the app_name option or the dir option to ensure that your pid 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 run docker-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 from docker-compose on an individual basis, you can now:

docker-sync start -d
docker-compose up #[options]

@masterful
Copy link
Contributor Author

Rebased on the latest master, fixed merge conflicts 😄

@EugenMayer
Copy link
Owner

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!

@EugenMayer
Copy link
Owner

If i can change the dest branch from this PR, tell me how, not able to find it :)

@masterful masterful changed the base branch from master to release/0.2.0 February 10, 2017 22:13
@masterful
Copy link
Contributor Author

I was able to do so by clicking Edit and then modifying the base branch - but perhaps that's only an option for those submitting the PR.

@EugenMayer
Copy link
Owner

Great I will review this a bit this we an merge it. Great contribution!

@EugenMayer
Copy link
Owner

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!

@EugenMayer
Copy link
Owner

@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

@masterful
Copy link
Contributor Author

masterful commented Feb 12, 2017

@EugenMayer - rebased 😄
(and working on that wiki page today)

@EugenMayer EugenMayer merged commit 0e17efa into EugenMayer:release/0.2.0 Feb 14, 2017
@EugenMayer
Copy link
Owner

@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!

@masterful
Copy link
Contributor Author

Thank you @EugenMayer! I'd be happy to help as a contributor 😄

@EugenMayer
Copy link
Owner

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants