Giter Site home page Giter Site logo

jetpack's Introduction

Jetpack

Build Status

jet.pack: package your JRuby webapp for Jetty.

There are already many tools in existence that help developers run JRuby webapps on popular servlet containers, such as trinidad, warbler, mizuno, and kirk. Jetpack is not fundamentally different from these tools: like the rest of them it uses the jruby-rack jar as a foundation. The key differences are stylistic.

Jetpack:

  • Uses Jetty... in all of its out-of-the-box, XML-configuration-file glory.
  • Uses bundler to "vendor" all of your gems.
  • Uses the jruby-complete jar, and provides convenience wrapper scripts (bin/ruby and bin/rake) in your project.
  • Does not attempt to run Jetty in a ruby-first, embedded manner.
  • Does not assume JRuby is already installed in your server environment (a basic JRE will do just fine).
  • Does not force your ruby webapp to load files from a jar or war.

In short, Jetpack creates a little self-contained JRuby/Jetty/vendored-gem world around your ruby project, which you only need to transport to a server and fire up using a JRE.

Jetpack's implementation mainly consists of an honest, proletarian, bash-like ruby script.

Install

Deploys need to be performed using MRI. Here is a sample section of a project Gemfile:

platforms :mri do
  gem 'jetpack'
end

Create config/jetpack.yml in your project:

jruby: "http://jruby.org.s3.amazonaws.com/downloads/1.7.25/jruby-complete-1.7.25.jar"
jetty: "http://download.eclipse.org/jetty/9.2.18.v20160721/dist/jetty-distribution-9.2.18.v20160721.zip"
jruby-rack: "http://central.maven.org/maven2/org/jruby/rack/jruby-rack/1.1.20/jruby-rack-1.1.20.jar"
app_user: "myapp"
app_root: "/usr/local/myapp/myapp"

Some other settings you might care about:

java_options: "-Xmx2048m"
http_port: 4080
https_port: 4443
max_threads: 50
ruby_version: 1.8
app_type: rack
keystore_type: JCEKS
keystore: /data/app/secrets/mystore.jceks
keystore_password: sekret
bundle_without: [test, development]

Run Jetpack:

bundle exec jetpack .

Of note, you'll now have:

  • a bin directory, with scripts that run ruby and rake, using jruby and with the gems defined in your project.
  • a vendor/jetty directory, containing everything necessary to run your app using jetty.
    • You can try your app out by cd'ing into vendor/jetty and running RAILS_ENV=development java -jar start.jar
    • vendor/jetty/jetty-init is an init script that starts your project. You should symlink /etc/init.d/[appuser]-jetty to this file, and then point monit at /etc/init.d/[appuser]-jetty

jetpack's People

Contributors

amrik avatar bdon avatar cee-dub avatar cheister avatar cuzelac avatar danrarr avatar ggilder avatar jeremywmoore avatar robbiegill avatar robolson avatar rudle avatar sconover avatar sqdan avatar tamird avatar taylorphillips avatar tristansokol avatar xaviershay avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jetpack's Issues

keystore file examples

Can someone show me what these keystore files should look like:

keystore_type: JCEKS
keystore: /data/app/secrets/mystore.jceks
keystore_password: sekret

I currently have those 3 lines in my jetpack.yml file, but they are commented out.
When I java -jar start.jar it asks me for "org.eclipse.jetty.ssl.password " which I just leave blank and hit enter.

What does .jceks look like? I'm assuming these are ssl related settings??

app_type is ignored

app_type seems to be ignored and all apps are created with a rails setup. Is there an easy way to use jetpack with just rack/sinatra?

When starting the app, the jetty expects RAILS_ENV to be set. Changing this setting manually via the XML still leads to issues with rails/type exceptions (ie. requiring dispatcher).

Running start.jar uses ruby 1.8.7, doesn't work with new hash syntax in session_store.rb

I'm running rvm, and my default ruby is 1.9.3.
When I run the jar that jetpack produces, I get the below error:

An exception happened during JRuby-Rack startup|/Users/snad/dev/sources/jruby/jettytest/jettytest/config/initializers/session_store.rb:3: syntax error, unexpected ':'||Jettytest::Application.config.session_store :cookie_store, key: '_jettytest_session'| ^|--- System|jruby 1.6.5.1 (ruby-1.8.7-p330) (2011-12-27 1bf37c2) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_51) [darwin-x86_64-java]|Time: Thu Jul 04 00:02:18 -0400 2013|Server: jetty/7.4.5.v20110725|```

Why is it using ruby 1.8.7? When I ran 'bundle exec jetpack .' I was using rvm with ruby-1.9.3-p392

I am using jruby 1.7.4 also.

Issues with rake binstub when updating from older jetpack version

I am trying to update a project using a quite old fork of jetpack (Chorus/jetpack) to the current version, but am encountering issues with the binstubs bundler is producing.

Previously bin/rake had this content (from jetpack):

#!/bin/bash

set -e

export FULL_DIR=`cd $(dirname $0); pwd`
export PATH=$FULL_DIR:$PATH
export GEM_HOME="file:$CHORUS_HOME/vendor/jruby.jar!/META-INF/jruby.home/lib/ruby/gems/1.8"
export GEM_PATH="file:$CHORUS_HOME/vendor/jruby.jar!/META-INF/jruby.home/lib/ruby/gems/1.8:vendor/bundler_gem"

cd $(dirname $0)/..

.rake_runner "$@"

Now it is produced by bundler with a jruby shebang#!/usr/bin/env jruby:

#!/usr/bin/env jruby
#
# This file was generated by Bundler.
#
# The application 'rake' is installed as part of a gem, and
# this file is here to facilitate running it.
#

require 'pathname'
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
  Pathname.new(__FILE__).realpath)

require 'rubygems'
require 'bundler/setup'

load Gem.bin_path('rake', 'rake')

So, executing bin/rake (as before) fails because jruby in not in the path. Trying to execute it with bin/jruby -S bin/rake will complain about git not being installed when using gems from git repos. Both errors are unexpected/changes when using the vendored jruby/gem world from jetpack.

Any ideas? Am I still correct in assuming I should be able to use a jetpack app without jruby in the path?

Other details:

  • The gems are vendored in vendor/bundle/jruby/1.9/gems/
  • bin/jruby content:
#!/usr/bin/env bash

cd $(dirname $0)/..

export RUBY=bin/ruby #This is needed to prevent rake from exploding

GEM_HOME=vendor/gems exec java $CHORUS_JAVA_OPTIONS -jar vendor/jruby.jar --1.9 "$@"

LoadError: OpenSSL::SSL requires the jruby-openssl gem

Created a new rails app rails new jetpack. Added the jetpack gem and config/jetpack.yml to the new rails application. Ran bundle exec jetpack . inside the rails app.

Resulted in the following:


LoadError: OpenSSL::SSL requires the jruby-openssl gem
                         (root) at file:/Users/tsanden/repos/jetpack/vendor/jruby.jar!/META-INF/jruby.home/lib/ruby/site_ruby/shared/jruby/openssl/autoloads/ssl.rb:8
                            ssl at file:/Users/tsanden/repos/jetpack/vendor/jruby.jar!/META-INF/jruby.home/lib/ruby/site_ruby/shared/jruby/openssl/autoloads/ssl.rb:451
                 connection_for at /Users/tsanden/repos/jetpack/vendor/bundler_gem/gems/bundler-1.1.rc/lib/bundler/vendor/net/http/persistent.rb:216
                        request at /Users/tsanden/repos/jetpack/vendor/bundler_gem/gems/bundler-1.1.rc/lib/bundler/vendor/net/http/persistent.rb:358
                          fetch at /Users/tsanden/repos/jetpack/vendor/bundler_gem/gems/bundler-1.1.rc/lib/bundler/fetcher.rb:135
  fetch_dependency_remote_specs at /Users/tsanden/repos/jetpack/vendor/bundler_gem/gems/bundler-1.1.rc/lib/bundler/fetcher.rb:160
             fetch_remote_specs at /Users/tsanden/repos/jetpack/vendor/bundler_gem/gems/bundler-1.1.rc/lib/bundler/fetcher.rb:122
                          specs at /Users/tsanden/repos/jetpack/vendor/bundler_gem/gems/bundler-1.1.rc/lib/bundler/fetcher.rb:70
                   remote_specs at /Users/tsanden/repos/jetpack/vendor/bundler_gem/gems/bundler-1.1.rc/lib/bundler/source.rb:230
                           each at org/jruby/RubyArray.java:1612


...

'cd . && PATH=$PATH:$(dirname $0) GEM_HOME="file:/Users/tsanden/repos/jetpack/vendor/jruby.jar!/META-INF/jruby.home/lib/ruby/gems/1.8" GEM_PATH="file:/Users/tsanden/repos/jetpack/vendor/jruby.jar!/META-INF/jruby.home/lib/ruby/gems/1.8:vendor/bundler_gem" exec java -Xmx2048m -jar vendor/jruby.jar --1.9  -e 'require "rubygems"; require "bundler"; require "bundler/cli"; cli=Bundler::CLI.new; cli.options={:deployment=>true}; cli.install'' failed.

I'm also using rbenv, not sure if this is causing issues.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.