prodder 1.8.1 → 1.8.2
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/.dockerignore +2 -0
- data/.github/workflows/ci.yml +33 -19
- data/.gitignore +0 -21
- data/Dockerfile +23 -0
- data/README.md +1 -1
- data/compose.yml +54 -0
- data/entrypoints/entry.sh +15 -0
- data/lib/prodder/pg.rb +1 -0
- data/lib/prodder/prodder.rake +9 -9
- data/lib/prodder/version.rb +1 -1
- metadata +10 -7
- data/config/database.yml.github-actions +0 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e3ab994663f2c4c9e24475f197d4aa5c2cc29fb98f2ee14841fb4f9df4dc680e
|
|
4
|
+
data.tar.gz: 59000cbb6bade96b5ae1e9143897fdf4706c149fa55ead7bc975832587dcebe8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c7914656c214ae8f87f23fe15de87a67bc9b471c65454408496639c4632364dccda94cbd8551b101b2989bd5d649fa6f3ff68a49da07fc476921af802f52d982
|
|
7
|
+
data.tar.gz: 2d3485303746abae32e25e57fbad7793a07878a1cdf2be230b6c94d250efaf7de3023b053bfb795539f205421fa386289332816783be4fdb1376cde320ddc732
|
data/.dockerignore
ADDED
data/.github/workflows/ci.yml
CHANGED
|
@@ -5,7 +5,9 @@ on:
|
|
|
5
5
|
push:
|
|
6
6
|
branches:
|
|
7
7
|
- main
|
|
8
|
-
|
|
8
|
+
pull_request_target:
|
|
9
|
+
branches:
|
|
10
|
+
- main
|
|
9
11
|
|
|
10
12
|
permissions:
|
|
11
13
|
contents: read
|
|
@@ -14,42 +16,54 @@ jobs:
|
|
|
14
16
|
test:
|
|
15
17
|
runs-on: ubuntu-latest
|
|
16
18
|
strategy:
|
|
19
|
+
fail-fast: false
|
|
17
20
|
matrix:
|
|
18
21
|
ruby-version: [2.6, 2.7, 3.0]
|
|
19
22
|
services:
|
|
20
23
|
postgres:
|
|
21
|
-
image: postgres:
|
|
24
|
+
image: postgres:13-alpine
|
|
22
25
|
ports:
|
|
23
26
|
- 5432:5432
|
|
24
27
|
env:
|
|
25
28
|
POSTGRES_USER: postgres
|
|
26
29
|
POSTGRES_PASSWORD: postgres
|
|
27
|
-
|
|
30
|
+
POSTGRES_HOST_AUTH_METHOD: trust
|
|
31
|
+
options: >-
|
|
32
|
+
--health-cmd pg_isready
|
|
33
|
+
--health-interval 10s
|
|
34
|
+
--health-timeout 5s
|
|
35
|
+
--health-retries 5
|
|
28
36
|
steps:
|
|
29
37
|
- name: Checkout Project
|
|
30
|
-
uses: actions/checkout@
|
|
31
|
-
|
|
38
|
+
uses: actions/checkout@v4
|
|
32
39
|
- name: Set up Ruby
|
|
33
40
|
uses: ruby/setup-ruby@v1
|
|
34
41
|
with:
|
|
35
42
|
ruby-version: ${{ matrix.ruby-version }}
|
|
36
43
|
bundler-cache: true
|
|
37
|
-
|
|
38
44
|
- name: Install Library Dependencies
|
|
39
|
-
run: sudo apt
|
|
40
|
-
|
|
45
|
+
run: sudo apt update && sudo apt install -y postgresql-client
|
|
41
46
|
- name: Setup Database
|
|
42
47
|
run: |
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
48
|
+
mkdir -p config
|
|
49
|
+
cat <<EOF > config/database.yml
|
|
50
|
+
test:
|
|
51
|
+
adapter: postgresql
|
|
52
|
+
encoding: unicode
|
|
53
|
+
pool: 20
|
|
54
|
+
database: prodder_test
|
|
55
|
+
EOF
|
|
49
56
|
- name: Test with RSpec
|
|
50
57
|
env:
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
58
|
+
PGHOST: localhost
|
|
59
|
+
PGPORT: 5432
|
|
60
|
+
PGUSER: postgres
|
|
61
|
+
PGPASSWORD: postgres
|
|
62
|
+
run: bundle exec rspec
|
|
63
|
+
- name: Test with Cucumber
|
|
64
|
+
env:
|
|
65
|
+
PGHOST: localhost
|
|
66
|
+
PGPORT: 5432
|
|
67
|
+
PGUSER: postgres
|
|
68
|
+
PGPASSWORD: postgres
|
|
69
|
+
run: bundle exec cucumber
|
data/.gitignore
CHANGED
|
@@ -1,23 +1,2 @@
|
|
|
1
1
|
Gemfile.lock
|
|
2
|
-
*.gem
|
|
3
|
-
*.rbc
|
|
4
|
-
.bundle
|
|
5
|
-
.config
|
|
6
|
-
coverage
|
|
7
|
-
InstalledFiles
|
|
8
|
-
lib/bundler/man
|
|
9
|
-
pkg
|
|
10
|
-
rdoc
|
|
11
|
-
spec/reports
|
|
12
|
-
test/tmp
|
|
13
|
-
test/version_tmp
|
|
14
2
|
tmp
|
|
15
|
-
|
|
16
|
-
# YARD artifacts
|
|
17
|
-
.yardoc
|
|
18
|
-
_yardoc
|
|
19
|
-
doc/
|
|
20
|
-
|
|
21
|
-
nc.yml
|
|
22
|
-
prodder-workspace/
|
|
23
|
-
features/support/blog.git
|
data/Dockerfile
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
ARG RUBY_VERSION=3.0
|
|
2
|
+
|
|
3
|
+
FROM ruby:${RUBY_VERSION}
|
|
4
|
+
|
|
5
|
+
WORKDIR /app
|
|
6
|
+
|
|
7
|
+
RUN apt update && \
|
|
8
|
+
apt install -y git postgresql-client && \
|
|
9
|
+
apt clean && \
|
|
10
|
+
rm -rf /var/lib/apt/lists/*
|
|
11
|
+
|
|
12
|
+
ENV BUNDLER_VERSION 2.4.22
|
|
13
|
+
|
|
14
|
+
RUN gem install bundler -v $BUNDLER_VERSION
|
|
15
|
+
|
|
16
|
+
COPY Gemfile ./
|
|
17
|
+
|
|
18
|
+
RUN bundle install -j $(nproc)
|
|
19
|
+
|
|
20
|
+
COPY . .
|
|
21
|
+
|
|
22
|
+
ENTRYPOINT ["entrypoints/entry.sh"]
|
|
23
|
+
CMD ["bin/prodder"]
|
data/README.md
CHANGED
|
@@ -82,7 +82,7 @@ Things that really matter:
|
|
|
82
82
|
created. Those initial seeds should have included your production app's `schema_migrations`
|
|
83
83
|
table contents. This means only those migrations that have not yet run in production
|
|
84
84
|
will need to be run locally.
|
|
85
|
-
3. If you
|
|
85
|
+
3. If you configured to have 3 users in your `#config/database.yml` file and have a `permissions.sql` file present,
|
|
86
86
|
all your `db:*` commands will be run in the context of the user it makes the most sense to run as, mimicking
|
|
87
87
|
our production environment. For instance(s), to reset the database (god forbid we do this in production), it will
|
|
88
88
|
run as `superuser`, to run a migration, as the `migration_user` and your application will connect to the database
|
data/compose.yml
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
services:
|
|
2
|
+
postgres:
|
|
3
|
+
image: postgres:13-alpine
|
|
4
|
+
volumes:
|
|
5
|
+
- postgres_data:/var/lib/postgresql/data
|
|
6
|
+
ports:
|
|
7
|
+
- 5432:5432
|
|
8
|
+
environment:
|
|
9
|
+
POSTGRES_USER: postgres
|
|
10
|
+
POSTGRES_PASSWORD: postgres
|
|
11
|
+
POSTGRES_HOST_AUTH_METHOD: trust
|
|
12
|
+
healthcheck:
|
|
13
|
+
test: ["CMD", "pg_isready"]
|
|
14
|
+
interval: 10s
|
|
15
|
+
timeout: 5s
|
|
16
|
+
retries: 5
|
|
17
|
+
restart: on-failure:5
|
|
18
|
+
|
|
19
|
+
prodder:
|
|
20
|
+
platform: linux/arm64
|
|
21
|
+
build:
|
|
22
|
+
context: .
|
|
23
|
+
dockerfile: Dockerfile
|
|
24
|
+
args:
|
|
25
|
+
RUBY_VERSION: 3.0
|
|
26
|
+
volumes:
|
|
27
|
+
- .:/app
|
|
28
|
+
- /app/config
|
|
29
|
+
depends_on:
|
|
30
|
+
postgres:
|
|
31
|
+
condition: service_healthy
|
|
32
|
+
environment:
|
|
33
|
+
PGHOST: localhost
|
|
34
|
+
PGPORT: "5432"
|
|
35
|
+
PGUSER: postgres
|
|
36
|
+
PGPASSWORD: postgres
|
|
37
|
+
network_mode: host
|
|
38
|
+
|
|
39
|
+
rspec:
|
|
40
|
+
profiles:
|
|
41
|
+
- test
|
|
42
|
+
extends:
|
|
43
|
+
service: prodder
|
|
44
|
+
command: bundle exec rspec
|
|
45
|
+
|
|
46
|
+
cucumber:
|
|
47
|
+
profiles:
|
|
48
|
+
- test
|
|
49
|
+
extends:
|
|
50
|
+
service: prodder
|
|
51
|
+
command: bundle exec cucumber
|
|
52
|
+
|
|
53
|
+
volumes:
|
|
54
|
+
postgres_data:
|
data/lib/prodder/pg.rb
CHANGED
data/lib/prodder/prodder.rake
CHANGED
|
@@ -169,7 +169,7 @@ namespace :db do
|
|
|
169
169
|
end
|
|
170
170
|
as("superuser", in: environments) do
|
|
171
171
|
ActiveRecord::Tasks::DatabaseTasks.create_current
|
|
172
|
-
|
|
172
|
+
ActiveRecord::Base.configurations.to_h.each do |env, config|
|
|
173
173
|
if environments.include?(env) && config["migration_user"] && config['database']
|
|
174
174
|
set_psql_env config
|
|
175
175
|
`psql --no-psqlrc --command "ALTER DATABASE #{config['database']} OWNER TO #{config['migration_user']}" #{Shellwords.escape(config['database'])}`
|
|
@@ -182,7 +182,7 @@ namespace :db do
|
|
|
182
182
|
task :all => dependencies do
|
|
183
183
|
as("superuser") do
|
|
184
184
|
ActiveRecord::Tasks::DatabaseTasks.create_all
|
|
185
|
-
|
|
185
|
+
ActiveRecord::Base.configurations.to_h.each do |env, config|
|
|
186
186
|
if config["migration_user"] && config['database']
|
|
187
187
|
set_psql_env config
|
|
188
188
|
`psql --no-psqlrc --command "ALTER DATABASE #{config['database']} OWNER TO #{config['migration_user']}" #{Shellwords.escape(config['database'])}`
|
|
@@ -362,19 +362,19 @@ namespace :db do
|
|
|
362
362
|
|
|
363
363
|
def as(user, opts = {}, &block)
|
|
364
364
|
if File.exist?('db/permissions.sql')
|
|
365
|
-
|
|
366
|
-
in_env = Array(opts[:in]) ||
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
config
|
|
370
|
-
|
|
365
|
+
original_config = ActiveRecord::Base.configurations.deep_dup
|
|
366
|
+
in_env = Array(opts[:in]) || ActiveRecord::Base.configurations.deep_dup.to_h.keys
|
|
367
|
+
disconnect
|
|
368
|
+
in_env.each do |env|
|
|
369
|
+
config = ActiveRecord::Base.configurations.find_db_config(env)
|
|
370
|
+
config["username"] = config[user]
|
|
371
371
|
end
|
|
372
372
|
else
|
|
373
373
|
puts "No permissions file (db/permissions.sql) found, running everything in context of user"
|
|
374
374
|
end
|
|
375
375
|
yield
|
|
376
376
|
ensure
|
|
377
|
-
ActiveRecord::Base.configurations =
|
|
377
|
+
ActiveRecord::Base.configurations = original_config if original_config
|
|
378
378
|
in_env.each { |env| ActiveRecord::Base.establish_connection(env.intern) } if in_env
|
|
379
379
|
end
|
|
380
380
|
|
data/lib/prodder/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: prodder
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.8.
|
|
4
|
+
version: 1.8.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Kyle Hargraves
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2024-12-03 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: deject
|
|
@@ -32,14 +32,17 @@ executables:
|
|
|
32
32
|
extensions: []
|
|
33
33
|
extra_rdoc_files: []
|
|
34
34
|
files:
|
|
35
|
+
- ".dockerignore"
|
|
35
36
|
- ".github/workflows/ci.yml"
|
|
36
37
|
- ".gitignore"
|
|
38
|
+
- Dockerfile
|
|
37
39
|
- Gemfile
|
|
38
40
|
- LICENSE.txt
|
|
39
41
|
- README.md
|
|
40
42
|
- Rakefile
|
|
41
43
|
- bin/prodder
|
|
42
|
-
-
|
|
44
|
+
- compose.yml
|
|
45
|
+
- entrypoints/entry.sh
|
|
43
46
|
- features/commit.feature
|
|
44
47
|
- features/dump.feature
|
|
45
48
|
- features/init.feature
|
|
@@ -67,7 +70,7 @@ homepage: https://github.com/enova/prodder
|
|
|
67
70
|
licenses:
|
|
68
71
|
- MIT
|
|
69
72
|
metadata: {}
|
|
70
|
-
post_install_message:
|
|
73
|
+
post_install_message:
|
|
71
74
|
rdoc_options: []
|
|
72
75
|
require_paths:
|
|
73
76
|
- lib
|
|
@@ -82,8 +85,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
82
85
|
- !ruby/object:Gem::Version
|
|
83
86
|
version: '0'
|
|
84
87
|
requirements: []
|
|
85
|
-
rubygems_version: 3.
|
|
86
|
-
signing_key:
|
|
88
|
+
rubygems_version: 3.3.26
|
|
89
|
+
signing_key:
|
|
87
90
|
specification_version: 4
|
|
88
91
|
summary: Maintain your Rails apps' structure, seed and quality_checks files using
|
|
89
92
|
production dumps
|