Skip to content

Commit

Permalink
fix(instance): fix app env of oss external endpoint port
Browse files Browse the repository at this point in the history
  • Loading branch information
maslow committed Sep 13, 2022
1 parent 9a3f2f2 commit 750a4d4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
10 changes: 8 additions & 2 deletions deploy/docker-compose/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ services:
mongo:
image: bitnami/mongodb:5.0.8
# image: bitnami/mongodb:4.4.13 # Use this version for Apple M1 Chip
restart: always
environment:
- MONGODB_REPLICA_SET_MODE=primary
- MONGODB_ADVERTISED_HOSTNAME=mongo
Expand All @@ -22,6 +23,7 @@ services:

oss:
image: 'minio/minio:RELEASE.2022-08-13T21-54-44Z'
restart: always
environment:
- MINIO_ROOT_USER=${MINIO_ROOT_USER}
- MINIO_ROOT_PASSWORD=${MINIO_ROOT_PASSWORD}
Expand All @@ -38,6 +40,7 @@ services:

etcd:
image: quay.io/coreos/etcd:v3.5.4
restart: always
environment:
- ETCD_ADVERTISE_CLIENT_URLS=http://etcd:2379
- ETCD_LISTEN_CLIENT_URLS=http://0.0.0.0:2379
Expand All @@ -53,6 +56,7 @@ services:
image: lafyun/system-server:latest
user: root
working_dir: /app
restart: always
environment:
SYS_DB_URI: mongodb://${SYS_DB_USER}:${SYS_DB_PASSWORD}@mongo:27017/?authSource=${SYS_DB}&replicaSet=laf&writeConcern=majority
APP_DB_URI: mongodb://root:${MONGODB_ROOT_PASSWORD}@mongo:27017/?authSource=admin&replicaSet=laf&writeConcern=majority
Expand All @@ -67,7 +71,7 @@ services:
MINIO_ACCESS_KEY: ${MINIO_ROOT_USER}
MINIO_ACCESS_SECRET: ${MINIO_ROOT_PASSWORD}
MINIO_INTERNAL_ENDPOINT: http://oss:9000
MINIO_EXTERNAL_ENDPOINT: ${OSS_DOMAIN}
MINIO_EXTERNAL_ENDPOINT: ${APP_SERVICE_DEPLOY_URL_SCHEMA}://${OSS_DOMAIN}:${PUBLISH_PORT:-8080}
PUBLISH_PORT: ${PUBLISH_PORT:-8080}
PUBLISH_HTTPS_PORT: ${PUBLISH_HTTPS_PORT:-9443}
MINIO_REGION_NAME: cn-default
Expand All @@ -88,6 +92,7 @@ services:

gateway:
image: apache/apisix:2.14.1-alpine
restart: always
depends_on:
- system-server
- mongo
Expand Down Expand Up @@ -117,6 +122,7 @@ services:

gateway-controller:
image: lafyun/gateway-controller:latest
restart: always
depends_on:
- gateway
environment:
Expand Down Expand Up @@ -147,7 +153,7 @@ services:
SERVICE_DRIVER: docker
APP_SERVICE_ENV_NPM_INSTALL_FLAGS: ' --no-audit --no-fund'
MINIO_INTERNAL_ENDPOINT: http://oss:9000
MINIO_EXTERNAL_ENDPOINT: ${OSS_DOMAIN}
MINIO_EXTERNAL_ENDPOINT: ${APP_SERVICE_DEPLOY_URL_SCHEMA}://${OSS_DOMAIN}:${PUBLISH_PORT:-8080}
PUBLISH_PORT: ${PUBLISH_PORT:-8080}
PUBLISH_HTTPS_PORT: ${PUBLISH_HTTPS_PORT:-9443}
MINIO_REGION_NAME: cn-default
Expand Down
2 changes: 1 addition & 1 deletion packages/instance-controller/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export default class Config {
const external_endpoint: string = new URL(process.env.MINIO_EXTERNAL_ENDPOINT).origin

// fixed external_endpoint with extra schema and port config
const external_port = process.env.APP_SERVICE_DEPLOY_URL_SCHEMA === 'http' ? process.env.PUBLISH_PORT : process.env.PUBLISH_HTTPS_PORT
const external_port = process.env.APP_SERVICE_DEPLOY_URL_SCHEMA === 'https' ? process.env.PUBLISH_HTTPS_PORT : process.env.PUBLISH_PORT
const obj = new URL(external_endpoint)
obj.port = external_port || obj.port
obj.protocol = process.env.APP_SERVICE_DEPLOY_URL_SCHEMA || 'http'
Expand Down
2 changes: 1 addition & 1 deletion packages/system-server/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ export default class Config {
const external_endpoint: string = new URL(process.env.MINIO_EXTERNAL_ENDPOINT).origin

// fixed external_endpoint with extra schema and port config
const external_port = process.env.APP_SERVICE_DEPLOY_URL_SCHEMA === 'http' ? process.env.PUBLISH_PORT : process.env.PUBLISH_HTTPS_PORT
const external_port = process.env.APP_SERVICE_DEPLOY_URL_SCHEMA === 'https' ? process.env.PUBLISH_HTTPS_PORT : process.env.PUBLISH_PORT
const obj = new URL(external_endpoint)
obj.port = external_port || obj.port
obj.protocol = process.env.APP_SERVICE_DEPLOY_URL_SCHEMA
Expand Down

0 comments on commit 750a4d4

Please sign in to comment.