-
Notifications
You must be signed in to change notification settings - Fork 79
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
Suggestion: Docker images that track this repo #69
Comments
@VikashKothary I am willing to help contribute on this. We can probably just use the Dockerfile from https://github.com/ankicommunity/docker-anki-sync-server. Let me know if you agree with my assessment. |
Hi @samyak-jain, Thanks for your suggestion. It's a really interesting topic and it think this a very valid suggestion, which comes with both pros and cons. Let's break it down. I want to apologise in advance because I think this will be a common question by many contributers and users as such I want to document my reasons for the current setup.
Firstly, what you're saying is very true. The fact that our docker images doesn't use this repo for its builds, is in my opinion the most critical issue in the community currently. I believe that it is in the process of being fixed, see: https://github.com/ankicommunity/docker-anki-sync-server/pull/21/files and ankicommunity/anki-devops-services#13. Feel free to join the conversation and review the PR that has been made. Secondly, I would agree that including the Docker image as part of the source code repos is a more common practice compared to separate repos for it. The current setup is my current process but it's one that also comes with its own pros and cons. So I'll try and explain my thought process and I'd love to hear what you think.
1) The Docker repo is more than just a Dockerfile. See my comments on all the different steps I follow when developing and deploying containers: ankicommunity/anki-devops-services#11 (comment). While writing a single Dockerfile is simple enough, the comment lists 5 different outputs/steps which need to be created to properly deploy the container. Which some users will be happy enough with just a Docker image, other users will feel that is not enough. @kuklinistvan and @AntonOfTheWoods do a great job of arguing both sides in the ticket and I'd recommend a read because it's really insightful. 2) Dockerfiles should be linted, tested and documentated. What wasn't mentioned in the ticket above, is that all 5 outputs are just source code (configuration as code). Dockerfiles like any other project should be linted for easy readability. This includes all bash/python scripts included in them that have nothing to do with this project itself. Dockerfiles can also be tested to confirm that the Dockerfiles work. I believe this is an important step to prevent shipping broken images. Dockerfiles also have different documentation in relation to them. This could involve describing how the images can be customised (using environment variables), also information on compatibility with different cloud services. 3) A development Dockerfile is not a production Dockerfile The next point I want to make is the a Dockerfile included in repos tend to favour development. An example of this is using a Ubuntu base image over a Alpine or Distoless base image. This makes sense but makes the images a lot more chunky and could cause security issues when running in production. 4) Dockerfiles multiply like bunnies Currently this repo requires two Docker iamges. Nginx and Python. A single centralised could support both. In the future, it can support others include databases which have been preconfigured to work with the Anki servers. 5) It's a specialised skill. The idea is that this repo is for Python developers and the Docker repo is for DevOps Engineers. We also have Djankiserv which includes its own Docker images so if a DevOps Engineer wants to make a change to all the images, they can do so all in one repo. This should scale better. 7) Is this the perfect setup? No. The biggest downside for this approach is the added complexity. This is the reason I have doubts with this setup however it does seem to scale better. If you know how we can maintain the benefits in a simpler workflow then I'd definitely be keen. Let me know your thoughts. |
Thanks for the thoughtful and detailed response! Here are my 2 cents:
One reason I insist on having the Dockerfile alone in this repository is so that we can setup CI to get the latest version of the anki server. For example, if any update to AnkiDesktop breaks the server, and sometime later this project patches up the issue. I will have to wait for someone to manually update the docker image which as you are aware is not even tracking the only active version of the server. I understand a lot of the points you bring up here. But I think if we keep thinking about how we build production grade infrastructure and build the most perfect DevOPS setup, we are letting the perfect be the enemy of the good. |
Missed your 4th point
|
Hi @samyak-jain, Okay I'm going to take a step back and discuss not the Am I correct to understand, that this issue would be solved, if there was a CI build, that released a new Docker Image whenever a commit was made to either the master or develop branches in the repo, regardless of where the Dockerfile is? Or is this a ticket, about the best practices in managing Dockerfiles? |
Yeah. I think we can consider this issue resolved if a CI is setup to track this repo. If you'd like, discussion of best practices can move to a different issue. |
Hey @VikashKothary , just a friendly ping. I am willing to take this on. Let me know if it's ok if I work on this. |
Hi @samyak-jain, So another contributor raised a similar issue. And like I said in that ticket, what you're saying makes sense. But I'm currently in the process of improving our build process, so if you continue to think there is an issue after I've made my changes, then I'm happy to discuss this further. I know you wish to see the latest changes from this project being deployed to our Docker images so you can use it without all this additional hassle, so I will try and make the changes ASAP. |
Sounds good! Thanks for working on this. For now, I'm using my fork which has Dockerfile + Github Actions: https://github.com/samyak-jain/anki-sync-server. Feel free to leverage any part of this in your efforts. Also let me know if there's anything that you feel requires help and I'd be happy to chip in. |
Hi @samyak-jain, We're making progress on this issue. We've implemented Github Actions in the devops repo and I hope to create a release to update the image on Dockerhub. See ankicommunity/anki-devops-services#11 for more information on that. While both tickets cover similar topics, I want to keep this ticket open because you make a good point that changes to this repo should trigger Docker builds and that hasn't been implemented. So I think this ticket should cover the changes needed in this repo to make that happen. Until that has happened, feel free to join the conversation on the other topic. |
Right now, the instructions ask us to use the following repo: https://github.com/ankicommunity/docker-anki-sync-server to deploy this server using Docker.
IMHO, I think the following
I think the best approach here should be to include a github action so that the latest tag of the official docker image tracks the master of this repo.
The text was updated successfully, but these errors were encountered: