-
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
Support building a deployable and self-executable WAR file of Squash #57
Conversation
@@ -3,3 +3,6 @@ | |||
node_modules | |||
doc/fdoc-html | |||
tmp/cache/* | |||
*.war | |||
public/assets | |||
bin/* |
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.
This is to (eventually) account for bundling with --binstubs
such that you can run any gem command from the WAR file by doing (for example): java -jar squash.war -S rails console
. See jruby/warbler#136
@RISCfuture do you have any input for how you think configuration should be handled with the constraint of being able to be provided post-compilation? I'm currently thinking that an initializer that can add an extra Configoro directory based on an environment variable and it will merge those in after all other configs have loaded. Therefore, something like |
I authored the Configoro gem so I'm happy to add runtime configuration directory support if that's the ideal way of doing it. Might be better than polluting the namespace with 100 environment variables. |
Yeah I'd like to avoid that too. The simplest solutions are:
|
I'd prefer the former approach as it allows the app to continue to work for people who do not wish to use ENV-based configuration. |
Actually, both options should allow config as it exists today. In the latter case, it would simply let users interpolate values into their database.yml using ERB and draw the real values from any source ( |
I'd actually vote for doing both of these things. Making Configoro more versatile and inline with Rails' regular The only ugly duckling here is |
Thanks to jruby/warbler#141, this will allow us to do the following in order to start a console, run a rake task, etc. directly from the WAR file: java -jar squash.war -S script/rails console
`setup.rb` can still be used to generate a working database.yml but local changes to this file won't result in a dirty directory
# :development. The gemspec requires warbler/version which doesn't | ||
# exist so the whole thing blows up. Putting this in :default group | ||
# until I can figure out how to fix it. | ||
gem 'warbler', github: 'bjeanes/warbler', platform: :jruby, require: nil |
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.
Squash uses JRuby at Square but we don't need Warbler; no reason we should have to install the gem. I'm facing a similar issue with Resque integration -- how can I avoid bundling the Resque gems for installs that don't use Resque? Bundler has no concept of an "optional" gem.
I need to come up with a comprehensive solution to this problem before we integrate too many optional third-party tools.
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.
This makes a lot of sense. I'll think about it too. If I were in your position, I would investigate what it would take to make Squash a Rails engine such that people can simply include it as a gem into their own mostly empty Rails app and set up customizations from there. I'm going to investigate vendoring Square and mounting the Rails app into a small Rack app as is...
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.
Yeah there were a lot of suggestions about making Squash some kind of giant gem that gets included into an otherwise empty app, but I think that kinda obfuscates the implementation a bit and disincentivizes contribution to the web app.
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.
OK, the most recent commits added a decent (but not awesome) functionality for optional gems. Check it out!
what is squash basic and dtd on xml pls sent me |
@bjeanes may I know about rails engine support work for squash? We were also thinking in the same line. Have you done anything so far ? Thanks. |
Work:
tmp/repos
) configurable since this path is inside the WAR and doesn't accommodate multiple instances running simultaneously (awaiting merge in Make repository clone directory configurable. #61).rake
sub-task works, get all bundler bin stubs executable from the WAR (see java -jar rails.war -S rake db:migrate jruby/warbler#136 and Support running executables from Bundler gems and project-local scripts jruby/warbler#141)warbler
gem should only be in:development
group only. See comment inGemfile
for why it currently is not. Tracked as Warbler bundles own gemspec, even when in an excluded bundler group jruby/warbler#142.config/database.yml
)ENV
varsENV
ENV
adapter, for example — useful for Heroku deployers)