Skip to content
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

Development #536

Merged
merged 3 commits into from
Nov 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ MIDDLEWARE_CORS_ORIGIN=*
URL_VERSIONING_ENABLE=true
URL_VERSION=1

DATABASE_URI=mongodb://localhost:27017,localhost:27018,localhost:27019/ack?retryWrites=true&w=majority&replicaSet=rs0
DATABASE_URL=mongodb://localhost:27017,localhost:27018,localhost:27019/ack?retryWrites=true&w=majority&replicaSet=rs0
DATABASE_DEBUG=true

AUTH_JWT_ISSUER=https://example.com
Expand Down
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ _You can [request feature][ack-issues] or [report bug][ack-issues] with followin
- [Database Migration and Seed](#database-migration-and-seed)
- [Template Migration](#template-migration)
- [Run Project](#run-project)
- [Installation dependencies with Docker](#installation-dependencies-with-docker)
- [Installation with Docker](#installation-with-docker)
- [Test](#test)
- [Swagger](#swagger)
- [API Key](#api-key)
Expand Down Expand Up @@ -207,16 +207,19 @@ Now you can run the project.
yarn start:dev
```

## Installation dependencies with Docker

> Docker will install mongodb (as replication set), and redis
## Installation with Docker

We need more tools to be installed.

1. [Docker][ref-docker]
2. [Docker-Compose][ref-dockercompose]

After clone this project, then run
Copy `.env.example` and change value

1. `DATABASE_URL`: `DATABASE_URL=mongodb://host.docker.internal:27017,host.docker.internal:27018,host.docker.internal:27019/ack?retryWrites=true&w=majority&replicaSet=rs0`
2. `REDIS_HOST`: `redis`

leave the rest as it, then run

```bash
docker-compose up -d
Expand Down
18 changes: 18 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,24 @@
name: ack

services:

apis:
build:
context: .
container_name: apis
hostname: apis
ports:
- 3000:3000
volumes:
- ./src/:/app/src/
- .env/:/app/.env
restart: always
networks:
- app-network
depends_on:
- redis
- mongodb1

redis:
image: redis:latest
container_name: redis
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ack-nestjs-boilerplate",
"version": "7.1.1",
"version": "7.1.3",
"description": "Ack NestJs Boilerplate",
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion src/configs/database.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default registerAs(
'database',
(): Record<string, any> => ({
url:
process.env?.DATABASE_URI ??
process.env?.DATABASE_URL ??
'mongodb://localhost:27017,localhost:27018,localhost:27019',

debug: process.env.DATABASE_DEBUG === 'true',
Expand Down
2 changes: 1 addition & 1 deletion test/app/dtos/app.dto.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ describe('AppEnvDto', () => {
URL_VERSIONING_ENABLE: true,
URL_VERSION: 1,

DATABASE_URI: faker.internet.url(),
DATABASE_URL: faker.internet.url(),
DATABASE_DEBUG: false,

AUTH_JWT_ISSUER: faker.internet.url(),
Expand Down
Loading