N
Novu6mo ago
Kh. M-S.

About three yml files in "docker/local" folder in the github repository.

Hi! There are three yml files in the "docker/local" folder in your github. What is responsible for what? Give me detailed explanation with use case examples.
27 Replies
Ask Inkeep
Ask Inkeep6mo ago
Hi @Kh. M-S., I'm an AI assistant for Novu. While a team member reviews this question, I'll see if I can find relevant sources for your question. ----------------------------- While I generate an answer, here are some sources that might be helpful: * Frequently Asked Questions * Deploy with Docker * AWS * MacOS/Linux ----------------------------- Answer The three YAML files in the "docker/local" folder of the Novu GitHub repository are designed for different purposes related to setting up and managing Novu in various environments. Here is a detailed explanation of each file and its use case: 1. docker-compose.yml: This file is primarily used to spin up the entire Novu environment for local development. It sets up all necessary services, including the API, web, worker, and other dependencies like MongoDB, Redis, and LocalStack. 2. docker-compose.override.yml: This file is typically used to override settings in the main docker-compose.yml for local development. It might contain configurations that are specific to the developer's local environment, such as different environment variables, volumes, or service parameters. 3. docker-compose.prod.yml: This file is tailored for production use. It configures services for a production environment, with optimizations and settings that ensure scalability, security, and performance. It includes configurations such as separate databases, external storage services, and optimized resource settings. Let's break down the use cases with examples: Use Case Examples: 1. Local Development (docker-compose.yml): - Purpose: To set up a complete Novu development environment on a local machine. - Example: A developer wants to contribute to Novu's codebase or test new features locally. They would use this file to run all necessary services and dependencies.
docker-compose up -d

docker-compose up -d

- Outcome: All services (API, web, worker, MongoDB, Redis, LocalStack) are running, enabling the developer to make and test changes. 2. Local Overrides (docker-compose.override.yml): - Purpose: To provide custom configurations that override the main docker-compose.yml settings for local development. - Example: A developer needs to use a different version of a service or customize environment variables for their local setup. They would add these configurations to docker-compose.override.yml.
services:
api:
environment:
NODE_ENV: development

services:
api:
environment:
NODE_ENV: development

- Outcome: The API service runs in development mode, allowing the developer to see detailed logging and hot-reloading. 3. Production Deployment (docker-compose.prod.yml): - Purpose: To configure and optimize Novu services for a production environment. - Example: A company wants to deploy Novu in their production environment with optimized settings for high availability and performance. They would use this file to set up the services.
docker-compose -f docker-compose.prod.yml up -d

docker-compose -f docker-compose.prod.yml up -d

- Outcome: Novu services are deployed with production-grade settings, including separate databases, external storage, and optimized resource allocations. Detailed Configuration Reference: 1. docker-compose.yml: - Sets up all necessary services for development. - Includes configurations for API, web, worker, MongoDB, Redis, and LocalStack. - Example service configuration:
services:
api:
build: ./api
ports:
- "3000:3000"
web:
build: ./web
ports:
- "4200:4200"

services:
api:
build: ./api
ports:
- "3000:3000"
web:
build: ./web
ports:
- "4200:4200"

2. docker-compose.override.yml: - Contains custom configurations for local development. - Overrides settings in the main docker-compose.yml. - Example override configuration:
services:
web:
environment:
VUE_APP_API_URL: "http://localhost:3000"

services:
web:
environment:
VUE_APP_API_URL: "http://localhost:3000"

3. docker-compose.prod.yml: - Configures services for production deployment. - Includes optimizations and settings for scalability, security, and performance. - Example production configuration:
services:
api:
build: ./api
environment:
NODE_ENV: production
DATABASE_URL: "mongodb://prod-db:27017/novu"
web:
build: ./web
environment:
VUE_APP_API_URL: "https://api.my-novu.com"

services:
api:
build: ./api
environment:
NODE_ENV: production
DATABASE_URL: "mongodb://prod-db:27017/novu"
web:
build: ./web
environment:
VUE_APP_API_URL: "https://api.my-novu.com"

These YAML files provide flexibility for different environments and use cases, ensuring that Novu can be efficiently developed and deployed. Please note, this information is based on understanding the typical structure and use of Docker Compose files in a multi-service application like Novu. For specific details and the latest configurations, it's recommended to review the actual files in the Novu GitHub repository.
Kh. M-S.
Kh. M-S.OP6mo ago
What is LocalStack? There are not such yml files in this directory. You did not amswer my qiestion.
Ask Inkeep
Ask Inkeep6mo ago
Got it. Tagging @Support for additional help.
Pawan Jain
Pawan Jain6mo ago
@Kh. M-S. We recently changed docker-compose yml file path from local/deployment to docker/community I just updated docs https://docs.novu.co/self-hosting-novu/deploy-with-docker Sorry for inconvenience
Kh. M-S.
Kh. M-S.OP6mo ago
@Pawan Jain Thank you very much! @Pawan Jain I just want to test Novu with my Next.js app localy. I did everything in this instruction. Additionaly to this I wrote my own JWT_SECRET and STORE_ENCRYPTION_KEY. Also I uncommented REACT_APP_API_URL=http://localhost:3000 because I deploy Novu in the local environment. I run docker. Everything works fine. I registered through the deployed web app. I signed in. I created workflow. I run my Next.js app localy. It is runned on 3001 port. When i try to connect to Novu I get the message "API Key not found" and error "Unauthorized" although I paste my API key correctly. Is there any steps I missed?
Novu_Bot
Novu_Bot6mo ago
@Kh. M-S., you just advanced to level 1!
Kh. M-S.
Kh. M-S.OP6mo ago
@Pawan Jain I have noticed right now that when I open localhost:3000 I get {"message":"Cannot GET /", "error" : "Not Found", " statusCode":404}
Pawan Jain
Pawan Jain6mo ago
@Kh. M-S. How you are connecting ? using nodejs sdk? When i try to connect to Novu I get the message "API Key not found" and error "Unauthorized" although I paste my API key correctly.
Kh. M-S.
Kh. M-S.OP6mo ago
@Pawan Jain Solved. It was my mistake. I wrote backendURL http://localhost:3000 and it works perfectly! Another one problem)
Kh. M-S.
Kh. M-S.OP6mo ago
I created workflow
No description
Kh. M-S.
Kh. M-S.OP6mo ago
Its content is
No description
Kh. M-S.
Kh. M-S.OP6mo ago
I created novu folder with two functions which call to my two different api
No description
Kh. M-S.
Kh. M-S.OP6mo ago
The first one "registerNewSubscriber" works fine. I see new subscribers in my web app But second one ("not1") does not work
Kh. M-S.
Kh. M-S.OP6mo ago
The api corresponding to this function is
No description
Kh. M-S.
Kh. M-S.OP6mo ago
The <Novu/> component code is
No description
Kh. M-S.
Kh. M-S.OP6mo ago
When I trigger not1 function I do not get notification.
Novu_Bot
Novu_Bot6mo ago
@Kh. M-S., you just advanced to level 2!
Kh. M-S.
Kh. M-S.OP6mo ago
When I print the result to the console from the api/nove_not_1 I get this
No description
Kh. M-S.
Kh. M-S.OP6mo ago
@Pawan Jain Maybe I placed NovuProvider in the wrong place?
Kh. M-S.
Kh. M-S.OP6mo ago
Also in dev console I see that the network request works
No description
Kh. M-S.
Kh. M-S.OP6mo ago
Also in dev console I see
No description
Kh. M-S.
Kh. M-S.OP6mo ago
No description
Kh. M-S.
Kh. M-S.OP6mo ago
@Pawan Jain I do not know is it related to my problem. But I paste my app identifier correctly. Solved! There was nothing about backendUrl and socketUrl for NovuProvider component in a tutorial I read. In NovuProvider I added backendUrl="http://localhost:3000" socketUrl="http://localhost:3002". @Pawan Jain Now I get notifications. Also I received old ones. But the problem now is that I get notifications only when I trigger them through the web app. But I do not receive notifications when I click the button to trigger my function. Although the result of this request has the code 201.
YingPang
YingPang2w ago
Hi Pawan, this is still somewhat confusing, the docker-compose in the community folder is incomplete as its not including the DOCKER_LOCALSTACK_PORT=4566 in the env file. and it does not mention that you should actually start the whole local docker-compose.yml stack too in addition to the community file. based on my understanding you need to start both for a local environment to fully function? it would be great if this whole section is documented somewhere online or at least in the repo itself this helps a lot
Ask Inkeep
Ask Inkeep2w ago
Please tag me in threads that I was a part of from the start.
Pawan Jain
Pawan Jain2w ago
@YingPang DOCKER_LOCALSTACK_PORT variable is not required to run community version. in docker/community/docker-compose.yml we have containers for each service and required env variables
YingPang
YingPang2w ago
this is still a bit confusing, but i guess it just uses localstack by defining S3_LOCAL_STACK=$HOST_NAME:4566 basically you need a local S3 which is why you setup https://github.com/novuhq/novu/blob/next/docker/local/docker-compose.yml so basically you could use community edition together with https://min.io/ or is there any other requirement from localstack
Want results from more Discord servers?
Add your server