项目作者: felixgeissler

项目描述 :
A dockerized stack with Angular, NestJS, Redis & Postgres ready for DEV & PROD
高级语言: HTML
项目地址: git://github.com/felixgeissler/angular-nestjs-boilerplate-stack.git
创建时间: 2020-07-28T10:39:52Z
项目社区:https://github.com/felixgeissler/angular-nestjs-boilerplate-stack

开源协议:MIT License

下载



Angular Logo
Nest Logo
Docker Logo


Angular & NestJS API Boilerplate


A dockerized stack, ready for development / deployment


GitHub License
GitHub repo size
GitHub issues

Discord

Setup for Development

  1. Create a .env copy from .env.example (adjust e.g. ports)
    1. cp .env.dev.example .env
  2. Startup containers via docker-compose:
    1. docker-compose up -d

Deployment

This docker setup is configured to use with an reverse proxy server in order to
deploy & expose multiple docker setups from a single machine.

  1. Checkout/pull latest version of the project
  2. Create a .env copy from .env.example
    1. cp .env.prod.example .env
  3. Edit variables in .env file (e.g. ports / secrets)
    1. vi .env
  4. Startup containers via docker-compose:
    1. docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d

Development notes

Tooling

Tunnel to docker service shell:

  1. docker-compose exec SERVICE_NAME_HERE /bin/sh

Additional CLI shortcuts a listed in the maidfile.md or via (Maid required):

  1. maid help

Execute Maid tasks like:

  1. maid TASKNAME

NPM Dependencies

Installing npm dependencies via npm install won’t mount the localy installed modules into the docker context, since the
anonymous volumes aren’t removed until their parent container is removed.

To overcome this issue simply run:

  1. docker-compose up --build -V

The --build parameter will make sure the npm install is run (during the build process), and the -V argument will remove any anonymous volumes and create them again.

Debugging with VS Code

On the left-hand side of VS Code, open the Debug & Run Panel and create a launch.json file. For proper NestJS backend debugging, replace the content of the config with the following:

  1. {
  2. "version": "0.2.0",
  3. "configurations": [
  4. {
  5. "type": "node",
  6. "request": "attach",
  7. "name": "Debug: app-name",
  8. "remoteRoot": "/usr/src/app",
  9. "localRoot": "${workspaceFolder}/backend",
  10. "protocol": "inspector",
  11. "port": 9229,
  12. "restart": true,
  13. "address": "0.0.0.0",
  14. "skipFiles": ["<node_internals>/**"]
  15. }
  16. ]
  17. }