assigning unique ports each app under go lang

Signed-off-by: MD Ashique <noorani.ashique5@gmail.com>
This commit is contained in:
MD Ashique 2023-03-09 16:13:21 +05:30
parent 9f86e54d12
commit ea182d5610
7 changed files with 7 additions and 7 deletions

View File

@ -60,7 +60,7 @@ timeout_seconds: 30
--> -->
```bash ```bash
dapr run --app-id batch-sdk --app-port 6002 --dapr-http-port 3502 --dapr-grpc-port 60002 --resources-path ../../../components -- go run . dapr run --app-id batch-sdk --app-port 6004 --dapr-http-port 3502 --dapr-grpc-port 60002 --resources-path ../../../components -- go run .
``` ```
<!-- END_STEP --> <!-- END_STEP -->

View File

@ -105,7 +105,7 @@ func main() {
var appPort string var appPort string
var okHost bool var okHost bool
if appPort, okHost = os.LookupEnv("APP_PORT"); !okHost { if appPort, okHost = os.LookupEnv("APP_PORT"); !okHost {
appPort = "6002" appPort = "6004"
} }
r := mux.NewRouter() r := mux.NewRouter()

View File

@ -27,7 +27,7 @@ sleep: 15
```bash ```bash
cd ./order-processor cd ./order-processor
dapr run --app-port 6002 --app-id order-processor-sdk --app-protocol http --dapr-http-port 3501 --resources-path ../../../components -- go run . dapr run --app-port 6005 --app-id order-processor-sdk --app-protocol http --dapr-http-port 3501 --resources-path ../../../components -- go run .
``` ```
<!-- END_STEP --> <!-- END_STEP -->

View File

@ -20,7 +20,7 @@ var sub = &common.Subscription{
func main() { func main() {
appPort := os.Getenv("APP_PORT") appPort := os.Getenv("APP_PORT")
if appPort == "" { if appPort == "" {
appPort = "6002" appPort = "6005"
} }
// Create the new server on appPort and add a topic listener // Create the new server on appPort and add a topic listener

View File

@ -26,7 +26,7 @@ sleep: 15
```bash ```bash
cd ./order-processor cd ./order-processor
dapr run \ dapr run \
--app-port 6001 \ --app-port 6006 \
--app-id order-processor \ --app-id order-processor \
--app-protocol http \ --app-protocol http \
--dapr-http-port 3501 \ --dapr-http-port 3501 \

View File

@ -2,7 +2,7 @@ version: 1
apps: apps:
- appDirPath: ./order-processor/ - appDirPath: ./order-processor/
appID: order-processor appID: order-processor
appPort: 6001 appPort: 6006
command: ["go", "run", "."] command: ["go", "run", "."]
- appID: checkout - appID: checkout
appDirPath: ./checkout/ appDirPath: ./checkout/

View File

@ -28,7 +28,7 @@ func main() {
// Start the server listening on port 6001 // Start the server listening on port 6001
// This is a blocking call // This is a blocking call
err := http.ListenAndServe(":6001", r) err := http.ListenAndServe(":6006", r)
if err != http.ErrServerClosed { if err != http.ErrServerClosed {
log.Println("Error starting HTTP server") log.Println("Error starting HTTP server")
} }