-
Notifications
You must be signed in to change notification settings - Fork 135
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
Use ENV variables for configuration, more upgradable (and Heroku support) #36
base: master
Are you sure you want to change the base?
Conversation
So what options do we have for Git repository access? About the only one I can think of is to somehow serialize the repository to the database, and create an in-memory representation of it at runtime. Which sounds very slow. |
Can someone fill me in on which parts of the workflow require special Somehow I was under the impression that the squash web app is the one that decides what the |
No, but performance will be very slow because each time your dynos restart all local copies of your projects' repositories are discarded. So you will be constantly re-cloning your repos. I'm struggling to find an optimal solution to this. |
OK, before this pull request is merged, we'll need
|
Ya... And I believe they wind down anytime they haven't been accessed recently (which will happen quite often on an application that only 4 developers are ever likely to look at)... I see the problem here, I can think of two possible solutions:
-- The app would need to store the credentials of a user that had access to the repos in question (Perhaps via environment variables) for private repos
-- This would require having a custom buildpack on all apps you intend on using with To recap: Squash Web ➡️ Buildpack clones client apps into... 💩 Shit. Just realized if you have any reasonable number of apps this would take forever, and it's not very feasible to clone everything into the app because heroku will end up limiting your slug size. It'd also be annoying to tell squash which apps it should pre-clone anytime you needed to add another app. Heroku integration is more complicated than it seems at first! It may be best to try to get the data you need via github API requests and cache or save reusable responses in the database... That of course limits people on heroku to using github and not other VCS's like bitbucket etc. |
I think Heroku support with a FS-based git repo is completely unfeasible — by design, on Heroku's part. The Git Data API could be used to support GitHub (Enterprise) repositories, but that's about it. However, we shouldn't conflate the heroku issue with the configuration changes, they have independent value. I am not deploying to Heroku but really don't want to have to use yml files for configuration for a few reasons. Upgradeability is a huge concern and, as much as possible, the app should be runnable and (reasonably) configurable without having to maintain your own fork of the project (or even make any commits at all). |
That's a valid point. We should split this into two issues. |
@RISCfuture agreed. So far, this PR is completely about configuration being decoupled from yml files that are committed. I think that's great for a number of reasons... I'm trying to get Squash deployed and running at Groupon at the moment, and am interested in making a few changes that would allow people in my situation to run squash as unmodified as possible, to maintain the ability to keep upstream changes mergable, Ideally, I shouldn't have to make a single deployment-specific commit to the project to get it running. This allows homogeneity which is awesome for things like community, upstream contributions, and cross-community support. I'm planning to make a few PRs this week to this end, if you'd be interested:
This PR starts on point 2 which is why I'm interested in it... Crap that was a long comment and a total tangent. |
Throw in Sidekiq for 3) and I'd appreciate it :) I'm considering the switch here at Square. Good luck and let me know if you need anything explained. |
@bjeanes @RISCfuture cool. I think continuing on with improving configuration / upgradeability from this start would be a good thing. The other points @bjeanes brought up, pretty related but could be separated out into further issues. All useful stuff 👍 On the git file system access, I have some ideas which I will try and document in a new issue when I get a chance. In short though, I think all of the git interaction could be separated to an interface. This could be the github API (if they released a blame API feature), github enterprise, a git repo fronted by a simple sinatra app on a separate server with a writable file system. You name it. |
OK (3) is done. 600adf0 |
@@ -1,4 +1,5 @@ | |||
source :rubygems | |||
ruby '1.9.3' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've submitted a pull request at RISCfuture/Configoro#2 to enable ERB preprocessing of YAML configuration files. This will allow |
@RISCfuture I think you can prevent restarts by keeping the application alive through ping the server every once and so often. (this is what I've done with all my apps on Heroku for better response times). This can be done for example with the NewRelic addon through monitoring. When you do this a restart only happens once a day. One |
One git-clone per day is fine. I've accepted the Configoro PR but it's ugly to have those |
@RISCfuture it doesn't have to be the default, the Configoro change just enables people to do that if they choose. They could also draw it from other arbitrary sources (Java |
Ugly maybe, but I'll take it over tools to rewrite and then commit config files :) |
Yeah, I agree with the idea; I'm just debating where best to abstract the logic. Open to ideas. |
Yeah I've wondered that on various projects; |
So, I'm aware there's another issue open #33 however, I think the point has been lost amongst using jruby etc. None of that is required to get it running on heroku.
The few changes made have allowed me to
Using the following process to create the app.
I'm not happy with where the hacks are to use ENV variables at present. There are more configurations set during
setup.rb
to be extracted and perhaps modifying the setup itself. However, this approach:git pull && git push heroku
)I would use this in conjunction with a
.env
file (added to .gitignore) and instantiating those ENV variables before running the server withor using the
dot_env
gem.I would continue further here but the heroku File System concerns I've outlaid in #35 have pretty much stopped my progress. I'm not sure running on heroku will be possible without drastic changes to git repository integration.
Therefore, this is more a proof of concept but I thought I would document here as