diff --git a/Dockerfile b/Dockerfile index 7e5dfa9..027e71e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,13 @@ -FROM ruby:2.4.0-alpine +FROM ruby:2.4.1-alpine ENV APPLICATION /usr/lib/origin ENV RAILS_ENV production ENV PORT 3001 +ENV BUNDLE_FORCE_RUBY_PLATFORM 1 WORKDIR $APPLICATION -RUN apk add --no-cache build-base tzdata +RUN apk add --no-cache build-base tzdata protobuf RUN apk add --no-cache --repository http://nl.alpinelinux.org/alpine/v3.5/main postgresql-dev RUN gem install bundler diff --git a/Gemfile b/Gemfile index e2f388a..68ed781 100644 --- a/Gemfile +++ b/Gemfile @@ -11,6 +11,7 @@ gem "pry-rails", "0.3.6" gem "pry-remote", "0.1.8" gem "bugsnag", "5.3.2" gem "secure_headers", "3.6.4" +gem "google-cloud-pubsub", "0.24.0", require: "google/cloud/pubsub" group :development, :test do gem "rspec-rails", "3.6.0" diff --git a/Gemfile.lock b/Gemfile.lock index b189db2..2cdde9c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -38,6 +38,8 @@ GEM i18n (~> 0.7) minitest (~> 5.1) tzinfo (~> 1.1) + addressable (2.5.1) + public_suffix (~> 2.0, >= 2.0.2) arel (8.0.0) bcrypt (3.1.11) bugsnag (5.3.2) @@ -46,26 +48,71 @@ GEM concurrent-ruby (1.0.5) diff-lcs (1.3) erubi (1.6.0) + faraday (0.12.1) + multipart-post (>= 1.2, < 3) globalid (0.4.0) activesupport (>= 4.2.0) + google-cloud-core (1.0.0) + google-cloud-env (~> 1.0) + googleauth (~> 0.5.1) + google-cloud-env (1.0.0) + faraday (~> 0.11) + google-cloud-pubsub (0.24.0) + google-cloud-core (~> 1.0) + google-gax (~> 0.8.0) + grpc-google-iam-v1 (~> 0.6.8) + google-gax (0.8.2) + google-protobuf (~> 3.2) + googleapis-common-protos (~> 1.3.5) + googleauth (~> 0.5.1) + grpc (~> 1.0) + rly (~> 0.2.3) + google-protobuf (3.3.0-x86_64-linux) + googleapis-common-protos (1.3.5) + google-protobuf (~> 3.2) + grpc (~> 1.0) + googleauth (0.5.1) + faraday (~> 0.9) + jwt (~> 1.4) + logging (~> 2.0) + memoist (~> 0.12) + multi_json (~> 1.11) + os (~> 0.9) + signet (~> 0.7) + grpc (1.2.5-x86_64-linux) + google-protobuf (~> 3.1) + googleauth (~> 0.5.1) + grpc-google-iam-v1 (0.6.8) + googleapis-common-protos (~> 1.3.1) + googleauth (~> 0.5.1) + grpc (~> 1.0) i18n (0.8.1) jsonapi-resources (0.9.0) activerecord (>= 4.1) concurrent-ruby railties (>= 4.1) + jwt (1.5.6) + little-plugger (1.1.4) + logging (2.2.2) + little-plugger (~> 1.1) + multi_json (~> 1.10) loofah (2.0.3) nokogiri (>= 1.5.9) mail (2.6.5) mime-types (>= 1.16, < 4) + memoist (0.15.0) method_source (0.8.2) mime-types (3.1) mime-types-data (~> 3.2015) mime-types-data (3.2016.0521) mini_portile2 (2.1.0) minitest (5.10.1) + multi_json (1.12.1) + multipart-post (2.0.0) nio4r (2.0.0) nokogiri (1.7.1) mini_portile2 (~> 2.1.0) + os (0.9.6) pg (0.19.0) pry (0.10.4) coderay (~> 1.1.0) @@ -76,6 +123,7 @@ GEM pry-remote (0.1.8) pry (~> 0.9) slop (~> 3.0) + public_suffix (2.0.5) puma (3.8.2) rack (2.0.1) rack-authentication_bearer (1.0.0) @@ -106,6 +154,7 @@ GEM rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) rake (12.0.0) + rly (0.2.3) rspec-core (3.6.0) rspec-support (~> 3.6.0) rspec-expectations (3.6.0) @@ -125,6 +174,11 @@ GEM rspec-support (3.6.0) secure_headers (3.6.4) useragent + signet (0.7.3) + addressable (~> 2.3) + faraday (~> 0.9) + jwt (~> 1.5) + multi_json (~> 1.10) slop (3.6.0) sprockets (3.7.1) concurrent-ruby (~> 1.0) @@ -148,6 +202,7 @@ PLATFORMS DEPENDENCIES bcrypt (= 3.1.11) bugsnag (= 5.3.2) + google-cloud-pubsub (= 0.24.0) jsonapi-resources (= 0.9.0) pg (= 0.19.0) pry-rails (= 0.3.6) diff --git a/config/initializers/google_pubsub.rb b/config/initializers/google_pubsub.rb new file mode 100644 index 0000000..cb5d77c --- /dev/null +++ b/config/initializers/google_pubsub.rb @@ -0,0 +1,3 @@ +client = Google::Cloud::Pubsub.new(ENV["GOOGLE_CLOUD_PROJECT"]) + +PUBSUB_CLIENT = client.topic(ENV["GOOGLE_CLOUD_PUBSUB_TOPIC"])