skywalking 0.0.0.alpha → 0.0.0.beta1
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 +19 -0
- data/.github/PULL_REQUEST_TEMPLATE +42 -0
- data/.github/workflows/ci.yml +70 -0
- data/.github/workflows/e2e.yml +73 -0
- data/.gitignore +80 -0
- data/.gitmodules +18 -0
- data/.licenserc.yaml +36 -0
- data/.rspec +1 -2
- data/.rubocop.yml +6 -0
- data/CHANGELOG.md +3 -0
- data/Gemfile +20 -0
- data/NOTICE +1 -1
- data/docs/README.md +7 -0
- data/docs/en/agent/plugins.md +10 -0
- data/docs/{How-to-release.md → en/development-and-contribution/how-to-release.md} +6 -5
- data/docs/en/setup/quick-start.md +106 -0
- data/docs/menu.yml +31 -0
- data/lib/rails/generators/skywalking/start_generator.rb +47 -0
- data/{examples/rails-demo/config/initializers/skywalking_ruby.rb → lib/rails/generators/skywalking/templates/skywalking_initializer.rb} +0 -2
- data/lib/skywalking/agent.rb +5 -5
- data/lib/skywalking/configuration.rb +54 -33
- data/lib/skywalking/environment.rb +103 -11
- data/lib/skywalking/log/logger.rb +1 -1
- data/lib/skywalking/plugins/net_http.rb +73 -0
- data/lib/skywalking/plugins/redis5.rb +3 -2
- data/lib/skywalking/plugins/sinatra.rb +2 -2
- data/lib/skywalking/reporter/buffer_trigger.rb +1 -1
- data/lib/skywalking/reporter/client/grpc_client.rb +2 -2
- data/lib/skywalking/reporter/report.rb +1 -1
- data/lib/skywalking/tracing/carrier.rb +9 -8
- data/lib/skywalking/tracing/constants.rb +11 -18
- data/lib/skywalking/tracing/exit_span.rb +1 -1
- data/lib/skywalking/tracing/noop_span.rb +1 -1
- data/lib/skywalking/tracing/span.rb +1 -1
- data/lib/skywalking/tracing/span_context.rb +4 -4
- data/lib/skywalking/tracing/tag.rb +36 -1
- data/lib/skywalking/version.rb +1 -1
- data/skywalking.gemspec +61 -0
- data/spec/fixtures/agent.yaml +33 -0
- data/spec/scenarios/common/Dockerfile.agent +26 -0
- data/spec/scenarios/common/base-compose.yml +46 -0
- data/spec/scenarios/common/common_spec_helper.rb +40 -0
- data/spec/scenarios/common/compose_context.rb +39 -0
- data/spec/scenarios/common/validator.rb +41 -0
- data/spec/scenarios/net_http/docker-compose.yml +49 -0
- data/spec/scenarios/net_http/expected.yml +39 -0
- data/spec/scenarios/net_http/net_http.rb +33 -0
- data/spec/scenarios/net_http/net_http_spec.rb +43 -0
- data/spec/scenarios/redis/docker-compose.yml +67 -0
- data/spec/scenarios/redis/expected.yml +66 -0
- data/{examples/sinatra-demo/sinatra-demo.rb → spec/scenarios/redis/redis.rb} +8 -10
- data/spec/scenarios/redis/redis_spec.rb +29 -0
- data/spec/scenarios/sinatra/docker-compose.yml +54 -0
- data/spec/scenarios/sinatra/expected.yml +38 -0
- data/spec/scenarios/sinatra/sinatra.rb +26 -0
- data/spec/scenarios/sinatra/sinatra_spec.rb +29 -0
- data/spec/skywalking/config_spec.rb +41 -0
- data/spec/skywalking/utils/id_gen_spec.rb +26 -0
- data/spec/spec_helper.rb +115 -0
- metadata +134 -143
- data/examples/rails-demo/.dockerignore +0 -47
- data/examples/rails-demo/.gitattributes +0 -9
- data/examples/rails-demo/.gitignore +0 -34
- data/examples/rails-demo/.kamal/hooks/docker-setup.sample +0 -3
- data/examples/rails-demo/.kamal/hooks/post-deploy.sample +0 -14
- data/examples/rails-demo/.kamal/hooks/post-proxy-reboot.sample +0 -3
- data/examples/rails-demo/.kamal/hooks/pre-build.sample +0 -51
- data/examples/rails-demo/.kamal/hooks/pre-connect.sample +0 -47
- data/examples/rails-demo/.kamal/hooks/pre-deploy.sample +0 -109
- data/examples/rails-demo/.kamal/hooks/pre-proxy-reboot.sample +0 -3
- data/examples/rails-demo/.kamal/secrets +0 -17
- data/examples/rails-demo/.rubocop.yml +0 -8
- data/examples/rails-demo/.ruby-version +0 -1
- data/examples/rails-demo/Dockerfile +0 -72
- data/examples/rails-demo/Gemfile +0 -64
- data/examples/rails-demo/README.md +0 -24
- data/examples/rails-demo/Rakefile +0 -6
- data/examples/rails-demo/app/assets/images/.keep +0 -0
- data/examples/rails-demo/app/assets/stylesheets/application.css +0 -10
- data/examples/rails-demo/app/controllers/application_controller.rb +0 -4
- data/examples/rails-demo/app/controllers/concerns/.keep +0 -0
- data/examples/rails-demo/app/helpers/application_helper.rb +0 -2
- data/examples/rails-demo/app/javascript/application.js +0 -3
- data/examples/rails-demo/app/javascript/controllers/application.js +0 -9
- data/examples/rails-demo/app/javascript/controllers/hello_controller.js +0 -7
- data/examples/rails-demo/app/javascript/controllers/index.js +0 -4
- data/examples/rails-demo/app/jobs/application_job.rb +0 -7
- data/examples/rails-demo/app/mailers/application_mailer.rb +0 -4
- data/examples/rails-demo/app/models/application_record.rb +0 -3
- data/examples/rails-demo/app/models/concerns/.keep +0 -0
- data/examples/rails-demo/app/views/layouts/application.html.erb +0 -28
- data/examples/rails-demo/app/views/layouts/mailer.html.erb +0 -13
- data/examples/rails-demo/app/views/layouts/mailer.text.erb +0 -1
- data/examples/rails-demo/app/views/pwa/manifest.json.erb +0 -22
- data/examples/rails-demo/app/views/pwa/service-worker.js +0 -26
- data/examples/rails-demo/bin/brakeman +0 -7
- data/examples/rails-demo/bin/bundle +0 -109
- data/examples/rails-demo/bin/dev +0 -2
- data/examples/rails-demo/bin/docker-entrypoint +0 -14
- data/examples/rails-demo/bin/importmap +0 -4
- data/examples/rails-demo/bin/jobs +0 -6
- data/examples/rails-demo/bin/kamal +0 -27
- data/examples/rails-demo/bin/rails +0 -4
- data/examples/rails-demo/bin/rake +0 -4
- data/examples/rails-demo/bin/rubocop +0 -8
- data/examples/rails-demo/bin/setup +0 -34
- data/examples/rails-demo/bin/thrust +0 -5
- data/examples/rails-demo/config/application.rb +0 -27
- data/examples/rails-demo/config/boot.rb +0 -4
- data/examples/rails-demo/config/cable.yml +0 -17
- data/examples/rails-demo/config/cache.yml +0 -16
- data/examples/rails-demo/config/credentials.yml.enc +0 -1
- data/examples/rails-demo/config/database.yml +0 -41
- data/examples/rails-demo/config/deploy.yml +0 -116
- data/examples/rails-demo/config/environment.rb +0 -5
- data/examples/rails-demo/config/environments/development.rb +0 -72
- data/examples/rails-demo/config/environments/production.rb +0 -90
- data/examples/rails-demo/config/environments/test.rb +0 -53
- data/examples/rails-demo/config/importmap.rb +0 -7
- data/examples/rails-demo/config/initializers/assets.rb +0 -7
- data/examples/rails-demo/config/initializers/content_security_policy.rb +0 -25
- data/examples/rails-demo/config/initializers/filter_parameter_logging.rb +0 -8
- data/examples/rails-demo/config/initializers/inflections.rb +0 -16
- data/examples/rails-demo/config/locales/en.yml +0 -31
- data/examples/rails-demo/config/puma.rb +0 -41
- data/examples/rails-demo/config/queue.yml +0 -18
- data/examples/rails-demo/config/recurring.yml +0 -10
- data/examples/rails-demo/config/routes.rb +0 -14
- data/examples/rails-demo/config/storage.yml +0 -34
- data/examples/rails-demo/config.ru +0 -6
- data/examples/rails-demo/db/cable_schema.rb +0 -11
- data/examples/rails-demo/db/cache_schema.rb +0 -14
- data/examples/rails-demo/db/queue_schema.rb +0 -129
- data/examples/rails-demo/db/seeds.rb +0 -9
- data/examples/rails-demo/lib/tasks/.keep +0 -0
- data/examples/rails-demo/log/.keep +0 -0
- data/examples/rails-demo/public/400.html +0 -114
- data/examples/rails-demo/public/404.html +0 -114
- data/examples/rails-demo/public/406-unsupported-browser.html +0 -114
- data/examples/rails-demo/public/422.html +0 -114
- data/examples/rails-demo/public/500.html +0 -114
- data/examples/rails-demo/public/icon.png +0 -0
- data/examples/rails-demo/public/icon.svg +0 -3
- data/examples/rails-demo/public/robots.txt +0 -1
- data/examples/rails-demo/script/.keep +0 -0
- data/examples/rails-demo/storage/.keep +0 -0
- data/examples/rails-demo/test/application_system_test_case.rb +0 -5
- data/examples/rails-demo/test/controllers/.keep +0 -0
- data/examples/rails-demo/test/fixtures/files/.keep +0 -0
- data/examples/rails-demo/test/helpers/.keep +0 -0
- data/examples/rails-demo/test/integration/.keep +0 -0
- data/examples/rails-demo/test/mailers/.keep +0 -0
- data/examples/rails-demo/test/models/.keep +0 -0
- data/examples/rails-demo/test/system/.keep +0 -0
- data/examples/rails-demo/test/test_helper.rb +0 -15
- data/examples/rails-demo/tmp/.keep +0 -0
- data/examples/rails-demo/tmp/pids/.keep +0 -0
- data/examples/rails-demo/tmp/storage/.keep +0 -0
- data/examples/rails-demo/vendor/.keep +0 -0
- data/examples/rails-demo/vendor/javascript/.keep +0 -0
@@ -1,109 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
# A sample pre-deploy hook
|
4
|
-
#
|
5
|
-
# Checks the Github status of the build, waiting for a pending build to complete for up to 720 seconds.
|
6
|
-
#
|
7
|
-
# Fails unless the combined status is "success"
|
8
|
-
#
|
9
|
-
# These environment variables are available:
|
10
|
-
# KAMAL_RECORDED_AT
|
11
|
-
# KAMAL_PERFORMER
|
12
|
-
# KAMAL_VERSION
|
13
|
-
# KAMAL_HOSTS
|
14
|
-
# KAMAL_COMMAND
|
15
|
-
# KAMAL_SUBCOMMAND
|
16
|
-
# KAMAL_ROLE (if set)
|
17
|
-
# KAMAL_DESTINATION (if set)
|
18
|
-
|
19
|
-
# Only check the build status for production deployments
|
20
|
-
if ENV["KAMAL_COMMAND"] == "rollback" || ENV["KAMAL_DESTINATION"] != "production"
|
21
|
-
exit 0
|
22
|
-
end
|
23
|
-
|
24
|
-
require "bundler/inline"
|
25
|
-
|
26
|
-
# true = install gems so this is fast on repeat invocations
|
27
|
-
gemfile(true, quiet: true) do
|
28
|
-
source "https://rubygems.org"
|
29
|
-
|
30
|
-
gem "octokit"
|
31
|
-
gem "faraday-retry"
|
32
|
-
end
|
33
|
-
|
34
|
-
MAX_ATTEMPTS = 72
|
35
|
-
ATTEMPTS_GAP = 10
|
36
|
-
|
37
|
-
def exit_with_error(message)
|
38
|
-
$stderr.puts message
|
39
|
-
exit 1
|
40
|
-
end
|
41
|
-
|
42
|
-
class GithubStatusChecks
|
43
|
-
attr_reader :remote_url, :git_sha, :github_client, :combined_status
|
44
|
-
|
45
|
-
def initialize
|
46
|
-
@remote_url = `git config --get remote.origin.url`.strip.delete_prefix("https://github.com/")
|
47
|
-
@git_sha = `git rev-parse HEAD`.strip
|
48
|
-
@github_client = Octokit::Client.new(access_token: ENV["GITHUB_TOKEN"])
|
49
|
-
refresh!
|
50
|
-
end
|
51
|
-
|
52
|
-
def refresh!
|
53
|
-
@combined_status = github_client.combined_status(remote_url, git_sha)
|
54
|
-
end
|
55
|
-
|
56
|
-
def state
|
57
|
-
combined_status[:state]
|
58
|
-
end
|
59
|
-
|
60
|
-
def first_status_url
|
61
|
-
first_status = combined_status[:statuses].find { |status| status[:state] == state }
|
62
|
-
first_status && first_status[:target_url]
|
63
|
-
end
|
64
|
-
|
65
|
-
def complete_count
|
66
|
-
combined_status[:statuses].count { |status| status[:state] != "pending"}
|
67
|
-
end
|
68
|
-
|
69
|
-
def total_count
|
70
|
-
combined_status[:statuses].count
|
71
|
-
end
|
72
|
-
|
73
|
-
def current_status
|
74
|
-
if total_count > 0
|
75
|
-
"Completed #{complete_count}/#{total_count} checks, see #{first_status_url} ..."
|
76
|
-
else
|
77
|
-
"Build not started..."
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
|
83
|
-
$stdout.sync = true
|
84
|
-
|
85
|
-
puts "Checking build status..."
|
86
|
-
attempts = 0
|
87
|
-
checks = GithubStatusChecks.new
|
88
|
-
|
89
|
-
begin
|
90
|
-
loop do
|
91
|
-
case checks.state
|
92
|
-
when "success"
|
93
|
-
puts "Checks passed, see #{checks.first_status_url}"
|
94
|
-
exit 0
|
95
|
-
when "failure"
|
96
|
-
exit_with_error "Checks failed, see #{checks.first_status_url}"
|
97
|
-
when "pending"
|
98
|
-
attempts += 1
|
99
|
-
end
|
100
|
-
|
101
|
-
exit_with_error "Checks are still pending, gave up after #{MAX_ATTEMPTS * ATTEMPTS_GAP} seconds" if attempts == MAX_ATTEMPTS
|
102
|
-
|
103
|
-
puts checks.current_status
|
104
|
-
sleep(ATTEMPTS_GAP)
|
105
|
-
checks.refresh!
|
106
|
-
end
|
107
|
-
rescue Octokit::NotFound
|
108
|
-
exit_with_error "Build status could not be found"
|
109
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
# Secrets defined here are available for reference under registry/password, env/secret, builder/secrets,
|
2
|
-
# and accessories/*/env/secret in config/deploy.yml. All secrets should be pulled from either
|
3
|
-
# password manager, ENV, or a file. DO NOT ENTER RAW CREDENTIALS HERE! This file needs to be safe for git.
|
4
|
-
|
5
|
-
# Example of extracting secrets from 1password (or another compatible pw manager)
|
6
|
-
# SECRETS=$(kamal secrets fetch --adapter 1password --account your-account --from Vault/Item KAMAL_REGISTRY_PASSWORD RAILS_MASTER_KEY)
|
7
|
-
# KAMAL_REGISTRY_PASSWORD=$(kamal secrets extract KAMAL_REGISTRY_PASSWORD ${SECRETS})
|
8
|
-
# RAILS_MASTER_KEY=$(kamal secrets extract RAILS_MASTER_KEY ${SECRETS})
|
9
|
-
|
10
|
-
# Use a GITHUB_TOKEN if private repositories are needed for the image
|
11
|
-
# GITHUB_TOKEN=$(gh config get -h github.com oauth_token)
|
12
|
-
|
13
|
-
# Grab the registry password from ENV
|
14
|
-
KAMAL_REGISTRY_PASSWORD=$KAMAL_REGISTRY_PASSWORD
|
15
|
-
|
16
|
-
# Improve security by using a password manager. Never check config/master.key into git!
|
17
|
-
RAILS_MASTER_KEY=$(cat config/master.key)
|
@@ -1 +0,0 @@
|
|
1
|
-
ruby-3.2.2
|
@@ -1,72 +0,0 @@
|
|
1
|
-
# syntax=docker/dockerfile:1
|
2
|
-
# check=error=true
|
3
|
-
|
4
|
-
# This Dockerfile is designed for production, not development. Use with Kamal or build'n'run by hand:
|
5
|
-
# docker build -t app_demo .
|
6
|
-
# docker run -d -p 80:80 -e RAILS_MASTER_KEY=<value from config/master.key> --name app_demo app_demo
|
7
|
-
|
8
|
-
# For a containerized dev environment, see Dev Containers: https://guides.rubyonrails.org/getting_started_with_devcontainer.html
|
9
|
-
|
10
|
-
# Make sure RUBY_VERSION matches the Ruby version in .ruby-version
|
11
|
-
ARG RUBY_VERSION=3.2.2
|
12
|
-
FROM docker.io/library/ruby:$RUBY_VERSION-slim AS base
|
13
|
-
|
14
|
-
# Rails app lives here
|
15
|
-
WORKDIR /rails
|
16
|
-
|
17
|
-
# Install base packages
|
18
|
-
RUN apt-get update -qq && \
|
19
|
-
apt-get install --no-install-recommends -y curl libjemalloc2 libvips sqlite3 && \
|
20
|
-
rm -rf /var/lib/apt/lists /var/cache/apt/archives
|
21
|
-
|
22
|
-
# Set production environment
|
23
|
-
ENV RAILS_ENV="production" \
|
24
|
-
BUNDLE_DEPLOYMENT="1" \
|
25
|
-
BUNDLE_PATH="/usr/local/bundle" \
|
26
|
-
BUNDLE_WITHOUT="development"
|
27
|
-
|
28
|
-
# Throw-away build stage to reduce size of final image
|
29
|
-
FROM base AS build
|
30
|
-
|
31
|
-
# Install packages needed to build gems
|
32
|
-
RUN apt-get update -qq && \
|
33
|
-
apt-get install --no-install-recommends -y build-essential git pkg-config && \
|
34
|
-
rm -rf /var/lib/apt/lists /var/cache/apt/archives
|
35
|
-
|
36
|
-
# Install application gems
|
37
|
-
COPY Gemfile Gemfile.lock ./
|
38
|
-
RUN bundle install && \
|
39
|
-
rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git && \
|
40
|
-
bundle exec bootsnap precompile --gemfile
|
41
|
-
|
42
|
-
# Copy application code
|
43
|
-
COPY . .
|
44
|
-
|
45
|
-
# Precompile bootsnap code for faster boot times
|
46
|
-
RUN bundle exec bootsnap precompile app/ lib/
|
47
|
-
|
48
|
-
# Precompiling assets for production without requiring secret RAILS_MASTER_KEY
|
49
|
-
RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
# Final stage for app image
|
55
|
-
FROM base
|
56
|
-
|
57
|
-
# Copy built artifacts: gems, application
|
58
|
-
COPY --from=build "${BUNDLE_PATH}" "${BUNDLE_PATH}"
|
59
|
-
COPY --from=build /rails /rails
|
60
|
-
|
61
|
-
# Run and own only the runtime files as a non-root user for security
|
62
|
-
RUN groupadd --system --gid 1000 rails && \
|
63
|
-
useradd rails --uid 1000 --gid 1000 --create-home --shell /bin/bash && \
|
64
|
-
chown -R rails:rails db log storage tmp
|
65
|
-
USER 1000:1000
|
66
|
-
|
67
|
-
# Entrypoint prepares the database.
|
68
|
-
ENTRYPOINT ["/rails/bin/docker-entrypoint"]
|
69
|
-
|
70
|
-
# Start server via Thruster by default, this can be overwritten at runtime
|
71
|
-
EXPOSE 80
|
72
|
-
CMD ["./bin/thrust", "./bin/rails", "server"]
|
data/examples/rails-demo/Gemfile
DELETED
@@ -1,64 +0,0 @@
|
|
1
|
-
source "https://rubygems.org"
|
2
|
-
|
3
|
-
# Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
|
4
|
-
gem "rails", "~> 8.0.0"
|
5
|
-
# The modern asset pipeline for Rails [https://github.com/rails/propshaft]
|
6
|
-
gem "propshaft"
|
7
|
-
# Use sqlite3 as the database for Active Record
|
8
|
-
gem "sqlite3", ">= 2.1"
|
9
|
-
# Use the Puma web server [https://github.com/puma/puma]
|
10
|
-
gem "puma", ">= 5.0"
|
11
|
-
# Use JavaScript with ESM import maps [https://github.com/rails/importmap-rails]
|
12
|
-
gem "importmap-rails"
|
13
|
-
# Hotwire's SPA-like page accelerator [https://turbo.hotwired.dev]
|
14
|
-
gem "turbo-rails"
|
15
|
-
# Hotwire's modest JavaScript framework [https://stimulus.hotwired.dev]
|
16
|
-
gem "stimulus-rails"
|
17
|
-
# Build JSON APIs with ease [https://github.com/rails/jbuilder]
|
18
|
-
gem "jbuilder"
|
19
|
-
gem "async"
|
20
|
-
gem "grpc"
|
21
|
-
# Use Active Model has_secure_password [https://guides.rubyonrails.org/active_model_basics.html#securepassword]
|
22
|
-
# gem "bcrypt", "~> 3.1.7"
|
23
|
-
|
24
|
-
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
|
25
|
-
gem "tzinfo-data", platforms: %i[ windows jruby ]
|
26
|
-
|
27
|
-
# Use the database-backed adapters for Rails.cache, Active Job, and Action Cable
|
28
|
-
gem "solid_cache"
|
29
|
-
gem "solid_queue"
|
30
|
-
gem "solid_cable"
|
31
|
-
|
32
|
-
# Reduces boot times through caching; required in config/boot.rb
|
33
|
-
gem "bootsnap", require: false
|
34
|
-
|
35
|
-
# Deploy this application anywhere as a Docker container [https://kamal-deploy.org]
|
36
|
-
gem "kamal", require: false
|
37
|
-
|
38
|
-
# Add HTTP asset caching/compression and X-Sendfile acceleration to Puma [https://github.com/basecamp/thruster/]
|
39
|
-
gem "thruster", require: false
|
40
|
-
|
41
|
-
# Use Active Storage variants [https://guides.rubyonrails.org/active_storage_overview.html#transforming-images]
|
42
|
-
# gem "image_processing", "~> 1.2"
|
43
|
-
|
44
|
-
group :development, :test do
|
45
|
-
# See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
|
46
|
-
gem "debug", platforms: %i[ mri windows ], require: "debug/prelude"
|
47
|
-
|
48
|
-
# Static analysis for security vulnerabilities [https://brakemanscanner.org/]
|
49
|
-
gem "brakeman", require: false
|
50
|
-
|
51
|
-
# Omakase Ruby styling [https://github.com/rails/rubocop-rails-omakase/]
|
52
|
-
gem "rubocop-rails-omakase", require: false
|
53
|
-
end
|
54
|
-
|
55
|
-
group :development do
|
56
|
-
# Use console on exceptions pages [https://github.com/rails/web-console]
|
57
|
-
gem "web-console"
|
58
|
-
end
|
59
|
-
|
60
|
-
group :test do
|
61
|
-
# Use system testing [https://guides.rubyonrails.org/testing.html#system-testing]
|
62
|
-
gem "capybara"
|
63
|
-
gem "selenium-webdriver"
|
64
|
-
end
|
@@ -1,24 +0,0 @@
|
|
1
|
-
# README
|
2
|
-
|
3
|
-
This README would normally document whatever steps are necessary to get the
|
4
|
-
application up and running.
|
5
|
-
|
6
|
-
Things you may want to cover:
|
7
|
-
|
8
|
-
* Ruby version
|
9
|
-
|
10
|
-
* System dependencies
|
11
|
-
|
12
|
-
* Configuration
|
13
|
-
|
14
|
-
* Database creation
|
15
|
-
|
16
|
-
* Database initialization
|
17
|
-
|
18
|
-
* How to run the test suite
|
19
|
-
|
20
|
-
* Services (job queues, cache servers, search engines, etc.)
|
21
|
-
|
22
|
-
* Deployment instructions
|
23
|
-
|
24
|
-
* ...
|
File without changes
|
@@ -1,10 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* This is a manifest file that'll be compiled into application.css.
|
3
|
-
*
|
4
|
-
* With Propshaft, assets are served efficiently without preprocessing steps. You can still include
|
5
|
-
* application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
|
6
|
-
* cascading order, meaning styles declared later in the document or manifest will override earlier ones,
|
7
|
-
* depending on specificity.
|
8
|
-
*
|
9
|
-
* Consider organizing styles into separate files for maintainability.
|
10
|
-
*/
|
File without changes
|
@@ -1,4 +0,0 @@
|
|
1
|
-
// Import and register all your controllers from the importmap via controllers/**/*_controller
|
2
|
-
import { application } from "controllers/application"
|
3
|
-
import { eagerLoadControllersFrom } from "@hotwired/stimulus-loading"
|
4
|
-
eagerLoadControllersFrom("controllers", application)
|
@@ -1,7 +0,0 @@
|
|
1
|
-
class ApplicationJob < ActiveJob::Base
|
2
|
-
# Automatically retry jobs that encountered a deadlock
|
3
|
-
# retry_on ActiveRecord::Deadlocked
|
4
|
-
|
5
|
-
# Most jobs are safe to ignore if the underlying records are no longer available
|
6
|
-
# discard_on ActiveJob::DeserializationError
|
7
|
-
end
|
File without changes
|
@@ -1,28 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title><%= content_for(:title) || "App Demo" %></title>
|
5
|
-
<meta name="viewport" content="width=device-width,initial-scale=1">
|
6
|
-
<meta name="apple-mobile-web-app-capable" content="yes">
|
7
|
-
<meta name="mobile-web-app-capable" content="yes">
|
8
|
-
<%= csrf_meta_tags %>
|
9
|
-
<%= csp_meta_tag %>
|
10
|
-
|
11
|
-
<%= yield :head %>
|
12
|
-
|
13
|
-
<%# Enable PWA manifest for installable apps (make sure to enable in config/routes.rb too!) %>
|
14
|
-
<%#= tag.link rel: "manifest", href: pwa_manifest_path(format: :json) %>
|
15
|
-
|
16
|
-
<link rel="icon" href="/icon.png" type="image/png">
|
17
|
-
<link rel="icon" href="/icon.svg" type="image/svg+xml">
|
18
|
-
<link rel="apple-touch-icon" href="/icon.png">
|
19
|
-
|
20
|
-
<%# Includes all stylesheet files in app/assets/stylesheets %>
|
21
|
-
<%= stylesheet_link_tag :app, "data-turbo-track": "reload" %>
|
22
|
-
<%= javascript_importmap_tags %>
|
23
|
-
</head>
|
24
|
-
|
25
|
-
<body>
|
26
|
-
<%= yield %>
|
27
|
-
</body>
|
28
|
-
</html>
|
@@ -1 +0,0 @@
|
|
1
|
-
<%= yield %>
|
@@ -1,22 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"name": "AppDemo",
|
3
|
-
"icons": [
|
4
|
-
{
|
5
|
-
"src": "/icon.png",
|
6
|
-
"type": "image/png",
|
7
|
-
"sizes": "512x512"
|
8
|
-
},
|
9
|
-
{
|
10
|
-
"src": "/icon.png",
|
11
|
-
"type": "image/png",
|
12
|
-
"sizes": "512x512",
|
13
|
-
"purpose": "maskable"
|
14
|
-
}
|
15
|
-
],
|
16
|
-
"start_url": "/",
|
17
|
-
"display": "standalone",
|
18
|
-
"scope": "/",
|
19
|
-
"description": "AppDemo.",
|
20
|
-
"theme_color": "red",
|
21
|
-
"background_color": "red"
|
22
|
-
}
|
@@ -1,26 +0,0 @@
|
|
1
|
-
// Add a service worker for processing Web Push notifications:
|
2
|
-
//
|
3
|
-
// self.addEventListener("push", async (event) => {
|
4
|
-
// const { title, options } = await event.data.json()
|
5
|
-
// event.waitUntil(self.registration.showNotification(title, options))
|
6
|
-
// })
|
7
|
-
//
|
8
|
-
// self.addEventListener("notificationclick", function(event) {
|
9
|
-
// event.notification.close()
|
10
|
-
// event.waitUntil(
|
11
|
-
// clients.matchAll({ type: "window" }).then((clientList) => {
|
12
|
-
// for (let i = 0; i < clientList.length; i++) {
|
13
|
-
// let client = clientList[i]
|
14
|
-
// let clientPath = (new URL(client.url)).pathname
|
15
|
-
//
|
16
|
-
// if (clientPath == event.notification.data.path && "focus" in client) {
|
17
|
-
// return client.focus()
|
18
|
-
// }
|
19
|
-
// }
|
20
|
-
//
|
21
|
-
// if (clients.openWindow) {
|
22
|
-
// return clients.openWindow(event.notification.data.path)
|
23
|
-
// }
|
24
|
-
// })
|
25
|
-
// )
|
26
|
-
// })
|
@@ -1,109 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
#
|
5
|
-
# This file was generated by Bundler.
|
6
|
-
#
|
7
|
-
# The application 'bundle' is installed as part of a gem, and
|
8
|
-
# this file is here to facilitate running it.
|
9
|
-
#
|
10
|
-
|
11
|
-
require "rubygems"
|
12
|
-
|
13
|
-
m = Module.new do
|
14
|
-
module_function
|
15
|
-
|
16
|
-
def invoked_as_script?
|
17
|
-
File.expand_path($0) == File.expand_path(__FILE__)
|
18
|
-
end
|
19
|
-
|
20
|
-
def env_var_version
|
21
|
-
ENV["BUNDLER_VERSION"]
|
22
|
-
end
|
23
|
-
|
24
|
-
def cli_arg_version
|
25
|
-
return unless invoked_as_script? # don't want to hijack other binstubs
|
26
|
-
return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update`
|
27
|
-
bundler_version = nil
|
28
|
-
update_index = nil
|
29
|
-
ARGV.each_with_index do |a, i|
|
30
|
-
if update_index && update_index.succ == i && a.match?(Gem::Version::ANCHORED_VERSION_PATTERN)
|
31
|
-
bundler_version = a
|
32
|
-
end
|
33
|
-
next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/
|
34
|
-
bundler_version = $1
|
35
|
-
update_index = i
|
36
|
-
end
|
37
|
-
bundler_version
|
38
|
-
end
|
39
|
-
|
40
|
-
def gemfile
|
41
|
-
gemfile = ENV["BUNDLE_GEMFILE"]
|
42
|
-
return gemfile if gemfile && !gemfile.empty?
|
43
|
-
|
44
|
-
File.expand_path("../Gemfile", __dir__)
|
45
|
-
end
|
46
|
-
|
47
|
-
def lockfile
|
48
|
-
lockfile =
|
49
|
-
case File.basename(gemfile)
|
50
|
-
when "gems.rb" then gemfile.sub(/\.rb$/, ".locked")
|
51
|
-
else "#{gemfile}.lock"
|
52
|
-
end
|
53
|
-
File.expand_path(lockfile)
|
54
|
-
end
|
55
|
-
|
56
|
-
def lockfile_version
|
57
|
-
return unless File.file?(lockfile)
|
58
|
-
lockfile_contents = File.read(lockfile)
|
59
|
-
return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/
|
60
|
-
Regexp.last_match(1)
|
61
|
-
end
|
62
|
-
|
63
|
-
def bundler_requirement
|
64
|
-
@bundler_requirement ||=
|
65
|
-
env_var_version ||
|
66
|
-
cli_arg_version ||
|
67
|
-
bundler_requirement_for(lockfile_version)
|
68
|
-
end
|
69
|
-
|
70
|
-
def bundler_requirement_for(version)
|
71
|
-
return "#{Gem::Requirement.default}.a" unless version
|
72
|
-
|
73
|
-
bundler_gem_version = Gem::Version.new(version)
|
74
|
-
|
75
|
-
bundler_gem_version.approximate_recommendation
|
76
|
-
end
|
77
|
-
|
78
|
-
def load_bundler!
|
79
|
-
ENV["BUNDLE_GEMFILE"] ||= gemfile
|
80
|
-
|
81
|
-
activate_bundler
|
82
|
-
end
|
83
|
-
|
84
|
-
def activate_bundler
|
85
|
-
gem_error = activation_error_handling do
|
86
|
-
gem "bundler", bundler_requirement
|
87
|
-
end
|
88
|
-
return if gem_error.nil?
|
89
|
-
require_error = activation_error_handling do
|
90
|
-
require "bundler/version"
|
91
|
-
end
|
92
|
-
return if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION))
|
93
|
-
warn "Activating bundler (#{bundler_requirement}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_requirement}'`"
|
94
|
-
exit 42
|
95
|
-
end
|
96
|
-
|
97
|
-
def activation_error_handling
|
98
|
-
yield
|
99
|
-
nil
|
100
|
-
rescue StandardError, LoadError => e
|
101
|
-
e
|
102
|
-
end
|
103
|
-
end
|
104
|
-
|
105
|
-
m.load_bundler!
|
106
|
-
|
107
|
-
if m.invoked_as_script?
|
108
|
-
load Gem.bin_path("bundler", "bundle")
|
109
|
-
end
|
data/examples/rails-demo/bin/dev
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/bin/bash -e
|
2
|
-
|
3
|
-
# Enable jemalloc for reduced memory usage and latency.
|
4
|
-
if [ -z "${LD_PRELOAD+x}" ]; then
|
5
|
-
LD_PRELOAD=$(find /usr/lib -name libjemalloc.so.2 -print -quit)
|
6
|
-
export LD_PRELOAD
|
7
|
-
fi
|
8
|
-
|
9
|
-
# If running the rails server then create or migrate existing database
|
10
|
-
if [ "${@: -2:1}" == "./bin/rails" ] && [ "${@: -1:1}" == "server" ]; then
|
11
|
-
./bin/rails db:prepare
|
12
|
-
fi
|
13
|
-
|
14
|
-
exec "${@}"
|