مئات الميغابايتات من ملفات locale.js المكررة على ما يبدو

مع وجود منتدى صغير (نسخ احتياطي بحجم 500 ميجابايت)، يفشل ./launcher rebuild الخاص بي على قرص بحجم 50 جيجابايت بسبب نفاد المساحة. أثناء محاولة معرفة ما يمكن تنظيفه (لم يسفر apt autoremove و ./launcher cleanup عن شيء)، وجدت مئات الميجابايت من اللغات غير المفيدة في /var/lib/docker/overlay2/.../merged/var/www/discourse/public/assets/locales.

للأسف، بدأت في حذفها قبل التقاط لقطة الشاشة، ولكن لا يزال بإمكانك رؤية العديد من ملفات JavaScript المكررة التي تم تجميعها لنفس اللغة. هل يمكن فعل شيء في كود Discourse لتجنب ذلك؟ هل تستخدم ملفات .map لأي غرض؟

بالإضافة إلى ذلك، يستخدم منتدى الخاص بي اللغة الإنجليزية فقط. كيف يمكنني إلغاء الاشتراك في جميع اللغات الأخرى؟

هناك بضع مئات أخرى من الميجابايت من اللغات التي أود عدم الاضطرار إلى تحريرها يدويًا موجودة في /usr/lib/locale:

إعجاب واحد (1)

بشرط أن هذا الخادم يقوم بتشغيل Discourse فقط، يمكنك محاولة تشغيل ما يلي:

cd /var/discourse
./launcher stop app
docker rmi -f $(docker images -aq)
./launcher rebuild app

سيؤدي ذلك إلى إيقاف Discourse، وإزالة جميع صور Docker، ثم إعادة بناء Discourse، مما يؤدي إلى تنزيل صورتنا الحالية.

بالنسبة للملفات المتراكمة، @david هل لدينا شيء مثل rake s3:expire_missing_assets للتخزين المحلي؟

إعجابَين (2)

الدليل /var/www/discourse/public داخل الحاوية غير مُركّب على المضيف… لذا أنا متأكد تمامًا من أنه يجب التخلص منها جميعًا عند تشغيل ./launcher rebuild app في تثبيت قياسي. :thinking:

إعجاب واحد (1)

ولكن ماذا عن تحديثات الويب؟

الخادم هو بالفعل يعمل فقط على Discourse.

لقد قمت بتشغيل الأوامر، وواجهت بعض الأخطاء المتعلقة بالمواقع المحلية، والآن توقف الإخراج عند FATAL: database files are incompatible with server. The data directory was initialized by PostgreSQL version 13, which is not compatible with this version 15.12.

هل قمت بحذف ملف موقع محلي مهم عن طريق الخطأ؟ يبدو أن en_US.UTF-8 قد تم إنشاؤه بنجاح.

# uname -a
Linux localhost 4.4.0-266-generic #300-Ubuntu SMP Mon Feb 17 19:45:09 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
root@localhost:/var/discourse# docker rmi -f $(docker images -aq)
Untagged: discourse/base:2.0.20250226-0128
Untagged: discourse/base@sha256:6f18aa2cd22bba0deb91d69194e577d4f96130ad555ae8ec646a8792cbfe37db
Deleted: sha256:557b1ff6168ad5bc1d1d80c6eaf6c10459780536cc281d020194a60aba9d833e
Untagged: local_discourse/app:latest
Deleted: sha256:06d986a896b239daabb5ed5ba64f70cb55ba53dc58e8c5147c19068378a2252d
Deleted: sha256:5f2aa2694b8b8e8ee8ac1a43dcf9d804ef9db3da11fc78027520c043408cc575
Error: No such image: 5f2aa2694b8b
root@localhost:/var/discourse# ./launcher rebuild app
WARNING: Docker version 20.10.7 deprecated, recommend upgrade to 24.0.7 or newer.
x86_64 arch detected.

WARNING: We are about to start downloading the Discourse base image
This process may take anywhere between a few minutes to an hour, depending on your network speed

Please be patient

2.0.20250226-0128: Pulling from discourse/base
af302e5c37e9: Already exists
ed49ab5c933d: Already exists
4d13d450f300: Already exists
[...].
bc6c17ae1969: Already exists
d19f089ead0e: Already exists
Digest: sha256:6f18aa2cd22bba0deb91d69194e577d4f96130ad555ae8ec646a8792cbfe37db
Status: Downloaded newer image for discourse/base:2.0.20250226-0128
docker.io/discourse/base:2.0.20250226-0128
WARNING: containers/app.yml file is world-readable. You can secure this file by running: chmod o-rwx containers/app.yml
Ensuring launcher is up to date
Fetching origin
Launcher is up-to-date
Stopping old container
+ /usr/bin/docker stop -t 600 app
app
2.0.20250226-0128: Pulling from discourse/base
Digest: sha256:6f18aa2cd22bba0deb91d69194e577d4f96130ad555ae8ec646a8792cbfe37db
Status: Image is up to date for discourse/base:2.0.20250226-0128
docker.io/discourse/base:2.0.20250226-0128
/usr/local/lib/ruby/gems/3.3.0/gems/pups-1.2.1/lib/pups.rb
/usr/local/bin/pups --stdin
I, [2025-04-03T17:28:37.320187 #1]  INFO -- : Reading from stdin
I, [2025-04-03T17:28:37.358715 #1]  INFO -- : File > /etc/service/postgres/run  chmod: +x  chown: 
I, [2025-04-03T17:28:37.369442 #1]  INFO -- : File > /etc/service/postgres/log/run  chmod: +x  chown: 
I, [2025-04-03T17:28:37.376162 #1]  INFO -- : File > /etc/runit/3.d/99-postgres  chmod: +x  chown: 
I, [2025-04-03T17:28:37.381934 #1]  INFO -- : File > /root/install_postgres  chmod: +x  chown: 
I, [2025-04-03T17:28:37.386982 #1]  INFO -- : File > /root/upgrade_postgres  chmod: +x  chown: 
I, [2025-04-03T17:28:37.389829 #1]  INFO -- : Replacing data_directory = '/var/lib/postgresql/15/main' with data_directory = '/shared/postgres_data' in /etc/postgresql/15/main/postgresql.conf
I, [2025-04-03T17:28:37.391604 #1]  INFO -- : Replacing (?-mix:#?listen_addresses *=.*) with listen_addresses = '*' in /etc/postgresql/15/main/postgresql.conf
I, [2025-04-03T17:28:37.398346 #1]  INFO -- : Replacing (?-mix:#?synchronous_commit *=.*) with synchronous_commit = $db_synchronous_commit in /etc/postgresql/15/main/postgresql.conf
I, [2025-04-03T17:28:37.399876 #1]  INFO -- : Replacing (?-mix:#?shared_buffers *=.*) with shared_buffers = $db_shared_buffers in /etc/postgresql/15/main/postgresql.conf
I, [2025-04-03T17:28:37.401239 #1]  INFO -- : Replacing (?-mix:#?work_mem *=.*) with work_mem = $db_work_mem in /etc/postgresql/15/main/postgresql.conf
I, [2025-04-03T17:28:37.402470 #1]  INFO -- : Replacing (?-mix:#?default_text_search_config *=.*) with default_text_search_config = '$db_default_text_search_config' in /etc/postgresql/15/main/postgresql.conf
I, [2025-04-03T17:28:37.403467 #1]  INFO -- : Replacing (?-mix:#?checkpoint_segments *=.*) with checkpoint_segments = $db_checkpoint_segments in /etc/postgresql/15/main/postgresql.conf
I, [2025-04-03T17:28:37.404421 #1]  INFO -- : Replacing (?-mix:#?logging_collector *=.*) with logging_collector = $db_logging_collector in /etc/postgresql/15/main/postgresql.conf
I, [2025-04-03T17:28:37.405408 #1]  INFO -- : Replacing (?-mix:#?log_min_duration_statement *=.*) with log_min_duration_statement = $db_log_min_duration_statement in /etc/postgresql/15/main/postgresql.conf
I, [2025-04-03T17:28:37.406950 #1]  INFO -- : Replacing (?-mix:^#local +replication +postgres +peer$) with local replication postgres  peer in /etc/postgresql/15/main/pg_hba.conf
I, [2025-04-03T17:28:37.407960 #1]  INFO -- : Replacing (?-mix:^host.*all.*all.*127.*$) with host all all 0.0.0.0/0 md5 in /etc/postgresql/15/main/pg_hba.conf
I, [2025-04-03T17:28:37.408886 #1]  INFO -- : Replacing (?-mix:^host.*all.*all.*::1\/128.*$) with host all all ::/0 md5 in /etc/postgresql/15/main/pg_hba.conf
I, [2025-04-03T17:28:37.409731 #1]  INFO -- : > if [ -f /root/install_postgres ]; then
  /root/install_postgres && rm -f /root/install_postgres
elif [ -e /shared/postgres_run/.s.PGSQL.5432 ]; then
  socat /dev/null UNIX-CONNECT:/shared/postgres_run/.s.PGSQL.5432 || exit 0 && echo postgres already running stop container ; exit 1
fi

failed to set locale!
[error] character map file `UTF-8' not found: No such file or directory
failed to set locale!
[error] default character map file `ANSI_X3.4-1968' not found: No such file or directory
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LANGUAGE = "en_US.UTF-8",
        LC_ALL = "en_US.UTF-8",
        LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
/bin/bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
popen failure: Cannot allocate memory
initdb: error: program "postgres" is needed by initdb but was not found in the same directory as "/usr/lib/postgresql/15/bin/initdb"
I, [2025-04-03T17:28:38.987799 #1]  INFO -- : Generating locales (this might take a while)...
  en_US.UTF-8... done
Generation complete.
Upgrading PostgreSQL from version 13 to 15

I, [2025-04-03T17:28:38.988959 #1]  INFO -- : > HOME=/var/lib/postgresql USER=postgres exec chpst -u postgres:postgres:ssl-cert -U postgres:postgres:ssl-cert /usr/lib/postgresql/15/bin/postmaster -D /etc/postgresql/15/main
I, [2025-04-03T17:28:38.991509 #1]  INFO -- : Terminating async processes
2025-04-03 17:28:39.091 UTC [51] FATAL:  database files are incompatible with server
2025-04-03 17:28:39.091 UTC [51] DETAIL:  The data directory was initialized by PostgreSQL version 13, which is not compatible with this version 15.12 (Debian 15.12-1.pgdg120+1).


^C^C^C

العملية لا تستجيب لـ Ctrl+C.

نعم، ستستمر في هذه الحالة. لكننا نفرض تحديثات CLI مرة واحدة على الأقل كل 6 أشهر، لذلك لا أتوقع أن تكون مشكلة كبيرة.

فيما يتعلق بالمواقع، نخطط لإجراء بعض التغييرات بحيث يتم تجميعها “في الوقت المناسب” عند طلبها لأول مرة. يجب أن يكون ذلك أكثر كفاءة، حيث أن معظم المواقع تعمل بلغة واحدة فقط.

3 إعجابات

يبدو هذا سيئًا. هل ذاكرة الخادم منخفضة جدًا؟ هل تم تكوين التبديل (swap)؟

لتحديث قاعدة البيانات، يرجى الرجوع إلى تحديث PostgreSQL 15

إعجاب واحد (1)

يحتوي الخادم على 2 جيجابايت من ذاكرة الوصول العشوائي. تم تعيين التبديل إلى 2 جيجابايت أخرى.

لقد قمت بترقيته من Ubuntu 16 (أعلم) إلى 18 في مكانه، وقمت بتحديث /var/discourse/containers/app.yml ليشمل ثلاثة إعدادات محلية، والآن نجحت هجرة PostgreSQL من الإصدار 13، ويبدو أن أحدث إصدار من Discourse يعمل بسعادة على Ubuntu 18.

4 إعجابات