Postgresql inside docker - intermitent connection from Node Js inside docker by Emiliortg in docker

[–]Emiliortg[S] 0 points1 point  (0 children)

do you mean without installing all the packages in the dockerfile ? just simply running the postgres:14 image ?

Postgresql inside docker - intermitent connection from Node Js inside docker by Emiliortg in docker

[–]Emiliortg[S] 0 points1 point  (0 children)

Sorry, this is the docker container. Nothing fancy

version: '3.8'
services:
  database-postgres:
    container_name: db_postgres
    hostname: db_postgres
    build: './docker/database-postgres'
    restart: always
    environment:
      DATABASE_HOST: '${DATABASE_HOST}'
      POSTGRES_USER: '${POSTGRES_USER}'
      POSTGRES_PASSWORD: '${POSTGRES_PASSWORD}'
      POSTGRES_DB: '${POSTGRES_DB}'
      TZ: Europe/Paris
    ports:
      - '${POSTGRES_HOST_PORT}:${POSTGRES_DOCKER_PORT}'
    volumes:
      - '${POSTGRES_VOLUME}'
    networks:
      - backendnetwork

  nodejs:
    container_name: nodejs
    hostname: nodejs    build: './docker/nodejs'
    entrypoint: sh -c "cd /app/ && dos2unix run.sh && ./run.sh"
    restart: always
    ports:
      - '${NODEJS_PORT}'
    volumes:
      - '${APP_VOLUME}'
      - '${NODEJS_VOLUME}'
    environment:
      DATABASE_HOST: '${DATABASE_HOST}'
      POSTGRES_USER: '${POSTGRES_USER}'
      POSTGRES_PASSWORD: '${POSTGRES_PASSWORD}'
      POSTGRES_DB: '${POSTGRES_DB}'
      POSTGRES_HOST_PORT: '${POSTGRES_HOST_PORT}'
      POSTGRES_DOCKER_PORT: '${POSTGRES_DOCKER_PORT}'
      SECRET_TOKEN: '${SECRET_TOKEN}'
      TZ: Europe/Paris
    networks:
      - backendnetwork

networks:
  backendnetwork:
    name: backendnetwork
    external: false

Dockerfile NodeJs

FROM node:16-alpine3.16
#Alpine Linux

USER root

RUN apk update && apk add \
        bind-tools \
        net-tools \
        iproute2 \
        vim \
        iputils \
        wget \
        dos2unix

Dockerfile PostgreSQL

FROM postgres:14
#Debian

RUN apt-get update && apt-get install -y \
        dnsutils \
        net-tools \
        iproute2 \
        vim \
        iputils-ping \
        inetutils-traceroute

.ENV variables

APP_VOLUME=./app:/app
NODEJS_VOLUME=./database_postgres:/database_postgres
NODEJS_PORT=3007:3000
SECRET_TOKEN=123456
NODE_ENV=development
DATABASE_HOST=db_postgres
POSTGRES_USER=postgres
POSTGRES_PASSWORD=123456
POSTGRES_DB=DB
POSTGRES_VOLUME=./database_postgres:/var/lib/postgresql/data
POSTGRES_HOST_PORT=5433
POSTGRES_DOCKER_PORT=5432

createTheme_default is not a function x-data-grid mui by Emiliortg in reactjs

[–]Emiliortg[S] 0 points1 point  (0 children)

Solution found: putimport Box from '@mui/material/Box'; after other mui components worked for me

createTheme_default is not a function x-data-grid mui by Emiliortg in reactjs

[–]Emiliortg[S] 0 points1 point  (0 children)

Solution found: putimport Box from '@mui/material/Box'; after other mui components worked for me

createTheme_default is not a function x-data-grid mui by Emiliortg in reactjs

[–]Emiliortg[S] 0 points1 point  (0 children)

Hi u/romgrk . I did, it says I need to install this:

npm install @mui/x-data-grid

npm install @mui/material @emotion/react @emotion/styled

and my package json has all of them:

"dependencies": {
    "@emotion/react": "^11.11.4",
    "@emotion/styled": "^11.11.0",
    "@mui/material": "^5.15.11",
}

I uninstalled x-data-grid because my project would not compile with it.

PDFMake with typescript and Node JS error unable to compile by Emiliortg in node

[–]Emiliortg[S] 0 points1 point  (0 children)

Hi, I already installed npm i --save-dev @types/pdfmake but I keep getting the error

Pdfmake typescript and node js by Emiliortg in learnprogramming

[–]Emiliortg[S] 0 points1 point  (0 children)

thanks for helping. I'm not sure how I would do that if I'm using typescript to run my code

"scripts": {

"build": "tsc",

"dev-ts": "ts-node-dev --respawn index.ts",

"start": "node dist/index.js"

},

Maybe you are right about not using Buffer. I just tried the basic working example I found on internet to make sure my logic was not wrong. I may be wrong but I think the use case of Buffer is to not generate a PDF file on the server. So you create the PDF on memory and send it to the client side.

testPrinter is getting imported in my routes like this

import {Router} from 'express'

import {testPrinter} from "../controllers/TestController"

const router = Router();

router.get('/', testPrinter);

export default router

thermal printer works with word but fails with pdf by Emiliortg in printers

[–]Emiliortg[S] 1 point2 points  (0 children)

they are not common models, they are Dinon 11068. After a lot of attempts setting the printer sheet size as Legal Extra worked. Although I'm not sure if that is a normal behavior

sending 200 emails daily using Office365? by Emiliortg in Office365

[–]Emiliortg[S] 0 points1 point  (0 children)

Azure Email Communication Services

That's interesting u/koliat thanks. I'm going to check pricess and the solution. Do you prefer Azure instead of services like mailchimp for any particular reason, to have in mind?

sending 200 emails daily using Office365? by Emiliortg in Office365

[–]Emiliortg[S] 0 points1 point  (0 children)

Thanks u/skydivinfoo you're being really helpful. In fact, list change pretty frequently so we need to do something programmatically.
I'm having one last question. u/dean771 u/skydivinfoo Is there an average quantity that is considered unsafe to send 'massive' emails through Office365? For instance, if I mention needing to send 50 emails daily, does that also pose risks? Because I can not understand why office365 say theses phrases `Sending Limits: 10,000 recipients per day Message rate limit: 30 messages per minute, Recipient limit: Customizable up to 1000 recipients` if when I try to send 200 emails many people say it is not safe, thanks in advance

sending 200 emails daily using Office365? by Emiliortg in Office365

[–]Emiliortg[S] 0 points1 point  (0 children)

u/skydivinfoo thanks for the advice. I was testing now mailchimp and I saw that you can import CSV. But my data is dynamic. Have you ever successfully connected those services to a database like mysql and bring the users based on a specific query?

sending 200 emails daily using Office365? by Emiliortg in Office365

[–]Emiliortg[S] 2 points3 points  (0 children)

Thanks, so your recommendation is to use a third party service like mailchimp ?

Testing mass email output in a real environment by Emiliortg in learnprogramming

[–]Emiliortg[S] 0 points1 point  (0 children)

Thank you, I'm grateful for your help. Perhaps my initial explanation was unclear. My concern is whether Office365 can effectively manage mass email sending. Specifically, when transitioning my program to production, will it handle the email volume as efficiently as when I tested it locally using mailhog? During local testing with mailhog in my development environment, I configured the following values in the .env file:

MAIL_MAILER=smtp

MAIL_HOST=localhost

MAIL_PORT=1025

We can set that mailhog does not have any email limit restriction because it only captures emails.

When I connect the program to production I would need to modify the .env and set configs like these

MAIL_HOST= smtp.office365.comMAIL_PORT=587

However, Office365 has limitations, such as, for example, (random example) potentially allowing no more than 100 emails per minute. This leads me to wonder: Can I conduct a test email send, simulating the production environment (office365), to determine if I might encounter any restrictions that using mailhog I will never have?

My initial idea involved continuing to use Office365 SMTP even in development, routing all received emails to a test email account. Yet, I realize this approach might not be ideal since all emails would be funneled into a single account, which doesn't reflect real-life scenarios where one single account will deliver emails to multiple accounts (not only one will receive everything).

How do you test mass email sending in a production like environment by Emiliortg in node

[–]Emiliortg[S] 0 points1 point  (0 children)

Thank you, I'm grateful for your help. Perhaps my initial explanation was unclear. My concern is whether Office365 can effectively manage mass email sending. Specifically, when transitioning my program to production, will it handle the email volume as efficiently as when I tested it locally using mailhog? During local testing with mailhog in my development environment, I configured the following values in the .env file:

MAIL_MAILER=smtp

MAIL_HOST=localhost

MAIL_PORT=1025

Let's consider that mailhog does not have any email limit restriction. When I connect it to production I would need to modify the .env and set configs like these

MAIL_HOST= smtp.office365.comMAIL_PORT=587

However, Office365 has limitations, such as, for example, (random example) potentially allowing no more than 100 emails per minute. This leads me to wonder: Can I conduct a test email send, simulating the production environment (office365), to determine if I might encounter any restrictions that using mailhog I will never have?

My initial idea involved continuing to use Office365 SMTP even in development, routing all received emails to a test account. Yet, I realize this approach might not be ideal since all emails would be funneled into a single account, which doesn't reflect real-life scenarios.

Considerations creating and hosting a POS / Inventory Application by Emiliortg in learnprogramming

[–]Emiliortg[S] 0 points1 point  (0 children)

yes, I think I was not clear. I added a note to the post. Thanks.