-
Notifications
You must be signed in to change notification settings - Fork 3
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
2-4 [배포] [배포] docker-compose redis, db 연결 #8
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,4 +35,4 @@ lerna-debug.log* | |
!.vscode/extensions.json | ||
|
||
# env | ||
/.dev.env | ||
*.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
version: '3' | ||
|
||
services: | ||
prv: | ||
restart: always | ||
env_file: | ||
- ${ENV_FILE} | ||
image: ${NCP_CONTAINER_REGISTRY} | ||
links: | ||
- redis | ||
- mongo | ||
ports: | ||
- 4000:4000 | ||
networks: | ||
- viewpoint | ||
|
||
mongo: | ||
image: mongo | ||
ports: | ||
- 27017:27017 | ||
networks: | ||
- viewpoint | ||
|
||
redis: | ||
image: redis | ||
ports: | ||
- 6379:6379 | ||
networks: | ||
- viewpoint | ||
|
||
networks: | ||
viewpoint: | ||
driver: bridge |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,77 +1,78 @@ | ||
{ | ||
"name": "backend", | ||
"version": "0.0.1", | ||
"description": "", | ||
"author": "", | ||
"private": true, | ||
"license": "UNLICENSED", | ||
"scripts": { | ||
"prebuild": "rimraf dist", | ||
"build": "nest build", | ||
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"", | ||
"start": "nest start", | ||
"start:dev": "nest start --watch", | ||
"start:debug": "nest start --debug --watch", | ||
"start:prod": "node dist/main", | ||
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix", | ||
"test": "jest", | ||
"test:watch": "jest --watch", | ||
"test:cov": "jest --coverage", | ||
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand", | ||
"test:e2e": "jest --config ./test/jest-e2e.json" | ||
}, | ||
"dependencies": { | ||
"@liaoliaots/nestjs-redis": "^9.0.4", | ||
"@nestjs/common": "^9.0.0", | ||
"@nestjs/config": "^2.2.0", | ||
"@nestjs/core": "^9.0.0", | ||
"@nestjs/platform-express": "^9.0.0", | ||
"cache-manager": "^5.1.3", | ||
"class-transformer": "^0.5.1", | ||
"class-validator": "^0.13.2", | ||
"ioredis": "^5.2.4", | ||
"reflect-metadata": "^0.1.13", | ||
"rimraf": "^3.0.2", | ||
"rxjs": "^7.2.0" | ||
}, | ||
"devDependencies": { | ||
"@nestjs/cli": "^9.0.0", | ||
"@nestjs/schematics": "^9.0.0", | ||
"@nestjs/testing": "^9.0.0", | ||
"@types/express": "^4.17.13", | ||
"@types/jest": "28.1.8", | ||
"@types/node": "^16.0.0", | ||
"@types/supertest": "^2.0.11", | ||
"@typescript-eslint/eslint-plugin": "^5.0.0", | ||
"@typescript-eslint/parser": "^5.0.0", | ||
"eslint": "^8.0.1", | ||
"eslint-config-prettier": "^8.3.0", | ||
"eslint-plugin-prettier": "^4.0.0", | ||
"jest": "28.1.3", | ||
"prettier": "^2.3.2", | ||
"source-map-support": "^0.5.20", | ||
"supertest": "^6.1.3", | ||
"ts-jest": "28.0.8", | ||
"ts-loader": "^9.2.3", | ||
"ts-node": "^10.0.0", | ||
"tsconfig-paths": "4.1.0", | ||
"typescript": "^4.7.4" | ||
}, | ||
"jest": { | ||
"moduleFileExtensions": [ | ||
"js", | ||
"json", | ||
"ts" | ||
], | ||
"rootDir": "src", | ||
"testRegex": ".*\\.spec\\.ts$", | ||
"transform": { | ||
"^.+\\.(t|j)s$": "ts-jest" | ||
}, | ||
"collectCoverageFrom": [ | ||
"**/*.(t|j)s" | ||
], | ||
"coverageDirectory": "../coverage", | ||
"testEnvironment": "node" | ||
} | ||
"name": "backend", | ||
"version": "0.0.1", | ||
"description": "", | ||
"author": "", | ||
"private": true, | ||
"license": "UNLICENSED", | ||
"scripts": { | ||
"prebuild": "rimraf dist", | ||
"build": "nest build", | ||
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"", | ||
"start": "nest start", | ||
"start:mac": "env $(cat be.env | grep -v '#' | xargs) npm start", | ||
"start:dev": "nest start --watch", | ||
"start:debug": "nest start --debug --watch", | ||
"start:prod": "node dist/main", | ||
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix", | ||
"test": "jest", | ||
"test:watch": "jest --watch", | ||
"test:cov": "jest --coverage", | ||
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand", | ||
"test:e2e": "jest --config ./test/jest-e2e.json" | ||
}, | ||
"dependencies": { | ||
"@liaoliaots/nestjs-redis": "^9.0.4", | ||
"@nestjs/common": "^9.0.0", | ||
"@nestjs/config": "^2.2.0", | ||
"@nestjs/core": "^9.0.0", | ||
"@nestjs/platform-express": "^9.0.0", | ||
"cache-manager": "^5.1.3", | ||
"class-transformer": "^0.5.1", | ||
"class-validator": "^0.13.2", | ||
"ioredis": "^5.2.4", | ||
"reflect-metadata": "^0.1.13", | ||
"rimraf": "^3.0.2", | ||
"rxjs": "^7.2.0" | ||
}, | ||
"devDependencies": { | ||
"@nestjs/cli": "^9.0.0", | ||
"@nestjs/schematics": "^9.0.0", | ||
"@nestjs/testing": "^9.0.0", | ||
"@types/express": "^4.17.13", | ||
"@types/jest": "28.1.8", | ||
"@types/node": "^16.0.0", | ||
"@types/supertest": "^2.0.11", | ||
"@typescript-eslint/eslint-plugin": "^5.0.0", | ||
"@typescript-eslint/parser": "^5.0.0", | ||
"eslint": "^8.0.1", | ||
"eslint-config-prettier": "^8.3.0", | ||
"eslint-plugin-prettier": "^4.0.0", | ||
"jest": "28.1.3", | ||
"prettier": "^2.3.2", | ||
"source-map-support": "^0.5.20", | ||
"supertest": "^6.1.3", | ||
"ts-jest": "28.0.8", | ||
"ts-loader": "^9.2.3", | ||
"ts-node": "^10.0.0", | ||
"tsconfig-paths": "4.1.0", | ||
"typescript": "^4.7.4" | ||
}, | ||
"jest": { | ||
"moduleFileExtensions": [ | ||
"js", | ||
"json", | ||
"ts" | ||
], | ||
"rootDir": "src", | ||
"testRegex": ".*\\.spec\\.ts$", | ||
"transform": { | ||
"^.+\\.(t|j)s$": "ts-jest" | ||
}, | ||
"collectCoverageFrom": [ | ||
"**/*.(t|j)s" | ||
], | ||
"coverageDirectory": "../coverage", | ||
"testEnvironment": "node" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
여기서 말하는 networks 는 무엇을 의미하나요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
두 경우 다 docker compose를 활용할 수 있습니당.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
설명이 잘 되어있는 블로그 글을 첨부드립니다.
간단하게 표현해보자면, 통신할 수 있는 문을 열어놓는다고 할 수 있을 것 같습니다.
docker-compose에 있는 친구들은 기본적으로 default network로 묶입니다.
동일 네트워크에 있으면 container 간 통신이 가능하게되는데요, 참고
지금 별도의 network를 생성한 것은 여기에 해당합니다.
즉, user defined network를 굳이 생성해서 연결시켰다고 보시면 되고, 없어도 default network에 연결됩니다!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
설명이 굉장히 잘 되어 있네요! 감사합니다. :)