satorix-rails 1.1.7 → 1.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +0 -1
- data/.gitlab-ci.yml +5 -6
- data/.ruby-version +1 -1
- data/Gemfile.lock +26 -0
- data/README.md +36 -38
- data/Rakefile +7 -3
- data/lib/rails/generators/templates/install/.gitlab-ci.yml +11 -16
- data/lib/rails/generators/templates/install/config/passenger_standalone/includes/authentication.erb +2 -2
- data/lib/satorix/rails/version.rb +1 -1
- data/satorix-rails.gemspec +1 -4
- data/satorix/CI/deploy/rubygems.rb +4 -2
- metadata +5 -47
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 3949871c7a24df013f4f59c91eea2e07cc1d954c42535116b3a1c4dc6832b546
|
4
|
+
data.tar.gz: 6b6ea3f3229e0d5379a0781be75ca3c8215a83e5109758d512cbdb744f556c67
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 416449f6f8f67cdee5340d9c04cff43b584a698eee6fcdacc6c3e68409d747df89bb56adbc854cef88eada785319dc38c344b0c45b958d0add3695bcb9801fd9
|
7
|
+
data.tar.gz: 7f23d2e504afd46918a4a6063085626a60af6a020e0a21634dafd51b32b8941d6f4d7d96a21c31e8f8cef6ad7c5fb1012bdd789d7072d556eb151955c3510235
|
data/.gitignore
CHANGED
data/.gitlab-ci.yml
CHANGED
@@ -3,7 +3,6 @@ image: 'satorix/rails'
|
|
3
3
|
|
4
4
|
.satorix: &satorix
|
5
5
|
script:
|
6
|
-
- bundle # This generates a Gemfile.lock, to make the buildpacks happy
|
7
6
|
- gem install satorix --source https://gems.iexposure.com --no-document
|
8
7
|
- satorix
|
9
8
|
|
@@ -15,17 +14,17 @@ cache:
|
|
15
14
|
|
16
15
|
|
17
16
|
rspec:
|
18
|
-
before_script:
|
19
|
-
- sed -i -e 's/add_development_dependency/add_dependency/g' satorix-rails.gemspec # To avoid an application dependency, but still be available for CI
|
20
17
|
<<: *satorix
|
21
18
|
|
22
19
|
|
23
|
-
# This is a custom job, defined at satorix/CI/deploy/
|
20
|
+
# This is a custom job, defined at satorix/CI/deploy/rubygems.rb
|
24
21
|
deploy_to_rubygems:
|
25
22
|
environment:
|
26
23
|
name: $CI_COMMIT_REF_NAME
|
27
|
-
url: '
|
24
|
+
url: 'https://rubygems.org/gems/satorix-rails'
|
28
25
|
stage: deploy
|
29
26
|
only:
|
30
|
-
-
|
27
|
+
- tags
|
28
|
+
except:
|
29
|
+
- schedules
|
31
30
|
<<: *satorix
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby-2.
|
1
|
+
ruby-2.6.6
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
satorix-rails (1.2.2)
|
5
|
+
passenger
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
passenger (6.0.4)
|
11
|
+
rack
|
12
|
+
rake (>= 0.8.1)
|
13
|
+
rack (2.2.2)
|
14
|
+
rake (13.0.1)
|
15
|
+
|
16
|
+
PLATFORMS
|
17
|
+
ruby
|
18
|
+
|
19
|
+
DEPENDENCIES
|
20
|
+
satorix-rails!
|
21
|
+
|
22
|
+
RUBY VERSION
|
23
|
+
ruby 2.6.6p146
|
24
|
+
|
25
|
+
BUNDLED WITH
|
26
|
+
1.17.3
|
data/README.md
CHANGED
@@ -6,22 +6,19 @@ By [Internet Exposure](https://www.iexposure.com/)
|
|
6
6
|
[![coverage](http://gitlab.iexposure.com/satorix/satorix-rails/badges/master/coverage.svg)](http://gitlab.iexposure.com/satorix/satorix-rails/pipelines)
|
7
7
|
|
8
8
|
|
9
|
-
[Satorix](
|
9
|
+
[Satorix](https://www.satorix.com): Get your app from local to live
|
10
10
|
|
11
|
-
The satorix-rails gem provides a streamlined mechanism for a 12-factor capable Rails application to interact with the Satorix ecosystem.
|
11
|
+
The `satorix-rails` gem provides a streamlined mechanism for a 12-factor capable Rails application to interact with the Satorix ecosystem.
|
12
12
|
|
13
|
-
|
14
|
-
## Getting Started
|
13
|
+
## Preparing your application
|
15
14
|
|
16
15
|
Add Satorix to your Rails application by including it in your Gemfile with:
|
17
16
|
|
18
17
|
```ruby
|
19
|
-
|
20
|
-
gem 'satorix-rails'
|
21
|
-
end
|
18
|
+
gem 'satorix-rails'
|
22
19
|
```
|
23
20
|
|
24
|
-
Run the bundle command to install it.
|
21
|
+
Run the `bundle` command to install it.
|
25
22
|
|
26
23
|
Next, run the generator from a terminal at the root of your application:
|
27
24
|
|
@@ -29,7 +26,7 @@ Next, run the generator from a terminal at the root of your application:
|
|
29
26
|
$ rails g satorix:install
|
30
27
|
```
|
31
28
|
|
32
|
-
|
29
|
+
This creates a set of files that utilize environment variables created by default with Satorix. These include the [Phusion Passenger Rails app server](https://www.phusionpassenger.com/) and the Passenger built in Nginx web server.
|
33
30
|
|
34
31
|
# Logging in Rails 4 and below
|
35
32
|
|
@@ -40,57 +37,62 @@ You will need to either:
|
|
40
37
|
* add `gem 'rails_12factor', group: :production` to your Gemfile
|
41
38
|
* Set `config.logger = Logger.new(STDOUT)` in `config/environments/production.rb`
|
42
39
|
|
40
|
+
# Configuring your application
|
43
41
|
|
44
|
-
|
42
|
+
You can configure your application on a per-environment basis using environment variables.
|
45
43
|
|
44
|
+
### Default environment Variables
|
46
45
|
|
47
|
-
|
46
|
+
The following default environment variables are used by the `satorix-rails` generated files and can be managed through the Satorix Dashboard:
|
48
47
|
|
49
|
-
|
48
|
+
##### SATORIX_CANONICAL_URI_HOST
|
50
49
|
|
51
|
-
|
50
|
+
*Optional*, a domain to rewrite all requests to by default. Setting this will make it so all requests to your site will go to the supplied domain.
|
52
51
|
|
53
|
-
|
52
|
+
Common setting:
|
54
53
|
|
55
|
-
|
54
|
+
* `www.domain.dom`
|
56
55
|
|
57
|
-
|
56
|
+
##### SATORIX_CANONICAL_URI_PROTOCOL
|
58
57
|
|
59
|
-
|
58
|
+
*Optional*, the `HTTP` protocol to rewrite requests to.
|
60
59
|
|
61
|
-
|
60
|
+
Valid settings:
|
62
61
|
|
63
|
-
|
62
|
+
* `http`
|
63
|
+
* `https`
|
64
64
|
|
65
|
-
|
65
|
+
##### SATORIX_PROXY_IPS
|
66
66
|
|
67
|
-
*
|
68
|
-
* single IP (`192.168.101.2`)
|
69
|
-
* single IP range (`192.168.101.0/24`)
|
70
|
-
* multiple IPs/ranges (`192.168.101.3 192.168.1.4`)
|
67
|
+
*Optional*, used to define proxy IP addresses, for services like CloudFlare. This will allow you to get the actual client IP address accessing your site in the logs and accessible to your application.
|
71
68
|
|
72
|
-
|
69
|
+
Valid settings:
|
73
70
|
|
74
|
-
|
71
|
+
* Space separated list of IPs or network ranges (`103.21.244.0/22 103.22.200.0/22 103.31.4.0/22 104.16.0.0/12 108.162.192.0/18 131.0.72.0/22 141.101.64.0/18 162.158.0.0/15 172.64.0.0/13 173.245.48.0/20 188.114.96.0/20 190.93.240.0/20 197.234.240.0/22 198.41.128.0/17 199.27.128.0/21`)
|
75
72
|
|
76
|
-
|
73
|
+
##### SATORIX_AUTHENTICATION_HTPASSWDS
|
77
74
|
|
78
|
-
|
75
|
+
*Optional*, used to control access to your site with HTTP Basic authentication. Needs to be generated in the format created by the Apache tool `htpasswd -nb username password` or using an [online generator](http://www.htaccesstools.com/htpasswd-generator/).
|
79
76
|
|
80
|
-
|
77
|
+
Valid settings:
|
81
78
|
|
82
|
-
|
79
|
+
* Newline separated list of username and hashed password (`username:$apr1$vAxBKb8N$m0en1zabtHktHeFyT3j9y`)
|
80
|
+
|
81
|
+
##### SATORIX_AUTHENTICATION_ALLOWED_IPS
|
83
82
|
|
84
|
-
|
83
|
+
*Optional*, used to control access to your site by bypassing the above HTTP Basic authentication. If set to `all` no authentication will be required. Any IP addresses or networks added here will not need to supply the username and password to access the site.
|
85
84
|
|
86
|
-
|
85
|
+
Valid settings:
|
87
86
|
|
87
|
+
* All (`all`)
|
88
|
+
* Single IP (`192.168.1.2`)
|
89
|
+
* Network range (`192.168.1.0/24`)
|
90
|
+
* Space separated list of multiple IPs or network ranges (`192.168.1.3 192.168.2.0/24`)
|
88
91
|
|
89
92
|
## Contributing
|
90
93
|
|
91
94
|
Please coordinate contributions using the [official issue tracker](http://gitlab.iexposure.com/satorix/satorix-rails/issues).
|
92
95
|
|
93
|
-
|
94
96
|
## Testing
|
95
97
|
|
96
98
|
This application is tested using [rspec](http://rspec.info/).
|
@@ -100,8 +102,7 @@ You can run the same tests that run during CI with:
|
|
100
102
|
```
|
101
103
|
bundle exec rspec spec
|
102
104
|
```
|
103
|
-
|
104
|
-
|
105
|
+
|
105
106
|
## CI/CD
|
106
107
|
|
107
108
|
Satorix is used to provide continuous integration and continuous deployment for this application.
|
@@ -110,9 +111,6 @@ CI is run against every push.
|
|
110
111
|
|
111
112
|
CD is used to build and publish the gem for the master branch.
|
112
113
|
|
113
|
-
|
114
|
-
|
115
114
|
## License
|
116
115
|
|
117
|
-
|
118
116
|
The Satorix gem is released under the terms described in the [LICENSE file](LICENSE).
|
data/Rakefile
CHANGED
@@ -1,6 +1,10 @@
|
|
1
1
|
require 'bundler/gem_tasks'
|
2
|
-
|
2
|
+
begin
|
3
|
+
require 'rspec/core/rake_task'
|
3
4
|
|
4
|
-
RSpec::Core::RakeTask.new(:spec)
|
5
|
+
RSpec::Core::RakeTask.new(:spec)
|
5
6
|
|
6
|
-
task :default => :spec
|
7
|
+
task :default => :spec
|
8
|
+
rescue LoadError
|
9
|
+
# no rspec available
|
10
|
+
end
|
@@ -1,4 +1,5 @@
|
|
1
|
-
# We are using the Satorix Rails CI image from https://hub.docker.com/r/satorix/rails/
|
1
|
+
# We are using the base Satorix Rails CI image from https://hub.docker.com/r/satorix/rails/
|
2
|
+
# Additional versions with expanded features can be found at https://hub.docker.com/u/satorix
|
2
3
|
image: 'satorix/rails'
|
3
4
|
|
4
5
|
|
@@ -9,12 +10,6 @@ cache:
|
|
9
10
|
- 'tmp/satorix/cache' # To cache buildpack gems between runs.
|
10
11
|
|
11
12
|
|
12
|
-
.satorix: &satorix
|
13
|
-
script:
|
14
|
-
- gem install satorix --source https://gems.iexposure.com --no-document
|
15
|
-
- satorix
|
16
|
-
|
17
|
-
|
18
13
|
###############################################################################
|
19
14
|
#
|
20
15
|
# Below are resources that will be available as part of the CI pipeline.
|
@@ -61,6 +56,13 @@ cache:
|
|
61
56
|
# MYSQL_ROOT_PASSWORD: password # The default user is: root
|
62
57
|
|
63
58
|
|
59
|
+
.satorix: &satorix
|
60
|
+
<<: *use_postgres
|
61
|
+
script:
|
62
|
+
- gem install satorix --source https://gems.iexposure.com --no-document
|
63
|
+
- satorix
|
64
|
+
|
65
|
+
|
64
66
|
###############################################################################
|
65
67
|
#
|
66
68
|
# Below are jobs that will run as part of the CI pipeline.
|
@@ -74,8 +76,6 @@ cache:
|
|
74
76
|
## Static analysis security scanner for Ruby on Rails
|
75
77
|
## http://brakemanscanner.org/
|
76
78
|
#brakeman:
|
77
|
-
# variables:
|
78
|
-
# SKIP_BUILDPACK: 'true'
|
79
79
|
# <<: *satorix
|
80
80
|
|
81
81
|
|
@@ -83,8 +83,6 @@ cache:
|
|
83
83
|
## Patch-level verification for Bundler
|
84
84
|
## https://github.com/rubysec/bundler-audit
|
85
85
|
#bundler_audit:
|
86
|
-
# variables:
|
87
|
-
# SKIP_BUILDPACK: 'true'
|
88
86
|
# <<: *satorix
|
89
87
|
|
90
88
|
|
@@ -92,7 +90,6 @@ cache:
|
|
92
90
|
## Executes executable specifications written in plain language
|
93
91
|
## https://github.com/cucumber/cucumber
|
94
92
|
#cucumber:
|
95
|
-
# <<: *use_postgres
|
96
93
|
# <<: *satorix
|
97
94
|
|
98
95
|
|
@@ -100,7 +97,6 @@ cache:
|
|
100
97
|
## Built-in mechanisms in Rails for testing your application
|
101
98
|
## http://guides.rubyonrails.org/testing.html
|
102
99
|
#rails_test:
|
103
|
-
# <<: *use_postgres
|
104
100
|
# <<: *satorix
|
105
101
|
|
106
102
|
|
@@ -108,7 +104,6 @@ cache:
|
|
108
104
|
## Behaviour Driven Development for Ruby
|
109
105
|
## http://rspec.info/
|
110
106
|
#rspec:
|
111
|
-
# <<: *use_postgres
|
112
107
|
# <<: *satorix
|
113
108
|
|
114
109
|
|
@@ -116,8 +111,6 @@ cache:
|
|
116
111
|
## A Ruby static code analyzer, based on the community Ruby style guide.
|
117
112
|
## https://github.com/bbatsov/rubocop
|
118
113
|
#rubocop:
|
119
|
-
# variables:
|
120
|
-
# SKIP_BUILDPACK: 'true'
|
121
114
|
# <<: *satorix
|
122
115
|
|
123
116
|
|
@@ -129,4 +122,6 @@ deploy_with_flynn:
|
|
129
122
|
only:
|
130
123
|
- staging
|
131
124
|
- production
|
125
|
+
except:
|
126
|
+
- schedules
|
132
127
|
<<: *satorix
|
data/lib/rails/generators/templates/install/config/passenger_standalone/includes/authentication.erb
CHANGED
@@ -22,16 +22,16 @@
|
|
22
22
|
end
|
23
23
|
|
24
24
|
allowed_without_auth = ENV['SATORIX_AUTHENTICATION_ALLOWED_IPS'].to_s.split
|
25
|
-
allowed_without_auth = ['
|
25
|
+
allowed_without_auth = ['all'] if allowed_without_auth.empty?
|
26
26
|
-%>
|
27
27
|
|
28
28
|
# Allow listed networks to access without auth, otherwise require password if defined
|
29
29
|
location / {
|
30
30
|
satisfy any;
|
31
|
-
deny all;
|
32
31
|
<%% allowed_without_auth.each do |target| -%>
|
33
32
|
allow <%%= target %>;
|
34
33
|
<%% end -%>
|
34
|
+
deny all;
|
35
35
|
<%% if File.file?(password_file_location('htpasswd')) -%>
|
36
36
|
auth_basic "Please Log In";
|
37
37
|
auth_basic_user_file <%%= password_file_location('htpasswd') %>;
|
data/satorix-rails.gemspec
CHANGED
@@ -6,7 +6,7 @@ require 'satorix/rails/version'
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = 'satorix-rails'
|
8
8
|
spec.version = Satorix::Rails::Version::VERSION
|
9
|
-
spec.authors = ['
|
9
|
+
spec.authors = ['Satorix']
|
10
10
|
spec.email = ['info@satorix.com']
|
11
11
|
|
12
12
|
spec.summary = 'Satorix in Rails'
|
@@ -30,7 +30,4 @@ Gem::Specification.new do |spec|
|
|
30
30
|
|
31
31
|
spec.add_dependency 'passenger'
|
32
32
|
|
33
|
-
spec.add_development_dependency 'bundler', '~> 1.13'
|
34
|
-
spec.add_development_dependency 'rake', '~> 10.0'
|
35
|
-
spec.add_development_dependency 'rspec', '~> 3.0'
|
36
33
|
end
|
@@ -25,7 +25,9 @@ module Satorix
|
|
25
25
|
|
26
26
|
|
27
27
|
def build_gem
|
28
|
-
|
28
|
+
Dir.chdir(Satorix.app_dir) do
|
29
|
+
run_command 'bundle exec rake build'
|
30
|
+
end
|
29
31
|
end
|
30
32
|
|
31
33
|
|
@@ -35,7 +37,7 @@ module Satorix
|
|
35
37
|
|
36
38
|
|
37
39
|
def gem_build_directory
|
38
|
-
File.join Satorix.
|
40
|
+
File.join Satorix.app_dir, 'pkg'
|
39
41
|
end
|
40
42
|
|
41
43
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: satorix-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- Satorix
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-09-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: passenger
|
@@ -24,48 +24,6 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: bundler
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '1.13'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '1.13'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: rake
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - "~>"
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '10.0'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - "~>"
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '10.0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: rspec
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - "~>"
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '3.0'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - "~>"
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '3.0'
|
69
27
|
description: The satorix-rails gem provides a streamlined mechanism for a Rails application
|
70
28
|
to interact with the Satorix ecosystem.
|
71
29
|
email:
|
@@ -79,6 +37,7 @@ files:
|
|
79
37
|
- ".rspec"
|
80
38
|
- ".ruby-version"
|
81
39
|
- Gemfile
|
40
|
+
- Gemfile.lock
|
82
41
|
- Procfile
|
83
42
|
- README.md
|
84
43
|
- Rakefile
|
@@ -120,8 +79,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
120
79
|
- !ruby/object:Gem::Version
|
121
80
|
version: '0'
|
122
81
|
requirements: []
|
123
|
-
|
124
|
-
rubygems_version: 2.6.12
|
82
|
+
rubygems_version: 3.0.3
|
125
83
|
signing_key:
|
126
84
|
specification_version: 4
|
127
85
|
summary: Satorix in Rails
|