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

How do I set the port mapping for the side car??? #1180

Closed
2 tasks
mikedice opened this issue May 27, 2024 · 2 comments
Closed
2 tasks

How do I set the port mapping for the side car??? #1180

mikedice opened this issue May 27, 2024 · 2 comments

Comments

@mikedice
Copy link

Please provide us with the following information:

This issue is a: (mark with an x)

  • bug report -> please search issues before submitting
  • [x ] documentation issue or request
  • regression (a behavior that used to work and stopped in a new release)

Issue description

I want to deploy a container app that consists of two containers. One container is implementing a web application (SPA like web app with a few server side features). I wanted to enhance this app with the ability to perform CRUD operations on Azure Storage. I thought it would be cool to split out the whole storage piece into a side car so I made another app that implements all the storage authorization and access. On localhost, this is how the sidecar container gets started:

docker run --rm -p 2112:2112 --env-file ./.env --env AZURE_CLIENT_SECRET="$us" --env AZURE_CLIENT_ID="$cid" --env AZURE_TENANT_ID="$tid" la-puerta-b-api:1 

Inside the side car container NodeJS with Express is running and a bunch of Azure stuff. On my localhost, the web app accesses the side car using URLs like http://localhost:2112/api/xxx. All this works fine on my localhost

Now I want to deploy all of this into my Azure container app. However, I cannot find anywhere in the Azure Portal where I can tell the container app that the la-puerta-b-api container needs to map port 2112 from inside the container to port 2112 on the host so that http://localhost:2112/api/xx will work in the container app. Since I cannot figure out how to configure the port mapping on the sidecar, the app gets a connection error when it tries to connect to http://localhost:2112/api/xx

My container app sidecar exploration has failed and now I am stuck.

Steps to reproduce

  1. I am using Azure Portal to deploy and configure everything

Expected behavior [What you expected to happen.]
A port mapping field somewhere that I can set the port mapping for the side car

Actual behavior [What actually happened.]
No place that I can see or find that says how to set the port mapping for the side car. I am stuck

@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs: triage 🔍 Pending a first pass to read, tag, and assign label May 27, 2024
@anthonychu
Copy link
Member

You don't need to specify the container port. All containers share networking and can reach each other on localhost. So you just need to start the sidecar container as usual, and it'll listen to 2112. Your main app would listen to a different port. If you want to expose the main app outside the environment, you would enable external HTTP ingress and set the target port to the main app's port. Let me know if that works.

@anthonychu anthonychu added Needs: Author Feedback and removed Needs: triage 🔍 Pending a first pass to read, tag, and assign labels May 31, 2024
Copy link
Contributor

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants