مؤخرًا قمت بنقل خادم Dell الخاص بي من موقع إلى آخر. نظام التشغيل الرئيسي/مدير الآلات الافتراضية هو Proxmox VE 5.3. لدي آلة افتراضية تعمل بنظام Nginx تقوم بعكس التوجيه (Reverse Proxy) لعدة آلات افتراضية أخرى، إحداها هي آلة Discourse الافتراضية.
بعد إعداد الموجه (Router) الجديد، تمكنت من توصيل عدة من آلاتي الافتراضية بالإنترنت (دون الحاجة حتى إلى تجديد شهادات SSL). ومع ذلك، عند محاولة الوصول إلى Discourse عبر المتصفح، أتحصل على رسالة خطأ 502 Bad Gateway - nginx/1.14.0 (Ubuntu).
لقد تلقيت هذا الخطأ من قبل، ولكن عادة ما يتم حله بإحدى الطرق التالية:
إعادة تشغيل آلة Discourse الافتراضية
لا يزال الخطأ 502 Bad Gateway - nginx/1.14.0 (Ubuntu) يظهر في المتصفح.
مسح ملفات تعريف الارتباط (Cookies) في المتصفح وتجربة متصفحات مختلفة
فقط في حال كانت المشكلة من جهتي… لا. نفس الخطأ 502 Bad Gateway - nginx/1.14.0 (Ubuntu) يظهر في متصفحات مختلفة.
تنظيف Discourse وفحص مساحة القرص
في البداية، عند التنظيف، تم حذف حوالي 4 جيجابايت من البيانات. لقد فوجئت جدًا. ربما كان هذا هو السبب في المشكلة من الأساس؟ على أي حال، الآن عندما أحاول تنظيف Discourse:
> root@forum:/var/discourse# ./launcher cleanup
> WARNING! This will remove all stopped containers.
> Are you sure you want to continue? [y/N] y
> Total reclaimed space: 0B
> WARNING! This will remove all images without at least one container associated to them.
> Are you sure you want to continue? [y/N] y
> Total reclaimed space: 0B
أود أيضًا التأكيد على أنني ليست نفدت مساحة القرص:
سحب Git
النظام محدث.
> root@forum:/var/discourse# git pull
> Already up to date.
إعادة تشغيل Discourse
هنا اكتشفت خطأين أحصل عليهما:
> root@forum:/var/discourse# ./launcher restart app
>
> 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
>
> Unable to find image 'discourse/base:2.0.20191013-2320' locally
> /usr/bin/docker: Error response from daemon: Get https://registry-1.docker.io/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers).
> See '/usr/bin/docker run --help'.
> Your Docker installation is not working correctly
>
> See: `https://meta.discourse.org/t/docker-error-on-bootstrap/13657/18?u=sam`
راجعت الرابط المقترح. يوصي الرابط بإجراء سحب Git و إعادة بناء Discourse (وسترى ما أحصل عليه لاحقًا أدناه). كما يقترح تشغيل أمر Docker “Hello World”. يعمل الأمر (على الرغم من أنه يبدو أن هناك بعض المشاكل؟):
> root@forum:/var/discourse# docker run -it --rm hello-world
> Unable to find image 'hello-world:latest' locally
> latest: Pulling from library/hello-world
> 1b930d010525: Pull complete
> Digest: sha256:c3b4ada4687bbaa170745b3e4dd8ac3f194ca95b2d0518b417fb47e5879d9b5f
> Status: Downloaded newer image for hello-world:latest
>
> Hello from Docker!
> This message shows that your installation appears to be working correctly.
>
> To generate this message, Docker took the following steps:
> 1. The Docker client contacted the Docker daemon.
> 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
> (amd64)
> 3. The Docker daemon created a new container from that image which runs the
> executable that produces the output you are currently reading.
> 4. The Docker daemon streamed that output to the Docker client, which sent it
> to your terminal.
>
> To try something more ambitious, you can run an Ubuntu container with:
> $ docker run -it ubuntu bash
>
> Share images, automate workflows, and more with a free Docker ID:
> https://hub.docker.com/
>
> For more examples and ideas, visit:
> https://docs.docker.com/get-started/
>
> failed to resize tty, using default size
حسنًا، جربت بعد ذلك Ubuntu Bash … وظهر خطأ:
> root@forum:/var/discourse# docker run -it ubuntu bash
> Unable to find image 'ubuntu:latest' locally
> docker: Error response from daemon: Get https://registry-1.docker.io/v2/library/ubuntu/manifests/latest: Get https://auth.docker.io/token?scope=repository%3Alibrary%2Fubuntu%3Apull&service=registry.docker.io: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers).
> See 'docker run --help'.
حان الوقت للانتقال إلى بعض الطرق الأخرى التي أعرفها:
إيقاف وتشغيل Discourse
أحصل على نفس النتيجة كما في حالة إعادة التشغيل:
> root@forum:/var/discourse# ./launcher stop app
>
> 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
>
> Unable to find image 'discourse/base:2.0.20191013-2320' locally
> /usr/bin/docker: Error response from daemon: Get https://registry-1.docker.io/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers).
> See '/usr/bin/docker run --help'.
> Your Docker installation is not working correctly
>
> See: `https://meta.discourse.org/t/docker-error-on-bootstrap/13657/18?u=sam`
>
> root@forum:/var/discourse# ./launcher start app
>
> 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
>
> Unable to find image 'discourse/base:2.0.20191013-2320' locally
> /usr/bin/docker: Error response from daemon: Get https://registry-1.docker.io/v2/discourse/base/manifests/2.0.20191013-2320: Get https://auth.docker.io/token?scope=repository%3Adiscourse%2Fbase%3Apull&service=registry.docker.io: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers).
> See '/usr/bin/docker run --help'.
> Your Docker installation is not working correctly
>
> See: `https://meta.discourse.org/t/docker-error-on-bootstrap/13657/18?u=sam`
إعادة بناء Discourse
وأحصل على نفس الخطأين مرة أخرى.
> root@forum:/var/discourse# ./launcher rebuild app
>
> 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
>
> Unable to find image 'discourse/base:2.0.20191013-2320' locally
> /usr/bin/docker: Error response from daemon: Get https://registry-1.docker.io/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers).
> See '/usr/bin/docker run --help'.
> Your Docker installation is not working correctly
>
> See: https://meta.discourse.org/t/docker-error-on-bootstrap/13657/18?u=sam
الاستعادة من نسخة احتياطية سابقة
لدي نسخة (Snapshot) من وقت قبل نقل الخادم وإجراء التنظيف (والذي، كما ذكرت، حذف حوالي 4 جيجابايت من الملفات). جربت كل ما سبق مرة أخرى … ونفس النتيجة (باستثناء التنظيف)، بالإضافة إلى 502 Bad Gateway - nginx/1.14.0 (Ubuntu) في المتصفح. إذن ربما لا علاقة لهذا بالتنظيف؟
في كل وقت قضيتُه مع Discourse، لم أواجه أيًا من هذين الخطأين من قبل. هل لديك أي اقتراحات حول ما يمكنني فعله لحل هذه الأخطاء وجعل Discourse يعمل في المتصفح؟
