Skip to content

Add Portainer Swarm stack configuration - #98

Merged
MEECHAIN1 merged 3 commits into
mainfrom
codex/connect-portainer-container-ports
Jun 19, 2026
Merged

MEECHAIN1 merged 3 commits into
mainfrom
codex/connect-portainer-container-ports

Conversation

@MEECHAIN1

@MEECHAIN1 MEECHAIN1 commented Jun 15, 2026 •

Copy link
Copy Markdown
Owner

Motivation

  • Provide an optional Docker Swarm stack to deploy Portainer EE connected to the Portainer Agent so administrators can manage the cluster via Portainer.
  • Include an attachable overlay network and persistent volumes (including an NFS-backed db-data) suitable for Swarm deployments.

Description

  • Add docker-compose.portainer.yml containing agent (mode: global) and portainer (replicated) services and an agent_network overlay network.
  • Define portainer_data volume and an NFS-backed db-data volume in the same volumes: block to avoid duplicate volume blocks.
  • Update README.md to document docker swarm init and docker stack deploy -c docker-compose.portainer.yml portainer usage.

Testing

  • Loaded docker-compose.portainer.yml and docker-compose.yml with js-yaml via Node and verified both files parse and contain a services section.
  • Confirmed docker-compose.yml reports 1 service(s) and docker-compose.portainer.yml reports 2 service(s) when inspected with the parsing script, and both checks succeeded.

Codex Task

Summary by CodeRabbit

  • Documentation

    • เพิ่มส่วน “Portainer (Docker Swarm)” ใน README พร้อมคำแนะนำการติดตั้ง Portainer EE ผ่าน Portainer Agent บน Docker Swarm และคำสั่งตัวอย่างสำหรับ docker swarm init / docker stack deploy รวมถึงพอร์ตที่ต้องเปิด 9443, 9000, 8000
  • New Features

    • เพิ่มไฟล์คอนฟิก Docker Compose สำหรับดีพลอย Portainer บน Docker Swarm ตั้งค่า agent แบบรันบนทุกโหนด (เฉพาะ Linux), จำกัด Portainer ให้ทำงานบน manager, กำหนดพอร์ตแมป และใช้เครือข่าย overlay พร้อม volume สำหรับจัดเก็บข้อมูล

@codesandbox

codesandbox Bot commented Jun 15, 2026

Copy link
Copy Markdown

Review or Edit in CodeSandbox

Open the branch in Web Editor • VS Code • Insiders

Open Preview

@coderabbitai

coderabbitai Bot commented Jun 15, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 8c1bf2d8-0f22-4b58-b1ec-19f72553cf09

📥 Commits

Reviewing files that changed from the base of the PR and between ff4eab7 and 569066a.

📒 Files selected for processing (1)
  • docker-compose.portainer.yml

📝 Walkthrough

Walkthrough

เพิ่มไฟล์ docker-compose.portainer.yml ใหม่สำหรับดีพลอย Portainer EE บน Docker Swarm พร้อม service agent และ portainer ในโหมด global และ replicated ตามลำดับ, overlay network แบบ attachable, port mapping สำหรับ 9443/9000/8000, volume สำหรับข้อมูล Portainer และอัปเดต README.md เพื่ออธิบายขั้นตอนการใช้งานและพอร์ตที่ต้องเปิด

Add new docker-compose.portainer.yml file for deploying Portainer EE on Docker Swarm with agent and portainer services in global and replicated modes respectively, attachable overlay network, port mappings for 9443/9000/8000, volume for Portainer data, and update README.md to document setup instructions and required ports.

Changes

Portainer Docker Swarm Deployment

Layer / File(s) Summary
Portainer Swarm Compose Configuration and Documentation
docker-compose.portainer.yml, README.md
เพิ่มไฟล์ Compose ที่กำหนด service agent (global mode เฉพาะ Linux ผ่าน placement constraint) และ service portainer (replicated 1 replica บน manager node) พร้อม port mapping 9443/9000/8000, overlay network agent_network แบบ attachable, volume portainer_data ที่ mount ไปยัง /data ของ portainer, และคำสั่งเชื่อมต่อ portainer ไปยัง agent ด้วย -H tcp://tasks.agent:9001; README อธิบายการใช้งาน Portainer EE บน Docker Swarm พร้อมตัวอย่างคำสั่ง docker swarm init และ docker stack deploy

Adds Compose file defining agent service (global mode for Linux only via placement constraints) and portainer service (replicated with 1 replica on manager node) with port mapping 9443/9000/8000, attachable overlay network agent_network, portainer_data volume mounted to /data, and portainer connection command -H tcp://tasks.agent:9001; README documents Portainer EE deployment with example docker swarm init and docker stack deploy commands.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐳 Swarm เริ่มต้นด้วยคำสั่งเดียว,
Agent กระจายทั่วทุก Node เบิกบาน,
Portainer EE ขึ้นบน Manager Lane,
พอร์ต 9443 เปิดรับทุกการ,
Overlay Network ผูกข้อมูลแน่น,
Stack Deploy — พร้อมแล้ว! 🚀

Swarm starts with a single command call,
Agents spread through every node tall,
Portainer EE on the Manager's hall,
Port 9443 opens to one and all,
Network overlay binds data tight,
Stack Deploy — ready to take flight! 🚀

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed ชื่อ PR 'Add Portainer Swarm stack configuration' สอดคล้องกับการเปลี่ยนแปลงหลักในชุดการเปลี่ยนแปลง เนื้อหาครอบคลุมการเพิ่มไฟล์ docker-compose.portainer.yml และการอัพเดต README.md สำหรับ Portainer Swarm
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)

✅ Unit Test PR creation complete.

  • Create PR with unit tests
  • Commit unit tests in branch codex/connect-portainer-container-ports

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@railway-app

railway-app Bot commented Jun 15, 2026

Copy link
Copy Markdown

🚅 Deployed to the MeeChain-Connect-pr-98 environment in meechain

5 services not affected by this PR
  • Redis-wHAO
  • Postgres-X79I
  • Postgres
  • MeeChain
  • Redis

@coderabbitai coderabbitai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
README.md (1)

57-64: 💤 Low value

พิจารณาเพิ่มคำอธิบายวัตถุประสงค์ของแต่ละพอร์ต / Consider documenting port purposes

เอกสารระบุพอร์ตที่เปิด แต่ไม่ได้อธิบายว่าแต่ละพอร์ตใช้งานเพื่ออะไร ซึ่งอาจทำให้ผู้ใช้สับสนว่าควรเข้าถึงผ่านพอร์ตไหน

The documentation lists exposed ports but doesn't explain their purposes, which might confuse users about which port to access.

แนะนำเพิ่มคำอธิบายสั้นๆ เช่น:

  • 9443: HTTPS web UI (แนะนำ)
  • 9000: HTTP web UI
  • 8000: Edge agent tunnel

Recommend adding brief explanations, e.g.:

  • 9443: HTTPS web UI (recommended)
  • 9000: HTTP web UI
  • 8000: Edge agent tunnel
📝 ตัวอย่างการปรับปรุงเอกสาร / Documentation improvement example
-ไฟล์ `docker-compose.portainer.yml` เพิ่ม Portainer EE แบบเชื่อมผ่าน Portainer Agent สำหรับ Docker Swarm โดยเปิดพอร์ต `9443`, `9000`, และ `8000`
+ไฟล์ `docker-compose.portainer.yml` เพิ่ม Portainer EE แบบเชื่อมผ่าน Portainer Agent สำหรับ Docker Swarm โดยเปิดพอร์ต:
+- `9443`: HTTPS web UI (แนะนำให้ใช้)
+- `9000`: HTTP web UI
+- `8000`: Edge agent tunnel
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@README.md` around lines 57 - 64, The documentation for the Portainer (Docker
Swarm) section lists the exposed ports (9443, 9000, and 8000) but does not
explain the purpose of each port, which may confuse users about which port to
access. Add brief explanatory text after mentioning the ports to clarify that
9443 is the HTTPS web UI (recommended), 9000 is the HTTP web UI, and 8000 is for
the Edge agent tunnel. This can be done either inline or as a bulleted list
immediately following the port numbers in the docker-compose.portainer.yml
description.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docker-compose.portainer.yml`:
- Line 25: The command for the Portainer service includes the --tlsskipverify
flag which bypasses TLS certificate verification between Portainer and the
agent, creating a security vulnerability. Remove the --tlsskipverify flag and
configure proper TLS certificates for secure communication between Portainer and
the agent, or if this must remain in development environments, create separate
docker-compose configurations (development and production) where --tlsskipverify
is only present in the development configuration file.
- Around line 48-53: The `db-data` volume is declared with NFS configuration but
is not mounted by any service in this compose file, creating confusion and
wasting resources. Either remove the entire `db-data` volume definition (lines
48-53) if it is not needed, or if this volume is planned for future use, add a
clear comment above it explaining its intended purpose. Additionally, replace
the hard-coded IP address `192.168.1.4` in the NFS configuration with an
environment variable reference (using `${VARIABLE_NAME}` syntax) to improve
portability across different environments, and document this required
environment variable clearly in your project documentation or a .env.example
file.

---

Nitpick comments:
In `@README.md`:
- Around line 57-64: The documentation for the Portainer (Docker Swarm) section
lists the exposed ports (9443, 9000, and 8000) but does not explain the purpose
of each port, which may confuse users about which port to access. Add brief
explanatory text after mentioning the ports to clarify that 9443 is the HTTPS
web UI (recommended), 9000 is the HTTP web UI, and 8000 is for the Edge agent
tunnel. This can be done either inline or as a bulleted list immediately
following the port numbers in the docker-compose.portainer.yml description.
🪄 Autofix (Beta)

✅ Autofix completed


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 447c36a6-f724-4e56-b0a5-914061aba1bd

📥 Commits

Reviewing files that changed from the base of the PR and between 456603a and ff4eab7.

📒 Files selected for processing (2)
  • README.md
  • docker-compose.portainer.yml

Comment thread docker-compose.portainer.yml Outdated
Comment thread docker-compose.portainer.yml Outdated
@coderabbitai

coderabbitai Bot commented Jun 18, 2026 •

Copy link
Copy Markdown
Contributor

Note

Autofix is a beta feature. Expect some limitations and changes as we gather feedback and continue to improve it.

Fixes Applied Successfully

Fixed 1 file(s) based on 2 unresolved review comments.

Files modified:

  • docker-compose.portainer.yml

Commit: 569066a4f5024c5db7df8894aa07d993e61d8f9e

The changes have been pushed to the codex/connect-portainer-container-ports branch.

Time taken: 2m 0s

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7a30417f16

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

- "9000:9000"
- "8000:8000"
volumes:
- portainer_data:/data

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Mount the NFS-backed volume for Portainer data

In a Swarm with more than one manager or after replacing the manager node, this still stores Portainer's /data on the local portainer_data volume; the NFS-backed db-data volume declared below is never referenced by any service. That means the Portainer database/configuration will not follow the task if it is rescheduled, despite this stack adding an NFS volume for persistent Swarm storage.

Useful? React with 👍 / 👎.

Fixed 1 file(s) based on 2 unresolved review comments.

Co-authored-by: CodeRabbit <noreply@coderabbit.ai>
@MEECHAIN1
MEECHAIN1 merged commit 1b57df5 into main Jun 19, 2026
2 of 9 checks passed
@MEECHAIN1
MEECHAIN1 deleted the codex/connect-portainer-container-ports branch June 19, 2026 14:10
@railway-app
railway-app Bot temporarily deployed to meechain / MeeChain-Connect-pr-98 June 19, 2026 14:10 Destroyed
@coderabbitai

coderabbitai Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Note

Unit test generation is a public access feature. Expect some limitations and changes as we gather feedback and continue to improve it.


Generating unit tests... This may take up to 20 minutes.

@coderabbitai

coderabbitai Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

✅ Created PR with unit tests: #103

MEECHAIN1 added a commit that referenced this pull request Jun 23, 2026
Unit test generation was requested by @MEECHAIN1.

*
#98 (comment)

The following files were modified:

* `test/docker-compose-portainer.test.js`

This branch was successfully deployed

No deployments
meechain / MeeChain-Connect-pr-98 — 569066a4 Deployed Jun 19, 2026 by railway-app[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant