Skip to content
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

binding a random api port #3528

Merged
merged 1 commit into from
Feb 21, 2024
Merged

binding a random api port #3528

merged 1 commit into from
Feb 21, 2024

Conversation

heiytor
Copy link
Contributor

@heiytor heiytor commented Feb 9, 2024

Introduces a new SHELLHUB_API_PORT variable, which allows the API to
randomly select a port when it starts up.

While binding the API to port 8080 might seem convenient, it can lead to
collision errors when running multiple Docker Compose instances (e.g.,
testcontainers) because each instance shares the same network.

To illustrate, consider two separate Docker Compose instances labeled
"A" and "B". In "A", a gateway is running on port 11111, and in "B", a
gateway is running on port 22222. Since both APIs are running on port
8080 and both instances share the same network, gateway "A" might
mistakenly request data from "B", and vice versa.

!Note: Due to the use of internalclient, this environment should be
sent to other services such as "ssh".

@heiytor heiytor self-assigned this Feb 9, 2024
@heiytor heiytor requested review from a team as code owners February 9, 2024 19:37
@heiytor heiytor force-pushed the chore/api-port branch 2 times, most recently from bcdb3a6 to 5e274c0 Compare February 9, 2024 20:10
otavio
otavio previously approved these changes Feb 9, 2024
@heiytor heiytor changed the base branch from master to ref/internal-client February 19, 2024 17:21
@heiytor heiytor force-pushed the ref/internal-client branch 3 times, most recently from 9586a4d to 910da50 Compare February 19, 2024 18:27
@heiytor heiytor force-pushed the chore/api-port branch 2 times, most recently from 8f75cb6 to b7f69bb Compare February 20, 2024 12:58
Base automatically changed from ref/internal-client to master February 21, 2024 12:05
Introduces a new `SHELLHUB_API_PORT` variable, which allows the API to
randomly select a port when it starts up.

While binding the API to port 8080 might seem convenient, it can lead to
collision errors when running multiple Docker Compose instances (e.g.,
testcontainers) because each instance shares the same network.

To illustrate, consider two separate Docker Compose instances labeled
"A" and "B". In "A", a gateway is running on port 11111, and in "B", a
gateway is running on port 22222. Since both APIs are running on port
8080 and both instances share the same network, gateway "A" might
mistakenly request data from "B", and vice versa.

> !Note: Due to the use of internalclient, this environment should be
  sent to other services such as "ssh".
@gustavosbarreto gustavosbarreto merged commit 0fea6fd into master Feb 21, 2024
8 checks passed
@gustavosbarreto gustavosbarreto deleted the chore/api-port branch February 21, 2024 12:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants