Skip to content

Commit

Permalink
Merge branch 'develop' into EventAgendasFix
Browse files Browse the repository at this point in the history
  • Loading branch information
Atharva-Kanherkar authored Apr 22, 2024
2 parents bcc5a8d + 03fe1b8 commit b317bdf
Show file tree
Hide file tree
Showing 110 changed files with 2,953 additions and 18,973 deletions.
8 changes: 8 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
node_modules
videos
.env
.git
.gitignore
.dockerignore
Dockerfile.dev
Dockerfile.prod
13 changes: 0 additions & 13 deletions Dockerfile

This file was deleted.

21 changes: 21 additions & 0 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Stage 1: Install Dependencies
FROM node:lts AS builder

WORKDIR /usr/src/app

COPY package.json ./

RUN npm install

COPY . .

# Stage 2: Final image
FROM node:lts-bookworm-slim

WORKDIR /usr/src/app

COPY --from=builder /usr/src/app ./

EXPOSE 4000

CMD ["npm", "run", "dev"]
25 changes: 25 additions & 0 deletions Dockerfile.prod
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Stage 1: Install Dependencies and Build
FROM node:lts AS builder

WORKDIR /usr/src/app

COPY package*.json ./

RUN npm install -g npm@latest && npm install && rm -rf ./package-lock.json

COPY . .

RUN npm run build

# Stage 2: Final image
FROM node:alpine

WORKDIR /usr/src/app

COPY --from=builder /usr/src/app/package.json ./
COPY --from=builder /usr/src/app/node_modules ./node_modules
COPY --from=builder /usr/src/app/build ./build

EXPOSE 4000

CMD ["npm", "start"]
68 changes: 50 additions & 18 deletions INSTALLATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,14 @@ This document provides instructions on how to set up and start a running instanc
- [Install TypeScript](#install-typescript)
- [Install git](#install-git)
- [Setting up this repository](#setting-up-this-repository)
- [Install the Required Packages](#install-the-required-packages)
- [Installation Using Docker](#installation-using-docker)
- [Prerequisites](#prerequisites-1)
- [Docker Compose Setup](#docker-compose-setup)
- [For Development](#for-development)
- [For Production](#for-production)
- [Congratulations! 🎉 Your Talawa API is now successfully set up and running using Docker!](#congratulations-%F0%9F%8E%89-your-talawa-api-is-now-successfully-set-up-and-running-using-docker)
- [Installation without Docker](#installation-without-docker)
- [Install the Required Packages](#install-the-required-packages)
- [Install MongoDB](#install-mongodb)
- [Setting up the mongoDB database](#setting-up-the-mongodb-database)
- [Install Redis](#install-redis)
Expand Down Expand Up @@ -134,37 +139,64 @@ This will setup the repository and the code files locally for you. For more deta

`NOTE: All the commands we're going to execute in the following instructions will assume you are in the root directory of the project. If you fail to do so, the commands will not work.`

## Install the Required Packages
# Installation Using Docker

Install the packages required by `talawa-api` using this command:
This guide provides step-by-step instructions on deploying a talawa-api using Docker. Docker allows you to package your application and its dependencies into a container, providing a consistent environment across different systems.

```
npm install
```
## Prerequisites
- [Docker Desktop](https://www.docker.com/products/docker-desktop) installed on your machine.

# Installation Using Docker
## Docker Compose Setup

> - **Requires Docker and Docker Compose to be installed**
> - Will start a local mongodb and redis instances
### For Development

Now use the following command to run docker containers -
1. **Build and Start Development Containers:**
```
docker-compose -f docker-compose.dev.yaml up --build
```
This command starts the development environment, where you can make changes to the code, and the server will automatically restart.
```sh
docker compose up
```
2. **Access the Development Application:**
Open your web browser and navigate to [http://localhost:4000](http://localhost:4000).
OR
3. **Stopping Development Containers:**
```
docker-compose -f docker-compose.dev.yml down
```
### For Production
1. **Build and Start Production Containers:**
```
docker-compose -f docker-compose.prod.yml up --build -d
```
This command starts the production environment in detached mode, suitable for production deployment.
2. **Access the Production Application:**
Open your web browser and navigate to [http://localhost:4001](http://localhost:4001).
3. **Stopping Production Containers:**
```
docker-compose -f docker-compose.prod.yml down
```
### Congratulations! 🎉 Your Talawa API is now successfully set up and running using Docker!
```sh
docker-compose up
```
**Note: If you're using Docker, you'll need to manually import the sample data after the Docker Compose has started the MongoDB container. For instructions on how to do this, refer to [Importing Sample Database](#importing-sample-database)**
# Installation without Docker
There are more steps, but the outcome is the same. A working Talawa-API instance.
## Install the Required Packages
Install the packages required by `talawa-api` using this command:
```
npm install
```
## Install MongoDB
Talawa-api makes use of `MongoDB` for its database needs. We make use of `mongoose ODM` to interact with the MongoDB database from within the code.
Expand Down Expand Up @@ -795,4 +827,4 @@ Talawa-api makes use of `vitest` to run tests because it is much faster than `je

You can run the tests for talawa-api using this command:

npm run test
npm run test
37 changes: 37 additions & 0 deletions docker-compose.dev.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
version: '3.8'

services:
mongodb:
image: mongo:latest
ports:
- 27017:27017
volumes:
- mongodb-data:/data/db

redis-stack-server:
image: redis/redis-stack-server:latest
ports:
- 6379:6379
volumes:
- redis-data:/data/redis

talawa-api-dev-container:
build:
context: .
dockerfile: Dockerfile.dev
ports:
- 4000:4000
volumes:
- .:/usr/src/app
- /usr/src/app/node_modules
depends_on:
- mongodb
- redis-stack-server
environment:
- MONGO_DB_URL=mongodb://mongodb:27017
- REDIS_HOST=redis-stack-server
- REDIS_PORT=6379

volumes:
mongodb-data:
redis-data:
8 changes: 6 additions & 2 deletions docker-compose.yaml → docker-compose.prod.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
version: '3.8'

services:
mongodb:
image: mongo:latest
Expand All @@ -13,8 +15,10 @@ services:
volumes:
- redis-data:/data/redis

talawa-api-container:
build: .
talawa-api-prod-container:
build:
context: .
dockerfile: Dockerfile.prod
ports:
- 4000:4000
depends_on:
Expand Down
2 changes: 2 additions & 0 deletions locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
"actionItem.notFound": "Action Item not found",
"advertisement.notFound": "Advertisement not found",
"event.notFound": "Event not found",
"baseRecurringEvent.notFound": "Base Recurring Event not found",
"recurrenceRule.notFound": "Recurrence Rule not found",
"organization.notFound": "Organization not found",
"organization.profileImage.notFound": "Organization profile image not found",
"organization.member.notFound": "Organization's user is not a member",
Expand Down
2 changes: 2 additions & 0 deletions locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
"actionItemCategory.isDisabled": "La catégorie d'élément d'action est désactivée",
"actionItem.notFound": "Élément d\\’action non trouvé",
"event.notFound": "Événement non trouvé",
"baseRecurringEvent.notFound": "Événement récurrent de base introuvable",
"recurrenceRule.notFound": "Règle de récurrence introuvable",
"organization.notFound": "Organisation introuvable",
"organization.profileImage.notFound": "Image du profil de l'organisation introuvable",
"organization.member.notFound": "L'utilisateur de l'organisation n'est pas membre",
Expand Down
2 changes: 2 additions & 0 deletions locales/hi.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
"actionItem.notFound": "कार्रवाई का मद नहीं मिला",
"advertisement.notFound": "विज्ञापन नहीं मिला",
"event.notFound": "घटना नहीं मिली",
"baseRecurringEvent.notFound": "आधार पुनरावृत्ति कार्यक्रम नहीं मिला",
"recurrenceRule.notFound": "पुनरावृत्ति नियम नहीं मिला",
"organization.notFound": "संगठन नहीं मिला",
"organization.profileImage.notFound": "संगठन की प्रोफ़ाइल छवि नहीं मिली",
"organization.member.notFound": "संगठन का उपयोगकर्ता सदस्य नहीं है",
Expand Down
2 changes: 2 additions & 0 deletions locales/sp.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
"actionItemCategory.isDisabled": "La categoría de elemento de acción está deshabilitada",
"actionItem.notFound": "Elemento de acción no encontrado",
"event.notFound": "Evento no encontrado",
"baseRecurringEvent.notFound": "Evento recurrente base no encontrado",
"recurrenceRule.notFound": "Regla de recurrencia no encontrada",
"organization.notFound": "Organización no encontrada",
"organization.profileImage.notFound": "No se encontró la imagen del perfil de la organización",
"organization.member.notFound": "El usuario de la organización no es miembro",
Expand Down
2 changes: 2 additions & 0 deletions locales/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
"actionItemCategory.isDisabled": "操作项类别已禁用",
"actionItem.notFound": "找不到操作项",
"event.notFound": "未找到事件",
"baseRecurringEvent.notFound": "未找到基本重复事件",
"recurrenceRule.notFound": "未找到重复规则",
"organization.notFound": "未找到組織",
"organization.profileImage.notFound": "未找到組織檔案圖像",
"organization.member.notFound": "組織的用戶不是成員",
Expand Down
Loading

0 comments on commit b317bdf

Please sign in to comment.