-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Incorporate install.sh into the docker image #2393
Comments
The install script does not install anything on the host. |
Alright then, so no installs on the host (that one sounded weird to me anyways). The migrations have to run in the containers, anything else wouldn't make sense (or even work). But the migrations aren't actually started on startup. Is there a reason for not doing that? I cannot imagine a single scenario in which this makes sense. Conceptually speaking: If you are running an updated version of some software, it HAS to run the database migration as well, otherwise the database may very well be in a state the application doesn't expect and cannot handle. Docker gives us a way of specifying what version of an image you want, why have some random script sit in the middle? |
We would love to simplify the installation process for self-hosted by reducing the number of containers in use, it's actually on our radar but we haven't quite gotten to it. To answer some of your questions
It is expected the
The migrations are run during the |
Interesting! Simplifying the underlying container structure would surely be nice, i don't want to hinder the enthusiasm, but this feature-request was more about removing the install.sh script from a user standpoint. To get back to one of your points:
Are you referring to the install script picking out the platform like ARM or x86? If user-friendliness is a concern for some install configuration which isn't yet in the post-install webpage, or which simply can't be handled beforehand, then i can also recommend another approach to getting a valid docker-compose with all the proper environmental variables set: Installation wizardA publicly hosted configuration wizard (No magic here, sorry). That idea is stolen shamelessly from the mailu project, if you're interested to what i mean, check it out here: It just asks the user a sequence of questions in an easily understandable way and then generates the appropriate docker-compose.yml and .env files according to your specifications. That would mean, that a beginner can quickly get up and running, and someone who is more experienced can deal with the configuration from a familiar docker-compose and env-file environment. I personally think that this encompasses the best of both worlds and eliminates the need of some script to be run on the self-hoster's machine. Open-sourcing the public instance's code would also be a practical requirement, as people are (and should be) very hesitant to enter environment specific information into a black box. I personally think the effort for creating, and running such a service is negligible in comparison to the potential uses it brings to the table. Running migrations on container start
On that note, is there anything which would prevent those migrations from being run on container startup? Implementing migrations on startup would basically eliminate the need for the install.sh when upgrading to newer releases, right? |
Yes, as our goal was to have an easy installation as possible for our users.
Any sort of db migration will incur some sort of risk, and it's possible data will be lost in that process and the installation could result in corrupted data. Additionally, with large amounts of data this migration could take a long time which could slow the startup-time in the scenario that the server crashes. I don't think that's a super ideal way to go about this. We can take this feedback and discuss it to see if any improvements will be made. Thanks for writing in :) |
This issue has gone three weeks without activity. In another week, I will close it. But! If you comment or otherwise update it, I will reset the clock, and if you remove the label "A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀 |
I'm just itching to go over those points :) For anyone reading this, and not knowing what migrations are, or why they matter, here is a quick rundown (if you know what they are, just skip this section) What are migrations?Database schemas may change in the lifetime of software. New tables will be added, relationships between them may change, the types or names of columns may be changed (deleted or created). Deeper diveNow, lets get to some of your points.
Yes, totally!
Still on board with your statement. However, there is one big issue with it: Why should the migrations be run? The manual way is fine, isn't it?If we go back to "What are migrations", we'll notice a single purpose: If a migration fails, the application should be unable to start. Because if it does start you get in the territory of undefined behavior. All bets are off at that point. Taking the django migrations as an example: Meaning, the only time a migration is run, is during setup and after upgrading to a newer release. When you migrate any software in production, you better make a backup of that system anyways. Startup time
Startup-time is certainly a concern. That's what i was worried about in my earlier posts as well. This one i feel like has to be tested and could break the camel's back. Though, again, migrations are only really applied on new releases (other systems may not be as forgiving as django, so this has to be carefully considered), a bit of educating the users can go a long way.
I'm kind of lost here, you're saying I'd argue the application doesn't start up at all, but maybe i got lost in the words there :) IdeasI think i've made my thought process at least somewhat clear, yet i can practically hear some of the issues you didn't mention but are probably thinking about. Lets get to a few: Will this result in problems for users (or more concretely your customers)Lets answer this with the most annoying answer: another question. Is the current system not resulting in issues? What if someone gets confused as to why the service isn't up and running?Startup may take longer due to running migrations, as discussed earlier. Impatient users (or those with a lot of data which has to be changed in the migration) may get confused/worried about the startup time. They might even choose to stop the service because they think its misbehaving or something similar. This is not really a technical problem, but more of an educational one. What is the impact on bigger systems (namely those which have a lot of historical data)I'll throw in a bold statement: How do i reach that conclusion? A few reasons (in no particular order):
Looking forward to your response. Sorry for the wall of text, i couldn't condense it down further without losing important points in my opinion. |
Thanks for the writeup @jakdevmail. We really appreciate the time you took here.
Yeah, you're right here, as the migrations must be run at some point regardless if upgrading to a new version. It technically shouldn't matter the timing when the migrations are run, and it is a one time process. You've made a lot of good points here regarding impact. I'd like to keep this issue open for discussion. Unfortunately, we don't have bandwidth right now to tackle this problem but you are welcome to submit PR's to help us out. |
I've just started experimenting with self-hosting Sentry and would love a solution with fewer containers and which has the install logic integrated into the entrypoint script. You may want to check out GitLab and Mattermost for inspiration. They both apply all upgrades, including migrations, automatically at container startup. GitLab is particularly slick in this regard. It's a single omnibus container which contains all their services (and there are a lot of them). Upgrading is as simple as pulling the latest image and running it. |
This issue has gone three weeks without activity. In another week, I will close it. But! If you comment or otherwise update it, I will reset the clock, and if you remove the label "A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀 |
Problem Statement
As it stands right now, the self-hosted setup requires the install.sh script to be run.
I have only tried sentry out for a few hours and have only glimpsed at some code snippets so far. The following info may therefore be inaccurate or just plain wrong. If you notice inaccuracies, please tell me about it! I see this more as an open discussion which could improve sentry :)
The install.sh script does basically these things:
Thanks to @aldy505 over on discord for sharing some insight on what the script is supposed to do.
I run a fair share of containerized services in my environment, over the years, through a bit of work and/or changing some docker images i've been able to get all my services to a point where they are just a docker-compose.yml file away from "just working".
Sentry is the exception to that rule. As the install.sh seems to do quite a bit, this could potentially require a considerable amount of work to get to that point.
Solution Brainstorm
Now that its clear what the script does, and what pain point i have, what is the point of all of this?
Why isn't the install.sh script simply a part of the containers themselves?
Things like docker volume creation and initial configuration can be easily achieved by simply providing an example docker-compose.yml and documenting the configuration options.
This change would mean that updating sentry is just a matter of pulling the new images and recreating the containers (basically a docker-compose pull && docker-compose up -d --force-recreate).
I'd be interested in helping with the sentry containers as i'm quite familiar with django and its migration system, but i'm not sure what i could contribute to the other container images.
Is this something that was already in the making possibly? Or is this maybe not wanted/possible due to something i've overlooked?
Looking forward to your responses :)
The text was updated successfully, but these errors were encountered: