Leona Maroni
2025-03-27 23:20:14 +01:00
parent 9d02f876c4
commit f2ebbabda0
9 changed files with 738 additions and 561 deletions

View File

@@ -354,6 +354,7 @@
- `programs.clash-verge.tunMode` was deprecated and removed because now service mode is necessary to start program. Without `programs.clash-verge.enable`, clash-verge-rev will refuse to start.
- `services.discourse` now requires PostgreSQL 15 per default. Please update before upgrading.
- `services.netbird.tunnels` was renamed to [`services.netbird.clients`](#opt-services.netbird.clients),
hardened (using dedicated less-privileged users) and significantly extended.

View File

@@ -13,8 +13,8 @@ let
cfg = config.services.discourse;
opt = options.services.discourse;
# Keep in sync with https://github.com/discourse/discourse_docker/blob/main/image/base/slim.Dockerfile#L5
upstreamPostgresqlVersion = lib.getVersion pkgs.postgresql_13;
# Keep in sync with https://github.com/discourse/discourse_docker/blob/main/image/base/Dockerfile PG_MAJOR
upstreamPostgresqlVersion = lib.getVersion pkgs.postgresql_15;
postgresqlPackage =
if config.services.postgresql.enable then config.services.postgresql.package else pkgs.postgresql;
@@ -676,6 +676,8 @@ in
dns_query_timeout_secs = null;
regex_timeout_seconds = 2;
allow_impersonation = true;
log_line_max_chars = 160000;
yjit_enabled = false;
};
services.redis.servers.discourse =
@@ -901,6 +903,9 @@ in
extraConfig
+ ''
proxy_set_header X-Request-Start "t=''${msec}";
proxy_set_header X-Sendfile-Type "";
proxy_set_header X-Accel-Mapping "";
proxy_set_header Client-Ip "";
'';
};
cache = time: ''

View File

@@ -59,7 +59,7 @@ import ./make-test-python.nix (
environment.systemPackages = [ pkgs.jq ];
services.postgresql.package = pkgs.postgresql_13;
services.postgresql.package = pkgs.postgresql_15;
services.discourse = {
enable = true;

View File

@@ -9,7 +9,7 @@
bundlerEnv,
callPackage,
ruby_3_2,
ruby_3_3,
replace,
gzip,
gnutar,
@@ -34,11 +34,9 @@
procps,
rsync,
icu,
fetchYarnDeps,
yarn,
fixup-yarn-lock,
pnpm_9,
nodePackages,
nodejs_18,
nodejs,
jq,
moreutils,
terser,
@@ -48,16 +46,16 @@
}@args:
let
version = "3.3.2";
version = "3.4.2";
src = fetchFromGitHub {
owner = "discourse";
repo = "discourse";
rev = "v${version}";
sha256 = "sha256-FaPcUta5z/8oasw+9zGBRZnUVYD8eCo1t/XwwsFoSM8=";
sha256 = "sha256-glTuY9aQ7wYvFZstOP579RkdSwKKh3q9mJt4wqg3zYk=";
};
ruby = ruby_3_2;
ruby = ruby_3_3;
runtimeDeps = [
# For backups, themes and assets
@@ -67,7 +65,7 @@ let
gnutar
git
brotli
nodejs_18
nodejs
# Misc required system utils
which
@@ -189,9 +187,9 @@ let
cd ../..
mkdir -p vendor/v8/${stdenv.hostPlatform.system}/libv8/obj/
ln -s "${nodejs_18.libv8}/lib/libv8.a" vendor/v8/${stdenv.hostPlatform.system}/libv8/obj/libv8_monolith.a
ln -s "${nodejs.libv8}/lib/libv8.a" vendor/v8/${stdenv.hostPlatform.system}/libv8/obj/libv8_monolith.a
ln -s ${nodejs_18.libv8}/include vendor/v8/include
ln -s ${nodejs.libv8}/include vendor/v8/include
mkdir -p ext/libv8-node
echo '--- !ruby/object:Libv8::Node::Location::Vendor {}' >ext/libv8-node/.location.yml
@@ -232,9 +230,10 @@ let
pname = "discourse-assets";
inherit version src;
yarnOfflineCache = fetchYarnDeps {
yarnLock = src + "/yarn.lock";
hash = "sha256-cSQofaULCmPuWGxS+hK4KlRq9lSkCPiYvhax9X6Dor8=";
pnpmDeps = pnpm_9.fetchDeps {
pname = "discourse-assets";
inherit version src;
hash = "sha256-WyRBnuKCl5NJLtqy3HK/sJcrpMkh0PjbasGPNDV6+7Y=";
};
nativeBuildInputs = runtimeDeps ++ [
@@ -242,10 +241,10 @@ let
redis
uglify-js
terser
yarn
jq
moreutils
fixup-yarn-lock
nodejs
pnpm_9.configHook
];
outputs = [
@@ -281,31 +280,9 @@ let
# run. This means that Redis and PostgreSQL has to be running and
# database migrations performed.
preBuild = ''
# Yarn wants a real home directory to write cache, config, etc to
export HOME=$NIX_BUILD_TOP/fake_home
yarn_install() {
local offlineCache=$1 yarnLock=$2
# Make yarn install packages from our offline cache, not the registry
yarn config --offline set yarn-offline-mirror $offlineCache
# Fixup "resolved"-entries in yarn.lock to match our offline cache
fixup-yarn-lock $yarnLock
# Install while ignoring hook scripts
yarn --offline --ignore-scripts --cwd $(dirname $yarnLock) install
}
# Install runtime and devDependencies.
# The dev deps are necessary for generating the theme-transpiler executed as dependent task
# assets:precompile:theme_transpiler before db:migrate and unfortunately also in the runtime
yarn_install $yarnOfflineCache yarn.lock
# Patch before running postinstall hook script
patchShebangs node_modules/
patchShebangs --build app/assets/javascripts
yarn --offline --cwd app/assets/javascripts run postinstall
export SSL_CERT_FILE=${cacert}/etc/ssl/certs/ca-bundle.crt
redis-server >/dev/null &
@@ -351,6 +328,10 @@ let
runHook postInstall
'';
# The node_modules output by design has broken symlinks, as it refers to the source code.
# They are resolved in the primary discourse derivation.
dontCheckForBrokenSymlinks = true;
};
discourse = stdenv.mkDerivation {
@@ -425,12 +406,11 @@ let
ln -sf /var/lib/discourse/tmp $out/share/discourse/tmp
ln -sf /run/discourse/config $out/share/discourse/config
ln -sf /run/discourse/public $out/share/discourse/public
# This needs to be copied because of symlinks in node_modules
# Also this needs to be full node_modules (including dev deps) because without loader.js it just throws 500
cp -r ${assets.node_modules} $out/share/discourse/node_modules
ln -sf ${assets.node_modules} $out/share/discourse/node_modules
ln -sf ${assets} $out/share/discourse/public.dist/assets
rm -r $out/share/discourse/app/assets/javascripts
ln -sf ${assets.javascripts} $out/share/discourse/app/assets/javascripts
# This needs to be copied because it contains symlinks to node_modules
cp -r ${assets.javascripts} $out/share/discourse/app/assets/javascripts
${lib.concatMapStringsSep "\n" (
p: "ln -sf ${p} $out/share/discourse/plugins/${p.pluginName or ""}"
) plugins}
@@ -466,9 +446,6 @@ let
maintainers = with maintainers; [ talyz ];
license = licenses.gpl2Plus;
description = "Discourse is an open source discussion platform";
# fails to compile mini_racer:
# mini_racer_v8.cc:316:45: error: no matching function for call to 'v8::ScriptOrigin::ScriptOrigin(v8::Local<v8::String>&)'
broken = true;
};
};
in

View File

@@ -1,21 +1,23 @@
diff --git a/lib/discourse_js_processor.rb b/lib/discourse_js_processor.rb
index 26d142fa4d..6040aba6f4 100644
index f1642386c5..5a672818da 100644
--- a/lib/discourse_js_processor.rb
+++ b/lib/discourse_js_processor.rb
@@ -68,7 +68,7 @@ class DiscourseJsProcessor
TRANSPILER_PATH =
(
if Rails.env.production?
- "tmp/theme-transpiler.js"
+ "app/assets/javascripts/theme-transpiler.js"
else
"tmp/theme-transpiler/#{Process.pid}.js"
@@ -54,7 +54,7 @@ class DiscourseJsProcessor
end
@@ -87,6 +87,6 @@ class DiscourseJsProcessor
"node",
"app/assets/javascripts/theme-transpiler/build.js",
TRANSPILER_PATH,
- )
+ ) if !Rails.env.production? or !File.file?(TRANSPILER_PATH)
class Transpiler
- TRANSPILER_PATH = "tmp/theme-transpiler.js"
+ TRANSPILER_PATH = "app/assets/javascripts/theme-transpiler.js"
@mutex = Mutex.new
@ctx_init = Mutex.new
@@ -75,7 +75,9 @@ class DiscourseJsProcessor
end
def self.build_production_theme_transpiler
- File.write(TRANSPILER_PATH, build_theme_transpiler)
+ if (!Rails.env.production? or !File.file?(TRANSPILER_PATH))
+ File.write(TRANSPILER_PATH, build_theme_transpiler)
+ end
TRANSPILER_PATH
end

View File

@@ -6,13 +6,13 @@ source "https://rubygems.org"
gem "bootsnap", require: false, platform: :mri
gem "actionmailer", "~> 7.1.0"
gem "actionpack", "~> 7.1.0"
gem "actionview", "~> 7.1.0"
gem "activemodel", "~> 7.1.0"
gem "activerecord", "~> 7.1.0"
gem "activesupport", "~> 7.1.0"
gem "railties", "~> 7.1.0"
gem "actionmailer", "~> 7.2.0"
gem "actionpack", "~> 7.2.0"
gem "actionview", "~> 7.2.0"
gem "activemodel", "~> 7.2.0"
gem "activerecord", "~> 7.2.0"
gem "activesupport", "~> 7.2.0"
gem "railties", "~> 7.2.0"
gem "sprockets-rails"
gem "json"
@@ -99,7 +99,7 @@ gem "sidekiq"
gem "mini_scheduler"
gem "execjs", require: false
gem "mini_racer"
gem "mini_racer", "0.17.pre13"
gem "highline", require: false
@@ -158,6 +158,8 @@ group :test, :development do
gem "syntax_tree"
gem "syntax_tree-disable_ternary"
gem "rspec-multi-mock"
end
group :development do
@@ -241,8 +243,6 @@ if ENV["IMPORT"] == "1"
gem "reverse_markdown"
gem "tiny_tds"
gem "csv"
gem "parallel", require: false
end
group :generic_import, optional: true do
@@ -269,10 +269,26 @@ gem "cgi", ">= 0.3.6", require: false
gem "tzinfo-data"
gem "csv", require: false
# TODO: Can be removed once we upgrade to Rails 7.1
gem "mutex_m"
gem "drb"
# dependencies for the automation plugin
gem "iso8601"
gem "rrule"
group :migrations, optional: true do
gem "extralite-bundle", require: "extralite"
# auto-loading
gem "zeitwerk"
# databases
gem "trilogy"
# CLI
gem "ruby-progressbar"
# non-cryptographic hashing algorithm for generating placeholder IDs
gem "digest-xxhash"
end
gem "dry-initializer", "~> 3.1"
gem "parallel"

View File

@@ -1,28 +1,26 @@
GEM
remote: https://rubygems.org/
specs:
actionmailer (7.1.3.4)
actionpack (= 7.1.3.4)
actionview (= 7.1.3.4)
activejob (= 7.1.3.4)
activesupport (= 7.1.3.4)
mail (~> 2.5, >= 2.5.4)
net-imap
net-pop
net-smtp
actionmailer (7.2.2.1)
actionpack (= 7.2.2.1)
actionview (= 7.2.2.1)
activejob (= 7.2.2.1)
activesupport (= 7.2.2.1)
mail (>= 2.8.0)
rails-dom-testing (~> 2.2)
actionpack (7.1.3.4)
actionview (= 7.1.3.4)
activesupport (= 7.1.3.4)
actionpack (7.2.2.1)
actionview (= 7.2.2.1)
activesupport (= 7.2.2.1)
nokogiri (>= 1.8.5)
racc
rack (>= 2.2.4)
rack (>= 2.2.4, < 3.2)
rack-session (>= 1.0.1)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
actionview (7.1.3.4)
activesupport (= 7.1.3.4)
useragent (~> 0.16)
actionview (7.2.2.1)
activesupport (= 7.2.2.1)
builder (~> 3.1)
erubi (~> 1.11)
rails-dom-testing (~> 2.2)
@@ -31,25 +29,27 @@ GEM
actionview (>= 6.0.a)
active_model_serializers (0.8.4)
activemodel (>= 3.0)
activejob (7.1.3.4)
activesupport (= 7.1.3.4)
activejob (7.2.2.1)
activesupport (= 7.2.2.1)
globalid (>= 0.3.6)
activemodel (7.1.3.4)
activesupport (= 7.1.3.4)
activerecord (7.1.3.4)
activemodel (= 7.1.3.4)
activesupport (= 7.1.3.4)
activemodel (7.2.2.1)
activesupport (= 7.2.2.1)
activerecord (7.2.2.1)
activemodel (= 7.2.2.1)
activesupport (= 7.2.2.1)
timeout (>= 0.4.0)
activesupport (7.1.3.4)
activesupport (7.2.2.1)
base64
benchmark (>= 0.3)
bigdecimal
concurrent-ruby (~> 1.0, >= 1.0.2)
concurrent-ruby (~> 1.0, >= 1.3.1)
connection_pool (>= 2.2.5)
drb
i18n (>= 1.6, < 2)
logger (>= 1.4.2)
minitest (>= 5.1)
mutex_m
tzinfo (~> 2.0)
securerandom (>= 0.3)
tzinfo (~> 2.0, >= 2.0.5)
addressable (2.8.7)
public_suffix (>= 2.0.2, < 7.0)
annotate (3.2.0)
@@ -76,17 +76,18 @@ GEM
aws-sigv4 (1.8.0)
aws-eventstream (~> 1, >= 1.0.2)
base64 (0.2.0)
benchmark (0.4.0)
better_errors (2.10.1)
erubi (>= 1.0.0)
rack (>= 0.9.0)
rouge (>= 1.0.0)
bigdecimal (3.1.8)
bigdecimal (3.1.9)
binding_of_caller (1.0.1)
debug_inspector (>= 1.2.0)
bootsnap (1.18.3)
bootsnap (1.18.4)
msgpack (~> 1.2)
builder (3.3.0)
bullet (7.2.0)
bullet (8.0.0)
activesupport (>= 3.0.0)
uniform_notifier (~> 1.11)
byebug (11.1.3)
@@ -104,26 +105,27 @@ GEM
cgi (0.4.1)
chunky_png (1.4.0)
coderay (1.1.3)
colored2 (4.0.0)
concurrent-ruby (1.3.3)
connection_pool (2.4.1)
cose (1.3.0)
colored2 (4.0.3)
concurrent-ruby (1.3.5)
connection_pool (2.5.0)
cose (1.3.1)
cbor (~> 0.5.9)
openssl-signature_algorithm (~> 1.0)
cppjieba_rb (0.4.2)
cppjieba_rb (0.4.4)
crack (1.0.0)
bigdecimal
rexml
crass (1.0.6)
css_parser (1.17.1)
css_parser (1.21.0)
addressable
csv (3.3.0)
date (3.3.4)
csv (3.3.2)
date (3.4.1)
debug_inspector (1.2.0)
diff-lcs (1.5.1)
diffy (3.4.2)
digest (3.1.1)
discourse-fonts (0.0.9)
diffy (3.4.3)
digest (3.2.0)
digest-xxhash (0.2.9)
discourse-fonts (0.0.18)
discourse-seed-fu (2.3.12)
activerecord (>= 3.1)
activesupport (>= 3.1)
@@ -132,50 +134,53 @@ GEM
literate_randomizer
docile (1.4.1)
drb (2.2.1)
email_reply_trimmer (0.1.13)
erubi (1.13.0)
excon (0.111.0)
execjs (2.9.1)
exifr (1.4.0)
dry-initializer (3.2.0)
email_reply_trimmer (0.2.0)
erubi (1.13.1)
excon (1.2.3)
execjs (2.10.0)
exifr (1.4.1)
extralite-bundle (2.8.2)
fabrication (2.31.0)
faker (2.23.0)
i18n (>= 1.8.11, < 2)
fakeweb (1.3.0)
faraday (2.10.0)
faraday-net_http (>= 2.0, < 3.2)
faraday (2.12.2)
faraday-net_http (>= 2.0, < 3.5)
json
logger
faraday-net_http (3.1.1)
net-http
faraday-net_http (3.4.0)
net-http (>= 0.5.0)
faraday-retry (2.2.1)
faraday (~> 2.0)
fast_blank (1.0.1)
fastimage (2.3.1)
ffi (1.17.0)
ffi (1.17.0-arm64-darwin)
ffi (1.17.0-x86_64-darwin)
ffi (1.17.1)
ffi (1.17.1-arm64-darwin)
ffi (1.17.1-x86_64-darwin)
fspath (3.1.2)
globalid (1.2.1)
activesupport (>= 6.1)
google-protobuf (4.27.2)
google-protobuf (4.29.3)
bigdecimal
rake (>= 13)
google-protobuf (4.27.2-arm64-darwin)
google-protobuf (4.29.3-arm64-darwin)
bigdecimal
rake (>= 13)
google-protobuf (4.27.2-x86_64-darwin)
google-protobuf (4.29.3-x86_64-darwin)
bigdecimal
rake (>= 13)
guess_html_encoding (0.0.11)
hana (1.3.7)
hashdiff (1.1.0)
hashdiff (1.1.2)
hashie (5.0.0)
highline (3.1.0)
highline (3.1.2)
reline
htmlentities (4.3.4)
http_accept_language (2.1.1)
i18n (1.14.5)
i18n (1.14.7)
concurrent-ruby (~> 1.0)
image_optim (0.31.3)
image_optim (0.31.4)
exifr (~> 1.2, >= 1.2.2)
fspath (~> 3.0)
image_size (>= 1.5, < 4)
@@ -183,32 +188,34 @@ GEM
progress (~> 3.0, >= 3.0.1)
image_size (3.4.0)
in_threads (1.6.0)
io-console (0.7.2)
irb (1.14.0)
io-console (0.8.0)
irb (1.15.1)
pp (>= 0.6.0)
rdoc (>= 4.0.0)
reline (>= 0.4.2)
iso8601 (0.13.0)
jmespath (1.6.2)
json (2.7.2)
json-schema (4.3.1)
addressable (>= 2.8)
json_schemer (2.3.0)
json (2.9.1)
json-schema (5.1.1)
addressable (~> 2.8)
bigdecimal (~> 3.1)
json_schemer (2.4.0)
bigdecimal
hana (~> 1.3)
regexp_parser (~> 2.0)
simpleidn (~> 0.2)
jwt (2.8.2)
jwt (2.10.1)
base64
kgio (2.11.4)
language_server-protocol (3.17.0.3)
libv8-node (18.19.0.0)
libv8-node (18.19.0.0-arm64-darwin)
libv8-node (18.19.0.0-x86_64-darwin)
language_server-protocol (3.17.0.4)
libv8-node (22.7.0.4)
libv8-node (22.7.0.4-arm64-darwin)
libv8-node (22.7.0.4-x86_64-darwin)
listen (3.9.0)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
literate_randomizer (0.4.0)
logger (1.6.0)
logger (1.6.5)
lograge (0.14.0)
actionpack (>= 4)
activesupport (>= 4)
@@ -216,7 +223,7 @@ GEM
request_store (~> 1.0)
logstash-event (1.2.02)
logster (2.20.0)
loofah (2.22.0)
loofah (2.24.0)
crass (~> 1.0.2)
nokogiri (>= 1.12.0)
lru_redux (1.1.0)
@@ -228,34 +235,33 @@ GEM
net-smtp
matrix (0.4.2)
maxminddb (0.1.22)
memory_profiler (1.0.2)
memory_profiler (1.1.0)
message_bus (4.3.8)
rack (>= 1.1.3)
messageformat-wrapper (1.1.0)
mini_racer (>= 0.6.3)
method_source (1.1.0)
mini_mime (1.1.5)
mini_portile2 (2.8.7)
mini_racer (0.14.1)
libv8-node (~> 18.19.0.0)
mini_scheduler (0.16.0)
sidekiq (>= 4.2.3, < 7.0)
mini_sql (1.5.0)
mini_portile2 (2.8.8)
mini_racer (0.17.0.pre13)
libv8-node (~> 22.7.0.4)
mini_scheduler (0.18.0)
sidekiq (>= 6.5, < 8.0)
mini_sql (1.6.0)
mini_suffix (0.3.3)
ffi (~> 1.9)
minio_runner (0.1.2)
minitest (5.24.1)
mocha (2.4.5)
minitest (5.25.4)
mocha (2.7.1)
ruby2_keywords (>= 0.0.5)
msgpack (1.7.2)
msgpack (1.7.5)
multi_json (1.15.0)
multi_xml (0.7.1)
bigdecimal (~> 3.1)
mustache (1.1.1)
mutex_m (0.2.0)
net-http (0.4.1)
net-http (0.6.0)
uri
net-imap (0.4.14)
net-imap (0.5.5)
date
net-protocol
net-pop (0.1.2)
@@ -264,13 +270,13 @@ GEM
timeout
net-smtp (0.5.0)
net-protocol
nio4r (2.7.3)
nokogiri (1.16.7)
nio4r (2.7.4)
nokogiri (1.18.2)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
nokogiri (1.16.7-arm64-darwin)
nokogiri (1.18.2-arm64-darwin)
racc (~> 1.4)
nokogiri (1.16.7-x86_64-darwin)
nokogiri (1.18.2-x86_64-darwin)
racc (~> 1.4)
oauth (1.1.0)
oauth-tty (~> 1.0, >= 1.0.1)
@@ -284,8 +290,9 @@ GEM
multi_json (~> 1.3)
multi_xml (~> 0.5)
rack (>= 1.2, < 4)
oj (3.16.4)
oj (3.16.9)
bigdecimal (>= 3.0)
ostruct (>= 0.2)
omniauth (1.9.2)
hashie (>= 3.4.6)
rack (>= 1.6.2, < 3)
@@ -299,27 +306,32 @@ GEM
oauth2 (~> 1.1)
omniauth (~> 1.1)
omniauth-oauth2 (>= 1.6)
omniauth-oauth (1.2.0)
omniauth-oauth (1.2.1)
oauth
omniauth (>= 1.0, < 3)
rack (>= 1.6.2, < 4)
omniauth-oauth2 (1.7.3)
oauth2 (>= 1.4, < 3)
omniauth (>= 1.9, < 3)
omniauth-twitter (1.4.0)
omniauth-oauth (~> 1.1)
rack
openssl (3.2.0)
openssl (3.3.0)
openssl-signature_algorithm (1.3.0)
openssl (> 2.0)
optimist (3.1.0)
parallel (1.25.1)
parallel_tests (4.7.1)
optimist (3.2.0)
ostruct (0.6.1)
parallel (1.26.3)
parallel_tests (4.9.0)
parallel
parser (3.3.4.0)
parser (3.3.7.0)
ast (~> 2.4.1)
racc
pg (1.5.4)
pg (1.5.9)
pp (0.6.2)
prettyprint
prettier_print (1.2.1)
prettyprint (0.2.0)
progress (3.6.0)
pry (0.14.2)
coderay (~> 1.1)
@@ -332,13 +344,14 @@ GEM
pry-stack_explorer (0.6.1)
binding_of_caller (~> 1.0)
pry (~> 0.13)
psych (5.1.2)
psych (5.2.3)
date
stringio
public_suffix (6.0.1)
puma (6.4.2)
puma (6.6.0)
nio4r (~> 2.0)
racc (1.8.0)
rack (2.2.9)
racc (1.8.1)
rack (2.2.10)
rack-mini-profiler (3.3.1)
rack (>= 1.2.0)
rack-protection (3.2.0)
@@ -346,29 +359,29 @@ GEM
rack (~> 2.2, >= 2.2.4)
rack-session (1.0.2)
rack (< 3)
rack-test (2.1.0)
rack-test (2.2.0)
rack (>= 1.3)
rackup (1.0.0)
rackup (1.0.1)
rack (< 3)
webrick
rails-dom-testing (2.2.0)
activesupport (>= 5.0.0)
minitest
nokogiri (>= 1.6)
rails-html-sanitizer (1.6.0)
rails-html-sanitizer (1.6.2)
loofah (~> 2.21)
nokogiri (~> 1.14)
rails_failover (2.1.1)
nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
rails_failover (2.2.0)
activerecord (>= 6.1, < 8.0)
concurrent-ruby
railties (>= 6.1, < 8.0)
rails_multisite (6.0.0)
rails_multisite (6.1.0)
activerecord (>= 6.0)
railties (>= 6.0)
railties (7.1.3.4)
actionpack (= 7.1.3.4)
activesupport (= 7.1.3.4)
irb
railties (7.2.2.1)
actionpack (= 7.2.2.1)
activesupport (= 7.2.2.1)
irb (~> 1.13)
rackup (>= 1.0.0)
rake (>= 12.2)
thor (~> 1.0, >= 1.2.2)
@@ -383,23 +396,22 @@ GEM
ffi (>= 1.0.6)
msgpack (>= 0.4.3)
optimist (>= 3.0.0)
rchardet (1.8.0)
rdoc (6.7.0)
rchardet (1.9.0)
rdoc (6.11.0)
psych (>= 4.0.0)
redcarpet (3.6.0)
redis (4.8.1)
redis-namespace (1.11.0)
redis (>= 4)
regexp_parser (2.9.2)
reline (0.5.9)
regexp_parser (2.10.0)
reline (0.6.0)
io-console (~> 0.5)
request_store (1.7.0)
rack (>= 1.4)
rexml (3.3.2)
strscan
rexml (3.4.0)
rinku (2.0.6)
rotp (6.3.0)
rouge (4.3.0)
rouge (4.5.1)
rqrcode (2.2.0)
chunky_png (~> 1.0)
rqrcode_core (~> 1.0)
@@ -410,51 +422,52 @@ GEM
rspec-core (~> 3.13.0)
rspec-expectations (~> 3.13.0)
rspec-mocks (~> 3.13.0)
rspec-core (3.13.0)
rspec-core (3.13.2)
rspec-support (~> 3.13.0)
rspec-expectations (3.13.1)
rspec-expectations (3.13.3)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-html-matchers (0.10.0)
nokogiri (~> 1)
rspec (>= 3.0.0.a)
rspec-mocks (3.13.1)
rspec-mocks (3.13.2)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-rails (6.1.3)
actionpack (>= 6.1)
activesupport (>= 6.1)
railties (>= 6.1)
rspec-multi-mock (0.3.1)
rspec (>= 3.7.0)
rspec-rails (7.1.0)
actionpack (>= 7.0)
activesupport (>= 7.0)
railties (>= 7.0)
rspec-core (~> 3.13)
rspec-expectations (~> 3.13)
rspec-mocks (~> 3.13)
rspec-support (~> 3.13)
rspec-support (3.13.1)
rss (0.3.0)
rspec-support (3.13.2)
rss (0.3.1)
rexml
rswag-specs (2.13.0)
activesupport (>= 3.1, < 7.2)
json-schema (>= 2.2, < 5.0)
railties (>= 3.1, < 7.2)
rswag-specs (2.16.0)
activesupport (>= 5.2, < 8.1)
json-schema (>= 2.2, < 6.0)
railties (>= 5.2, < 8.1)
rspec-core (>= 2.14)
rtlcss (0.2.1)
mini_racer (>= 0.6.3)
rubocop (1.65.0)
rubocop (1.71.1)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 2.4, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.31.1, < 2.0)
regexp_parser (>= 2.9.3, < 3.0)
rubocop-ast (>= 1.38.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.31.3)
unicode-display_width (>= 2.4.0, < 4.0)
rubocop-ast (1.38.0)
parser (>= 3.3.1.0)
rubocop-capybara (2.21.0)
rubocop (~> 1.41)
rubocop-discourse (3.8.1)
rubocop-discourse (3.9.3)
activesupport (>= 6.1)
rubocop (>= 1.59.0)
rubocop-capybara (>= 2.0.0)
@@ -464,26 +477,26 @@ GEM
rubocop-rspec_rails (>= 2.30.0)
rubocop-factory_bot (2.26.1)
rubocop (~> 1.61)
rubocop-rails (2.25.1)
rubocop-rails (2.29.1)
activesupport (>= 4.2.0)
rack (>= 1.1)
rubocop (>= 1.33.0, < 2.0)
rubocop (>= 1.52.0, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
rubocop-rspec (3.0.3)
rubocop-rspec (3.4.0)
rubocop (~> 1.61)
rubocop-rspec_rails (2.30.0)
rubocop (~> 1.61)
rubocop-rspec (~> 3, >= 3.0.1)
ruby-prof (1.7.0)
ruby-prof (1.7.1)
ruby-progressbar (1.13.0)
ruby-readability (0.7.1)
ruby-readability (0.7.2)
guess_html_encoding (>= 0.0.4)
nokogiri (>= 1.6.0)
ruby2_keywords (0.0.5)
rubyzip (2.3.2)
sanitize (6.1.2)
rubyzip (2.4.1)
sanitize (7.0.0)
crass (~> 1.0.2)
nokogiri (>= 1.12.0)
nokogiri (>= 1.16.8)
sass-embedded (1.77.5)
google-protobuf (>= 3.25, < 5.0)
rake (>= 13)
@@ -493,15 +506,16 @@ GEM
google-protobuf (>= 3.25, < 5.0)
sassc-embedded (1.77.7)
sass-embedded (~> 1.77)
selenium-devtools (0.126.0)
securerandom (0.4.1)
selenium-devtools (0.132.0)
selenium-webdriver (~> 4.2)
selenium-webdriver (4.23.0)
selenium-webdriver (4.28.0)
base64 (~> 0.2)
logger (~> 1.4)
rexml (~> 3.2, >= 3.2.5)
rubyzip (>= 1.2.2, < 3.0)
websocket (~> 1.0)
shoulda-matchers (6.2.0)
shoulda-matchers (6.4.0)
activesupport (>= 5.2.0)
sidekiq (6.5.12)
connection_pool (>= 2.2.5, < 3)
@@ -511,64 +525,65 @@ GEM
docile (~> 1.1)
simplecov-html (~> 0.11)
simplecov_json_formatter (~> 0.1)
simplecov-html (0.12.3)
simplecov-html (0.13.1)
simplecov_json_formatter (0.1.4)
simpleidn (0.2.3)
snaky_hash (2.0.1)
hashie
version_gem (~> 1.1, >= 1.1.1)
sprockets (3.7.3)
sprockets (3.7.5)
base64
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
sprockets-rails (3.5.1)
sprockets-rails (3.5.2)
actionpack (>= 6.1)
activesupport (>= 6.1)
sprockets (>= 3.0.0)
sqlite3 (2.0.2)
sqlite3 (2.5.0)
mini_portile2 (~> 2.8.0)
sqlite3 (2.0.2-arm64-darwin)
sqlite3 (2.0.2-x86_64-darwin)
sqlite3 (2.5.0-arm64-darwin)
sqlite3 (2.5.0-x86_64-darwin)
sshkey (3.0.0)
stackprof (0.2.26)
stringio (3.1.1)
strscan (3.1.0)
stackprof (0.2.27)
stringio (3.1.2)
syntax_tree (6.2.0)
prettier_print (>= 1.2.0)
syntax_tree-disable_ternary (1.0.0)
test-prof (1.3.3.1)
thor (1.3.1)
timeout (0.4.1)
test-prof (1.4.4)
thor (1.3.2)
timeout (0.4.3)
trilogy (2.9.0)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
tzinfo-data (1.2024.1)
tzinfo-data (1.2025.1)
tzinfo (>= 1.0.0)
uglifier (4.2.0)
uglifier (4.2.1)
execjs (>= 0.3.0, < 3)
unf (0.1.4)
unf_ext
unf_ext (0.0.9.1)
unicode-display_width (2.5.0)
unf (0.2.0)
unicode-display_width (3.1.4)
unicode-emoji (~> 4.0, >= 4.0.4)
unicode-emoji (4.0.4)
unicorn (6.1.0)
kgio (~> 2.6)
raindrops (~> 0.7)
uniform_notifier (1.16.0)
uri (0.13.0)
uri (1.0.2)
useragent (0.16.11)
version_gem (1.1.4)
web-push (3.0.1)
jwt (~> 2.0)
openssl (~> 3.0)
webmock (3.23.1)
webmock (3.24.0)
addressable (>= 2.8.0)
crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0)
webrick (1.8.1)
webrick (1.9.1)
websocket (1.2.11)
xpath (3.2.0)
nokogiri (~> 1.8)
yaml-lint (0.1.2)
yard (0.9.36)
zeitwerk (2.6.16)
yard (0.9.37)
zeitwerk (2.7.1)
PLATFORMS
arm64-darwin-21
@@ -577,16 +592,18 @@ PLATFORMS
arm64-darwin-24
ruby
x86_64-darwin-22
x86_64-darwin-23
x86_64-darwin-24
DEPENDENCIES
actionmailer (~> 7.1.0)
actionpack (~> 7.1.0)
actionview (~> 7.1.0)
actionmailer (~> 7.2.0)
actionpack (~> 7.2.0)
actionview (~> 7.2.0)
actionview_precompiler
active_model_serializers (~> 0.8.3)
activemodel (~> 7.1.0)
activerecord (~> 7.1.0)
activesupport (~> 7.1.0)
activemodel (~> 7.2.0)
activerecord (~> 7.2.0)
activesupport (~> 7.2.0)
addressable
annotate
aws-sdk-s3
@@ -607,13 +624,15 @@ DEPENDENCIES
csv
diffy
digest
digest-xxhash
discourse-fonts
discourse-seed-fu
discourse_dev_assets
drb
dry-initializer (~> 3.1)
email_reply_trimmer
excon
execjs
extralite-bundle
fabrication
faker (~> 2.16)
fakeweb
@@ -641,7 +660,7 @@ DEPENDENCIES
message_bus
messageformat-wrapper
mini_mime
mini_racer
mini_racer (= 0.17.pre13)
mini_scheduler
mini_sql
mini_suffix
@@ -649,7 +668,6 @@ DEPENDENCIES
mocha
multi_json
mustache
mutex_m
net-http
net-imap
net-pop
@@ -662,6 +680,7 @@ DEPENDENCIES
omniauth-google-oauth2
omniauth-oauth2
omniauth-twitter
parallel
parallel_tests
pg
pry-byebug
@@ -674,7 +693,7 @@ DEPENDENCIES
rails-dom-testing
rails_failover
rails_multisite
railties (~> 7.1.0)
railties (~> 7.2.0)
rake
rb-fsevent
rbtrace
@@ -688,12 +707,14 @@ DEPENDENCIES
rrule
rspec
rspec-html-matchers
rspec-multi-mock
rspec-rails
rss
rswag-specs
rtlcss
rubocop-discourse
ruby-prof
ruby-progressbar
ruby-readability
rubyzip
sanitize
@@ -712,6 +733,7 @@ DEPENDENCIES
syntax_tree-disable_ternary
test-prof
thor
trilogy
tzinfo-data
uglifier
unf
@@ -720,6 +742,7 @@ DEPENDENCIES
webmock
yaml-lint
yard
zeitwerk
BUNDLED WITH
2.4.22
2.5.22

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,5 @@
#!/usr/bin/env nix-shell
#! nix-shell -i python3 -p "python3.withPackages (ps: with ps; [ requests click click-log packaging ])" bundix bundler nix-update nurl prefetch-yarn-deps
#! nix-shell -i python3 -p "python3.withPackages (ps: with ps; [ requests click click-log packaging ])" bundix bundler nix-update nurl
from __future__ import annotations
import click
@@ -86,13 +86,6 @@ class DiscourseRepo:
return self._latest_commit_sha
def get_yarn_lock_hash(self, rev: str, path: str):
yarnLockText = self.get_file(path, rev)
with tempfile.NamedTemporaryFile(mode='w') as lockFile:
lockFile.write(yarnLockText)
hash = subprocess.check_output(['prefetch-yarn-deps', lockFile.name]).decode().strip()
return subprocess.check_output(["nix", "hash", "to-sri", "--type", "sha256", hash]).decode().strip()
def get_file(self, filepath, rev):
"""Return file contents at a given rev.
@@ -105,6 +98,24 @@ class DiscourseRepo:
return r.text
def _get_build_lock_hash():
nixpkgs_path = Path(__file__).parent / '../../../../'
output = subprocess.run(['nix-build', '-A', 'discourse'], text=True, cwd=nixpkgs_path, capture_output=True)
# The line is of the form " got: sha256-xxx"
lines = [i.strip() for i in output.stderr.splitlines()]
new_hash_lines = [i.strip("got:").strip() for i in lines if i.startswith("got:")]
if len(new_hash_lines) == 0:
if output.returncode != 0:
print("Error while fetching new hash with nix build")
print(output.stderr)
print("No hash change is needed")
return None
if len(new_hash_lines) > 1:
print(new_hash_lines)
raise Exception("Got an unexpected number of new hash lines:")
return new_hash_lines[0]
def _call_nix_update(pkg, version):
"""Call nix-update from nixpkgs root dir."""
nixpkgs_path = Path(__file__).parent / '../../../../'
@@ -233,13 +244,14 @@ def update(rev):
_call_nix_update('discourse', version.version)
old_yarn_hash = _nix_eval('discourse.assets.yarnOfflineCache.outputHash')
new_yarn_hash = repo.get_yarn_lock_hash(version.tag, "yarn.lock")
click.echo(f"Updating yarn lock hash: {old_yarn_hash} -> {new_yarn_hash}")
old_pnpm_hash = _nix_eval('discourse.assets.pnpmDeps.outputHash')
new_pnpm_hash = _get_build_lock_hash()
if new_pnpm_hash is not None:
click.echo(f"Updating yarn lock hash: {old_pnpm_hash} -> {new_pnpm_hash}")
with open(Path(__file__).parent / "default.nix", 'r+') as f:
content = f.read()
content = content.replace(old_yarn_hash, new_yarn_hash)
content = content.replace(old_pnpm_hash, new_pnpm_hash)
f.seek(0)
f.write(content)
f.truncate()