stack_car 0.14.0 → 0.16.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rspec-action.yaml +35 -0
- data/README.md +22 -6
- data/lib/stack_car/cli.rb +36 -28
- data/lib/stack_car/version.rb +3 -1
- data/templates/.env.erb +9 -0
- data/templates/.gitlab/issue_templates/enable_pipeline_check_before_merge.md +8 -0
- data/templates/README.md +4 -1
- data/templates/deploy.yml.erb +2 -2
- data/templates/docker-compose.yml.erb +3 -3
- data/templates/solrcloud-assign-configset.sh +35 -0
- data/templates/solrcloud-upload-configset.sh +42 -0
- metadata +7 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f65e5a4cb61c3b0ae89c7a41866723cfb7caf9e1853a566279eb178181746774
|
4
|
+
data.tar.gz: 6624f7b9f2bb1dc6faea803a4d8f19cf97fdc03939a90082c20600c4021066f6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ef5bd6bfac0e8c0301778a79bdb17cb7f23d22cdab0e661d951f734b16de61a69288eb4c923aee552de339811f0a45b55a5645e55042b067e86965cb0421ac30
|
7
|
+
data.tar.gz: b7fd067e699c6a93f38d4c384de5f7270b6a7fc61b6e28fce4c380bdf77599e278f57d762e825a80f893fe2c435c73679c7542aff9fee32fe37ebb5fa8c7c702
|
@@ -0,0 +1,35 @@
|
|
1
|
+
name: Test
|
2
|
+
on:
|
3
|
+
push:
|
4
|
+
branches:
|
5
|
+
- main
|
6
|
+
pull_request:
|
7
|
+
branches:
|
8
|
+
- main
|
9
|
+
jobs:
|
10
|
+
rspec:
|
11
|
+
name: Run rspec with ruby
|
12
|
+
runs-on: ubuntu-latest
|
13
|
+
steps:
|
14
|
+
- name: Checkout code
|
15
|
+
uses: actions/checkout@v3
|
16
|
+
- name: Cache
|
17
|
+
uses: actions/cache@v2.1.3
|
18
|
+
with:
|
19
|
+
path: vendor/bundle
|
20
|
+
key: '2.3'
|
21
|
+
- name: Setup Ruby
|
22
|
+
uses: ruby/setup-ruby@v1.59.1
|
23
|
+
with:
|
24
|
+
ruby-version: '2.3'
|
25
|
+
- name: Dependencies
|
26
|
+
run: |
|
27
|
+
bundle config path vendor/bundle
|
28
|
+
bundle install
|
29
|
+
- name: Rspec
|
30
|
+
run: 'bundle exec rspec'
|
31
|
+
- name: Publish Test Report
|
32
|
+
uses: mikepenz/action-junit-report@v3
|
33
|
+
if: always() # always run even if the previous step fails
|
34
|
+
with:
|
35
|
+
report_paths: '**/build/test-results/test/TEST-*.xml'
|
data/README.md
CHANGED
@@ -26,14 +26,14 @@ Commands are accesible via the "sc" short cut. Note: this will need to be in you
|
|
26
26
|
|
27
27
|
```ruby
|
28
28
|
Commands:
|
29
|
-
stack_car bundle_exec ARGS # wraps docker
|
29
|
+
stack_car bundle_exec ARGS # wraps docker compose exec web bundle exec unless --service is used to specify (sc be ARGS)
|
30
30
|
stack_car console ARGS # shortcut to start rails console
|
31
31
|
stack_car dockerize DIR # Will copy the docker tempates in to your project, see options for supported dependencies
|
32
|
-
stack_car exec ARGS # wraps docker
|
32
|
+
stack_car exec ARGS # wraps docker compose exec web unless --service is used to specify
|
33
33
|
stack_car help [COMMAND] # Describe available commands or one specific command
|
34
|
-
stack_car stop # starts docker
|
35
|
-
stack_car up # starts docker
|
36
|
-
stack_car walk ARGS # wraps docker
|
34
|
+
stack_car stop # starts docker compose with rebuild and orphan removal, defaults to all
|
35
|
+
stack_car up # starts docker compose with rebuild and orphan removal, defaults to web
|
36
|
+
stack_car walk ARGS # wraps docker compose run web unless --service is used to specify
|
37
37
|
```
|
38
38
|
|
39
39
|
## Development
|
@@ -57,7 +57,10 @@ Developing stack_car often requires a rails application for you to run updated c
|
|
57
57
|
- Commit your changes
|
58
58
|
|
59
59
|
### Releasing a new version
|
60
|
-
|
60
|
+
**NOTE:** You will need an account for [rubygems.org](https://rubygems.org) and be made an owner of the [stack_car gem](https://rubygems.org/gems/stack_car) in order to release a new version.
|
61
|
+
|
62
|
+
- Update the version number in `version.rb`. Please follow [Semantic Versioning](https://semver.org/) guidelines.
|
63
|
+
- Commit `version.rb` and create an MR. Once the MR is approved and merged, checkout the `main` branch and do a `git pull`.
|
61
64
|
- Run `bundle exec rake release`
|
62
65
|
- This will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
63
66
|
|
@@ -67,6 +70,19 @@ Dockerizing your application with stack_car can be thought of in 2 steps:
|
|
67
70
|
- **Generate the file templates**
|
68
71
|
- **Customize provided templates to the requirements of the application**
|
69
72
|
|
73
|
+
**Set MERGE tool**
|
74
|
+
When using stack_car to dockerize an app, it might be necessary to merge templates as opposed to completely overwriting them. To set a tool run:
|
75
|
+
```bash
|
76
|
+
export THOR_MERGE=<editor>
|
77
|
+
```
|
78
|
+
Alternatively, set it in your shell's `rc` file (`~/.bashrc`, `~/.zshrc`, etc.)
|
79
|
+
|
80
|
+
With `THOR_MERGE` set, you can enter `m` at the command prompt when there is a conflict between app and `sc` template files.
|
81
|
+
|
82
|
+
*Note*: For best experience, set `THOR_MERGE` to **GUI text editor** (ie. `code` or `atom`).
|
83
|
+
|
84
|
+
Initiating a merge pulls 2 versions of the file to the editor. One is what is proposed by stack_car, the other is the original. **Add what you need from the template version to the original file and save the changes**.
|
85
|
+
|
70
86
|
### Generate templates (`sc dockerize`)
|
71
87
|
You can generate requisite files for running your application for local development in Docker with the **dockerize** command.
|
72
88
|
|
data/lib/stack_car/cli.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'thor'
|
2
2
|
require 'erb'
|
3
|
-
require 'dotenv
|
3
|
+
require 'dotenv'
|
4
4
|
require 'json'
|
5
5
|
require 'byebug'
|
6
6
|
module StackCar
|
@@ -18,17 +18,17 @@ module StackCar
|
|
18
18
|
method_option :service, default: 'web', type: :string, aliases: '-s'
|
19
19
|
method_option :build, default: false, type: :boolean, aliases: '-b'
|
20
20
|
method_option :logs, default: true, type: :boolean
|
21
|
-
desc "up", "starts docker
|
21
|
+
desc "up", "starts docker compose with rebuild and orphan removal, defaults to web"
|
22
22
|
def up
|
23
23
|
setup
|
24
24
|
ensure_development_env
|
25
25
|
args = ['--remove-orphans']
|
26
26
|
args << '--build' if options[:build]
|
27
27
|
if options[:build]
|
28
|
-
run("#{dotenv} docker
|
28
|
+
run("#{dotenv} docker compose pull #{options[:service]}")
|
29
29
|
end
|
30
30
|
|
31
|
-
run_with_exit("#{dotenv} docker
|
31
|
+
run_with_exit("#{dotenv} docker compose up #{args.join(' ')} #{options[:service]}")
|
32
32
|
end
|
33
33
|
|
34
34
|
method_option :service, default: '', type: :string, aliases: '-s'
|
@@ -36,7 +36,7 @@ module StackCar
|
|
36
36
|
def stop
|
37
37
|
setup
|
38
38
|
ensure_development_env
|
39
|
-
run("#{dotenv} docker
|
39
|
+
run("#{dotenv} docker compose stop #{options[:service]}")
|
40
40
|
run_with_exit("rm -rf tmp/pids/*")
|
41
41
|
end
|
42
42
|
|
@@ -53,7 +53,7 @@ module StackCar
|
|
53
53
|
ensure_development_env
|
54
54
|
|
55
55
|
if options[:help]
|
56
|
-
run('docker
|
56
|
+
run('docker compose down --help')
|
57
57
|
say 'Additional stack_car options:'
|
58
58
|
say ' -a, --all Removes all containers, networks, volumes, and'
|
59
59
|
say ' images created by `up`.'
|
@@ -85,7 +85,7 @@ module StackCar
|
|
85
85
|
args << '--timeout' if options[:timeout]
|
86
86
|
end
|
87
87
|
|
88
|
-
run("#{dotenv} docker
|
88
|
+
run("#{dotenv} docker compose down #{args.join(' ')}")
|
89
89
|
run_with_exit('rm -rf tmp/pids/*')
|
90
90
|
end
|
91
91
|
|
@@ -94,65 +94,65 @@ module StackCar
|
|
94
94
|
def build
|
95
95
|
setup
|
96
96
|
ensure_development_env
|
97
|
-
run_with_exit("#{dotenv} docker
|
97
|
+
run_with_exit("#{dotenv} docker compose build #{options[:service]}")
|
98
98
|
end
|
99
99
|
|
100
100
|
method_option :service, default: 'web', type: :string, aliases: '-s'
|
101
|
-
desc "push ARGS", "wraps docker
|
101
|
+
desc "push ARGS", "wraps docker compose push web unless --service is used to specify"
|
102
102
|
def push(*args)
|
103
103
|
setup
|
104
|
-
run_with_exit("#{dotenv} docker
|
104
|
+
run_with_exit("#{dotenv} docker compose push #{options[:service]} #{args.join(' ')}")
|
105
105
|
end
|
106
106
|
|
107
107
|
method_option :service, default: 'web', type: :string, aliases: '-s'
|
108
|
-
desc "pull ARGS", "wraps docker
|
108
|
+
desc "pull ARGS", "wraps docker compose pull web unless --service is used to specify"
|
109
109
|
def pull(*args)
|
110
110
|
setup
|
111
|
-
run_with_exit("#{dotenv} docker
|
111
|
+
run_with_exit("#{dotenv} docker compose pull #{options[:service]} #{args.join(' ')}")
|
112
112
|
end
|
113
113
|
|
114
114
|
method_option :service, default: '', type: :string, aliases: '-s'
|
115
|
-
desc "ps ARGS", "wraps docker
|
115
|
+
desc "ps ARGS", "wraps docker compose pull web unless --service is used to specify"
|
116
116
|
def ps(*args)
|
117
117
|
setup
|
118
|
-
run_with_exit("#{dotenv} docker
|
118
|
+
run_with_exit("#{dotenv} docker compose ps #{options[:service]} #{args.join(' ')}")
|
119
119
|
end
|
120
120
|
map status: :ps
|
121
121
|
|
122
122
|
method_option :service, default: 'web', type: :string, aliases: '-s'
|
123
|
-
desc "bundle ARGS", "wraps docker
|
123
|
+
desc "bundle ARGS", "wraps docker compose run web unless --service is used to specify"
|
124
124
|
def bundle(*args)
|
125
125
|
setup
|
126
|
-
run_with_exit("#{dotenv} docker
|
126
|
+
run_with_exit("#{dotenv} docker compose exec #{options[:service]} bundle")
|
127
127
|
end
|
128
128
|
|
129
129
|
method_option :service, default: 'web', type: :string, aliases: '-s'
|
130
|
-
desc "walk ARGS", "wraps docker
|
130
|
+
desc "walk ARGS", "wraps docker compose run web unless --service is used to specify"
|
131
131
|
def walk(*args)
|
132
132
|
setup
|
133
|
-
run_with_exit("#{dotenv} docker
|
133
|
+
run_with_exit("#{dotenv} docker compose run #{options[:service]} #{args.join(' ')}")
|
134
134
|
end
|
135
135
|
|
136
136
|
method_option :service, default: 'web', type: :string, aliases: '-s'
|
137
|
-
desc "exec ARGS", "wraps docker
|
137
|
+
desc "exec ARGS", "wraps docker compose exec web unless --service is used to specify"
|
138
138
|
def exec(*args)
|
139
139
|
setup
|
140
|
-
run_with_exit("#{dotenv} docker
|
140
|
+
run_with_exit("#{dotenv} docker compose exec #{options[:service]} #{args.join(' ')}")
|
141
141
|
end
|
142
142
|
map ex: :exec
|
143
143
|
|
144
144
|
method_option :service, default: 'web', type: :string, aliases: '-s'
|
145
|
-
desc 'sh ARGS', "launch a shell using docker
|
145
|
+
desc 'sh ARGS', "launch a shell using docker compose exec, sets tty properly"
|
146
146
|
def sh(*args)
|
147
147
|
setup
|
148
|
-
run_with_exit("#{dotenv} docker
|
148
|
+
run_with_exit("#{dotenv} docker compose exec -e COLUMNS=\"\`tput cols\`\" -e LINES=\"\`tput lines\`\" #{options[:service]} bash #{args.join(' ')}")
|
149
149
|
end
|
150
150
|
|
151
151
|
method_option :service, default: 'web', type: :string, aliases: '-s'
|
152
|
-
desc "bundle_exec ARGS", "wraps docker
|
152
|
+
desc "bundle_exec ARGS", "wraps docker compose exec web bundle exec unless --service is used to specify"
|
153
153
|
def bundle_exec(*args)
|
154
154
|
setup
|
155
|
-
run_with_exit("#{dotenv} docker
|
155
|
+
run_with_exit("#{dotenv} docker compose exec #{options[:service]} bundle exec #{args.join(' ')}")
|
156
156
|
end
|
157
157
|
map be: :bundle_exec
|
158
158
|
|
@@ -160,12 +160,13 @@ module StackCar
|
|
160
160
|
desc "console ARGS", "shortcut to start rails console"
|
161
161
|
def console(*args)
|
162
162
|
setup
|
163
|
-
run_with_exit("#{dotenv} docker
|
163
|
+
run_with_exit("#{dotenv} docker compose exec #{options[:service]} bundle exec rails console #{args.join(' ')}")
|
164
164
|
end
|
165
165
|
map rc: :console
|
166
166
|
|
167
167
|
desc "release ENVIRONTMENT", "tag and push and image to the registry"
|
168
168
|
def release(environment)
|
169
|
+
Dotenv.load(".env.#{environment}", '.env')
|
169
170
|
setup
|
170
171
|
timestamp = Time.now.strftime("%Y%m%d%I%M%S")
|
171
172
|
sha = `git rev-parse HEAD`[0..8]
|
@@ -193,6 +194,7 @@ module StackCar
|
|
193
194
|
|
194
195
|
desc "ssh ENVIRONMENT", "log in to a running instance - requires PRODUCTION_SSH to be set"
|
195
196
|
def ssh(environment)
|
197
|
+
Dotenv.load(".env.#{environment}", '.env')
|
196
198
|
setup
|
197
199
|
target = ENV["#{environment.upcase}_SSH"]
|
198
200
|
if target
|
@@ -239,7 +241,8 @@ module StackCar
|
|
239
241
|
setup
|
240
242
|
# Commandline overrides config files
|
241
243
|
# options = file_config.merge(options)
|
242
|
-
|
244
|
+
# Sets project name to parent directory name if working with stack_car dir
|
245
|
+
@project_name = @sc_dir ? File.basename(File.expand_path('..')) : File.basename(File.expand_path(dir))
|
243
246
|
apt_packages << "libpq-dev postgresql-client" if options[:postgres]
|
244
247
|
apt_packages << "mysql-client" if options[:mysql]
|
245
248
|
apt_packages << "imagemagick" if options[:imagemagick]
|
@@ -276,6 +279,11 @@ module StackCar
|
|
276
279
|
template("development.rb.erb", "config/environments/development.rb")
|
277
280
|
template("production.rb.erb", "config/environments/production.rb")
|
278
281
|
|
282
|
+
if options[:solr]
|
283
|
+
template("solrcloud-upload-configset.sh", "bin/solrcloud-upload-configset.sh")
|
284
|
+
template("solrcloud-assign-configset.sh", "bin/solrcloud-assign-configset.sh")
|
285
|
+
end
|
286
|
+
|
279
287
|
if File.exists?('README.md')
|
280
288
|
prepend_to_file "README.md" do
|
281
289
|
File.read("#{self.class.source_root}/README.md")
|
@@ -431,11 +439,11 @@ module StackCar
|
|
431
439
|
end
|
432
440
|
|
433
441
|
def find_container_by_service(service_name)
|
434
|
-
container_id = `docker
|
442
|
+
container_id = `docker compose ps -aq #{service_name}`.strip
|
435
443
|
|
436
444
|
if container_id.empty?
|
437
445
|
say "Unable to locate a container for the service '#{service_name}'"
|
438
|
-
say "Try running `docker
|
446
|
+
say "Try running `docker compose ps #{service_name}` to make sure the container exists"
|
439
447
|
exit(1)
|
440
448
|
end
|
441
449
|
|
data/lib/stack_car/version.rb
CHANGED
data/templates/.env.erb
CHANGED
@@ -41,3 +41,12 @@ ES_URL=http://elasticsearch:9200
|
|
41
41
|
SITE_URI=https://CHANGEME.com
|
42
42
|
DEPLOY_HOOK=CHANGEME
|
43
43
|
<% end -%>
|
44
|
+
<% if options[:solr] -%>
|
45
|
+
SOLR_URL=http://admin:admin@solr:8983/solr/<%= @project_name %>-development
|
46
|
+
SOLR_ADMIN_PASSWORD=admin
|
47
|
+
SOLR_ADMIN_USER=admin
|
48
|
+
SOLR_COLLECTION_NAME=<%= @project_name %>-development
|
49
|
+
SOLR_CONFIGSET_NAME=<%= @project_name %>
|
50
|
+
SOLR_HOST=solr
|
51
|
+
SOLR_PORT=8983
|
52
|
+
<% end -%>
|
@@ -0,0 +1,8 @@
|
|
1
|
+
# Gitlab Original Documentation:
|
2
|
+
- https://docs.gitlab.com/ee/user/project/merge_requests/merge_when_pipeline_succeeds.html#only-allow-merge-requests-to-be-merged-if-the-pipeline-succeeds
|
3
|
+
|
4
|
+
# Notch8 Playbook Artcile with image:
|
5
|
+
- http://playbook-staging.notch8.com/en/gitlab-only-merge-if-pipeline-succeeds
|
6
|
+
|
7
|
+
# How to Video:
|
8
|
+
- https://share.getcloudapp.com/yAuykArv
|
data/templates/README.md
CHANGED
@@ -36,8 +36,11 @@ We recommend committing .env to your repo with good defaults. .env.development,
|
|
36
36
|
|
37
37
|
6) Load and seed the database
|
38
38
|
``` bash
|
39
|
-
sc be rake db:migrate db:
|
39
|
+
sc be rake db:migrate db:seed
|
40
40
|
```
|
41
|
+
|
42
|
+
7) Visit the running instance in the browser at `project-name.test`
|
43
|
+
|
41
44
|
### Troubleshooting Docker Development Setup
|
42
45
|
Confirm or configure settings. Sub your information for the examples.
|
43
46
|
``` bash
|
data/templates/deploy.yml.erb
CHANGED
@@ -29,7 +29,7 @@
|
|
29
29
|
- debug: var=authout
|
30
30
|
|
31
31
|
- name: Restart service
|
32
|
-
command: "cd {{ compose_dir }} && docker
|
32
|
+
command: "cd {{ compose_dir }} && docker compose -f {{ project_name }}.yml pull web && docker compose -f {{ project_name }}.yml up -d web"
|
33
33
|
environment:
|
34
34
|
TAG: "{{ tag }}"
|
35
35
|
register: output
|
@@ -62,4 +62,4 @@
|
|
62
62
|
body_format: json
|
63
63
|
status_code: 200
|
64
64
|
|
65
|
-
<% end %>
|
65
|
+
<% end %>
|
@@ -51,7 +51,7 @@ services:
|
|
51
51
|
- docker-entrypoint.sh
|
52
52
|
- solr-precreate
|
53
53
|
- mycore
|
54
|
-
# docker
|
54
|
+
# docker compose exec --user=solr solr bin/solr create_core -c CORENAME
|
55
55
|
<% end -%>
|
56
56
|
<% if options[:redis] -%>
|
57
57
|
redis:
|
@@ -129,8 +129,8 @@ services:
|
|
129
129
|
ports:
|
130
130
|
- "${WEB_PORT}"
|
131
131
|
environment:
|
132
|
-
- VIRTUAL_HOST
|
133
|
-
- VIRTUAL_PORT=
|
132
|
+
- VIRTUAL_HOST=.<%= @project_name %>.test
|
133
|
+
- VIRTUAL_PORT=3000
|
134
134
|
depends_on:
|
135
135
|
<%= compose_depends %>
|
136
136
|
|
@@ -0,0 +1,35 @@
|
|
1
|
+
#!/usr/bin/env sh
|
2
|
+
COUNTER=0;
|
3
|
+
|
4
|
+
if [ "$SOLR_ADMIN_USER" ]; then
|
5
|
+
solr_user_settings="--user $SOLR_ADMIN_USER:$SOLR_ADMIN_PASSWORD"
|
6
|
+
fi
|
7
|
+
|
8
|
+
solr_config_name="${SOLR_CONFIGSET_NAME:-solrconfig}"
|
9
|
+
solr_collection_name="${SOLR_COLLECTION_NAME:-hyrax}"
|
10
|
+
|
11
|
+
# Solr Cloud Collection API URLs
|
12
|
+
solr_collection_list_url="$SOLR_HOST:$SOLR_PORT/solr/admin/collections?action=LIST"
|
13
|
+
solr_collection_modify_url="$SOLR_HOST:$SOLR_PORT/solr/admin/collections?action=MODIFYCOLLECTION&collection=${solr_collection_name}&collection.configName=${solr_config_name}"
|
14
|
+
|
15
|
+
while [ $COUNTER -lt 30 ]; do
|
16
|
+
if nc -z "${SOLR_HOST}" "${SOLR_PORT}"; then
|
17
|
+
if curl --silent $solr_user_settings "$solr_collection_list_url" | grep -q "$solr_collection_name"; then
|
18
|
+
echo "-- Collection ${solr_collection_name} exists; setting ${solr_config_name} ConfigSet ..."
|
19
|
+
echo $solr_collection_modify_url
|
20
|
+
curl $solr_user_settings "$solr_collection_modify_url"
|
21
|
+
exit
|
22
|
+
else
|
23
|
+
echo "-- Collection ${solr_collection_name} does not exist; creating and setting ${solr_config_name} ConfigSet ..."
|
24
|
+
solr_collection_create_url="$SOLR_HOST:$SOLR_PORT/solr/admin/collections?action=CREATE&name=${solr_collection_name}&collection.configName=${solr_config_name}&numShards=1"
|
25
|
+
curl $solr_user_settings "$solr_collection_create_url"
|
26
|
+
exit
|
27
|
+
fi
|
28
|
+
fi
|
29
|
+
echo "-- Looking for Solr (${SOLR_HOST}:${SOLR_PORT})..."
|
30
|
+
COUNTER=$(( COUNTER+1 ));
|
31
|
+
sleep 5s
|
32
|
+
done
|
33
|
+
|
34
|
+
echo "--- ERROR: failed to create/update Solr collection after 5 minutes";
|
35
|
+
exit 1
|
@@ -0,0 +1,42 @@
|
|
1
|
+
#!/usr/bin/env sh
|
2
|
+
|
3
|
+
COUNTER=0;
|
4
|
+
# /app/samvera/hyrax-webapp/solr/conf
|
5
|
+
CONFDIR="${1}"
|
6
|
+
|
7
|
+
if [ "$SOLR_ADMIN_USER" ]; then
|
8
|
+
solr_user_settings="--user $SOLR_ADMIN_USER:$SOLR_ADMIN_PASSWORD"
|
9
|
+
fi
|
10
|
+
|
11
|
+
solr_config_name="${SOLR_CONFIGSET_NAME:-solrconfig}"
|
12
|
+
|
13
|
+
# Solr Cloud ConfigSet API URLs
|
14
|
+
solr_config_list_url="http://$SOLR_HOST:$SOLR_PORT/api/cluster/configs?omitHeader=true"
|
15
|
+
solr_config_upload_url="http://$SOLR_HOST:$SOLR_PORT/solr/admin/configs?action=UPLOAD&name=${solr_config_name}"
|
16
|
+
|
17
|
+
while [ $COUNTER -lt 30 ]; do
|
18
|
+
echo "-- Looking for Solr (${SOLR_HOST}:${SOLR_PORT})..."
|
19
|
+
if nc -z "${SOLR_HOST}" "${SOLR_PORT}"; then
|
20
|
+
# shellcheck disable=SC2143,SC2086
|
21
|
+
if curl --silent --user 'fake:fake' "$solr_config_list_url" | grep -q '401'; then
|
22
|
+
# the solr pods come up and report available before they are ready to accept trusted configs
|
23
|
+
# only try to upload the config if auth is on.
|
24
|
+
if curl --silent $solr_user_settings "$solr_config_list_url" | grep -q "$solr_config_name"; then
|
25
|
+
echo "-- ConfigSet already exists; skipping creation ...";
|
26
|
+
else
|
27
|
+
echo "-- ConfigSet for ${CONFDIR} does not exist; creating ..."
|
28
|
+
(cd "$CONFDIR" && zip -r - *) | curl -X POST $solr_user_settings --header "Content-Type:application/octet-stream" --data-binary @- "$solr_config_upload_url"
|
29
|
+
fi
|
30
|
+
exit
|
31
|
+
else
|
32
|
+
echo "-- Solr at $solr_config_list_url is accepting unauthorized connections; we can't upload a trusted ConfigSet."
|
33
|
+
echo "-- It's possible SolrCloud is bootstrapping its configuration, so this process will retry."
|
34
|
+
echo "-- see: https://solr.apache.org/guide/8_6/configsets-api.html#configsets-upload"
|
35
|
+
fi
|
36
|
+
fi
|
37
|
+
COUNTER=$(( COUNTER+1 ));
|
38
|
+
sleep 5s
|
39
|
+
done
|
40
|
+
|
41
|
+
echo "--- ERROR: failed to create Solr ConfigSet after 5 minutes";
|
42
|
+
exit 1
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stack_car
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.16.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rob Kaufman
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-03-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -159,6 +159,7 @@ executables:
|
|
159
159
|
extensions: []
|
160
160
|
extra_rdoc_files: []
|
161
161
|
files:
|
162
|
+
- ".github/workflows/rspec-action.yaml"
|
162
163
|
- ".gitignore"
|
163
164
|
- ".gitlab-ci.yml"
|
164
165
|
- ".rspec"
|
@@ -186,6 +187,7 @@ files:
|
|
186
187
|
- templates/.gitlab/issue_templates/Bug.md
|
187
188
|
- templates/.gitlab/issue_templates/Feature.md
|
188
189
|
- templates/.gitlab/issue_templates/Question.md
|
190
|
+
- templates/.gitlab/issue_templates/enable_pipeline_check_before_merge.md
|
189
191
|
- templates/.gitlab/merge_request_templates/Bug.md
|
190
192
|
- templates/.gitlab/merge_request_templates/Feature.md
|
191
193
|
- templates/.sops.yaml.erb
|
@@ -243,6 +245,8 @@ files:
|
|
243
245
|
- templates/ops/roles/docker.ubuntu/vars/main.yml
|
244
246
|
- templates/production.rb.erb
|
245
247
|
- templates/provision.yml.erb
|
248
|
+
- templates/solrcloud-assign-configset.sh
|
249
|
+
- templates/solrcloud-upload-configset.sh
|
246
250
|
- templates/webapp.conf.erb
|
247
251
|
- templates/worker.sh.erb
|
248
252
|
homepage: https://gitlab.com/notch8/stack_car
|
@@ -263,7 +267,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
263
267
|
- !ruby/object:Gem::Version
|
264
268
|
version: '0'
|
265
269
|
requirements: []
|
266
|
-
rubygems_version: 3.
|
270
|
+
rubygems_version: 3.1.6
|
267
271
|
signing_key:
|
268
272
|
specification_version: 4
|
269
273
|
summary: A tool to make rails + docker easy
|