MongoDB เพิ่ม auth กรณีต้องการความปลอดภัย

1. Connect DB แล้ว run command ตามโน้น

use admin
db.createUser(
  {
    user: "myUserAdmin",
    pwd: passwordPrompt(), // or cleartext password
    roles: [ { role: "userAdminAnyDatabase", db: "admin" }, "readWriteAnyDatabase" ]
  }
)

2. Shutdown Mongo

db.adminCommand( { shutdown: 1 } )

3. Add config mongod.conf ตามนี้

security:
    authorization: enabled

4. Start mongo

Dockerize Nginx with Nodejs

ref. https://dev.to/subhransu/nevertheless-subhransu-maharana-coded-5eam

Example Dockerfile

FROM node:12.8.1 as builder

COPY package*.json ./
RUN npm install  && mkdir -pv /opt/app && mv ./node_modules /opt/app/.

WORKDIR /opt/app

COPY . .

RUN npm run build
#EXPOSE 8080
# For Development ENV
#CMD [ "npm", "run", "serve" ]
FROM nginx:1.16.0-alpine
COPY --from=builder /opt/app/dist /usr/share/nginx/html
RUN rm /etc/nginx/conf.d/default.conf
COPY nginx/nginx.conf /etc/nginx/conf.d
EXPOSE 80
EXPOSE 443
CMD ["nginx", "-g", "daemon off;"]