Update ecosystem configuration for production environment and modify package scripts to use env-cmd for environment management
This commit is contained in:
parent
86a67420ea
commit
bcf0e3d1bf
13
dev.local.ecosystem.config.js
Normal file
13
dev.local.ecosystem.config.js
Normal file
@ -0,0 +1,13 @@
|
||||
module.exports = {
|
||||
apps: [
|
||||
{
|
||||
name: 'qcast-front-local-development',
|
||||
script: 'node_modules/next/dist/bin/next',
|
||||
instances: 1,
|
||||
exec_mode: 'fork',
|
||||
env: {
|
||||
PORT: 5000,
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
||||
@ -6,7 +6,7 @@ module.exports = {
|
||||
instances: 2,
|
||||
exec_mode: 'cluster',
|
||||
env: {
|
||||
PORT: 5000,
|
||||
NODE_ENV: 'production',
|
||||
},
|
||||
},
|
||||
],
|
||||
|
||||
14
package.json
14
package.json
@ -3,11 +3,14 @@
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev",
|
||||
"build": "next build",
|
||||
"start:cluster1": "next start -p 5000",
|
||||
"start:cluster2": "next start -p 5001",
|
||||
"start:dev": "next start -p 5010",
|
||||
"dev": "env-cmd -f .env.localhost next dev",
|
||||
"local:dev": "env-cmd -f .env.local.dev next dev",
|
||||
"build": "env-cmd -f .env.productionnext build",
|
||||
"build:dev": "env-cmd -f .env.development next build",
|
||||
"build:local.dev": "env-cmd -f .env.local.dev next build",
|
||||
"start:cluster1": "env-cmd -f .env.production next start -p 5000",
|
||||
"start:cluster2": "env-cmd -f .env.production next start -p 5001",
|
||||
"start:dev": "env-cmd -f .env.development next start -p 5010",
|
||||
"lint": "next lint",
|
||||
"serve": "node server.js"
|
||||
},
|
||||
@ -18,6 +21,7 @@
|
||||
"big.js": "^6.2.2",
|
||||
"chart.js": "^4.4.6",
|
||||
"dayjs": "^1.11.13",
|
||||
"env-cmd": "^10.1.0",
|
||||
"fabric": "^5.3.0",
|
||||
"framer-motion": "^11.2.13",
|
||||
"fs": "^0.0.1-security",
|
||||
|
||||
11
src/config/config.common.js
Normal file
11
src/config/config.common.js
Normal file
@ -0,0 +1,11 @@
|
||||
// local, development, production 과 관계없이 동일한 값으로 반환되는 부분은 해당 함수의 return 되는 부분만 수정하면 됩니다. (달라져야 하는 값이 아닌, 같은 값에 대해서는 local, development, production 파일을 모두 수정할 필요가 없어지게 됩니다.)
|
||||
export default function getConfigs(params) {
|
||||
// local, development, production 마다 달라지는 값
|
||||
const { baseUrl, mode } = params
|
||||
|
||||
// 공통으로 반환되는 구조
|
||||
return {
|
||||
baseUrl,
|
||||
mode,
|
||||
}
|
||||
}
|
||||
13
src/config/config.development.js
Normal file
13
src/config/config.development.js
Normal file
@ -0,0 +1,13 @@
|
||||
import getConfigs from './config.common'
|
||||
|
||||
// 환경마다 달라져야 할 변수, 값들을 정의합니다. (여기는 development 환경에 맞는 값을 지정합니다.)
|
||||
const baseUrl = 'https://dev.hanssys.jp'
|
||||
const mode = 'development'
|
||||
|
||||
// 환경마다 달라져야 할 값들을 getConfig 함수에 전달합니다.
|
||||
const configDevelopment = getConfigs({
|
||||
baseUrl,
|
||||
mode,
|
||||
})
|
||||
|
||||
export default configDevelopment
|
||||
22
src/config/config.export.js
Normal file
22
src/config/config.export.js
Normal file
@ -0,0 +1,22 @@
|
||||
import configDevelopment from './config.development'
|
||||
import configLocal from './config.local'
|
||||
import configLocalDev from './config.local.dev'
|
||||
import configProduction from './config.production'
|
||||
|
||||
// 클라이언트에서는 이 함수를 사용하여 config 값을 참조합니다.
|
||||
const Config = () => {
|
||||
switch (process.env.NEXT_PUBLIC_RUN_MODE) {
|
||||
case 'local':
|
||||
return configLocal
|
||||
case 'local.dev':
|
||||
return configLocalDev
|
||||
case 'development':
|
||||
return configDevelopment
|
||||
case 'production':
|
||||
return configProduction
|
||||
default:
|
||||
return configLocal
|
||||
}
|
||||
}
|
||||
|
||||
export default Config
|
||||
13
src/config/config.local.dev.js
Normal file
13
src/config/config.local.dev.js
Normal file
@ -0,0 +1,13 @@
|
||||
import getConfigs from './config.common'
|
||||
|
||||
// 환경마다 달라져야 할 변수, 값들을 정의합니다. (여기는 local 환경에 맞는 값을 지정합니다.)
|
||||
const baseUrl = 'http://1.248.227.176:5000'
|
||||
const mode = 'local.dev'
|
||||
|
||||
// 환경마다 달라져야 할 값들을 getConfig 함수에 전달합니다.
|
||||
const configLocalDev = getConfigs({
|
||||
baseUrl,
|
||||
mode,
|
||||
})
|
||||
|
||||
export default configLocalDev
|
||||
13
src/config/config.local.js
Normal file
13
src/config/config.local.js
Normal file
@ -0,0 +1,13 @@
|
||||
import getConfigs from './config.common'
|
||||
|
||||
// 환경마다 달라져야 할 변수, 값들을 정의합니다. (여기는 local 환경에 맞는 값을 지정합니다.)
|
||||
const baseUrl = 'http://localhost:3000'
|
||||
const mode = 'local'
|
||||
|
||||
// 환경마다 달라져야 할 값들을 getConfig 함수에 전달합니다.
|
||||
const configLocal = getConfigs({
|
||||
baseUrl,
|
||||
mode,
|
||||
})
|
||||
|
||||
export default configLocal
|
||||
13
src/config/config.production.js
Normal file
13
src/config/config.production.js
Normal file
@ -0,0 +1,13 @@
|
||||
import getConfigs from './config.common'
|
||||
|
||||
// 환경마다 달라져야 할 변수, 값들을 정의합니다. (여기는 production 환경에 맞는 값을 지정합니다.)
|
||||
const baseUrl = 'https://www.hanasys.jp'
|
||||
const mode = 'production'
|
||||
|
||||
// 환경마다 달라져야 할 값들을 getConfig 함수에 전달합니다.
|
||||
const configProduction = getConfigs({
|
||||
baseUrl,
|
||||
mode,
|
||||
})
|
||||
|
||||
export default configProduction
|
||||
@ -97,7 +97,7 @@ export function useRefFiles() {
|
||||
setPopSpinnerStore(true)
|
||||
console.log('🚀 ~ handleFileDelete ~ handleFileDelete:', refImage)
|
||||
console.log('🚀 ~ handleFileDelete ~ currentCanvasPlan.bgImageName:', currentCanvasPlan.bgImageName)
|
||||
await del({ url: `${process.env.NEXT_PUBLIC_API_HOST_URL}/api/image/upload?fileName=${currentCanvasPlan.bgImageName}` })
|
||||
await del({ url: `${Config().baseUrl}/api/image/upload?fileName=${currentCanvasPlan.bgImageName}` })
|
||||
setCurrentBgImage(null)
|
||||
await deleteBackGroundImage({
|
||||
objectId: currentCanvasPlan.id,
|
||||
@ -118,7 +118,7 @@ export function useRefFiles() {
|
||||
confirmFn: async () => {
|
||||
console.log('🚀 ~ handleAddressDelete ~ handleAddressDelete:', refImage)
|
||||
console.log('🚀 ~ handleAddressDelete ~ currentCanvasPlan.bgImageName:', currentCanvasPlan.bgImageName)
|
||||
await del({ url: `${process.env.NEXT_PUBLIC_API_HOST_URL}/api/image/map?fileName=${currentCanvasPlan.bgImageName}` })
|
||||
await del({ url: `${Config().baseUrl}/api/image/map?fileName=${currentCanvasPlan.bgImageName}` })
|
||||
setMapPositionAddress('')
|
||||
setCurrentBgImage(null)
|
||||
await deleteBackGroundImage({
|
||||
@ -149,7 +149,7 @@ export function useRefFiles() {
|
||||
}))
|
||||
|
||||
const res = await get({
|
||||
url: `${process.env.NEXT_PUBLIC_API_HOST_URL}/api/image/map?q=${queryRef.current.value}&fileNm=${currentCanvasPlan.id}&zoom=20`,
|
||||
url: `${Config().baseUrl}/api/image/map?q=${queryRef.current.value}&fileNm=${currentCanvasPlan.id}&zoom=20`,
|
||||
})
|
||||
console.log('🚀 ~ handleMapImageDown ~ res:', res)
|
||||
setCurrentBgImage(`${process.env.NEXT_PUBLIC_AWS_S3_BASE_URL}/${res.fileName}`)
|
||||
@ -208,7 +208,7 @@ export function useRefFiles() {
|
||||
formData.append('file', file)
|
||||
|
||||
const res = await post({
|
||||
url: `${process.env.NEXT_PUBLIC_API_HOST_URL}/api/image/upload`,
|
||||
url: `${Config().baseUrl}/api/image/upload`,
|
||||
data: formData,
|
||||
})
|
||||
console.log('🚀 ~ handleUploadImageRefFile ~ res:', res)
|
||||
@ -265,7 +265,7 @@ export function useRefFiles() {
|
||||
|
||||
/** 캐드 도면 파일 업로드 */
|
||||
const result = await post({
|
||||
url: `${process.env.NEXT_PUBLIC_API_HOST_URL}/api/image/cad`,
|
||||
url: `${Config().baseUrl}/api/image/cad`,
|
||||
data: newFormData,
|
||||
})
|
||||
console.log('🚀 ~ handleUploadConvertRefFile ~ result:', result)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user