ocean-rails 7.2.5 → 7.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/generators/ocean_setup/ocean_setup_generator.rb +16 -3
- data/lib/generators/ocean_setup/templates/Dockerfile +49 -0
- data/lib/generators/ocean_setup/templates/config.yml +2 -5
- data/lib/generators/ocean_setup/templates/dockerignore +9 -0
- data/lib/generators/ocean_setup/templates/env +26 -0
- data/lib/generators/ocean_setup/templates/puma.rb +19 -0
- data/lib/ocean/api.rb +2 -2
- data/lib/ocean/version.rb +1 -1
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 65fb8fb628f0daa342b47ba75447cada3b97d1b583feac3c2b1ce6c88e48ceb6
|
4
|
+
data.tar.gz: b7e3d250c457b1b71b1e867a77da6401df1c5be8e41f6ef61b2620024a6a6ca4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
79
|
+
copy_file "config.yml", "#{Rails.root}/config/config.yml"
|
80
80
|
end
|
81
81
|
|
82
82
|
def install_aws_yml_files
|
83
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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,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
|
data/lib/ocean/api.rb
CHANGED
@@ -325,7 +325,7 @@ class Api
|
|
325
325
|
#
|
326
326
|
def self.purge(*args)
|
327
327
|
hydra = Typhoeus::Hydra.hydra
|
328
|
-
|
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
|
-
|
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
|
data/lib/ocean/version.rb
CHANGED
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.
|
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-
|
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
|