Compare commits
1 Commits
main
..
2884b94b7f
| Author | SHA1 | Date | |
|---|---|---|---|
| 2884b94b7f |
+7
-18
@@ -1,27 +1,16 @@
|
||||
FROM ruby:3.4-slim
|
||||
FROM ruby:3.4
|
||||
|
||||
# 1. Install essential build tools for gems like 'pg' or 'sqlite3'
|
||||
RUN apt-get update -qq && apt-get install -y \
|
||||
build-essential \
|
||||
libpq-dev \
|
||||
curl \
|
||||
git
|
||||
RUN gem install bundler
|
||||
|
||||
WORKDIR /usr/src/game-data
|
||||
|
||||
# 2. Set environment variables for the Gem volume we discussed
|
||||
ENV BUNDLE_PATH=/usr/local/bundle \
|
||||
BUNDLE_BIN=/usr/local/bundle/bin \
|
||||
PATH=/usr/local/bundle/bin:$PATH
|
||||
COPY Gemfile Gemfile.l*ck ./
|
||||
|
||||
# 3. Copy Gemfile first to leverage layer caching
|
||||
COPY Gemfile Gemfile.lock ./
|
||||
RUN bundle install
|
||||
RUN bundle check || bundle install
|
||||
|
||||
RUN gem install rake
|
||||
|
||||
# 4. Copy the application code
|
||||
COPY . ./
|
||||
|
||||
# 5. Make sure your entrypoint script is executable
|
||||
RUN chmod +x entrypoints/dev.sh
|
||||
|
||||
ENTRYPOINT ["bash", "entrypoints/dev.sh"]
|
||||
|
||||
|
||||
+5
-22
@@ -1,28 +1,11 @@
|
||||
app_dir = File.expand_path('..', __dir__)
|
||||
directory app_dir
|
||||
|
||||
# load puma config from environment variables
|
||||
environment ENV.fetch('RACK_ENV', 'development')
|
||||
|
||||
# listening address
|
||||
host = ENV.fetch('BIND_HOST', '0.0.0.0')
|
||||
port = ENV.fetch('PORT', 9292)
|
||||
bind "tcp://#{host}:#{port}"
|
||||
require_relative '../src/config'
|
||||
conf = Config.new()
|
||||
|
||||
# Concurrency tuning
|
||||
workers_count = ENV.fetch('WEB_CONCURRENCY', 2).to_i
|
||||
workers workers_count
|
||||
|
||||
max_threads_count = ENV.fetch('PUMA_MAX_THREADS', ENV.fetch('RAILS_MAX_THREADS', 5)).to_i
|
||||
min_threads_count = ENV.fetch('PUMA_MIN_THREADS', ENV.fetch('RAILS_MIN_THREADS', 1)).to_i
|
||||
threads min_threads_count, max_threads_count
|
||||
|
||||
# Preload app code before forking worker processes for better memory usage (Copy-on-Write)
|
||||
if workers_count > 0
|
||||
preload_app!
|
||||
|
||||
before_fork do
|
||||
# Disconnect Sequel connection pool in the master process before forking
|
||||
DB.disconnect if defined?(DB)
|
||||
end
|
||||
end
|
||||
bind "tcp://#{conf.get('server.host')}:#{conf.get('server.port')}"
|
||||
workers 2
|
||||
threads 1, 5
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
services:
|
||||
game-data:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile.dev
|
||||
image: game-data
|
||||
container_name: game-data
|
||||
ports:
|
||||
- "9292:9292"
|
||||
volumes:
|
||||
- .:/usr/src/game-data
|
||||
tty: true
|
||||
|
||||
game-data-gulp:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile.gulp
|
||||
image: game-data-gulp
|
||||
container_name: game-data-gulp
|
||||
volumes:
|
||||
- .:/usr/src/game-data
|
||||
tty: true
|
||||
command: npm run gulp watch
|
||||
+2
-4
@@ -1,9 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Run the migrations to make sure the DB is up-to-date
|
||||
echo 'Checking database status...'
|
||||
if [ ! -f ./data/gamedata.db ]; then
|
||||
rake db:migrate
|
||||
fi
|
||||
|
||||
# Start the HTTP server
|
||||
echo 'Starting development server...'
|
||||
rake server:dev
|
||||
|
||||
@@ -59,10 +59,11 @@ RSpec.describe(TestController) do
|
||||
before do
|
||||
@hardware = Hardware.create(name: 'Test Hardware', type: 'gpu')
|
||||
@benchmark = Benchmark.create(name: 'Test Benchmark', scoring: 'fps')
|
||||
@benchmark_profile = BenchmarkProfile.create(label: 'Test Benchmark Profile', settings: '{}', benchmark_id: @benchmark.id)
|
||||
request_data = {
|
||||
test_name: 'Test Test',
|
||||
test_hardware: @hardware.id,
|
||||
'test_benchmarks[]': [@benchmark.id],
|
||||
'test_benchmarks[]': [@benchmark_profile.id],
|
||||
test_description: 'Test for testing'
|
||||
}
|
||||
post '/test/add', request_data
|
||||
@@ -93,11 +94,11 @@ RSpec.describe(TestController) do
|
||||
end
|
||||
|
||||
it 'Test add POST route created test has benchmarks.' do
|
||||
expect(Test.first.benchmarks.length).to(eq(1))
|
||||
expect(Test.first.benchmark_profiles.length).to(eq(1))
|
||||
end
|
||||
|
||||
it 'Test add POST route created test\'s benchmark can be read.' do
|
||||
expect(Test.first.benchmarks[0].id).to(eq(@benchmark.id))
|
||||
expect(Test.first.benchmark_profiles[0].id).to(eq(@benchmark.id))
|
||||
end
|
||||
|
||||
it 'Test add POST route created test has description.' do
|
||||
@@ -110,12 +111,13 @@ RSpec.describe(TestController) do
|
||||
before do
|
||||
@hardware = Hardware.create(name: 'Test Hardware', type: 'gpu')
|
||||
@benchmark = Benchmark.create(name: 'Test Benchmark', scoring: 'fps')
|
||||
@benchmark_profile = BenchmarkProfile.create(label: 'Test Benchmark Profile', settings: '{}', benchmark_id: @benchmark.id)
|
||||
@test = Test.create(
|
||||
name: 'Test Test',
|
||||
hardware_id: @hardware.id,
|
||||
description: 'Test for testing'
|
||||
)
|
||||
@test.add_benchmark(@benchmark)
|
||||
@test.add_benchmark_profile(@benchmark_profile)
|
||||
get "/test/#{@test.id}"
|
||||
end
|
||||
|
||||
@@ -141,12 +143,13 @@ RSpec.describe(TestController) do
|
||||
before do
|
||||
@hardware = Hardware.create(name: 'Test Hardware', type: 'gpu')
|
||||
@benchmark = Benchmark.create(name: 'Test Benchmark', scoring: 'fps')
|
||||
@benchmark_profile = BenchmarkProfile.create(label: 'Test Benchmark Profile', settings: '{}', benchmark_id: @benchmark.id)
|
||||
@test = Test.create(
|
||||
name: 'Test Test',
|
||||
hardware_id: @hardware.id,
|
||||
description: 'Test for testing'
|
||||
)
|
||||
@test.add_benchmark(@benchmark)
|
||||
@test.add_benchmark_profile(@benchmark_profile)
|
||||
get "/test/#{@test.id}/edit"
|
||||
end
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ class ResultController < BaseController
|
||||
|
||||
Result.create(
|
||||
test_id: params[:result_test],
|
||||
benchmark_profile_id: params[:result_benchmark],
|
||||
benchmark_id: params[:result_benchmark],
|
||||
avg_score: params[:result_average],
|
||||
min_score: result_minimum,
|
||||
max_score: result_maximum
|
||||
|
||||
+2
-2
@@ -7,8 +7,8 @@ class Test < Sequel::Model
|
||||
many_to_one :hardware
|
||||
many_to_many :benchmark_profiles
|
||||
|
||||
def benchmark?(benchmark_id)
|
||||
return benchmark_profiles_dataset.where(Sequel[:benchmark_profiles][:id] => benchmark_id).any?
|
||||
def benchmark?(benchmark_profile_id)
|
||||
return benchmark_profiles_dataset.where(Sequel[:benchmark_profiles][:id] => benchmark_profile_id).any?
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@
|
||||
<select id="test_benchmarks" class="form-select" name="test_benchmarks[]" multiple>
|
||||
<% for b in benchmarks %>
|
||||
<% for bp in b.benchmark_profiles %>
|
||||
<option value="<%= bp.id %>"><%= bp.display_name %></option>
|
||||
<option value="<%= bp.id %>"><%= b.display_name() %></option>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</select>
|
||||
|
||||
+2
-2
@@ -71,8 +71,8 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% test.benchmark_profiles.each do |bp| %>
|
||||
<tr data-benchmark-id="<%= bp.id %>"></tr>
|
||||
<% test.benchmark_profiles.each do |benchmark| %>
|
||||
<tr data-benchmark-id="<%= benchmark.id %>"></tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
Reference in New Issue
Block a user