-
Notifications
You must be signed in to change notification settings - Fork 390
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 Docker suport #80
Conversation
cbaa45f
to
1c0f63d
Compare
the @belsander has done the right thing, and has documented it well - are you 2 interested in combining your work?? |
45074fe
to
28e751e
Compare
@SvenDowideit sure thing, I'll have a look at it tonight! |
Damn, sorry man. Really having a hard time, getting some time free. I quickly checked it out, if you want, I'll merge my fork in here. EDIT: let me know what you want to do, seems like you copied all my stuff already in here. |
@belsander hi, @SvenDowideit just write a dockerfile describe which environment let the And he wanna keep the cronicle process running as fg process use debug.sh, otherwise this docker container will exit(without hacks). It's good work, but i think use node image base on ubuntu is too large, not good for spread, maybe use alpine? |
Signed-off-by: Dowideit, Sven (O&A, St. Lucia) <[email protected]>
Signed-off-by: Dowideit, Sven (O&A, St. Lucia) <[email protected]>
28e751e
to
a79bb5f
Compare
@soulteary good point - using |
@jhuckaby wdyt? |
@SvenDowideit Good job. But I suggest use Maybe I'll make a pr after you, let it work together with traefik: make it more simple, scale, stable.. |
Just one remark, is there no need for extra alpine dependencies? I have already forgotten why, but I've added the following packages to make it work in my case: belsander/docker-cronicle/Dockerfile
using node:9.11-alpine though...
EDIT: if you'll be using Traefik with Let's Encrypt certificates, have a look at the following:
|
Hey everyone, I see that I've been pinged on this issue. First of all, thank you for all your hard work! I am really pleased to see so many people interested in Cronicle. Now, unfortunately I know absolutely nothing about Docker, having never used it once, so I really cannot merge this PR into the main repo. Please understand my reasoning here -- it's not that your work is sub-par (it's not), or I think Docker sucks (I don't), or anything of the sort. The problem is, I simply wouldn't be able to support it. I haven't a clue what these files are or what they do, or how to change them when I upgrade Cronicle in the future. And if people see a I have to understand everything that goes in my apps, so if something comes up or I decide to make a change, I know how to fix problems, or make huge architectural shifts. With these Docker additions, I would be unable to update or change them. This is my own fault. Docker is really taking over the world, and is used practically everywhere, so I am solely to blame for not knowing how to use it. Maybe someday I'll learn, but it's probably a long way off. The last point I have to make here is that Cronicle is still in a pre-release state (still sub-v1.0), and its state is in flux. I may change all kinds of things before v1.0 which may break this Docker support, and for that reason I cannot accept any PRs (I've already had to reject several). I think @belsander has the right idea here, in creating his own repo that augments Cronicle for running in a Docker environment. Could this PR be redesigned to live in it's own repo? Heck, it even could be made into an npm module, with a post-install script that moves the files into I tried to make Cronicle super easy to install, so it could be integrated into things like container systems without much trouble. I see that you guys are still running into roadblocks, though, and having to work around them with hacks. So maybe I can help with some of those to make the Docker integration cleaner. First of all, I see that you are using environment variables, and then using jq to insert those into the Cronicle JSON configuration file. Perhaps I can help here. What if Cronicle simply understood a special environment variable syntax, and allowed those to be configuration overrides on startup? Example:
Note the use of double-underscore ( I also plan on allowing any configuration option to be overridden on the command-line using dot notation, so you can (soon) do things like this:
Would any of these changes help you make the Docker integration cleaner? Secondly, I see that you have to use Someone recently contacted me and asked if Cronicle could have a Anyway, I am extremely sorry that I cannot merge this PR, but I am more than happy to add features to Cronicle that make sense for all users, and that includes things that may help you, like environment variable support, CLI config overrides, and foreground launching. Let me know if any of these would be of interest to you! And seriously, thank you all for your interest in Cronicle, and your efforts to make it better. |
Hi @jhuckaby! And thanks for your hard work! I can keep supporting Cronicle as a docker container, that works fine for me, but I'm far off for being a Javascript expert. So I can't support it as an npm module. First things first. Let's get that debug out of the way! If you could enable the flag '--foreground', I would be very pleased, so yes, that would be a huge improvement. |
@jhuckaby heya! :) yup, 90% of what we'd love for Docker support is environment variable based settings - so we don't need to create / modify / manage application specific config files, and a start script that can do setup (if the instance wasn't previously setup) and run in foreground. After that, the Dockerfile would be the only needed part. Personally, I like the Dockerfile to be in the main repository, so that any time you do a release, it triggers (via some hub.docker.com automation) a rebuild of the Docker image - but I can understand that doesn't make sense for you :) |
@belsander @SvenDowideit Just released Version 0.8.23 which introduces environment variables and foreground mode. Hope it helps! |
Awesome, thanks @jhuckaby ! I'll make the changes next week |
the docker image has been updated with the environmental variables and no longer using debug to start cronicle. nice improvement! One remark though, @jhuckaby. I haven't looked at it yet, but it seems when stopping the Docker container a SIGKILL is used, because |
@belsander The
|
@jhuckaby Makes sense, I'll make the changes EDIT: any need for the garbage collection flags you are using in |
@jhuckaby Really appreciate your efforts to make Docker integration a piece of cake for Cronicle. I've had great success using the Dockerfile made by @belsander to deploy Cronicle in our Docker swarm cluster. The only thing I am missing is email support. We use Google's SMTP for our mail so naturally we need to somehow provide Cronicle with a password to authenticate. The only problem is that would either result in me putting our password as an environment variable in our docker-compose file or in plain text in a config file that we inject into the container. Both of these would result in the password in source control which is an obvious no-no. If Cronicle could support reading the password from a text file that would allow me to easily inject it using secrets support in Docker swarm which securely mounts secrets into the container at run time in This would also be an issue if we choose to use a storage engine that would require authentication so it might be appropriate for a more generic solution. Perhaps a better approach would be to have an environment variable/config options For example: {
"auth": { "username": "admin"}
} secrets.json {
"auth": { "password": "SecreT"}
} combined.json {
"auth": { "username": "admin", "password": "SecreT"}
} |
@belsander Oops, I'm so sorry -- I didn't see the edit to your comment. GitHub didn't notify me when it was updated. Yes, you can safely remove all those old garbage collection flags. They were leftover from the old Node v0.12 days, and are now removed entirely as of Cronicle 0.8.26. @kdolan That's a rather complicated and specific feature, for something that I believe Linux already provides. All Linux flavors support adding a script into the #!/bin/sh
EXPORT CRONICLE_mail_options__auth__pass=YOURPASSWORDHERE Would that solve your problem? I think you might have to set the file permissions to 755 (executable), but I am not sure. |
That would work perfectly! Did not think about approaching it from that angle. Thanks! I also found a need to write my own simple plugin to make HTTP requests with our internal API keys since we could not just add them to header of the default HTTP plugin for security reasons. At that point I just added email support for failed jobs into the plugin itself. Added these two lines to @belsander's Dockerfile to support adding custom plugins to the image. COPY plugins /plugins
RUN cd /plugins && npm install && rm -f .npmrc && chmod +x *.js |
Thanks, @jhuckaby. I removed the garbage collection parameters. @kdolan , I added a plugins directory I'll also have a look at versioning the docker container, for the moment it only supports tag |
@belsander and @jhuckaby awesome work - I'm finally circling around to this again in our infra-stack (using docker swarm) and it looks alot like the but there is the problem of updating the images, tagging for releases etc - perhaps we could get a github webhook setup on this repo, which triggers a build? This is one circumstance where having the Dockerfile in your repository would be simpler - as Docker auto-builds trigger from Github repo updates - and can build different images based on git tags and branch names. anyhow - looking good :) |
@SvenDowideit sure, a webhook would do the job. I just fixed the version in de docker repo for the moment, so a manual update can be done. If we can set up a webhook, then I'll set the master branch back to build the latest version of Cronicle. |
@SvenDowideit @belsander I have no problem adding a webhook trigger for you. Just get me the URL you want to ping and I'll add it in. |
@jhuckaby is there a way to contact you directly? Then I can send you the build URL. |
@belsander Sure, my e-mail address is my GitHub username at gmail dot com. |
|
For anyone that's interested, I've got cronicle to work in k8s using container below so I think it'll be the same for running in docker with little tweak of course. If you're interested then give me your email and I'll send you the manifests I use for k8s. My setup is one primary master and two back masters and any amount of slaves. |
@chngtrn you are always free to create a PR with the relevant part of your k8s config as an example. Much appreciated :) |
@belsander I've added k8s manifests via pull request below. |
Here is my docker image, based on linuxserver.io requirements: |
If someone wants to start Cronicle quickly and painlessly in the docker, you can try: https://github.com/soulteary/docker-cronicle I made a simple startup script that can make data reconstruction and migration in docker environment more easily. And, no one needs to wait another 60 seconds before the initial initialization. ( Only Single Master Node Mode) |
for #4
I'm likely to use it with Docker Swarm for now, so will be able to follow up with a docker-compose file that leverages Traefik at some point.