Permalink
Browse files

Merge tag '2.3.0' into stable

2.3.0
  • Loading branch information...
crayfishx committed Jul 24, 2017
2 parents 02612df + a21fa73 commit 9a0a7ffeada4083d4cbdce1f599bbe8d8db59172
Showing with 72 additions and 5 deletions.
  1. +5 −0 CHANGELOG.md
  2. +40 −0 Dockerfile
  3. +23 −2 lib/jerakia/cli/server.rb
  4. +3 −2 lib/jerakia/server.rb
  5. +1 −1 lib/jerakia/version.rb
@@ -1,5 +1,10 @@
# Jerakia Release Notes
## 2.3.0
* Enhancement: Added `--bind`, `--port` and `--token_ttl` options to `jerakia server` to override these values from the CLI
## 2.2.0
* New feature: `config` CLI option to display current runtime configuration
* Fix: Better descrption of --verbose and --debug for server CLI options
@@ -0,0 +1,40 @@
FROM alpine:3.6
MAINTAINER Craig Dunn <craig@craigdunn.org>
ARG RUNTIME_UID=99901
ARG RUNTIME_GID=99901
ENV RUBYOPTS="-W0" JERAKIA_CONFIG="/etc/jerakia/config/jerakia.yaml"
RUN apk update && apk upgrade && apk add bash curl-dev ruby-dev build-base && \
apk add ruby ruby-bundler ruby-io-console sqlite-dev ruby-nokogiri
RUN addgroup -g $RUNTIME_GID jerakia && adduser -u $RUNTIME_UID -G jerakia jerakia -S && \
mkdir -p /usr/app /var/log/jerakia /etc/jerakia /etc/jerakia/policy.d /var/db/jerakia /var/lib/jerakia/plugins /var/lib/jerakia/schema /etc/jerakia/config && \
chown jerakia.jerakia -R /usr/app /var/log/jerakia /var/db/jerakia /var/lib/jerakia/plugins /var/lib/jerakia/schema /etc/jerakia
VOLUME /etc/jerakia/policy.d /var/lib/jerakia/plugins /var/lib/jerakia/data /var/lib/jerakia/schema /var/db/jerakia /etc/jerakia/config
WORKDIR /usr/app
ADD lib ./lib
ADD bin ./bin
COPY Gemfile /usr/app
COPY jerakia.gemspec .
RUN bundle config build.nokogiri --use-system-libraries && \
bundle install --without development test
RUN bundle config build.nokogiri --use-system-libraries && \
bundle install --without development test &&\
bundle exec gem build jerakia.gemspec && \
bundle exec gem install --no-rdoc --no-ri ./jerakia*.gem
VOLUME /etc/jerakia/policy.d /var/lib/jerakia/plugins /var/lib/jerakia/data /var/lib/jerakia/schema /var/db/jerakia /etc/jerakia/config
RUN rm -rf /var/cache/apk*
USER jerakia
ENTRYPOINT ["jerakia"]
CMD ["server"]
@@ -4,6 +4,21 @@ module Server
def self.included(thor)
thor.class_eval do
desc 'server <options>', 'Start the Jerakia REST server'
option :port,
aliases: :p,
type: :string,
desc: 'Specify alternate port to bind to (default 9843)'
option :bind,
aliases: :b,
type: :string,
desc: 'Specify alternate address to bind to (default 127.0.0.1)'
option :token_ttl,
aliases: :t,
type: :string,
desc: 'Specify token TTL (default 300)'
option :config,
aliases: :c,
type: :string,
@@ -37,11 +52,17 @@ def server
:config => options[:config],
:logfile => logfile,
:loglevel => loglevel,
:trace => options[:trace]
:trace => options[:trace],
}
server_opts = {
"port" => options[:port],
"bind" => options[:bind],
"token_ttl" => options[:token_ttl],
}.reject { |k,v| v.nil? }
require 'jerakia/server'
Jerakia::Server.start(jerakia_opts)
Jerakia::Server.start(jerakia_opts, server_opts)
end
end
end
@@ -27,13 +27,14 @@ def jerakia
@jerakia
end
def start(opts)
def start(opts, server_opts={})
@jerakia = Jerakia.new(opts)
require 'jerakia/server/rest'
@config = default_config.merge(Jerakia.config[:server] || {})
@config = default_config.merge(Jerakia.config[:server] || {}).merge(server_opts)
Thin::Logging.logger=Jerakia.log.logger
Jerakia::Server::Rest.set :bind, @config['bind']
Jerakia::Server::Rest.set :port, @config['port']
Jerakia.log.verbose("Starting Jerakia on #{@config['bind']}:#{@config['port']}")
Jerakia::Server::Rest.run!
end
end
@@ -3,5 +3,5 @@ class Jerakia
#
# This should be updated when a new gem is released and it is read from the gemspec file
#
VERSION = '2.2.0'.freeze
VERSION = '2.3.0'.freeze
end

0 comments on commit 9a0a7ff

Please sign in to comment.