appmap 0.77.4 → 0.80.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -0
- data/.travis.yml +4 -16
- data/CHANGELOG.md +30 -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/agent.rb +8 -0
- data/lib/appmap/builtin_hooks/ruby.yml +6 -3
- data/lib/appmap/event.rb +19 -12
- data/lib/appmap/gem_hooks/actionpack.yml +6 -0
- data/lib/appmap/handler/eval.rb +41 -0
- data/lib/appmap/handler/rails/render_handler.rb +29 -0
- data/lib/appmap/handler/rails/request_handler.rb +13 -11
- data/lib/appmap/handler/rails/sql_handler.rb +43 -1
- data/lib/appmap/handler.rb +3 -0
- data/lib/appmap/hook/method.rb +0 -1
- 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 +6 -1
- data/spec/rails_recording_spec.rb +7 -21
- 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
- data/test/expectations/openssl_test_key_sign2-3.1.json +2 -1
- metadata +24 -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
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.80.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-04-
|
11
|
+
date: 2022-04-08 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,8 +391,10 @@ 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
|
397
|
+
- lib/appmap/handler/rails/render_handler.rb
|
381
398
|
- lib/appmap/handler/rails/request_handler.rb
|
382
399
|
- lib/appmap/handler/rails/sql_handler.rb
|
383
400
|
- lib/appmap/handler/rails/template.rb
|
@@ -420,6 +437,7 @@ files:
|
|
420
437
|
- spec/fixtures/config/invalid_yaml_config.yml
|
421
438
|
- spec/fixtures/config/missing_path_or_gem.yml
|
422
439
|
- spec/fixtures/config/valid_config.yml
|
440
|
+
- spec/fixtures/database.yml
|
423
441
|
- spec/fixtures/depends/.gitignore
|
424
442
|
- spec/fixtures/depends/app/controllers/api/api_keys_controller.rb
|
425
443
|
- spec/fixtures/depends/app/controllers/organizations_controller.rb
|
@@ -462,18 +480,14 @@ files:
|
|
462
480
|
- spec/fixtures/hook/user_page_scenario.appmap.json
|
463
481
|
- spec/fixtures/rack_users_app/.dockerignore
|
464
482
|
- spec/fixtures/rack_users_app/.gitignore
|
465
|
-
- spec/fixtures/rack_users_app/Dockerfile
|
466
483
|
- spec/fixtures/rack_users_app/Gemfile
|
467
484
|
- spec/fixtures/rack_users_app/appmap.yml
|
468
485
|
- spec/fixtures/rack_users_app/config.ru
|
469
|
-
- spec/fixtures/rack_users_app/docker-compose.yml
|
470
486
|
- spec/fixtures/rack_users_app/lib/app.rb
|
471
487
|
- spec/fixtures/rails5_users_app/.dockerignore
|
472
488
|
- spec/fixtures/rails5_users_app/.gitignore
|
473
489
|
- spec/fixtures/rails5_users_app/.rspec
|
474
490
|
- spec/fixtures/rails5_users_app/.ruby-version
|
475
|
-
- spec/fixtures/rails5_users_app/Dockerfile
|
476
|
-
- spec/fixtures/rails5_users_app/Dockerfile.pg
|
477
491
|
- spec/fixtures/rails5_users_app/Gemfile
|
478
492
|
- spec/fixtures/rails5_users_app/Rakefile
|
479
493
|
- spec/fixtures/rails5_users_app/app/controllers/api/users_controller.rb
|
@@ -522,10 +536,8 @@ files:
|
|
522
536
|
- spec/fixtures/rails5_users_app/config/initializers/wrap_parameters.rb
|
523
537
|
- spec/fixtures/rails5_users_app/config/locales/en.yml
|
524
538
|
- spec/fixtures/rails5_users_app/config/routes.rb
|
525
|
-
- spec/fixtures/rails5_users_app/create_app
|
526
539
|
- spec/fixtures/rails5_users_app/db/migrate/20190728211408_create_users.rb
|
527
540
|
- spec/fixtures/rails5_users_app/db/schema.rb
|
528
|
-
- spec/fixtures/rails5_users_app/docker-compose.yml
|
529
541
|
- spec/fixtures/rails5_users_app/features/api_users.feature
|
530
542
|
- spec/fixtures/rails5_users_app/features/support/env.rb
|
531
543
|
- spec/fixtures/rails5_users_app/features/support/hooks.rb
|
@@ -542,9 +554,6 @@ files:
|
|
542
554
|
- spec/fixtures/rails6_users_app/.dockerignore
|
543
555
|
- spec/fixtures/rails6_users_app/.gitignore
|
544
556
|
- spec/fixtures/rails6_users_app/.rspec
|
545
|
-
- spec/fixtures/rails6_users_app/.ruby-version
|
546
|
-
- spec/fixtures/rails6_users_app/Dockerfile
|
547
|
-
- spec/fixtures/rails6_users_app/Dockerfile.pg
|
548
557
|
- spec/fixtures/rails6_users_app/Gemfile
|
549
558
|
- spec/fixtures/rails6_users_app/Rakefile
|
550
559
|
- spec/fixtures/rails6_users_app/app/controllers/api/users_controller.rb
|
@@ -593,10 +602,8 @@ files:
|
|
593
602
|
- spec/fixtures/rails6_users_app/config/initializers/wrap_parameters.rb
|
594
603
|
- spec/fixtures/rails6_users_app/config/locales/en.yml
|
595
604
|
- spec/fixtures/rails6_users_app/config/routes.rb
|
596
|
-
- spec/fixtures/rails6_users_app/create_app
|
597
605
|
- spec/fixtures/rails6_users_app/db/migrate/20190728211408_create_users.rb
|
598
606
|
- spec/fixtures/rails6_users_app/db/schema.rb
|
599
|
-
- spec/fixtures/rails6_users_app/docker-compose.yml
|
600
607
|
- spec/fixtures/rails6_users_app/features/api_users.feature
|
601
608
|
- spec/fixtures/rails6_users_app/features/support/env.rb
|
602
609
|
- spec/fixtures/rails6_users_app/features/support/hooks.rb
|
@@ -619,9 +626,6 @@ files:
|
|
619
626
|
- spec/fixtures/rails7_users_app/.gitattributes
|
620
627
|
- spec/fixtures/rails7_users_app/.gitignore
|
621
628
|
- spec/fixtures/rails7_users_app/.rspec
|
622
|
-
- spec/fixtures/rails7_users_app/.ruby-version
|
623
|
-
- spec/fixtures/rails7_users_app/Dockerfile
|
624
|
-
- spec/fixtures/rails7_users_app/Dockerfile.pg
|
625
629
|
- spec/fixtures/rails7_users_app/Gemfile
|
626
630
|
- spec/fixtures/rails7_users_app/README.md
|
627
631
|
- spec/fixtures/rails7_users_app/Rakefile
|
@@ -672,12 +676,10 @@ files:
|
|
672
676
|
- spec/fixtures/rails7_users_app/config/puma.rb
|
673
677
|
- spec/fixtures/rails7_users_app/config/routes.rb
|
674
678
|
- spec/fixtures/rails7_users_app/config/storage.yml
|
675
|
-
- spec/fixtures/rails7_users_app/create_app
|
676
679
|
- spec/fixtures/rails7_users_app/db/migrate/20220328093141_create_instances.rb
|
677
680
|
- spec/fixtures/rails7_users_app/db/migrate/20220328093154_create_instructors.rb
|
678
681
|
- spec/fixtures/rails7_users_app/db/schema.rb
|
679
682
|
- spec/fixtures/rails7_users_app/db/seeds.rb
|
680
|
-
- spec/fixtures/rails7_users_app/docker-compose.yml
|
681
683
|
- spec/fixtures/rails7_users_app/lib/assets/.keep
|
682
684
|
- spec/fixtures/rails7_users_app/lib/tasks/.keep
|
683
685
|
- spec/fixtures/rails7_users_app/log/.keep
|
@@ -703,6 +705,7 @@ files:
|
|
703
705
|
- spec/fixtures/rails7_users_app/test/models/instructor_test.rb
|
704
706
|
- spec/fixtures/rails7_users_app/test/system/.keep
|
705
707
|
- spec/fixtures/rails7_users_app/test/test_helper.rb
|
708
|
+
- spec/handler/eval_spec.rb
|
706
709
|
- spec/hook_spec.rb
|
707
710
|
- spec/open_spec.rb
|
708
711
|
- 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
|
@@ -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: rails7-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
|