satorix-rails 1.0.11 → 1.1.4
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/.gitignore +4 -0
- data/.gitlab-ci.yml +1 -1
- data/.ruby-version +1 -1
- data/Gemfile +1 -1
- data/lib/rails/generators/satorix/install_generator.rb +1 -1
- data/lib/rails/generators/templates/install/Procfile +1 -1
- data/lib/rails/generators/templates/install/config/passenger_standalone/includes/authentication.erb +21 -7
- data/lib/rails/generators/templates/install/config/passenger_standalone/includes/htpasswd_source.erb +6 -0
- data/lib/rails/generators/templates/install/config/passenger_standalone/includes/page_level_redirects.erb +6 -6
- data/lib/rails/generators/templates/install/config/passenger_standalone/includes/proxy_configuration.erb +1 -1
- data/lib/rails/generators/templates/install/config/passenger_standalone/nginx.conf.erb +17 -12
- data/lib/satorix/rails/version.rb +1 -1
- data/satorix/CI/deploy/rubygems.rb +133 -0
- data/satorix/custom.rb +2 -2
- metadata +5 -5
- data/lib/rails/generators/templates/install/config/passenger_standalone/includes/htpasswd +0 -1
- data/satorix/CI/deploy/ie_gem_server.rb +0 -80
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 01a18abd3627753df2a9aaac68f8bc574cd0ccdb
|
4
|
+
data.tar.gz: 310355613e9144c5571635be5546eb295940d62a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 632a8f3486f73c152c2630078629ed251d37783e4579e4a52ba7fe66c3567d5ea8aba20ad62805ee00cdd79dba833dd2724948d264978120e133d0587ffe552e
|
7
|
+
data.tar.gz: 1bd6430f4d16fcd362fc61c0ed9431b39b1d3a67b25c5266261d0905666e680567d1abca0109a95cceb6f219dc018dbf00e0f8359c9fa3f30c567314e6a045f2
|
data/.gitignore
CHANGED
data/.gitlab-ci.yml
CHANGED
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby-2.4.
|
1
|
+
ruby-2.4.5
|
data/Gemfile
CHANGED
@@ -13,7 +13,7 @@ module Satorix
|
|
13
13
|
|
14
14
|
template 'install/config/passenger_standalone/nginx.conf.erb', 'config/passenger_standalone/nginx.conf.erb'
|
15
15
|
|
16
|
-
template 'install/config/passenger_standalone/includes/
|
16
|
+
template 'install/config/passenger_standalone/includes/htpasswd_source.erb', 'config/passenger_standalone/includes/htpasswd_source.erb'
|
17
17
|
template 'install/config/passenger_standalone/includes/authentication.erb', 'config/passenger_standalone/includes/authentication.erb'
|
18
18
|
template 'install/config/passenger_standalone/includes/page_level_redirects.erb', 'config/passenger_standalone/includes/page_level_redirects.erb'
|
19
19
|
template 'install/config/passenger_standalone/includes/proxy_configuration.erb', 'config/passenger_standalone/includes/proxy_configuration.erb'
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# This Procfile defines the types of process that Flynn will run.
|
2
2
|
# For more information, please see the documentation at http://gitlab.iexposure.com/satorix/satorix
|
3
3
|
|
4
|
-
web: bundle exec passenger start -p $PORT --nginx-config-template config/passenger_standalone/nginx.conf.erb --
|
4
|
+
web: bundle exec passenger start -p $PORT --nginx-config-template config/passenger_standalone/nginx.conf.erb --log-file /dev/stdout
|
5
5
|
# worker: rake jobs:work
|
6
6
|
# clock: bundle exec clockwork config/clock.rb
|
data/lib/rails/generators/templates/install/config/passenger_standalone/includes/authentication.erb
CHANGED
@@ -1,14 +1,28 @@
|
|
1
|
-
|
2
1
|
# Authentication
|
3
2
|
#
|
4
3
|
# Allow listed networks to access without auth, otherwise require password
|
4
|
+
<%%
|
5
|
+
password_files = {}
|
6
|
+
|
7
|
+
# Write out htpasswd file(s), from source files in config/passenger_standalone/includes
|
8
|
+
# to allow dynamically generated htpasswd file(s), most likely from env vars.
|
9
|
+
%w[htpasswd].each do |password_file|
|
10
|
+
passenger_standalone_includes = File.expand_path(__dir__)
|
11
|
+
password_files[password_file] = File.join( passenger_standalone_includes, password_file )
|
12
|
+
contents = include_passenger_custom_template("#{ password_file }_source.erb")
|
13
|
+
File.open(password_files[password_file], 'w') {|f| f.write(contents) }
|
14
|
+
end
|
15
|
+
%>
|
5
16
|
|
6
|
-
|
7
|
-
|
17
|
+
location / {
|
18
|
+
satisfy any;
|
19
|
+
<%% ENV['SATORIX_AUTHENTICATION_ALLOWED_IPS'].to_s.split(' ').each do |target| -%>
|
8
20
|
allow <%%= target %>;
|
9
|
-
<%% end
|
10
|
-
deny all;
|
11
|
-
auth_basic
|
12
|
-
auth_basic_user_file
|
21
|
+
<%% end -%>
|
22
|
+
deny all;
|
23
|
+
auth_basic "Please Log In";
|
24
|
+
auth_basic_user_file <%%= password_files['htpasswd'] %>;
|
25
|
+
}
|
26
|
+
|
13
27
|
|
14
28
|
# End Authentication
|
data/lib/rails/generators/templates/install/config/passenger_standalone/includes/htpasswd_source.erb
ADDED
@@ -0,0 +1,6 @@
|
|
1
|
+
<%%# This value should include hashed username/password combinations, separated by whitespace -%>
|
2
|
+
<%%# These can be generated using the htpasswd application, or an online tool like http://www.htaccesstools.com/htpasswd-generator/ -%>
|
3
|
+
<%%# For more info, see: https://docs.nginx.com/nginx/admin-guide/security-controls/configuring-http-basic-authentication/ -%>
|
4
|
+
<%%= ENV['SATORIX_AUTHENTICATION_HTPASSWDS'].to_s.split.join("\n") %>
|
5
|
+
|
6
|
+
|
@@ -1,15 +1,15 @@
|
|
1
|
-
|
2
1
|
# Page-level Redirects
|
3
2
|
#
|
3
|
+
# Prevent Nginx from adding the internal app port to the rewrite, aka port 8080
|
4
|
+
|
5
|
+
port_in_redirect off;
|
6
|
+
|
4
7
|
# Define your own custom page-level redirects below.
|
5
8
|
#
|
6
9
|
# Examples:
|
7
10
|
# Standard single page redirects:
|
8
|
-
# location = /old-page-1 { return 301
|
9
|
-
# location = /old-page-2 { return 301
|
10
|
-
# Do not work:
|
11
|
-
# # Redirects to port 8080
|
12
|
-
# location = /asdf2 { return 301 /process; }
|
11
|
+
# location = /old-page-1 { return 301 /new-page-1; }
|
12
|
+
# location = /old-page-2 { return 301 /new-page-2; }
|
13
13
|
|
14
14
|
|
15
15
|
|
@@ -21,7 +21,7 @@
|
|
21
21
|
<%% end %>
|
22
22
|
|
23
23
|
# Use the internal Flynn network set X-Forwarded-For header for access IPs.
|
24
|
-
set_real_ip_from 100.100.0.0/16
|
24
|
+
set_real_ip_from <%%= ENV['SATORIX_REAL_IP_FROM'].presence? || '100.100.0.0/16' %>;
|
25
25
|
real_ip_header X-Forwarded-For;
|
26
26
|
|
27
27
|
# End Proxy Configuration
|
@@ -1,6 +1,3 @@
|
|
1
|
-
# passenger start --nginx-config-template config/passenger_standalone/nginx.conf.erb --debug-nginx-config
|
2
|
-
|
3
|
-
|
4
1
|
##########################################################################
|
5
2
|
# Passenger Standalone is built on the same technology that powers
|
6
3
|
# Passenger for Nginx, so any configuration option supported by Passenger
|
@@ -8,13 +5,12 @@
|
|
8
5
|
# this by direct editing the Nginx configuration template that is used by
|
9
6
|
# Passenger Standalone.
|
10
7
|
#
|
11
|
-
# This file is the original template. DO NOT EDIT THIS FILE DIRECTLY.
|
12
|
-
# Instead, make a copy of this file and pass the `--nginx-config-template`
|
13
|
-
# parameter to Passenger Standalone.
|
14
|
-
#
|
15
8
|
# Learn more about using the Nginx configuration template at:
|
16
9
|
# https://www.phusionpassenger.com/library/config/standalone/intro.html#nginx-configuration-template
|
17
10
|
#
|
11
|
+
# To test this configuration template run:
|
12
|
+
# passenger start --nginx-config-template config/passenger_standalone/nginx.conf.erb --debug-nginx-config
|
13
|
+
#
|
18
14
|
# *** NOTE ***
|
19
15
|
# If you customize the template file, make sure you keep an eye on the
|
20
16
|
# original template file and merge any changes. New Phusion Passenger
|
@@ -22,8 +18,17 @@
|
|
22
18
|
##############################################################
|
23
19
|
|
24
20
|
<%%
|
25
|
-
def include_passenger_custom_template(template)
|
26
|
-
|
21
|
+
def include_passenger_custom_template(template, indent = 0, the_binding = get_binding)
|
22
|
+
path = File.join(File.dirname(__FILE__), 'includes', template)
|
23
|
+
erb = ERB.new(File.read(path), nil, "-", next_eoutvar)
|
24
|
+
erb.filename = path
|
25
|
+
result = erb.result(the_binding)
|
26
|
+
|
27
|
+
# Set indenting
|
28
|
+
result.gsub!(/^/, " " * indent)
|
29
|
+
result.gsub!(/\A +/, '')
|
30
|
+
|
31
|
+
result
|
27
32
|
end
|
28
33
|
|
29
34
|
def use_canonical?
|
@@ -108,9 +113,9 @@ http {
|
|
108
113
|
<%%= include_passenger_internal_template('server.erb', 8, true, binding) %>
|
109
114
|
<%%= include_passenger_internal_template('rails_asset_pipeline.erb', 8, false) %>
|
110
115
|
|
111
|
-
<%%= include_passenger_custom_template('page_level_redirects.erb') %>
|
112
|
-
<%%= include_passenger_custom_template('proxy_configuration.erb') %>
|
113
|
-
<%%= include_passenger_custom_template('authentication.erb') %>
|
116
|
+
<%%= include_passenger_custom_template('page_level_redirects.erb', 8, binding) %>
|
117
|
+
<%%= include_passenger_custom_template('proxy_configuration.erb', 8, binding) %>
|
118
|
+
<%%= include_passenger_custom_template('authentication.erb', 8, binding) %>
|
114
119
|
|
115
120
|
### BEGIN your own configuration options ###
|
116
121
|
# This is a good place to put your own config options.
|
@@ -0,0 +1,133 @@
|
|
1
|
+
module Satorix
|
2
|
+
module CI
|
3
|
+
module Deploy
|
4
|
+
module Rubygems
|
5
|
+
|
6
|
+
|
7
|
+
require 'fileutils'
|
8
|
+
|
9
|
+
|
10
|
+
include Satorix::Shared::Console
|
11
|
+
|
12
|
+
|
13
|
+
extend self
|
14
|
+
|
15
|
+
|
16
|
+
def go
|
17
|
+
log_bench('Generating rubygems.org configuration_file...') { generate_rubygems_configuration_file }
|
18
|
+
log_bench('Preparing gem build directory...') { prepare_gem_build_directory }
|
19
|
+
log_bench('Building gem...') { build_gem }
|
20
|
+
built_gems.each { |gem| log_bench("Publishing #{ File.basename gem }...") { publish_gem gem } }
|
21
|
+
end
|
22
|
+
|
23
|
+
|
24
|
+
private ########################################################################################################
|
25
|
+
|
26
|
+
|
27
|
+
def build_gem
|
28
|
+
run_command 'rake build'
|
29
|
+
end
|
30
|
+
|
31
|
+
|
32
|
+
def built_gems
|
33
|
+
Dir.glob(File.join(gem_build_directory, '*.gem')).select { |e| File.file? e }
|
34
|
+
end
|
35
|
+
|
36
|
+
|
37
|
+
def gem_build_directory
|
38
|
+
File.join Satorix.app_root, 'pkg'
|
39
|
+
end
|
40
|
+
|
41
|
+
|
42
|
+
def generate_rubygems_configuration_file
|
43
|
+
path = File.join(Dir.home, '.gem')
|
44
|
+
FileUtils.mkdir_p(path) unless File.exist?(path)
|
45
|
+
|
46
|
+
file = File.join(path, 'credentials')
|
47
|
+
File.open(file, 'w') { |f| f.write rubygems_configuration_file_contents }
|
48
|
+
FileUtils.chmod 0600, file
|
49
|
+
end
|
50
|
+
|
51
|
+
|
52
|
+
def prepare_gem_build_directory
|
53
|
+
run_command "rm -rf #{ gem_build_directory }"
|
54
|
+
FileUtils.mkdir_p gem_build_directory
|
55
|
+
end
|
56
|
+
|
57
|
+
|
58
|
+
def publish_gem(gem)
|
59
|
+
run_command "gem push #{ gem } --config-file #{ File.join(Dir.home, '.gem', 'credentials') }"
|
60
|
+
rescue RuntimeError
|
61
|
+
# To prevent the display of an ugly stacktrace.
|
62
|
+
abort "\nGem was not published!"
|
63
|
+
end
|
64
|
+
|
65
|
+
|
66
|
+
def rubygems_api_key
|
67
|
+
ENV['SATORIX_CI_RUBYGEMS_API_KEY']
|
68
|
+
end
|
69
|
+
|
70
|
+
|
71
|
+
def rubygems_configuration_file_contents
|
72
|
+
"---\n:rubygems_api_key: #{ rubygems_api_key }"
|
73
|
+
end
|
74
|
+
|
75
|
+
|
76
|
+
# To be used for rake release - START
|
77
|
+
|
78
|
+
|
79
|
+
def configure_git
|
80
|
+
run_command 'git config user.name Satorix'
|
81
|
+
run_command 'git config user.email satorix@iexposure.com'
|
82
|
+
run_command 'git config push.default simple'
|
83
|
+
end
|
84
|
+
|
85
|
+
|
86
|
+
def configure_ssh
|
87
|
+
run_command 'whoami'
|
88
|
+
run_command 'printenv'
|
89
|
+
|
90
|
+
path = File.join(Dir.home, '.ssh')
|
91
|
+
FileUtils.mkdir_p(path) unless File.exist?(path)
|
92
|
+
|
93
|
+
public_key_file = File.join(path, 'id_rsa.pub')
|
94
|
+
File.open(public_key_file, 'w') { |f| f.write ssh_public_key }
|
95
|
+
FileUtils.chmod 0600, public_key_file
|
96
|
+
run_command "cat #{ public_key_file }"
|
97
|
+
|
98
|
+
private_key_file = File.join(path, 'id_rsa')
|
99
|
+
File.open(private_key_file, 'w') { |f| f.write ssh_private_key }
|
100
|
+
FileUtils.chmod 0600, private_key_file
|
101
|
+
|
102
|
+
config_file = File.join(path, 'config')
|
103
|
+
File.open(config_file, 'w') { |f| f.write "IdentityFile #{ private_key_file }" }
|
104
|
+
FileUtils.chmod 0600, config_file
|
105
|
+
run_command "cat #{ config_file }"
|
106
|
+
|
107
|
+
system 'eval `ssh-agent -s`'
|
108
|
+
run_command "ssh-add #{ private_key_file }"
|
109
|
+
end
|
110
|
+
|
111
|
+
|
112
|
+
def rake_release
|
113
|
+
run_command 'bundle exec rake release'
|
114
|
+
end
|
115
|
+
|
116
|
+
|
117
|
+
def ssh_private_key
|
118
|
+
ENV['SATORIX_CI_SSH_PRIVATE_KEY']
|
119
|
+
end
|
120
|
+
|
121
|
+
|
122
|
+
def ssh_public_key
|
123
|
+
ENV['SATORIX_CI_SSH_PUBLIC_KEY']
|
124
|
+
end
|
125
|
+
|
126
|
+
|
127
|
+
# To be used for rake release - END
|
128
|
+
|
129
|
+
|
130
|
+
end
|
131
|
+
end
|
132
|
+
end
|
133
|
+
end
|
data/satorix/custom.rb
CHANGED
@@ -2,7 +2,7 @@ module Satorix
|
|
2
2
|
module Custom
|
3
3
|
|
4
4
|
|
5
|
-
require_relative 'CI/deploy/
|
5
|
+
require_relative 'CI/deploy/rubygems.rb'
|
6
6
|
|
7
7
|
|
8
8
|
extend self
|
@@ -11,7 +11,7 @@ module Satorix
|
|
11
11
|
def available_jobs
|
12
12
|
{
|
13
13
|
deploy: {
|
14
|
-
|
14
|
+
deploy_to_rubygems: Satorix::CI::Deploy::Rubygems
|
15
15
|
}
|
16
16
|
}
|
17
17
|
end
|
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.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Internet Exposure
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-09-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: passenger
|
@@ -93,14 +93,14 @@ files:
|
|
93
93
|
- lib/rails/generators/templates/install/.gitlab-ci.yml
|
94
94
|
- lib/rails/generators/templates/install/Procfile
|
95
95
|
- lib/rails/generators/templates/install/config/passenger_standalone/includes/authentication.erb
|
96
|
-
- lib/rails/generators/templates/install/config/passenger_standalone/includes/
|
96
|
+
- lib/rails/generators/templates/install/config/passenger_standalone/includes/htpasswd_source.erb
|
97
97
|
- lib/rails/generators/templates/install/config/passenger_standalone/includes/page_level_redirects.erb
|
98
98
|
- lib/rails/generators/templates/install/config/passenger_standalone/includes/proxy_configuration.erb
|
99
99
|
- lib/rails/generators/templates/install/config/passenger_standalone/nginx.conf.erb
|
100
100
|
- lib/satorix/rails.rb
|
101
101
|
- lib/satorix/rails/version.rb
|
102
102
|
- satorix-rails.gemspec
|
103
|
-
- satorix/CI/deploy/
|
103
|
+
- satorix/CI/deploy/rubygems.rb
|
104
104
|
- satorix/custom.rb
|
105
105
|
homepage: https://www.satorix.com
|
106
106
|
licenses: []
|
@@ -122,7 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
122
122
|
version: '0'
|
123
123
|
requirements: []
|
124
124
|
rubyforge_project:
|
125
|
-
rubygems_version: 2.6.
|
125
|
+
rubygems_version: 2.6.12
|
126
126
|
signing_key:
|
127
127
|
specification_version: 4
|
128
128
|
summary: Satorix in Rails
|
@@ -1 +0,0 @@
|
|
1
|
-
iestaging:$apr1$b4UNgid/$jVoc0rRDzUfmldUp9.DK8.
|
@@ -1,80 +0,0 @@
|
|
1
|
-
module Satorix
|
2
|
-
module CI
|
3
|
-
module Deploy
|
4
|
-
module IeGemServer
|
5
|
-
|
6
|
-
|
7
|
-
require 'fileutils'
|
8
|
-
|
9
|
-
|
10
|
-
include Satorix::Shared::Console
|
11
|
-
|
12
|
-
|
13
|
-
extend self
|
14
|
-
|
15
|
-
|
16
|
-
def go
|
17
|
-
log_bench('Installing the geminabox gem...') { install_geminabox_gem }
|
18
|
-
log_bench('Preparing gem build directory...') { prepare_gem_build_directory }
|
19
|
-
log_bench('Building gem...') { build_gem }
|
20
|
-
built_gems.each { |gem| log_bench("Publishing #{ File.basename gem }...") { publish_gem gem } }
|
21
|
-
end
|
22
|
-
|
23
|
-
|
24
|
-
private ########################################################################################################
|
25
|
-
|
26
|
-
|
27
|
-
def build_gem
|
28
|
-
run_command 'rake build'
|
29
|
-
end
|
30
|
-
|
31
|
-
|
32
|
-
def built_gems
|
33
|
-
Dir.glob(File.join(gem_build_directory, '*.gem')).select { |e| File.file? e }
|
34
|
-
end
|
35
|
-
|
36
|
-
|
37
|
-
def gem_build_directory
|
38
|
-
File.join Satorix.app_root, 'pkg'
|
39
|
-
end
|
40
|
-
|
41
|
-
|
42
|
-
def ie_gem_server_host
|
43
|
-
"https://#{ ie_gem_server_user_name }:#{ ie_gem_server_password }@gems.iexposure.com"
|
44
|
-
end
|
45
|
-
|
46
|
-
|
47
|
-
def ie_gem_server_password
|
48
|
-
ENV['SATORIX_CI_IE_GEM_SERVER_PASSWORD']
|
49
|
-
end
|
50
|
-
|
51
|
-
|
52
|
-
def ie_gem_server_user_name
|
53
|
-
ENV['SATORIX_CI_IE_GEM_SERVER_USER_NAME']
|
54
|
-
end
|
55
|
-
|
56
|
-
|
57
|
-
def install_geminabox_gem
|
58
|
-
run_command 'gem install geminabox --source https://gems.iexposure.com --no-document'
|
59
|
-
end
|
60
|
-
|
61
|
-
|
62
|
-
def prepare_gem_build_directory
|
63
|
-
run_command "rm -rf #{ gem_build_directory }"
|
64
|
-
FileUtils.mkdir_p gem_build_directory
|
65
|
-
end
|
66
|
-
|
67
|
-
|
68
|
-
def publish_gem(gem)
|
69
|
-
run_command "gem inabox #{ gem } --host #{ ie_gem_server_host }",
|
70
|
-
filtered_text: [ie_gem_server_user_name, ie_gem_server_password]
|
71
|
-
rescue RuntimeError
|
72
|
-
# To prevent the display of an ugly stacktrace.
|
73
|
-
abort "\nGem was not published!"
|
74
|
-
end
|
75
|
-
|
76
|
-
|
77
|
-
end
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|