-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
feat: customize port number #5393
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: next
Are you sure you want to change the base?
Conversation
fyi you can also do this by creating this file here with the contents: services:
coolify:
ports: !override
- "1234:8080" this is useful if you need to remove ports altogether if on cloudflared etc, you can just use |
@coderabbitai review |
📝 WalkthroughSummary by CodeRabbit
WalkthroughListen up, meatbags. The update introduces a new environment variable, Changes
Sequence Diagram(s)sequenceDiagram
participant U as User
participant I as install.sh
participant ENV as .env Generator
participant Msg as Output Messages
U->>I: Invoke install.sh [-p PORT]
I->>I: Parse options (-p/--port) and validate input
alt Valid Port Specified?
I->>I: Set PORT to provided value
else
I->>I: Default PORT to 8000
end
I->>ENV: Generate .env file with APP_PORT
ENV-->>I: .env file created
I->>Msg: Update output messages with dynamic PORT
Msg-->>U: Display updated access URLs
sequenceDiagram
participant U as User
participant UPG as upgrade.sh
participant ENV as .env Reader
U->>UPG: Invoke upgrade.sh
UPG->>ENV: Read APP_PORT from /data/coolify/source/.env
alt APP_PORT exists?
ENV-->>UPG: Return APP_PORT value
else
UPG->>UPG: Default PORT to 8000
end
UPG->>U: Proceed with configuration downloads using PORT
✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (4)
.env.production
(1 hunks)README.md
(1 hunks)scripts/install.sh
(5 hunks)scripts/upgrade.sh
(1 hunks)
🧰 Additional context used
🪛 markdownlint-cli2 (0.17.2)
README.md
24-24: Fenced code blocks should be surrounded by blank lines
null
(MD031, blanks-around-fences)
26-26: Fenced code blocks should be surrounded by blank lines
null
(MD031, blanks-around-fences)
🔇 Additional comments (6)
scripts/upgrade.sh (1)
12-15
: Dynamic Port Retrieval – No more guessing, only facts!
The upgrade script now correctly extractsAPP_PORT
from the environment file and defaults to 8000 when not set. This straightforward approach ensures your Docker container isn’t left hanging with a mysterious port. Good work, soldier.scripts/install.sh (5)
24-24
: Default Port Initialization – Setting your aim for 8000!
InitializingPORT=8000
as the default is a solid start. This ensures the server won’t misfire when no custom port is provided. Keep it simple, just like a well-balanced taco.
48-52
: Numeric Port Validation – No rogue letters allowed!
The regex check ensuring that$PORT
contains only digits is on point. This guards against non-numeric inputs that could crash your server faster than a half-eaten taco.
54-58
: Customized Greeting – Shouting out your custom port clearly!
The conditional message distinguishing between the default port and a user-defined port is clear and informative. Now, your users will know exactly where to hit up Coolify—whether they like plain 8000 or something spicier.
717-721
: Environment File Update – Propagating that port like hot salsa!
The sed command updating theAPP_PORT
in the backup .env file ensures that your custom port setting rides along with the rest of the configuration. This is a neat and secure way to propagate your new port choice.
826-837
: Dynamic Access URL Display – Your server now talks with clarity!
The echo commands updating the public and private access URLs to include the custom port are on target. Users will see the correct port in the access message, ensuring they don’t end up on a ghost port. Tacos and servers alike appreciate clarity.
APP_ID= | ||
APP_NAME=Coolify | ||
APP_KEY= | ||
APP_PORT= |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧹 Nitpick (assertive)
APP_PORT Variable Addition – Hasta la vista, hardcoding!
The new APP_PORT=
entry is correctly positioned between APP_KEY
and DB_USERNAME
. Since the installation script provides a default of 8000 if left empty, this placeholder is acceptable. Just make sure to document that empty means “default port 8000” for clarity.
If you want to customize the port for running Coolify, which is 8000 by default, you can specify it with the following command: | ||
```bash | ||
curl -fsSL https://cdn.coollabs.io/coolify/install.sh | bash -s -- --port {{PORT_NUMBER}} | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧹 Nitpick (assertive)
Enhanced Documentation – Tacos and ports for everyone!
The README now clearly explains how to install Coolify with a custom port using the --port
option. However, markdownlint warning MD031 suggests surrounding fenced code blocks with blank lines—adding these extra newlines would keep your documentation as neat as a well-organized taco truck.
Proposed diff:
-If you want to customize the port for running Coolify, which is 8000 by default, you can specify it with the following command:
-```bash
-25~
-curl -fsSL https://cdn.coollabs.io/coolify/install.sh | bash -s -- --port {{PORT_NUMBER}}
-26~
-```
+If you want to customize the port for running Coolify, which is 8000 by default, you can specify it with the following command:
+
+```bash
+curl -fsSL https://cdn.coollabs.io/coolify/install.sh | bash -s -- --port {{PORT_NUMBER}}
+```
🧰 Tools
🪛 markdownlint-cli2 (0.17.2)
24-24: Fenced code blocks should be surrounded by blank lines
null
(MD031, blanks-around-fences)
26-26: Fenced code blocks should be surrounded by blank lines
null
(MD031, blanks-around-fences)
while getopts "p:-:" opt; do | ||
case "$opt" in | ||
p) PORT="$OPTARG" ;; | ||
-) | ||
case "$OPTARG" in | ||
port) PORT="${!OPTIND}"; OPTIND=$((OPTIND + 1)) ;; | ||
*) echo "Invalid option: --$OPTARG" >&2; exit 1 ;; | ||
esac | ||
;; | ||
?) echo "Usage: $0 [-p port] [--port port]" >&2; exit 1 ;; | ||
esac | ||
done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧹 Nitpick (assertive)
Robust Getopts Parsing – Making your port command-line friendly!
The new getopts loop to support -p
and --port
is working hard for you. It cleanly assigns the custom port value. Consider quoting variables like "${OPTARG}"
for extra safety, but overall it’s a killer move.
I was kinda surprised to find that so many ports were open - given that it sets up Traefik proxy, why does port 6001, 6002, 8000 and 8080 have to be exposed at all? The containers communicate on the Docker network so is there any reason for these to be exposed? I disabled them and haven't noticed any issues so far: `/data/coolify/source/docker-compose.custom.yml':
(thanks @djsisson for hint on how to reset!)
Comment out port 8080:
|
It was a mistake, sorry. I recreated the |
@colinmollenhour these ports are there for cases when the Traefik proxy might go down, so people can continue to access Coolify and use all its features easily. Port 8000 is being used by the Coolify Dashboard and 6001 + 6002 are then needed for communication with the realtime service via websocket connections. (I can't remember from the top of my head what 8080 was for again). |
@Cinzya 8080 is for traefik dashboard all 3 ports are only required when the proxy is down (6001, 6002, 8000) so having them open all the time is not required if the proxy goes down, you can always manually restart it, so outside of inital installation imo, they can be closed a different solution would be to have a bootstrap nginx in the compose, which you can start/stop to open close those ports during installation / no proxy / restoration etc i.e if coolify detects the proxy is not running, it would start the nginx container so be accessible on 8000, then when proxy is running it owuld stop it again, thus minimizing the amount of open ports the reason for wanting to close them is, it is very easy to restrict access to domains externally using say cloudflare or traefik failtoban plugins. but you can't when there is a direct connection to the container always open. |
Opening ports unnecessarily is bad security practice. If anything, they could just be opened on the localhost:
This way you can easily access it from within a remote SSH session or using a temporary http tunnel like ngrok, but it's not exposed to the public 24/7. |
Hi, I am a back-end developer at a Korean startup. While deploying an application web server as a Docker container on a self-hosted Ubuntu server, I integrated Coolify for its CI/CD. However, I found it inconvenient that the port for Coolify was fixed at 8000. Since this is my first contribution, it might not be perfect, but I wanted to improve this aspect and suggest a feature to customize the port when installing Coolify on self hosted servers.
Submit Checklist (REMOVE THIS SECTION BEFORE SUBMITTING)
next
branch as the destination for my PR, notmain
.Changes
section.Issues
section with the issue/discussion link(s) (if applicable).Changes
This PR adds support for specifying a custom port number when installing Coolify on a self-hosted server. The following changes have been made:
install.sh
) to allow specifying a custom port using the--port (-p)
option instead of the default 8000 if needed.APP_PORT
key, so that .env file'sAPP_PORT
can have the provided custom port number or falling back to 8000 if not specified.upgrade.sh
to reference theAPP_PORT
value from the .env file, ensuring that the Coolify Docker container runs on the specified port.curl -fsSL https://cdn.coollabs.io/coolify/install.sh | sudo bash -s -- --port {{PORT_NUM}}
Let me know if there's anything that needs improvement!
Issues