diff --git a/generator/generators/app/copyVariableFiles.js b/generator/generators/app/copyVariableFiles.js index 6a62615..88a21cc 100644 --- a/generator/generators/app/copyVariableFiles.js +++ b/generator/generators/app/copyVariableFiles.js @@ -3,8 +3,10 @@ const ports = require('./usedPorts.json'); module.exports.run = (self, addEvents, apiSpec) => { let port = 3500; + let dbport = 5400; while (ports.used.includes(port)) { port += 1; + dbport += 1; } self.fs.copyTpl( @@ -20,7 +22,7 @@ module.exports.run = (self, addEvents, apiSpec) => { self.fs.copyTpl( self.templatePath('docker-compose.local.yaml.ejs'), self.destinationPath('docker-compose.local.yaml'), - { port }, + { port, dbport }, ); ports.used.push(port); diff --git a/generator/generators/app/templates/.env.default b/generator/generators/app/templates/.env.default index 5a3fcb0..febfd6a 100644 --- a/generator/generators/app/templates/.env.default +++ b/generator/generators/app/templates/.env.default @@ -1,4 +1,5 @@ -SERVER_PORT=3500 +SERVER_EXPOSED_PORT= +DB_EXPOSED_PORT= PRISMA_MANAGEMENT_API_SECRET=wsflk897dh%£ diff --git a/generator/generators/app/templates/.env.default.with-kafka b/generator/generators/app/templates/.env.default.with-kafka index ff711da..5f97f4f 100644 --- a/generator/generators/app/templates/.env.default.with-kafka +++ b/generator/generators/app/templates/.env.default.with-kafka @@ -1,4 +1,5 @@ -SERVER_PORT=3500 +SERVER_EXPOSED_PORT= +DB_EXPOSED_PORT= PRISMA_MANAGEMENT_API_SECRET=wsflk897dh%£ diff --git a/generator/generators/app/templates/docker-compose.local.yaml.ejs b/generator/generators/app/templates/docker-compose.local.yaml.ejs index 9820d71..81640d6 100644 --- a/generator/generators/app/templates/docker-compose.local.yaml.ejs +++ b/generator/generators/app/templates/docker-compose.local.yaml.ejs @@ -2,7 +2,7 @@ version: '3' services: app: ports: - - '${SERVER_PORT:-<%= port %>}:3500' + - '${SERVER_EXPOSED_PORT:-<%= port %>}:3500' networks: - kafka_broker @@ -23,6 +23,8 @@ services: postgres: image: postgres:10.3 + ports: + - '${DB_EXPOSED_PORT:-<%= dbport %>}:5432' restart: always networks: - postgres diff --git a/services/api-gateway/docker-compose.yaml b/services/api-gateway/docker-compose.yaml index 85ee241..e7a810f 100644 --- a/services/api-gateway/docker-compose.yaml +++ b/services/api-gateway/docker-compose.yaml @@ -6,7 +6,7 @@ services: volumes: - .:/etc/krakend ports: - - "${API_PORT:-8080}:8080" + - "${API_PORT:-9898}:8080" depends_on: - influxdb - jaeger diff --git a/services/article/.env.default b/services/article/.env.default index ff711da..5f97f4f 100644 --- a/services/article/.env.default +++ b/services/article/.env.default @@ -1,4 +1,5 @@ -SERVER_PORT=3500 +SERVER_EXPOSED_PORT= +DB_EXPOSED_PORT= PRISMA_MANAGEMENT_API_SECRET=wsflk897dh%£ diff --git a/services/article/docker-compose.local.yaml b/services/article/docker-compose.local.yaml index ce91e93..fd32b25 100644 --- a/services/article/docker-compose.local.yaml +++ b/services/article/docker-compose.local.yaml @@ -2,7 +2,7 @@ version: '3' services: app: ports: - - '${SERVER_PORT:-3502}:3500' + - '${SERVER_EXPOSED_PORT:-3502}:3500' networks: - kafka_broker @@ -23,6 +23,8 @@ services: postgres: image: postgres:10.3 + ports: + - '${DB_EXPOSED_PORT:-5402}:5432' restart: always networks: - postgres diff --git a/services/auth/.env.default b/services/auth/.env.default index 8a16f6e..4740285 100644 --- a/services/auth/.env.default +++ b/services/auth/.env.default @@ -1,4 +1,4 @@ -SERVER_PORT=3500 +SERVER_EXPOSED_PORT= USER_SERVICE=http://user_app_1:3500 diff --git a/services/auth/docker-compose.local.yaml b/services/auth/docker-compose.local.yaml index 0bb216f..455f54e 100644 --- a/services/auth/docker-compose.local.yaml +++ b/services/auth/docker-compose.local.yaml @@ -2,7 +2,7 @@ version: '3' services: app: ports: - - '${SERVER_PORT:-3505}:3500' + - '${SERVER_EXPOSED_PORT:-3505}:3500' networks: - kafka_broker diff --git a/services/cart/.env.default b/services/cart/.env.default index ff711da..5f97f4f 100644 --- a/services/cart/.env.default +++ b/services/cart/.env.default @@ -1,4 +1,5 @@ -SERVER_PORT=3500 +SERVER_EXPOSED_PORT= +DB_EXPOSED_PORT= PRISMA_MANAGEMENT_API_SECRET=wsflk897dh%£ diff --git a/services/cart/docker-compose.local.yaml b/services/cart/docker-compose.local.yaml index f9ef945..b58aeb7 100644 --- a/services/cart/docker-compose.local.yaml +++ b/services/cart/docker-compose.local.yaml @@ -2,7 +2,7 @@ version: '3' services: app: ports: - - '${SERVER_PORT:-3503}:3500' + - '${SERVER_EXPOSED_PORT:-3503}:3500' networks: - kafka_broker @@ -23,6 +23,8 @@ services: postgres: image: postgres:10.3 + ports: + - '${DB_EXPOSED_PORT:-5403}:5432' restart: always networks: - postgres diff --git a/services/documentation/.env.default b/services/documentation/.env.default index 5058c09..76464ff 100644 --- a/services/documentation/.env.default +++ b/services/documentation/.env.default @@ -1,4 +1,4 @@ -SERVER_PORT=3500 +SERVER_EXPOSED_PORT= EXTERNAL_PORT=9898 EXTERNAL_HOST=http://localhost diff --git a/services/documentation/docker-compose.local.yaml b/services/documentation/docker-compose.local.yaml index 3c4c9fe..6bf69d4 100644 --- a/services/documentation/docker-compose.local.yaml +++ b/services/documentation/docker-compose.local.yaml @@ -2,4 +2,4 @@ version: "3" services: app: ports: - - "${SERVER_PORT:-3501}:3500" + - "${SERVER_EXPOSED_PORT:-3501}:3500" diff --git a/services/documentation/index.js b/services/documentation/index.js index 7fba839..b918ec5 100644 --- a/services/documentation/index.js +++ b/services/documentation/index.js @@ -6,8 +6,8 @@ require('dotenv').config(); const app = express(); const port = 3500; -const externalHost = process.env.EXTERNAL_HOST; -const externalPort = process.env.EXTERNAL_PORT; +const externalHost = process.env.EXTERNAL_HOST || 'http://localhost'; +const externalPort = process.env.EXTERNAL_PORT || 9898; /** * Configure winston diff --git a/services/user/.env.default b/services/user/.env.default index 5a3fcb0..febfd6a 100644 --- a/services/user/.env.default +++ b/services/user/.env.default @@ -1,4 +1,5 @@ -SERVER_PORT=3500 +SERVER_EXPOSED_PORT= +DB_EXPOSED_PORT= PRISMA_MANAGEMENT_API_SECRET=wsflk897dh%£ diff --git a/services/user/docker-compose.local.yaml b/services/user/docker-compose.local.yaml index bb7aac2..a95eec4 100644 --- a/services/user/docker-compose.local.yaml +++ b/services/user/docker-compose.local.yaml @@ -2,7 +2,7 @@ version: '3' services: app: ports: - - '${SERVER_PORT:-3506}:3500' + - '${SERVER_EXPOSED_PORT:-3506}:3500' networks: - kafka_broker @@ -23,6 +23,8 @@ services: postgres: image: postgres:10.3 + ports: + - '${DB_EXPOSED_PORT:-5406}:5432' restart: always networks: - postgres