Skip to content

Commit

Permalink
FIX: Remove bundle config jobs (#821)
Browse files Browse the repository at this point in the history
This fixes a regression introduced in
bbefa1e. Basically, we cannot configure
the default bundle jobs when building the image because the number of
cores used to build the image can be different from the number of cores
on the machine running the image.
  • Loading branch information
tgxworld authored Aug 8, 2024
1 parent 6f7f62c commit 9e253b7
Show file tree
Hide file tree
Showing 12 changed files with 23 additions and 23 deletions.
3 changes: 1 addition & 2 deletions image/base/release.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ RUN cd /var/www/discourse &&\
sudo -u discourse bundle config --local deployment true &&\
sudo -u discourse bundle config --local path ./vendor/bundle &&\
sudo -u discourse bundle config --local without test development &&\
sudo -u discourse bundle config --local jobs $(($(nproc) - 1)) && \
sudo -u discourse bundle install &&\
sudo -u discourse bundle install --jobs $(($(nproc) - 1)) &&\
sudo -u discourse yarn install --frozen-lockfile &&\
sudo -u discourse yarn cache clean &&\
find /var/www/discourse/vendor/bundle -name tmp -type d -exec rm -rf {} +
2 changes: 1 addition & 1 deletion image/discourse_bench/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ RUN git config --global user.email "you@example.com" &&\
git config --global user.name "Your Name"

RUN git pull &&\
sudo -u discourse bundle install --standalone
sudo -u discourse bundle install --jobs $(($(nproc) - 1)) --standalone

RUN gem install facter &&\
gem install mailcatcher
Expand Down
2 changes: 1 addition & 1 deletion image/discourse_bench/run_bench.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ redis-server /etc/redis/redis.conf
git pull

# install needed gems
sudo -E -u discourse bundle install
sudo -E -u discourse bundle install --jobs $(($(nproc) - 1))

# start mailcatcher
mailcatcher --http-ip 0.0.0.0
Expand Down
2 changes: 1 addition & 1 deletion image/discourse_dev/postgres_dev.template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ run:
- exec: cd tmp && git clone https://github.com/discourse/discourse.git --depth=1
- exec: chown -R discourse /tmp/discourse
- exec: cd /tmp/discourse && sudo -u discourse bundle config --local path ./vendor/bundle
- exec: cd /tmp/discourse && sudo -u discourse bundle install
- exec: cd /tmp/discourse && sudo -u discourse bundle install --jobs $(($(nproc) - 1))
- exec: cd /tmp/discourse && sudo -u discourse yarn install
- exec: cd /tmp/discourse && sudo -u discourse yarn cache clean
- exec: cd /tmp/discourse && sudo -u discourse bundle exec rake db:migrate
Expand Down
13 changes: 7 additions & 6 deletions image/discourse_fast_switch/create_switch.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
require 'fileutils'
require "fileutils"

puts "-"*100,"creating switch","-"*100
puts "-" * 100, "creating switch", "-" * 100

system("cd /var/www/discourse && git pull")

['24', '25'].each do |v|
%w[24 25].each do |v|
bin = "/usr/local/bin/use_#{v}"

File.write(bin, <<RUBY
File.write(bin, <<RUBY)
#!/usr/ruby_24/bin/ruby
Dir.glob('/usr/ruby_#{v}/bin/*').each do |file|
Expand All @@ -16,9 +16,10 @@
end
RUBY
)

system("chmod +x #{bin}")
system("use_#{v} && gem update --system && gem install bundler --force")
system("use_#{v} && cd /var/www/discourse && sudo -u discourse bundle install --deployment --jobs 4 --without test development")
system(
"use_#{v} && cd /var/www/discourse && sudo -u discourse bundle install --deployment --jobs $(($(nproc) - 1)) --without test development",
)
end
2 changes: 1 addition & 1 deletion image/discourse_test/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ RUN /tmp/install-chrome &&\
FROM with_browsers AS release

RUN cd /var/www/discourse &&\
sudo -u discourse bundle install &&\
sudo -u discourse bundle install --jobs $(($(nproc) - 1)) &&\
sudo -E -u discourse -H yarn install &&\
sudo -u discourse yarn cache clean

Expand Down
2 changes: 1 addition & 1 deletion templates/import/mbox.template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ hooks:
- apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y libsqlite3-dev
- echo "gem 'sqlite3'" >> Gemfile
- su discourse -c 'bundle config unset deployment'
- su discourse -c 'bundle install --no-deployment --path vendor/bundle --jobs 4 --without test development'
- su discourse -c 'bundle install --no-deployment --path vendor/bundle --jobs $(($(nproc) - 1)) --without test development'
2 changes: 1 addition & 1 deletion templates/import/mssql-dep.template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ hooks:
cmd:
- echo "gem 'tiny_tds'" >> Gemfile
- su discourse -c 'bundle config unset deployment'
- su discourse -c 'bundle install --no-deployment --path vendor/bundle --jobs 4 --without test development'
- su discourse -c 'bundle install --no-deployment --path vendor/bundle --jobs $(($(nproc) - 1)) --without test development'
2 changes: 1 addition & 1 deletion templates/import/mysql-dep.template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ hooks:
- echo "gem 'mysql2'" >> Gemfile
- apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y libmariadb-dev
- su discourse -c 'bundle config unset deployment'
- su discourse -c 'bundle install --no-deployment --path vendor/bundle --jobs 4 --without test development'
- su discourse -c 'bundle install --no-deployment --path vendor/bundle --jobs $(($(nproc) - 1)) --without test development'
2 changes: 1 addition & 1 deletion templates/import/phpbb3.template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,4 +114,4 @@ hooks:
- echo "gem 'mysql2'" >> Gemfile
- echo "gem 'ruby-bbcode-to-md', :github => 'nlalonde/ruby-bbcode-to-md'" >> Gemfile
- su discourse -c 'bundle config unset deployment'
- su discourse -c 'bundle install --no-deployment --path vendor/bundle --jobs 4 --without test development'
- su discourse -c 'bundle install --no-deployment --path vendor/bundle --jobs $(($(nproc) - 1)) --without test development'
12 changes: 6 additions & 6 deletions templates/import/vanilla.template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,23 +98,23 @@ hooks:
cmd:
- mkdir -p /shared/import/data
- chown discourse -R /shared/import

before_code:
- exec:
cd: $home
cmd:
# Add your discourse core fork and pull custom code
cmd:
# Add your discourse core fork and pull custom code
- su discourse -c 'git remote set-url origin https://github.com/{github_username}/discourse.git'

after_bundle_exec:
- exec:
cd: $home
cmd:
# Add the gems used in the script
- echo "gem 'mysql2'" >> Gemfile
- echo "gem 'mysql2'" >> Gemfile
- echo "gem 'ruby-bbcode-to-md', :github => 'nlalonde/ruby-bbcode-to-md'" >> Gemfile
- su discourse -c 'bundle config unset deployment'
- su discourse -c 'bundle install --no-deployment --path vendor/bundle --jobs 4 --without test development'
- su discourse -c 'bundle install --no-deployment --path vendor/bundle --jobs $(($(nproc) - 1)) --without test development'
- service mariadb start
# imports the DB into mysql
- sh /usr/local/bin/import_flarum_test.sh
- sh /usr/local/bin/import_flarum_test.sh
2 changes: 1 addition & 1 deletion templates/web.template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ run:
cd: $home
hook: bundle_exec
cmd:
- su discourse -c 'bundle install --retry 3'
- su discourse -c 'bundle install --jobs $(($(nproc) - 1)) --retry 3'

- exec:
cd: $home
Expand Down

0 comments on commit 9e253b7

Please sign in to comment.