appmap 0.77.3 → 0.79.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/.rubocop.yml +1 -0
- data/.travis.yml +4 -23
- data/CHANGELOG.md +21 -0
- data/{spec/fixtures/rails5_users_app/Dockerfile.pg → Dockerfile.pg} +0 -0
- data/README.md +14 -44
- data/README_CI.md +0 -7
- data/Rakefile +12 -150
- data/appmap.gemspec +3 -2
- data/docker-compose.yml +10 -0
- data/ext/appmap/appmap.c +21 -2
- data/lib/appmap/builtin_hooks/ruby.yml +6 -3
- data/lib/appmap/handler/eval.rb +41 -0
- data/lib/appmap/handler/function.rb +8 -8
- data/lib/appmap/handler/net_http.rb +19 -18
- data/lib/appmap/handler/rails/request_handler.rb +3 -4
- data/lib/appmap/handler/rails/template.rb +68 -62
- data/lib/appmap/hook/method/ruby2.rb +56 -0
- data/lib/appmap/hook/method/ruby3.rb +56 -0
- data/lib/appmap/hook/method.rb +42 -98
- data/lib/appmap/hook.rb +2 -2
- data/lib/appmap/version.rb +1 -1
- data/spec/config_spec.rb +1 -1
- data/spec/depends/api_spec.rb +13 -5
- data/spec/depends/spec_helper.rb +0 -9
- data/spec/fixtures/database.yml +11 -0
- data/spec/fixtures/rails5_users_app/config/database.yml +1 -0
- data/spec/fixtures/rails6_users_app/Gemfile +1 -25
- data/spec/fixtures/rails6_users_app/config/database.yml +1 -0
- data/spec/fixtures/rails7_users_app/Gemfile +1 -25
- data/spec/fixtures/rails7_users_app/config/database.yml +1 -0
- data/spec/handler/eval_spec.rb +66 -0
- data/spec/hook_spec.rb +3 -3
- data/spec/rails_recording_spec.rb +4 -20
- data/spec/rails_spec_helper.rb +76 -63
- data/spec/rails_test_spec.rb +7 -17
- data/spec/railtie_spec.rb +4 -18
- data/spec/record_sql_rails_pg_spec.rb +44 -75
- data/spec/remote_recording_spec.rb +18 -30
- data/spec/spec_helper.rb +1 -0
- data/spec/swagger/swagger_spec.rb +1 -16
- data/spec/util_spec.rb +1 -1
- metadata +25 -21
- data/Dockerfile.appmap +0 -5
- data/spec/fixtures/rack_users_app/Dockerfile +0 -32
- data/spec/fixtures/rack_users_app/docker-compose.yml +0 -9
- data/spec/fixtures/rails5_users_app/Dockerfile +0 -29
- data/spec/fixtures/rails5_users_app/config/database.yml +0 -18
- data/spec/fixtures/rails5_users_app/create_app +0 -33
- data/spec/fixtures/rails5_users_app/docker-compose.yml +0 -31
- data/spec/fixtures/rails6_users_app/.ruby-version +0 -1
- data/spec/fixtures/rails6_users_app/Dockerfile +0 -44
- data/spec/fixtures/rails6_users_app/Dockerfile.pg +0 -3
- data/spec/fixtures/rails6_users_app/config/database.yml +0 -18
- data/spec/fixtures/rails6_users_app/create_app +0 -33
- data/spec/fixtures/rails6_users_app/docker-compose.yml +0 -31
- data/spec/fixtures/rails7_users_app/.ruby-version +0 -1
- data/spec/fixtures/rails7_users_app/Dockerfile +0 -30
- data/spec/fixtures/rails7_users_app/Dockerfile.pg +0 -3
- data/spec/fixtures/rails7_users_app/config/database.yml +0 -86
- data/spec/fixtures/rails7_users_app/create_app +0 -31
- data/spec/fixtures/rails7_users_app/docker-compose.yml +0 -31
@@ -4,24 +4,9 @@ describe 'rake appmap:swagger' do
|
|
4
4
|
include_context 'Rails app pg database', "spec/fixtures/rails6_users_app" unless use_existing_data?
|
5
5
|
include_context 'rails integration test setup'
|
6
6
|
|
7
|
-
def run_spec(spec_name)
|
8
|
-
cmd = <<~CMD.gsub "\n", ' '
|
9
|
-
docker-compose run --rm -e RAILS_ENV=test -e APPMAP=true
|
10
|
-
-v #{File.absolute_path tmpdir}:/app/tmp app ./bin/rspec #{spec_name}
|
11
|
-
CMD
|
12
|
-
run_cmd cmd, chdir: fixture_dir
|
13
|
-
end
|
14
|
-
|
15
|
-
def generate_swagger
|
16
|
-
cmd = <<~CMD.gsub "\n", ' '
|
17
|
-
docker-compose run --rm -v #{File.absolute_path tmpdir}:/app/tmp app ./bin/rake appmap:swagger
|
18
|
-
CMD
|
19
|
-
run_cmd cmd, chdir: fixture_dir
|
20
|
-
end
|
21
|
-
|
22
7
|
unless use_existing_data?
|
23
8
|
before(:all) do
|
24
|
-
|
9
|
+
@app.run_cmd './bin/rake appmap:swagger'
|
25
10
|
end
|
26
11
|
end
|
27
12
|
|
data/spec/util_spec.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: appmap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.79.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin Gilpin
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-04-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -86,14 +86,14 @@ dependencies:
|
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '5.
|
89
|
+
version: '5.15'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '5.
|
96
|
+
version: '5.15'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: pry-byebug
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -276,6 +276,20 @@ dependencies:
|
|
276
276
|
- - ">="
|
277
277
|
- !ruby/object:Gem::Version
|
278
278
|
version: '0'
|
279
|
+
- !ruby/object:Gem::Dependency
|
280
|
+
name: random-port
|
281
|
+
requirement: !ruby/object:Gem::Requirement
|
282
|
+
requirements:
|
283
|
+
- - "~>"
|
284
|
+
- !ruby/object:Gem::Version
|
285
|
+
version: 0.5.1
|
286
|
+
type: :development
|
287
|
+
prerelease: false
|
288
|
+
version_requirements: !ruby/object:Gem::Requirement
|
289
|
+
requirements:
|
290
|
+
- - "~>"
|
291
|
+
- !ruby/object:Gem::Version
|
292
|
+
version: 0.5.1
|
279
293
|
- !ruby/object:Gem::Dependency
|
280
294
|
name: webrick
|
281
295
|
requirement: !ruby/object:Gem::Requirement
|
@@ -312,7 +326,7 @@ files:
|
|
312
326
|
- ARCHITECTURE.md
|
313
327
|
- CHANGELOG.md
|
314
328
|
- CONTRIBUTING.md
|
315
|
-
- Dockerfile.
|
329
|
+
- Dockerfile.pg
|
316
330
|
- Gemfile
|
317
331
|
- LICENSE.txt
|
318
332
|
- README.md
|
@@ -321,6 +335,7 @@ files:
|
|
321
335
|
- appmap.gemspec
|
322
336
|
- appmap.yml
|
323
337
|
- config-schema.yml
|
338
|
+
- docker-compose.yml
|
324
339
|
- examples/install.rb
|
325
340
|
- examples/mock_webapp/Gemfile
|
326
341
|
- examples/mock_webapp/appmap.yml
|
@@ -376,6 +391,7 @@ files:
|
|
376
391
|
- lib/appmap/gem_hooks/sidekiq.yml
|
377
392
|
- lib/appmap/gem_hooks/sprockets.yml
|
378
393
|
- lib/appmap/handler.rb
|
394
|
+
- lib/appmap/handler/eval.rb
|
379
395
|
- lib/appmap/handler/function.rb
|
380
396
|
- lib/appmap/handler/net_http.rb
|
381
397
|
- lib/appmap/handler/rails/request_handler.rb
|
@@ -383,6 +399,8 @@ files:
|
|
383
399
|
- lib/appmap/handler/rails/template.rb
|
384
400
|
- lib/appmap/hook.rb
|
385
401
|
- lib/appmap/hook/method.rb
|
402
|
+
- lib/appmap/hook/method/ruby2.rb
|
403
|
+
- lib/appmap/hook/method/ruby3.rb
|
386
404
|
- lib/appmap/metadata.rb
|
387
405
|
- lib/appmap/middleware/remote_recording.rb
|
388
406
|
- lib/appmap/minitest.rb
|
@@ -418,6 +436,7 @@ files:
|
|
418
436
|
- spec/fixtures/config/invalid_yaml_config.yml
|
419
437
|
- spec/fixtures/config/missing_path_or_gem.yml
|
420
438
|
- spec/fixtures/config/valid_config.yml
|
439
|
+
- spec/fixtures/database.yml
|
421
440
|
- spec/fixtures/depends/.gitignore
|
422
441
|
- spec/fixtures/depends/app/controllers/api/api_keys_controller.rb
|
423
442
|
- spec/fixtures/depends/app/controllers/organizations_controller.rb
|
@@ -460,18 +479,14 @@ files:
|
|
460
479
|
- spec/fixtures/hook/user_page_scenario.appmap.json
|
461
480
|
- spec/fixtures/rack_users_app/.dockerignore
|
462
481
|
- spec/fixtures/rack_users_app/.gitignore
|
463
|
-
- spec/fixtures/rack_users_app/Dockerfile
|
464
482
|
- spec/fixtures/rack_users_app/Gemfile
|
465
483
|
- spec/fixtures/rack_users_app/appmap.yml
|
466
484
|
- spec/fixtures/rack_users_app/config.ru
|
467
|
-
- spec/fixtures/rack_users_app/docker-compose.yml
|
468
485
|
- spec/fixtures/rack_users_app/lib/app.rb
|
469
486
|
- spec/fixtures/rails5_users_app/.dockerignore
|
470
487
|
- spec/fixtures/rails5_users_app/.gitignore
|
471
488
|
- spec/fixtures/rails5_users_app/.rspec
|
472
489
|
- spec/fixtures/rails5_users_app/.ruby-version
|
473
|
-
- spec/fixtures/rails5_users_app/Dockerfile
|
474
|
-
- spec/fixtures/rails5_users_app/Dockerfile.pg
|
475
490
|
- spec/fixtures/rails5_users_app/Gemfile
|
476
491
|
- spec/fixtures/rails5_users_app/Rakefile
|
477
492
|
- spec/fixtures/rails5_users_app/app/controllers/api/users_controller.rb
|
@@ -520,10 +535,8 @@ files:
|
|
520
535
|
- spec/fixtures/rails5_users_app/config/initializers/wrap_parameters.rb
|
521
536
|
- spec/fixtures/rails5_users_app/config/locales/en.yml
|
522
537
|
- spec/fixtures/rails5_users_app/config/routes.rb
|
523
|
-
- spec/fixtures/rails5_users_app/create_app
|
524
538
|
- spec/fixtures/rails5_users_app/db/migrate/20190728211408_create_users.rb
|
525
539
|
- spec/fixtures/rails5_users_app/db/schema.rb
|
526
|
-
- spec/fixtures/rails5_users_app/docker-compose.yml
|
527
540
|
- spec/fixtures/rails5_users_app/features/api_users.feature
|
528
541
|
- spec/fixtures/rails5_users_app/features/support/env.rb
|
529
542
|
- spec/fixtures/rails5_users_app/features/support/hooks.rb
|
@@ -540,9 +553,6 @@ files:
|
|
540
553
|
- spec/fixtures/rails6_users_app/.dockerignore
|
541
554
|
- spec/fixtures/rails6_users_app/.gitignore
|
542
555
|
- spec/fixtures/rails6_users_app/.rspec
|
543
|
-
- spec/fixtures/rails6_users_app/.ruby-version
|
544
|
-
- spec/fixtures/rails6_users_app/Dockerfile
|
545
|
-
- spec/fixtures/rails6_users_app/Dockerfile.pg
|
546
556
|
- spec/fixtures/rails6_users_app/Gemfile
|
547
557
|
- spec/fixtures/rails6_users_app/Rakefile
|
548
558
|
- spec/fixtures/rails6_users_app/app/controllers/api/users_controller.rb
|
@@ -591,10 +601,8 @@ files:
|
|
591
601
|
- spec/fixtures/rails6_users_app/config/initializers/wrap_parameters.rb
|
592
602
|
- spec/fixtures/rails6_users_app/config/locales/en.yml
|
593
603
|
- spec/fixtures/rails6_users_app/config/routes.rb
|
594
|
-
- spec/fixtures/rails6_users_app/create_app
|
595
604
|
- spec/fixtures/rails6_users_app/db/migrate/20190728211408_create_users.rb
|
596
605
|
- spec/fixtures/rails6_users_app/db/schema.rb
|
597
|
-
- spec/fixtures/rails6_users_app/docker-compose.yml
|
598
606
|
- spec/fixtures/rails6_users_app/features/api_users.feature
|
599
607
|
- spec/fixtures/rails6_users_app/features/support/env.rb
|
600
608
|
- spec/fixtures/rails6_users_app/features/support/hooks.rb
|
@@ -617,9 +625,6 @@ files:
|
|
617
625
|
- spec/fixtures/rails7_users_app/.gitattributes
|
618
626
|
- spec/fixtures/rails7_users_app/.gitignore
|
619
627
|
- spec/fixtures/rails7_users_app/.rspec
|
620
|
-
- spec/fixtures/rails7_users_app/.ruby-version
|
621
|
-
- spec/fixtures/rails7_users_app/Dockerfile
|
622
|
-
- spec/fixtures/rails7_users_app/Dockerfile.pg
|
623
628
|
- spec/fixtures/rails7_users_app/Gemfile
|
624
629
|
- spec/fixtures/rails7_users_app/README.md
|
625
630
|
- spec/fixtures/rails7_users_app/Rakefile
|
@@ -670,12 +675,10 @@ files:
|
|
670
675
|
- spec/fixtures/rails7_users_app/config/puma.rb
|
671
676
|
- spec/fixtures/rails7_users_app/config/routes.rb
|
672
677
|
- spec/fixtures/rails7_users_app/config/storage.yml
|
673
|
-
- spec/fixtures/rails7_users_app/create_app
|
674
678
|
- spec/fixtures/rails7_users_app/db/migrate/20220328093141_create_instances.rb
|
675
679
|
- spec/fixtures/rails7_users_app/db/migrate/20220328093154_create_instructors.rb
|
676
680
|
- spec/fixtures/rails7_users_app/db/schema.rb
|
677
681
|
- spec/fixtures/rails7_users_app/db/seeds.rb
|
678
|
-
- spec/fixtures/rails7_users_app/docker-compose.yml
|
679
682
|
- spec/fixtures/rails7_users_app/lib/assets/.keep
|
680
683
|
- spec/fixtures/rails7_users_app/lib/tasks/.keep
|
681
684
|
- spec/fixtures/rails7_users_app/log/.keep
|
@@ -701,6 +704,7 @@ files:
|
|
701
704
|
- spec/fixtures/rails7_users_app/test/models/instructor_test.rb
|
702
705
|
- spec/fixtures/rails7_users_app/test/system/.keep
|
703
706
|
- spec/fixtures/rails7_users_app/test/test_helper.rb
|
707
|
+
- spec/handler/eval_spec.rb
|
704
708
|
- spec/hook_spec.rb
|
705
709
|
- spec/open_spec.rb
|
706
710
|
- spec/rails_recording_spec.rb
|
data/Dockerfile.appmap
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
ARG GEM_VERSION
|
2
|
-
ARG RUBY_VERSION
|
3
|
-
|
4
|
-
FROM appmap:${GEM_VERSION} as appmap
|
5
|
-
|
6
|
-
FROM ruby:${RUBY_VERSION}
|
7
|
-
RUN apt-get update && apt-get install -y vim less
|
8
|
-
|
9
|
-
RUN mkdir /app
|
10
|
-
WORKDIR /app
|
11
|
-
|
12
|
-
RUN gem install -N bundler
|
13
|
-
|
14
|
-
COPY Gemfile .
|
15
|
-
|
16
|
-
RUN bundle
|
17
|
-
RUN bundle binstubs rack
|
18
|
-
|
19
|
-
COPY . .
|
20
|
-
|
21
|
-
COPY --from=appmap /pkg/appmap.gem /tmp/
|
22
|
-
RUN gem install /tmp/appmap.gem && \
|
23
|
-
bundle update --local appmap && \
|
24
|
-
bundle binstubs appmap --force
|
25
|
-
|
26
|
-
EXPOSE 9292
|
27
|
-
|
28
|
-
ENV GLI_DEBUG=true
|
29
|
-
|
30
|
-
ENTRYPOINT [ "./bin/appmap", "record", "-o", "tmp/appmap.json" ]
|
31
|
-
|
32
|
-
HEALTHCHECK --interval=1s --retries=10 CMD curl --fail http://localhost:9292/health || exit 1
|
@@ -1,29 +0,0 @@
|
|
1
|
-
ARG GEM_VERSION
|
2
|
-
ARG RUBY_VERSION
|
3
|
-
|
4
|
-
FROM appmap:${GEM_VERSION} as appmap
|
5
|
-
|
6
|
-
FROM ruby:${RUBY_VERSION}
|
7
|
-
RUN apt-get update && apt-get install -y vim less
|
8
|
-
RUN apt-get install -y postgresql-client
|
9
|
-
|
10
|
-
RUN mkdir /app
|
11
|
-
WORKDIR /app
|
12
|
-
|
13
|
-
RUN gem install -N bundler
|
14
|
-
|
15
|
-
COPY Gemfile .
|
16
|
-
|
17
|
-
RUN bundle
|
18
|
-
RUN bundle binstubs bundler rspec-core --force
|
19
|
-
|
20
|
-
COPY . .
|
21
|
-
|
22
|
-
COPY --from=appmap /pkg/appmap.gem /tmp/
|
23
|
-
RUN gem install /tmp/appmap.gem && \
|
24
|
-
bundle update --local appmap && \
|
25
|
-
bundle binstubs appmap --force
|
26
|
-
|
27
|
-
EXPOSE 3000
|
28
|
-
|
29
|
-
HEALTHCHECK --interval=1s --retries=10 CMD curl --fail http://localhost:3000/health || exit 1
|
@@ -1,18 +0,0 @@
|
|
1
|
-
default: &default
|
2
|
-
host: <%= ENV['PGHOST'] || 'pg' %>
|
3
|
-
port: <%= ENV['PGPORT'] || 5432 %>
|
4
|
-
user: postgres
|
5
|
-
adapter: postgresql
|
6
|
-
encoding: unicode
|
7
|
-
# For details on connection pooling, see Rails configuration guide
|
8
|
-
# http://guides.rubyonrails.org/configuring.html#database-pooling
|
9
|
-
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
|
10
|
-
|
11
|
-
development:
|
12
|
-
<<: *default
|
13
|
-
database: app_development
|
14
|
-
test:
|
15
|
-
<<: *default
|
16
|
-
database: app_test
|
17
|
-
production:
|
18
|
-
<<: *default
|
@@ -1,33 +0,0 @@
|
|
1
|
-
#!/usr/bin/env bash
|
2
|
-
set -ex
|
3
|
-
|
4
|
-
# Just checking for a healthy container isn't enough, apparently. If
|
5
|
-
# we don't wait here, sometimes the database is inaccessible.
|
6
|
-
for i in {1..10}; do
|
7
|
-
psql -h pg -U postgres postgres -c 'select 1' >/dev/null 2>&1 && break
|
8
|
-
printf ' .'
|
9
|
-
sleep 1
|
10
|
-
done
|
11
|
-
echo
|
12
|
-
out="$(psql -h pg -U postgres postgres -c 'select 1' 2>&1)"
|
13
|
-
if [[ $? != 0 ]]; then
|
14
|
-
echo "Postgres didn't start in time:"
|
15
|
-
echo "$out"
|
16
|
-
exit 1
|
17
|
-
fi
|
18
|
-
|
19
|
-
# Required for migrations
|
20
|
-
export ORM_MODULE=sequel
|
21
|
-
|
22
|
-
set +e
|
23
|
-
psql -h pg -U postgres -c "drop database if exists app_development"
|
24
|
-
psql -h pg -U postgres -c "drop database if exists app_test"
|
25
|
-
set -e
|
26
|
-
|
27
|
-
psql -h pg -U postgres -c "create database app_development"
|
28
|
-
psql -h pg -U postgres -c "create database app_test"
|
29
|
-
|
30
|
-
env RAILS_ENV=development bundle exec rake -t db:migrate
|
31
|
-
env RAILS_ENV=test bundle exec rake -t db:migrate
|
32
|
-
|
33
|
-
echo "INSERT INTO users ( login ) VALUES ( 'admin' ) " | psql -h pg -U postgres app_development
|
@@ -1,31 +0,0 @@
|
|
1
|
-
version: "3"
|
2
|
-
services:
|
3
|
-
pg:
|
4
|
-
build:
|
5
|
-
context: .
|
6
|
-
dockerfile: Dockerfile.pg
|
7
|
-
ports:
|
8
|
-
- "5432"
|
9
|
-
environment:
|
10
|
-
POSTGRES_HOST_AUTH_METHOD: trust
|
11
|
-
|
12
|
-
app:
|
13
|
-
build:
|
14
|
-
context: .
|
15
|
-
dockerfile: Dockerfile
|
16
|
-
image: rails5-app:${RUBY_VERSION}
|
17
|
-
command:
|
18
|
-
[ "./bin/rails", "server", "-b", "0.0.0.0", "webrick" ]
|
19
|
-
environment:
|
20
|
-
RAILS_ENV:
|
21
|
-
ORM_MODULE:
|
22
|
-
PGHOST: pg
|
23
|
-
PGPORT: '5432'
|
24
|
-
DATABASE_URL: postgres://postgres@pg
|
25
|
-
APPMAP:
|
26
|
-
volumes:
|
27
|
-
- .:/src/app
|
28
|
-
ports:
|
29
|
-
- "3000"
|
30
|
-
links:
|
31
|
-
- pg:pg
|
@@ -1 +0,0 @@
|
|
1
|
-
2.6.2
|
@@ -1,44 +0,0 @@
|
|
1
|
-
ARG GEM_VERSION
|
2
|
-
ARG RUBY_VERSION
|
3
|
-
|
4
|
-
FROM appmap:${GEM_VERSION} as appmap
|
5
|
-
FROM ruby:${RUBY_VERSION}
|
6
|
-
|
7
|
-
SHELL ["/bin/bash", "-c"]
|
8
|
-
|
9
|
-
RUN apt-get update && apt-get install -y vim less
|
10
|
-
RUN apt-get install -y postgresql-client
|
11
|
-
|
12
|
-
RUN curl -fsSL https://fnm.vercel.app/install | bash \
|
13
|
-
&& source /root/.bashrc \
|
14
|
-
&& fnm install --lts \
|
15
|
-
&& echo 'fnm default $(fnm current)' >> ~/.bashrc \
|
16
|
-
&& ln -s $(which node) /usr/local/bin/ \
|
17
|
-
&& ln -s $(which npx) /usr/local/bin/ \
|
18
|
-
&& npm install -g yarn \
|
19
|
-
&& ln -s $(which yarn) /usr/local/bin/
|
20
|
-
|
21
|
-
RUN mkdir /app
|
22
|
-
WORKDIR /app
|
23
|
-
|
24
|
-
RUN gem install -N bundler
|
25
|
-
|
26
|
-
COPY package.json .
|
27
|
-
|
28
|
-
RUN yarn install
|
29
|
-
|
30
|
-
COPY Gemfile .
|
31
|
-
|
32
|
-
RUN bundle
|
33
|
-
RUN bundle binstubs bundler rspec-core --force
|
34
|
-
|
35
|
-
COPY . .
|
36
|
-
|
37
|
-
COPY --from=appmap /pkg/appmap.gem /tmp/
|
38
|
-
RUN gem install /tmp/appmap.gem && \
|
39
|
-
bundle update --local appmap && \
|
40
|
-
bundle binstubs appmap --force
|
41
|
-
|
42
|
-
EXPOSE 3000
|
43
|
-
|
44
|
-
HEALTHCHECK --interval=1s --retries=10 CMD curl --fail http://localhost:3000/health || exit 1
|
@@ -1,18 +0,0 @@
|
|
1
|
-
default: &default
|
2
|
-
host: <%= ENV['PGHOST'] || 'pg' %>
|
3
|
-
port: <%= ENV['PGPORT'] || 5432 %>
|
4
|
-
user: postgres
|
5
|
-
adapter: postgresql
|
6
|
-
encoding: unicode
|
7
|
-
# For details on connection pooling, see Rails configuration guide
|
8
|
-
# http://guides.rubyonrails.org/configuring.html#database-pooling
|
9
|
-
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
|
10
|
-
|
11
|
-
development:
|
12
|
-
<<: *default
|
13
|
-
database: app_development
|
14
|
-
test:
|
15
|
-
<<: *default
|
16
|
-
database: app_test
|
17
|
-
production:
|
18
|
-
<<: *default
|
@@ -1,33 +0,0 @@
|
|
1
|
-
#!/usr/bin/env bash
|
2
|
-
set -ex
|
3
|
-
|
4
|
-
# Just checking for a healthy container isn't enough, apparently. If
|
5
|
-
# we don't wait here, sometimes the database is inaccessible.
|
6
|
-
for i in {1..10}; do
|
7
|
-
psql -h pg -U postgres postgres -c 'select 1' >/dev/null 2>&1 && break
|
8
|
-
printf ' .'
|
9
|
-
sleep 1
|
10
|
-
done
|
11
|
-
echo
|
12
|
-
out="$(psql -h pg -U postgres postgres -c 'select 1' 2>&1)"
|
13
|
-
if [[ $? != 0 ]]; then
|
14
|
-
echo "Postgres didn't start in time:"
|
15
|
-
echo "$out"
|
16
|
-
exit 1
|
17
|
-
fi
|
18
|
-
|
19
|
-
# Required for migrations
|
20
|
-
export ORM_MODULE=sequel
|
21
|
-
|
22
|
-
set +e
|
23
|
-
psql -h pg -U postgres -c "drop database if exists app_development"
|
24
|
-
psql -h pg -U postgres -c "drop database if exists app_test"
|
25
|
-
set -e
|
26
|
-
|
27
|
-
psql -h pg -U postgres -c "create database app_development"
|
28
|
-
psql -h pg -U postgres -c "create database app_test"
|
29
|
-
|
30
|
-
env RAILS_ENV=development bundle exec rake -t db:migrate
|
31
|
-
env RAILS_ENV=test bundle exec rake -t db:migrate
|
32
|
-
|
33
|
-
echo "INSERT INTO users ( login ) VALUES ( 'admin' ) " | psql -h pg -U postgres app_development
|
@@ -1,31 +0,0 @@
|
|
1
|
-
version: "3"
|
2
|
-
services:
|
3
|
-
pg:
|
4
|
-
build:
|
5
|
-
context: .
|
6
|
-
dockerfile: Dockerfile.pg
|
7
|
-
ports:
|
8
|
-
- "5432"
|
9
|
-
environment:
|
10
|
-
POSTGRES_HOST_AUTH_METHOD: trust
|
11
|
-
|
12
|
-
app:
|
13
|
-
build:
|
14
|
-
context: .
|
15
|
-
dockerfile: Dockerfile
|
16
|
-
image: rails6-app:${RUBY_VERSION}
|
17
|
-
command:
|
18
|
-
[ "./bin/rails", "server", "-b", "0.0.0.0", "-u", "webrick" ]
|
19
|
-
environment:
|
20
|
-
RAILS_ENV:
|
21
|
-
ORM_MODULE:
|
22
|
-
PGHOST: pg
|
23
|
-
PGPORT: '5432'
|
24
|
-
DATABASE_URL: postgres://postgres@pg
|
25
|
-
APPMAP:
|
26
|
-
volumes:
|
27
|
-
- .:/src/app
|
28
|
-
ports:
|
29
|
-
- "3000"
|
30
|
-
links:
|
31
|
-
- pg:pg
|
@@ -1 +0,0 @@
|
|
1
|
-
ruby-3.1.0
|
@@ -1,30 +0,0 @@
|
|
1
|
-
ARG GEM_VERSION
|
2
|
-
ARG RUBY_VERSION
|
3
|
-
|
4
|
-
FROM appmap:${GEM_VERSION} as appmap
|
5
|
-
FROM ruby:${RUBY_VERSION}
|
6
|
-
|
7
|
-
SHELL ["/bin/bash", "-c"]
|
8
|
-
|
9
|
-
RUN apt-get update && apt-get install -y vim less
|
10
|
-
RUN apt-get install -y postgresql-client
|
11
|
-
|
12
|
-
RUN mkdir /app
|
13
|
-
WORKDIR /app
|
14
|
-
|
15
|
-
RUN gem install -N bundler
|
16
|
-
|
17
|
-
COPY Gemfile .
|
18
|
-
|
19
|
-
RUN bundle
|
20
|
-
|
21
|
-
COPY . .
|
22
|
-
|
23
|
-
COPY --from=appmap /pkg/appmap.gem /tmp/
|
24
|
-
RUN gem install /tmp/appmap.gem && \
|
25
|
-
bundle update --local appmap && \
|
26
|
-
bundle binstubs appmap --force
|
27
|
-
|
28
|
-
EXPOSE 3000
|
29
|
-
|
30
|
-
HEALTHCHECK --interval=1s --retries=10 CMD curl --fail http://localhost:3000/health || exit 1
|
@@ -1,86 +0,0 @@
|
|
1
|
-
# PostgreSQL. Versions 9.3 and up are supported.
|
2
|
-
#
|
3
|
-
# Install the pg driver:
|
4
|
-
# gem install pg
|
5
|
-
# On macOS with Homebrew:
|
6
|
-
# gem install pg -- --with-pg-config=/usr/local/bin/pg_config
|
7
|
-
# On macOS with MacPorts:
|
8
|
-
# gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config
|
9
|
-
# On Windows:
|
10
|
-
# gem install pg
|
11
|
-
# Choose the win32 build.
|
12
|
-
# Install PostgreSQL and put its /bin directory on your path.
|
13
|
-
#
|
14
|
-
# Configure Using Gemfile
|
15
|
-
# gem "pg"
|
16
|
-
#
|
17
|
-
default: &default
|
18
|
-
adapter: postgresql
|
19
|
-
encoding: unicode
|
20
|
-
# For details on connection pooling, see Rails configuration guide
|
21
|
-
# https://guides.rubyonrails.org/configuring.html#database-pooling
|
22
|
-
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
|
23
|
-
|
24
|
-
development:
|
25
|
-
<<: *default
|
26
|
-
database: app_development
|
27
|
-
|
28
|
-
# The specified database role being used to connect to postgres.
|
29
|
-
# To create additional roles in postgres see `$ createuser --help`.
|
30
|
-
# When left blank, postgres will use the default role. This is
|
31
|
-
# the same name as the operating system user running Rails.
|
32
|
-
#username: app
|
33
|
-
|
34
|
-
# The password associated with the postgres role (username).
|
35
|
-
#password:
|
36
|
-
|
37
|
-
# Connect on a TCP socket. Omitted by default since the client uses a
|
38
|
-
# domain socket that doesn't need configuration. Windows does not have
|
39
|
-
# domain sockets, so uncomment these lines.
|
40
|
-
#host: localhost
|
41
|
-
|
42
|
-
# The TCP port the server listens on. Defaults to 5432.
|
43
|
-
# If your server runs on a different port number, change accordingly.
|
44
|
-
#port: 5432
|
45
|
-
|
46
|
-
# Schema search path. The server defaults to $user,public
|
47
|
-
#schema_search_path: myapp,sharedapp,public
|
48
|
-
|
49
|
-
# Minimum log levels, in increasing order:
|
50
|
-
# debug5, debug4, debug3, debug2, debug1,
|
51
|
-
# log, notice, warning, error, fatal, and panic
|
52
|
-
# Defaults to warning.
|
53
|
-
#min_messages: notice
|
54
|
-
|
55
|
-
# Warning: The database defined as "test" will be erased and
|
56
|
-
# re-generated from your development database when you run "rake".
|
57
|
-
# Do not set this db to the same as development or production.
|
58
|
-
test:
|
59
|
-
<<: *default
|
60
|
-
database: app_test
|
61
|
-
|
62
|
-
# As with config/credentials.yml, you never want to store sensitive information,
|
63
|
-
# like your database password, in your source code. If your source code is
|
64
|
-
# ever seen by anyone, they now have access to your database.
|
65
|
-
#
|
66
|
-
# Instead, provide the password or a full connection URL as an environment
|
67
|
-
# variable when you boot the app. For example:
|
68
|
-
#
|
69
|
-
# DATABASE_URL="postgres://myuser:mypass@localhost/somedatabase"
|
70
|
-
#
|
71
|
-
# If the connection URL is provided in the special DATABASE_URL environment
|
72
|
-
# variable, Rails will automatically merge its configuration values on top of
|
73
|
-
# the values provided in this file. Alternatively, you can specify a connection
|
74
|
-
# URL environment variable explicitly:
|
75
|
-
#
|
76
|
-
# production:
|
77
|
-
# url: <%= ENV["MY_APP_DATABASE_URL"] %>
|
78
|
-
#
|
79
|
-
# Read https://guides.rubyonrails.org/configuring.html#configuring-a-database
|
80
|
-
# for a full overview on how database connection configuration can be specified.
|
81
|
-
#
|
82
|
-
production:
|
83
|
-
<<: *default
|
84
|
-
database: app_production
|
85
|
-
username: app
|
86
|
-
password: <%= ENV["APP_DATABASE_PASSWORD"] %>
|
@@ -1,31 +0,0 @@
|
|
1
|
-
#!/usr/bin/env bash
|
2
|
-
set -ex
|
3
|
-
|
4
|
-
# Just checking for a healthy container isn't enough, apparently. If
|
5
|
-
# we don't wait here, sometimes the database is inaccessible.
|
6
|
-
for i in {1..10}; do
|
7
|
-
psql -h pg -U postgres postgres -c 'select 1' >/dev/null 2>&1 && break
|
8
|
-
printf ' .'
|
9
|
-
sleep 1
|
10
|
-
done
|
11
|
-
echo
|
12
|
-
out="$(psql -h pg -U postgres postgres -c 'select 1' 2>&1)"
|
13
|
-
if [[ $? != 0 ]]; then
|
14
|
-
echo "Postgres didn't start in time:"
|
15
|
-
echo "$out"
|
16
|
-
exit 1
|
17
|
-
fi
|
18
|
-
|
19
|
-
# Required for migrations
|
20
|
-
export ORM_MODULE=sequel
|
21
|
-
|
22
|
-
set +e
|
23
|
-
psql -h pg -U postgres -c "drop database if exists app_development"
|
24
|
-
psql -h pg -U postgres -c "drop database if exists app_test"
|
25
|
-
set -e
|
26
|
-
|
27
|
-
psql -h pg -U postgres -c "create database app_development"
|
28
|
-
psql -h pg -U postgres -c "create database app_test"
|
29
|
-
|
30
|
-
env RAILS_ENV=development bundle exec rake -t db:migrate
|
31
|
-
env RAILS_ENV=test bundle exec rake -t db:migrate
|