ocean-rails 7.2.5 → 7.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ae94418c6ed9425568ee1da771c64cff6dc5dc25720c451e4d27b5d3bd446c91
4
- data.tar.gz: 11b92197a8b0fc5cac8c825fc85ae51d73f216772ccd2abe51cccce98663143c
3
+ metadata.gz: 65fb8fb628f0daa342b47ba75447cada3b97d1b583feac3c2b1ce6c88e48ceb6
4
+ data.tar.gz: b7e3d250c457b1b71b1e867a77da6401df1c5be8e41f6ef61b2620024a6a6ca4
5
5
  SHA512:
6
- metadata.gz: d93655a8e004101667ba7c02c608648ca3e07801a47b556e1459fc055c641e7a9acbee11d452dcade0f23ac3bec238d4460b77676f604c68d432dcae3425cec1
7
- data.tar.gz: 29561210bd7dad8ebccc975613e341b2e5e3ef50dda1906521341a9d0dd180de130718c2353d6fc8ac4936da750a1265d9b975d84cb18839ef145dc67fcb6df6
6
+ metadata.gz: a3cccb9f2f64465228356ee2cb1aa9e683949186581a6a6a83efc755177637a88c9c177948b8e5ec906bc863aaf3994f8f82e393cad51c433b7ebf18e6758b41
7
+ data.tar.gz: 3b050247ae9c3c20b8808329ce3a75adb2747e31b5e96b3ec2503fa3758b9c48d662839ccffe4f7451a47fd2aff67e3c6f726385670c1bcf058ccd632e22750f
@@ -76,15 +76,19 @@ class OceanSetupGenerator < Rails::Generators::NamedBase #:nodoc: all
76
76
  end
77
77
 
78
78
  def install_config_yml_files
79
- template "config.yml", "#{Rails.root}/config/config.yml"
79
+ copy_file "config.yml", "#{Rails.root}/config/config.yml"
80
80
  end
81
81
 
82
82
  def install_aws_yml_files
83
- template "aws.yml", "#{Rails.root}/config/aws.yml"
83
+ copy_file "aws.yml", "#{Rails.root}/config/aws.yml"
84
+ end
85
+
86
+ def install_puma_config_file
87
+ copy_file "puma.rb", "#{Rails.root}/config/puma.rb"
84
88
  end
85
89
 
86
90
  def install_default_cache_time_file
87
- template "default_cache_time.rb", "#{Rails.root}/config/initializers/default_cache_time.rb"
91
+ copy_file "default_cache_time.rb", "#{Rails.root}/config/initializers/default_cache_time.rb"
88
92
  end
89
93
 
90
94
  def replace_gemfile
@@ -97,4 +101,13 @@ class OceanSetupGenerator < Rails::Generators::NamedBase #:nodoc: all
97
101
  git :init
98
102
  end
99
103
 
104
+ def setup_docker
105
+ copy_file "Dockerfile", "#{Rails.root}/Dockerfile"
106
+ copy_file "dockerignore", "#{Rails.root}/.dockerignore"
107
+ end
108
+
109
+ def setup_dotenv_file
110
+ copy_file "env", "#{Rails.root}.env"
111
+ end
112
+
100
113
  end
@@ -0,0 +1,49 @@
1
+ FROM ruby:2.5.1-alpine
2
+ MAINTAINER peter@peterbengtson.com
3
+
4
+ # Set locale
5
+ ENV LANG=en_US.UTF-8 \
6
+ LANGUAGE=en_US.UTF-8 \
7
+ LC_CTYPE=en_US.UTF-8 \
8
+ LC_ALL=en_US.UTF-8
9
+
10
+ # Update and upgrade
11
+ RUN apk update && \
12
+ apk upgrade && \
13
+ apk add --no-cache --virtual .build-deps \
14
+ build-base && \
15
+ apk add --no-cache \
16
+ mysql-dev && \
17
+ apk add --no-cache \
18
+ socat \
19
+ tzdata \
20
+ curl \
21
+ findutils && \
22
+ ln -fs /usr/share/zoneinfo/GMT /etc/localtime && \
23
+ gem install bundler
24
+
25
+ # Create the /srv directory to run the Rails app from
26
+ RUN mkdir -p /srv
27
+ WORKDIR /srv
28
+
29
+ # Install gems
30
+ COPY Gemfile Gemfile.lock ./
31
+ RUN bundle install --jobs 25 --retry 5
32
+
33
+ # Delete build dependencies
34
+ RUN apk del .build-deps
35
+
36
+ # Install the app, except for files excluded in .dockerignore
37
+ COPY . ./
38
+
39
+ # Create the tmp directory in the app
40
+ RUN mkdir -p tmp
41
+
42
+ # Expose the service port
43
+ EXPOSE 80
44
+
45
+ # Set the shell command line prefix
46
+ ENTRYPOINT ["bundle", "exec"]
47
+
48
+ # Start the web server
49
+ CMD ['puma' '-C' 'config/puma.rb']
@@ -19,13 +19,10 @@ INTERNAL_OCEAN_API_URL: <%= ENV['INTERNAL_OCEAN_API_URL'] %>
19
19
  # This enumerates the latest versions of all resources in the system, not just the
20
20
  # ones defined by this service. You should keep it updated at all times.
21
21
  # The special key _default is used as a fallback.
22
- #API_VERSIONS: <%= JSON.parse(ENV['API_VERSIONS']) %>
22
+ API_VERSIONS: <%= ENV['API_VERSIONS'] %>
23
23
 
24
24
  # This is the list of IP numbers for the Varnish instances. (For PURGE and BAN.)
25
- LOAD_BALANCERS: <%= ENV['LOAD_BALANCERS'].split "," %>
26
-
27
- # This is the list of IP numbers for the memcached servers. (Only used in production.)
28
- MEMCACHED_SERVERS: <%= ENV['MEMCACHED_SERVERS'].split "," %>
25
+ VARNISH_CACHES: <%= ENV['VARNISH_CACHES'] %>
29
26
 
30
27
  # The password regex and error message
31
28
  PASSWORD_REGEXP: <%= ENV['PASSWORD_REGEXP'] %>
@@ -0,0 +1,9 @@
1
+ .git
2
+ .gitignore
3
+ coverage
4
+ .DS_Store
5
+ /db/*.sqlite3
6
+ /log/*.log
7
+ /tmp
8
+ *.log
9
+ /.bundle
@@ -0,0 +1,26 @@
1
+ # config.yml
2
+ OCEAN_ENV=dev
3
+ APP_NAME=yourappname
4
+ API_USER=yourappname
5
+ API_PASSWORD=xxxxxxxxxx
6
+ BASE_DOMAIN=example.com
7
+ OCEAN_API_HOST=dev-api.example.com
8
+ OCEAN_API_URL=http://dev-api.example.com
9
+ INTERNAL_OCEAN_API_URL=http://dev-api.example.com
10
+ API_VERSIONS={"_default":"v1"}
11
+ VARNISH_CACHES=[]
12
+ PASSWORD_REGEXP="\A[A-zA-z0-9_!\?*%&/-]{6,}\z"
13
+ PASSWORD_MSG="should be at least 6 characters long and contain only the characters A-Z, a-z, 0-9, and _!?/*%&-"
14
+
15
+ # DB and AWS services
16
+ RAILS_MAX_THREADS=5
17
+ WEB_CONCURRENCY=2
18
+ SQL_DB_ADAPTER=mysql2
19
+ SQL_CONNECTION_POOL_SIZE=20
20
+ SQL_HOST=docker.for.mac.localhost
21
+ SQL_PORT=3306
22
+ SQL_DATABASE=auth
23
+ SQL_USERNAME=root
24
+ SQL_PASSWORD=thepassword
25
+ AWS_REGION=eu-west-1
26
+ AWS_DYNAMODB_ENDPOINT=http://docker.for.mac.localhost:4569
@@ -0,0 +1,19 @@
1
+ workers Integer(ENV['WEB_CONCURRENCY'] || 2)
2
+ threads_count = Integer(ENV['RAILS_MAX_THREADS'] || 5)
3
+ threads threads_count, threads_count
4
+
5
+ preload_app!
6
+
7
+ rackup DefaultRackup
8
+ port ENV['PORT'] || 80
9
+ environment ENV['RACK_ENV'] || 'development'
10
+
11
+ stdout_redirect(stdout = '/dev/stdout',
12
+ stderr = '/dev/stderr',
13
+ append = true)
14
+
15
+ on_worker_boot do
16
+ ActiveSupport.on_load(:active_record) do
17
+ ActiveRecord::Base.establish_connection
18
+ end
19
+ end
@@ -325,7 +325,7 @@ class Api
325
325
  #
326
326
  def self.purge(*args)
327
327
  hydra = Typhoeus::Hydra.hydra
328
- LOAD_BALANCERS.each do |host|
328
+ VARNISH_CACHES.each do |host|
329
329
  url = "http://#{host}#{path}"
330
330
  request = Typhoeus::Request.new(url, method: :purge, headers: {})
331
331
  hydra.queue request
@@ -341,7 +341,7 @@ class Api
341
341
  def self.ban(path)
342
342
  hydra = Typhoeus::Hydra.hydra
343
343
  escaped_path = escape(path)
344
- LOAD_BALANCERS.each do |host|
344
+ VARNISH_CACHES.each do |host|
345
345
  url = "http://#{host}#{escaped_path}"
346
346
  request = Typhoeus::Request.new(url, method: :ban, headers: {})
347
347
  hydra.queue request
@@ -1,3 +1,3 @@
1
1
  module Ocean
2
- VERSION = "7.2.5"
2
+ VERSION = "7.3.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ocean-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.2.5
4
+ version: 7.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Bengtson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-23 00:00:00.000000000 Z
11
+ date: 2018-06-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: typhoeus
@@ -222,13 +222,17 @@ files:
222
222
  - lib/generators/ocean_scaffold_dynamo/templates/views/_resource.json.jbuilder
223
223
  - lib/generators/ocean_setup/USAGE
224
224
  - lib/generators/ocean_setup/ocean_setup_generator.rb
225
+ - lib/generators/ocean_setup/templates/Dockerfile
225
226
  - lib/generators/ocean_setup/templates/Gemfile
226
227
  - lib/generators/ocean_setup/templates/application_controller.rb
227
228
  - lib/generators/ocean_setup/templates/aws.yml
228
229
  - lib/generators/ocean_setup/templates/config.yml
229
230
  - lib/generators/ocean_setup/templates/default_cache_time.rb
231
+ - lib/generators/ocean_setup/templates/dockerignore
232
+ - lib/generators/ocean_setup/templates/env
230
233
  - lib/generators/ocean_setup/templates/gitignore
231
234
  - lib/generators/ocean_setup/templates/hyperlinks.rb
235
+ - lib/generators/ocean_setup/templates/puma.rb
232
236
  - lib/generators/ocean_setup/templates/routes.rb
233
237
  - lib/generators/ocean_setup/templates/spec_helper.rb
234
238
  - lib/ocean-rails.rb