Skip to content

Commit c712e86

Browse files
authored
chore: Update rideshare example docker builds and makefile (#3509)
* Fix rideshare example directories in Makefile * Fix error in ruby docker build * Restore bin folder in rideshare Ruby example
1 parent 398f241 commit c712e86

File tree

6 files changed

+160
-6
lines changed

6 files changed

+160
-6
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# Binaries for programs and plugins
2-
bin
32
/phlare
43
/pyroscope
54
/profilecli

Makefile.examples

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,20 @@ rideshare/docker/push-loadgen:
1616

1717
.PHONY: rideshare/docker/push-python
1818
rideshare/docker/push-python:
19-
docker buildx build --push --platform $(IMAGE_PLATFORM) -t $(IMAGE_PREFIX)pyroscope-rideshare-python -t $(IMAGE_PREFIX)pyroscope-rideshare-python:$(IMAGE_TAG) examples/python/rideshare/flask
19+
docker buildx build --push --platform $(IMAGE_PLATFORM) -t $(IMAGE_PREFIX)pyroscope-rideshare-python -t $(IMAGE_PREFIX)pyroscope-rideshare-python:$(IMAGE_TAG) examples/language-sdk-instrumentation/python/rideshare/flask
2020

2121
.PHONY: rideshare/docker/push-ruby
2222
rideshare/docker/push-ruby:
23-
docker buildx build --push --platform $(IMAGE_PLATFORM) -t $(IMAGE_PREFIX)pyroscope-rideshare-ruby -t $(IMAGE_PREFIX)pyroscope-rideshare-ruby:$(IMAGE_TAG) examples/ruby/rideshare_rails
23+
docker buildx build --push --platform $(IMAGE_PLATFORM) -t $(IMAGE_PREFIX)pyroscope-rideshare-ruby -t $(IMAGE_PREFIX)pyroscope-rideshare-ruby:$(IMAGE_TAG) examples/language-sdk-instrumentation/ruby/rideshare_rails
2424

2525
.PHONY: rideshare/docker/push-dotnet
2626
rideshare/docker/push-dotnet:
27-
docker buildx build --push --platform $(IMAGE_PLATFORM) -t $(IMAGE_PREFIX)pyroscope-rideshare-dotnet -t $(IMAGE_PREFIX)pyroscope-rideshare-dotnet:$(IMAGE_TAG) examples/dotnet/rideshare/
27+
docker buildx build --push --platform $(IMAGE_PLATFORM) -t $(IMAGE_PREFIX)pyroscope-rideshare-dotnet -t $(IMAGE_PREFIX)pyroscope-rideshare-dotnet:$(IMAGE_TAG) examples/language-sdk-instrumentation/dotnet/rideshare/
2828

2929
.PHONY: rideshare/docker/push-java
3030
rideshare/docker/push-java:
31-
docker buildx build --push --platform $(IMAGE_PLATFORM) -t $(IMAGE_PREFIX)pyroscope-rideshare-java -t $(IMAGE_PREFIX)pyroscope-rideshare-java:$(IMAGE_TAG) examples/java/rideshare
31+
docker buildx build --push --platform $(IMAGE_PLATFORM) -t $(IMAGE_PREFIX)pyroscope-rideshare-java -t $(IMAGE_PREFIX)pyroscope-rideshare-java:$(IMAGE_TAG) examples/language-sdk-instrumentation/java/rideshare
3232

3333
.PHONY: rideshare/docker/push-rust
3434
rideshare/docker/push-rust:
35-
docker buildx build --push --platform $(IMAGE_PLATFORM) -t $(IMAGE_PREFIX)pyroscope-rideshare-rust -t $(IMAGE_PREFIX)pyroscope-rideshare-rust:$(IMAGE_TAG) examples/rust/rideshare
35+
docker buildx build --push --platform $(IMAGE_PLATFORM) -t $(IMAGE_PREFIX)pyroscope-rideshare-rust -t $(IMAGE_PREFIX)pyroscope-rideshare-rust:$(IMAGE_TAG) examples/language-sdk-instrumentation/rust/rideshare
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
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 =~ 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", __FILE__)
45+
end
46+
47+
def lockfile
48+
lockfile =
49+
case File.basename(gemfile)
50+
when "gems.rb" then gemfile.sub(/\.rb$/, gemfile)
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 || cli_arg_version ||
66+
bundler_requirement_for(lockfile_version)
67+
end
68+
69+
def bundler_requirement_for(version)
70+
return "#{Gem::Requirement.default}.a" unless version
71+
72+
bundler_gem_version = Gem::Version.new(version)
73+
74+
requirement = bundler_gem_version.approximate_recommendation
75+
76+
return requirement unless Gem.rubygems_version < Gem::Version.new("2.7.0")
77+
78+
requirement += ".a" if bundler_gem_version.prerelease?
79+
80+
requirement
81+
end
82+
83+
def load_bundler!
84+
ENV["BUNDLE_GEMFILE"] ||= gemfile
85+
86+
activate_bundler
87+
end
88+
89+
def activate_bundler
90+
gem_error = activation_error_handling do
91+
gem "bundler", bundler_requirement
92+
end
93+
return if gem_error.nil?
94+
require_error = activation_error_handling do
95+
require "bundler/version"
96+
end
97+
return if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION))
98+
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}'`"
99+
exit 42
100+
end
101+
102+
def activation_error_handling
103+
yield
104+
nil
105+
rescue StandardError, LoadError => e
106+
e
107+
end
108+
end
109+
110+
m.load_bundler!
111+
112+
if m.invoked_as_script?
113+
load Gem.bin_path("bundler", "bundle")
114+
end
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env ruby
2+
APP_PATH = File.expand_path("../config/application", __dir__)
3+
require_relative "../config/boot"
4+
require "rails/commands"
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env ruby
2+
require_relative "../config/boot"
3+
require "rake"
4+
Rake.application.run
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/usr/bin/env ruby
2+
require "fileutils"
3+
4+
# path to your application root.
5+
APP_ROOT = File.expand_path("..", __dir__)
6+
7+
def system!(*args)
8+
system(*args) || abort("\n== Command #{args} failed ==")
9+
end
10+
11+
FileUtils.chdir APP_ROOT do
12+
# This script is a way to set up or update your development environment automatically.
13+
# This script is idempotent, so that you can run it at any time and get an expectable outcome.
14+
# Add necessary setup steps to this file.
15+
16+
puts "== Installing dependencies =="
17+
system! "gem install bundler --conservative"
18+
system("bundle check") || system!("bundle install")
19+
20+
# puts "\n== Copying sample files =="
21+
# unless File.exist?("config/database.yml")
22+
# FileUtils.cp "config/database.yml.sample", "config/database.yml"
23+
# end
24+
25+
puts "\n== Preparing database =="
26+
system! "bin/rails db:prepare"
27+
28+
puts "\n== Removing old logs and tempfiles =="
29+
system! "bin/rails log:clear tmp:clear"
30+
31+
puts "\n== Restarting application server =="
32+
system! "bin/rails restart"
33+
end

0 commit comments

Comments
 (0)