Skip to content

Commit

Permalink
Merge pull request #535 from andrechristikan/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
andrechristikan authored Nov 10, 2024
2 parents e52815b + 736bfae commit 0654094
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 34 deletions.
17 changes: 6 additions & 11 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 with Docker](#installation-with-docker)
- [Installation dependencies with Docker](#installation-dependencies-with-docker)
- [Test](#test)
- [Swagger](#swagger)
- [API Key](#api-key)
Expand Down Expand Up @@ -129,7 +129,6 @@ Describes which version.
- Server Side Pagination.
- Sentry.io for Monitoring Tools.
- Support Docker installation.
- Support CI/CD (Eg: Github Action).
- Husky GitHook for run linter before commit 🐶.
- Linter with EsLint for Typescript.

Expand Down Expand Up @@ -208,20 +207,16 @@ Now you can run the project.
yarn start:dev
```

## Installation with Docker
## Installation dependencies with Docker

For docker installation, we need more tools to be installed.
> Docker will install mongodb (as replication set), and redis
We need more tools to be installed.

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

Make your own environment file with a copy of `env.example` and adjust values to suit your own environment.

```bash
cp .env.example .env
```

then run
After clone this project, then run

```bash
docker-compose up -d
Expand Down
24 changes: 4 additions & 20 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,6 @@
version: '3.8'
name: ack

services:
service:
build:
context: .
container_name: service
hostname: service
ports:
- 3000:3000
volumes:
- ./src/:/app/src/
- .env/:/app/.env
restart: always
networks:
- app-network

redis:
image: redis:latest
container_name: redis
Expand Down Expand Up @@ -75,11 +60,10 @@ services:
extra_hosts:
- 'host.docker.internal:host-gateway'
healthcheck:
test: echo "try { rs.status() } catch (err) { rs.initiate({_id:'rs0',members:[{_id:0,host:'host.docker.internal:27017',priority:1},{_id:1,host:'host.docker.internal:27018',priority:0.5},{_id:2,host:'host.docker.internal:27019',priority:0.5}]}) }" | mongosh --bind_ip_all --port 27017 --quiet
interval: 5s
timeout: 30s
start_period: 0s
start_interval: 1s
test: echo "try { rs.status() } catch (err) { rs.initiate({_id:'rs0',members:[{_id:0,host:'host.docker.internal:27017',priority:1},{_id:1,host:'host.docker.internal:27018',priority:0.5},{_id:2,host:'host.docker.internal:27019',priority:0.5}]}) }" | mongosh --port 27017 --quiet
interval: 10s
timeout: 10s
start_period: 30s
retries: 5

mongodb2:
Expand Down
1 change: 0 additions & 1 deletion src/common/database/services/database.options.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ export class DatabaseOptionService implements IDatabaseOptionService {
autoIndex: env === ENUM_APP_ENVIRONMENT.MIGRATION,
...timeoutOptions,
};
console.log('mongooseOptions', mongooseOptions);

return mongooseOptions;
}
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 @@ -11,7 +11,7 @@ export default registerAs(
timeoutOptions: {
serverSelectionTimeoutMS: 30 * 1000, // 30 secs
socketTimeoutMS: 30 * 1000, // 30 secs
heartbeatFrequencyMS: 30 * 1000, // 30 secs
heartbeatFrequencyMS: 5 * 1000, // 30 secs
},
})
);
2 changes: 1 addition & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ async function bootstrap() {
});

const configService = app.get(ConfigService);
const databaseUri: string = configService.get<string>('database.uri');
const databaseUri: string = configService.get<string>('database.url');
const env: string = configService.get<string>('app.env');
const timezone: string = configService.get<string>('app.timezone');
const host: string = configService.get<string>('app.http.host');
Expand Down

0 comments on commit 0654094

Please sign in to comment.