استخدام صورة Docker المبنية بواسطة Launcher في docker-compose

I’ve been asked to make a docker-compose file for a discourse project I’m working on to make it as simple as possible for developers and sysadmins we’re working with to fire up a discourse instance to test against.

I’ve read through Can Discourse ship frequent Docker images that do not need to be bootstrapped? and came away the notions that ./launcher was really necessary in order to keep the right versions of software in play, to make installation of plugins seamless and deterministic, and to enable software upgrades via the web UI, all ./launcher was doing was working out the correct command line options to send to docker, using docker-compose to build the image did not work given the complexities involved, and interestingly, that I could just use the docker image created by ./launcher and use that with docker-compose.

I rebuilt the app, copied the final command to launch the instance, converted that to a docker-compose.yml file and started the container. I just have the init scripts to go.

I’m thinking I’d have the scripts … the initial init scripts being accessible in the shared folder and getting using docker-compose run or docker exec to get to the bootstrapping.

Has anyone done this?
Are there any guides as to what subset of scripts need to be run is the base image has already been built?

Cheers and thanks

Keith John Hutchison

Background Research.

I’ve read through install-with-docker-compose and it works well enough … main issues is it’s slightly behind the official release, and there is no command line support for discourse and rails.

I’ve since discovered that adding discourse and rails command line support will be trivial as they are bash scripts.

I’ve read through Beginners Guide to Install Discourse for Development using Docker and I got a local instance of docker running on my Mac.

The main issue here was I had to bootstrap the image which is something I’ve been asked to avoid.

I restored locally after running discourse enable_restore from a staging backup and it looks good.

I’ve investigated bitnami/discourse. It worked … main issues was it was a fair bit behind the official image, quite a bit different with paths and it was slower than Install with Docker compose

Yes.

No. The only supported way to run discourse is through launcher. If you do it at other way, you’re on your own. If you use bitnami you will need to get support from them, and I’m pretty sure they provide none

If you have a budget, I might be able to help. My contact info is in my profile.

G’day Jay

I wasn’t asking for help with Bitnami … that was just background. It would be too different from the staging environments that uses .launcher.

I’m following the lead from Can Discourse ship frequent Docker images that do not need to be bootstrapped? - #26 by sam which basically said using the output from .launcher is the way to go if you want to use docker-composer.

But is it simple if said image ends up not being representative, lags behind official releases and said developers and sysadmins are unable to get support here?

It’s always frustrating for users when tell them their install is completely unsupported, you’re effectively asking for guidance in building another unsupportable install. Do the IndieHosters understand that you/they will be totally on their own with this?

I totally agree. That’s why I suggested to our dev lead not to use the bitnami/discourse images, why he asked me to research the best way forward and why I’ve chosen to use the image(s) created by ./launcher as suggested by

So the question for me now is, how to generate the base image(s) using launcher and bring up the environment using compose?

I’ve already tried using the image created by ./launcher rebuild app.
I’m about to look at ./launcher bootstrap app.

… bootstrap is called by rebuild so there would be no difference in the resultant image …

The image from bootstrap is fine, in fact it is running here on meta, PG is running on AWS RDS, Redis in a dedicated container.

I know the image is fine Sam. We’re using it on a staging server. I clearly understand that what is lacking here currently is my knowledge on how to run the scripts required to setup the shared folders within docker-compose.

I am super confused at why you would even want to involve compose.

This gives your devs an ultra easy setup path on local:

In production … why would you even think about deploying with compose? In general production container orchestration happens in either scripts or kubernates or some other dedicated production tool.

It’s only for testing instances

Mainly because I’ve been asked to by our team lead. His argument is when testing … he doesn’t want to rely on sysadmins, or devs knowing how to set up discourse other than doing docker-compose up -d.

I agree … I followed the instructions and it didn’t take a lot of time to set up. The main issue I will have is selling the idea of running the scripts

I am still not following at all, maybe ask your dev manager to post here explaining why our officially supported docker dev setup is a problem.

I asked if Beginners Guide to Install Discourse for Development using Docker would suffice.

The answer was yes.

I am not associated with the OP here, but I can tell you why I want a docker compose file rather than a shell script:

  1. Shell scripts tend to not work on Windows.
  2. The shell script requires git, my docker hosts only have a bare OS and docker installed. They are, by design, incredibly lean and bare.
  3. Docker compose files can, with a little work, be converted to docker swarm files which can be run on my infrastructure and managed with docker swarm management tooling.
  4. Every other piece of my infrastructure is managed via docker-swarm tooling. Having a single piece of infrastructure that is an outlier adds a large amount of cognitive overhead that I need to store somewhere and will certainly be lost/forgotten when it comes time to upgrade (every other piece of our infrastructure gets upgrades by just updating image version in docker swarm file).

What I would like to see is a template docker swarm or docker compose file that I can use, which references an image published to Docker Hub, and I can configure by just editing the various swarm file settings.

I haven’t yet tried running the scripts locally to see if I can extract the compose file, but it sounds like that is my best bet to not have Discourse be some oddball outlier in my system. I would prefer if I didn’t need to go run a script just to generate a sample docker-compose/swarm file and if instead I could just see one in docs or a gist or something.

أريد أن أتمكن من إجراء جميع عمليات بناء Docker على خادم بناء منفصل عن الخادم الذي أستخدمه في الإنتاج. لماذا نستخدم Docker إذا كان مجرد مجموعة من السكربتات المطلوبة على المضيف؟

أريد على خادم الإنتاج أن يكون Docker مثبتًا في وضع Swarm، مع القدرة على تسجيل الدخول إلى سجلي (registry) لسحب ما هو مطلوب. كما أريد أن أتمكن من تشغيل مثلاً 3 نسخ من أي حاوية عبر 3 عقد (بحيث تكون أي وحدات تخزين أو نقاط ربط (bind mounts) إلى المضيف قابلة للإدارة بسهولة).

أنا مستعد تمامًا للبناء واتباع الطريقة المدعومة رسميًا من Discourse على خادم الاختبار (staging).

سأشير إلى أن Swarm Docker في الإنتاج الذي أتحدث عنه سيتضمن العديد من المنتجات الأخرى على نفس المجموعة (cluster).

أخطط لفحص جميع الحاويات على خادم الاختبار المدعوم رسميًا من Discourse باستخدام أمر docker inspect، ثم دفع جميع صور Docker المُنشأة مسبقًا إلى سجل (registry)، ومحاولة نشرها على مجموعة Swarm في الإنتاج.

إذا تمكنت من تحقيق ذلك، سأشارك التفاصيل هنا.

أود تقسيم النظام إلى حاويات متعددة. من ما لاحظته، يتعامل الإصدار المدعوم رسميًا من Discourse مع Docker كما لو كان آلة افتراضية (VM)، ويقوم بكل شيء داخل حاوية واحدة (كيف يمكنك توسيع نطاق مكون واحد فقط عند الضرورة؟).

ربما يكون الإصدار مفتوح المصدر المدعوم عمدًا غير متوافق مع مديري التوزيع (orchestration managers) لكي يتمكنوا من الحصول على عقود لإدارة عمليات النشر التي تتطلب نطاقًا ضخمًا. هذا النموذج مقبول بالنسبة لي. يجب أن يكون لديهم كل الحق في كسب المال من خلال تثبيت Discourse على مجموعات Swarm أو Kubernetes جاهزة للإنتاج ومستقرة بالفعل.

لا أقول إن هذا هو مصدر بعض دخلهم، بل مجرد تخمين. ليس من المهم ما إذا كانوا كذلك أم لا، بل فقط الإشارة إلى أنهم غير ملزمون بأي شكل من الأشكال بدعم أي شيء غير الآليات المدعومة حاليًا. يجب فقط الاعتراف بأن الطريقة المدعومة ليست ودية تجاه مجموعات التوزيع (orchestration clusters) الجاهزة للإنتاج.

فهمي هو أن الهدف هو تسهيل الدعم؛ حيث يستخدم CDKC الإصدار المفتوح المصدر، وهم يحققون دخلهم من الاستضافة، وهذا الدخل يمول الدعم المجاني الذي يقدمونه للإصدار المدعوم رسميًا.

هناك دليل لتقسيم الحاويات هنا Multisite configuration with Docker

لقد تمكنا من تشغيل مثيل واحد باستخدام docker-compose، لذا فإن ما تهدف إليه ممكن بالتأكيد.

هل قمت بفتح المصدر؟ سيكون رائعًا رؤية بعض الأمثلة.

لقد استخدمنا إصدارًا أقدم من libre.sh / compose / Discourse · GitLab كدليل. يجب أن يساعدك ذلك على البدء.

مرحبًا.
نحن في مايو 2020، ولا يزال هذا المجال محل جدل كبير من حيث الاستخدام.

لقد قرأت كل المواضيع التي تمكنت من العثور عليها حول دعم Discourse الحالي لـ Docker، ومررت بخمسة مراحل من الحزن بشأن هذا الأمر - والآن وصلت إلى مرحلة الاستسلام.

السياق:

أنا أدير مجموعة Docker (Docker Swarm) تشغّل كل شيء لمواقعنا وأعمالنا. لا أريد شراء أو صيانة خادم افتراضي (VPS) إضافي فقط لاستضافة منتدى.

أريد ببساطة نشر صورة Discourse على هذه المجموعة باستخدام حاويات منفصلة حتى أتمكن من توسيع النطاق بشكل مختلف حسب الحاجة. حتى الآن، فشلت في ذلك. لا ينبغي أن يكون هذا الأمر صعبًا إلى هذا الحد.

لقد قمت بذلك مع قواعد كود أكثر تعقيدًا وقابلة للمقارنة مثل Gitlab وSentry في ساعة أو ساعتين فقط. هذه هي أسبوعي الثالث وأنا أحاول الحصول على حل يعمل مع Discourse، ولا يزال لا توجد تثبيت موثوق.

يبدو لي أن…

  • Discourse غني بالميزات، موجود منذ فترة، ويحظى بمساهمين شغوفين ومهرة.
  • كان Discourse من أوائل المتبنين لتقنية الحاويات، وقد فعل ما فعله باستخدام الأدوات والمعرفة المتاحة في ذلك الوقت.
  • غالبًا ما يتم الرد على الانتقادات الموجهة لكيفية قيامه بما يقوم به بردود فعل دفاعية.
  • لا توجد إرشادات واضحة وحاسمة بشأن هذه المشكلة بالذات، وهي مشكلة طرحها الكثيرون خلال السنوات الماضية، وسيطرحها الكثيرون في المستقبل فيما يتعلق بتنسيق المجموعات (cluster orchestration).
  • أداة Launcher وما شابهها جيدة لآلة Docker واحدة، وهي سكريبت رائع يناسب حالة استخدام شائعة. لكن تجربتي في استخدامها لإنشاء صورة قابلة للنقل كانت فاشلة.

أشياء تبدو سخيفة:

  • الردود السلبية العدوانية على المخاوف المشروعة التي يثيرها أشخاص يحاولون ببساطة إنجاز جزء صغير من عملهم.
  • الإصرار على أن Launcher هي الطريقة الوحيدة التي يجب أن تعمل بها.
  • الإشارة إلى “التوثيق” في مواضيع قديمة وغير محدثة، مع توقع أن يقضي الناس وقتًا طويلاً في قراءة مثل هذا المحتوى فقط لتثبيت شيء ما.

يمكننا أن نفعل أفضل من هذا.

الطلب / العرض:
أنا مستعد لقضاء وقتي مع شخص يعرف كيفية عمل Launcher لإنشاء دليل خطوة بخطوة لإنشاء تثبيتات حاويات منفصلة قابلة للتكرار - مع فيديو.

من مستعد للانضمام إلينا في هذا؟