add debugging.

This commit is contained in:
Nawaz Dhandala 2021-06-21 22:08:35 +01:00
parent 5eb5371a21
commit 71f66549be
29 changed files with 340 additions and 151 deletions

1
.gitignore vendored
View File

@ -17,7 +17,6 @@ node_modules
.env.test.local
.env.production.local
env.js
/.vscode
npm-debug.log*
yarn-debug.log*

22
.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,22 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"address": "0.0.0.0",
"localRoot": "${workspaceFolder}/backend",
"name": "Backend: Debug with Docker",
"port": 9232,
"remoteRoot": "/usr/src/app",
"request": "attach",
"skipFiles": [
"<node_internals>/**"
],
"type": "pwa-node"
},
]
}

View File

@ -6,26 +6,21 @@
FROM node:16
#SET ENV Variables
ENV PRODUCTION=true
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
RUN mkdir -p /usr/src/app
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
WORKDIR /usr/src/app
# Copy package.json files
COPY ./package.json /usr/src/app/package.json
COPY ./package-lock.json /usr/src/app/package-lock.json
# Install app dependencies
COPY package*.json /usr/src/app/
RUN npm ci --only=production
# Copy app source
COPY . /usr/src/app
# Bundle app source
RUN npm run build
RUN npm install
# Expose ports.
# - 3003: accounts
EXPOSE 3003
#Run the app
CMD [ "npm", "start" ]
CMD [ "npm", "run", "dev" ]

View File

@ -0,0 +1,27 @@
#
# Admin Dashboard Dockerfile
#
# Pull base image nodejs image.
FROM node:16
#SET ENV Variables
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
WORKDIR /usr/src/app
# Copy package.json files
COPY ./package.json /usr/src/app/package.json
COPY ./package-lock.json /usr/src/app/package-lock.json
# Install app dependencies
RUN npm install
# Expose ports.
# - 3100: Fyipe-admin-dashboard
EXPOSE 3100
#Run the app
CMD [ "npm", "run", "dev" ]

View File

@ -15,7 +15,7 @@ RUN npm ci --only=production
COPY . /usr/src/app
# Expose ports.
# - 1445: Fyipe Dcos
# - 1445: Fyipe Docs
EXPOSE 1445
#Run the app

26
api-docs/Dockerfile.dev Normal file
View File

@ -0,0 +1,26 @@
#
# Fyipe Docs Dockerfile
#
# Pull base image nodejs image.
FROM node:16
#SET ENV Variables
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
WORKDIR /usr/src/app
# Copy package.json files
COPY ./package.json /usr/src/app/package.json
COPY ./package-lock.json /usr/src/app/package-lock.json
# Install app dependencies
RUN npm install
# Expose ports.
# - 3000: Fyipe
EXPOSE 3000
#Run the app
CMD [ "npm", "run", "dev" ]

View File

@ -6,7 +6,7 @@
FROM node:16
#SET ENV Variables
ENV PRODUCTION=true
WORKDIR /usr/src/app
@ -21,7 +21,7 @@ RUN mkdir -p greenlock.d
COPY ./package.json /usr/src/app/package.json
COPY ./package-lock.json /usr/src/app/package-lock.json
RUN npm ci
RUN npm install
# Expose ports.
# - 3002: Fyipe-backend

26
dashboard/Dockerfile.dev Normal file
View File

@ -0,0 +1,26 @@
#
# Fyipe Docs Dockerfile
#
# Pull base image nodejs image.
FROM node:16
#SET ENV Variables
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
WORKDIR /usr/src/app
# Copy package.json files
COPY ./package.json /usr/src/app/package.json
COPY ./package-lock.json /usr/src/app/package-lock.json
# Install app dependencies
RUN npm install
# Expose ports.
# - 1445: Fyipe Docs
EXPOSE 1445
#Run the app
CMD [ "npm", "run", "dev" ]

View File

@ -25,6 +25,17 @@ services:
- '6390:6379'
command: redis-server
accounts:
ports:
- '3003:3003'
build:
context: ./accounts
dockerfile: ./Dockerfile.dev
env_file:
- ./accounts/.env
environment:
- IS_SAAS_SERVICE=${IS_SAAS_SERVICE}
backend:
ports:
- '3002:3002' # Service Port.

View File

@ -13,7 +13,7 @@ RUN npm ci --only=production
COPY . /usr/src/app
# Expose ports.
# - 1445: Fyipe Helm Chart Server
# - 3423: Fyipe Helm Chart Server
EXPOSE 3423
#Run the app

28
helm-chart/Dockerfile.dev Normal file
View File

@ -0,0 +1,28 @@
#
# Fyipe Docs Dockerfile
#
# Pull base image nodejs image.
FROM node:16
#SET ENV Variables
WORKDIR /usr/src/app
# Copy package.json files
COPY ./package.json /usr/src/app/package.json
COPY ./package-lock.json /usr/src/app/package-lock.json
# Install app dependencies
RUN npm install
# Expose ports.
# - 3423: Fyipe Helm Chart Server
EXPOSE 3423
# Expose Debugger port
EXPOSE 9229
#Run the app
CMD [ "npm", "run", "dev" ]

View File

@ -6,7 +6,7 @@
"scripts": {
"preinstall": "npx npm-force-resolutions || echo 'No package-lock.json file. Skipping force resolutions'",
"start": "node server.js",
"dev": "nodemon server.js",
"dev": "nodemon --inspect=0.0.0.0 server.js",
"test": "cross-env NODE_ENV=development mocha --exit test/index.js",
"audit": "npm audit --audit-level=low",
"dep-check": "depcheck ./ --skip-missing=true --ignores='ejs'"

View File

@ -21,7 +21,7 @@ RUN npm ci --only=production
COPY . /usr/src/app
# Expose ports.
# - 1444: CloudBoost Fyipe Home
# - 1444: Fyipe Home
EXPOSE 1444
#Run the app

29
home/Dockerfile.dev Normal file
View File

@ -0,0 +1,29 @@
#
# Home Dev Dockerfile
#
# Pull base image nodejs image.
FROM node:16
#SET ENV Variables
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
WORKDIR /usr/src/app
# Copy package.json files
COPY ./package.json /usr/src/app/package.json
COPY ./package-lock.json /usr/src/app/package-lock.json
# Install app dependencies
RUN npm install
# Expose ports.
# - 1444: Fyipe Home
EXPOSE 1444
# Expose Debugger port
EXPOSE 9229
#Run the app
CMD [ "npm", "run", "dev" ]

View File

@ -4,7 +4,7 @@
"scripts": {
"preinstall": "npx npm-force-resolutions || echo 'No package-lock.json file. Skipping force resolutions'",
"start": "node server.js",
"dev": "nodemon server.js",
"dev": "nodemon --inspect=0.0.0.0 server.js",
"test": "echo 'no tests'",
"lighthouse-test": "jest --forceExit lighthouse-tests/test/index.test.js --env=node",
"lighthouse": "start-server-and-test http://localhost:1444",

View File

@ -0,0 +1,29 @@
#
# HTTP Test Server Dockerfile
#
# Pull base image nodejs image.
FROM node:16
#SET ENV Variables
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
WORKDIR /usr/src/app
# Copy package.json files
COPY ./package.json /usr/src/app/package.json
COPY ./package-lock.json /usr/src/app/package-lock.json
# Install app dependencies
RUN npm install
# Expose ports.
# - 3010: Fyipe-http-test-server
EXPOSE 3010
# Expose Debugger port
EXPOSE 9229
#Run the app
CMD [ "npm", "run", "dev" ]

View File

@ -6,7 +6,7 @@
"scripts": {
"preinstall": "npx npm-force-resolutions || echo 'No package-lock.json file. Skipping force resolutions'",
"start": "node server.js",
"dev": "cross-env NODE_ENV=development nodemon server.js",
"dev": "cross-env NODE_ENV=development nodemon --inspect=0.0.0.0 server.js",
"audit": "npm audit --audit-level=low",
"test": "jest --forceExit --runInBand test",
"dep-check": "depcheck ./ --skip-missing=true --ignores='ejs'"

View File

@ -16,11 +16,5 @@ COPY . /usr/src/app
# Install app dependencies
RUN npm install
# Bundle app source
# RUN npm run build
# Expose app port
# EXPOSE 3010
# Run app
CMD ["npm", "start"]

View File

@ -0,0 +1,25 @@
#
# Init Scirpt Dockerfile
#
# Pull base image nodejs image.
FROM node:16
#SET ENV Variables
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
WORKDIR /usr/src/app
# Copy package.json files
COPY ./package.json /usr/src/app/package.json
COPY ./package-lock.json /usr/src/app/package-lock.json
# Install app dependencies
RUN npm install
# Expose Debugger port
EXPOSE 9229
#Run the app
CMD [ "npm", "run", "dev" ]

View File

@ -7,7 +7,7 @@
"preinstall": "npx npm-force-resolutions || echo 'No package-lock.json file. Skipping force resolutions'",
"test": "jest --forceExit tests",
"start": "node server.js",
"dev": "nodemon server.js",
"dev": "nodemon --inspect=0.0.0.0 server.js",
"audit": "npm audit --audit-level=low",
"dep-check": "depcheck ./ --skip-missing=true --ignores='babel-*,browserslist,ejs,path'"
},

29
licensing/Dockerfile.dev Normal file
View File

@ -0,0 +1,29 @@
#
# HTTP Test Server Dockerfile
#
# Pull base image nodejs image.
FROM node:16
#SET ENV Variables
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
WORKDIR /usr/src/app
# Copy package.json files
COPY ./package.json /usr/src/app/package.json
COPY ./package-lock.json /usr/src/app/package-lock.json
# Install app dependencies
RUN npm install
# Expose ports.
# - 3004: Fyipe-licensing
EXPOSE 3004
# Expose Debugger port
EXPOSE 9229
#Run the app
CMD [ "npm", "run", "dev" ]

View File

@ -20,7 +20,7 @@
"scripts": {
"preinstall": "npx npm-force-resolutions || echo 'No package-lock.json file. Skipping force resolutions'",
"start": "node server.js",
"dev": "nodemon server.js",
"dev": "nodemon --inspect=0.0.0.0 server.js",
"test": "mocha --exit test/index.js",
"audit": "npm audit --audit-level=low",
"dep-check": "depcheck ./ --skip-missing=true --ignores='ejs'"

View File

@ -6,7 +6,6 @@
FROM node:16
#SET ENV Variables
ENV PRODUCTION=true
ENV CHROME_PATH=/usr/bin/google-chrome
# Install Chrome.
@ -27,13 +26,22 @@ RUN chmod +x ./kubectl
RUN mv ./kubectl /usr/local/bin/kubectl && \
chown root: /usr/local/bin/kubectl
WORKDIR /app
# Install app dependencies
RUN cd /usr/src/app
# Copy package.json files
COPY ./package.json /usr/src/app/package.json
COPY ./package-lock.json /usr/src/app/package-lock.json
RUN npm install
# Expose ports.
# - 3008: probe
EXPOSE 3008
#Run the app
CMD [ "npm", "start"]
# Expose Debugging port.
EXPOSE 9229
#Run the app
CMD [ "npm", "run", "dev"]

View File

@ -0,0 +1,28 @@
#
# Accounts Dockerfile
#
# Pull base image nodejs image.
FROM node:16
#SET ENV Variables
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
WORKDIR /usr/src/app
# Copy package.json files
COPY ./package.json /usr/src/app/package.json
COPY ./package-lock.json /usr/src/app/package-lock.json
# Install app dependencies
RUN npm install
# Expose ports.
# - 3009: Fyipe:script-runner
EXPOSE 3009
# Expose Debugging port.
EXPOSE 9229
#Run the app
CMD [ "npm", "run", "dev" ]

View File

@ -5,7 +5,7 @@
"main": "index.js",
"scripts": {
"start": "node index.js",
"dev": "nodemon index.js",
"dev": "nodemon --inspect=0.0.0.0 index.js",
"test": "echo \"Error: no test specified\" && exit 1",
"audit": "npm audit --audit-level=low"
},

View File

@ -1,43 +0,0 @@
##
# This file is from the official Harakaa Docker Repository - https://github.com/haraka/Haraka
# https://github.com/haraka/Haraka/blob/master/Dockerfile
##
###
#Important: Highly dependent on *-alpine image.
###
FROM node:16.0.1-alpine3.12
#set language enviroments
ENV LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 \
TIMEZONE="America/New_York" \
SMTP_PORT=25 \
LOGLEVEL=warn \
DATADIR=/data \
HEADER="Haraka Server"
# install dependence
RUN apk upgrade --update && \
apk add --no-cache -t .fetch-deps \
autoconf \
g++ \
gcc \
make \
python && \
addgroup -g 88 -S smtp && \
adduser -u 88 -D -S -G smtp -h /data smtp && \
# Install haraka
npm install -g --unsafe-perm Haraka && \
# # Cleaning up
apk del --purge -r .fetch-deps && \
apk add --no-cache tzdata openssl execline ca-certificates && \
rm -rf /var/cache/apk/* /tmp/* ~/.pearrc
RUN apk add bash
# install software
COPY run.sh /
RUN chmod 755 /run.sh
CMD ["/run.sh"]

View File

@ -1,45 +0,0 @@
# Haraka Docker Container for Fyipe
This is a simple SMTP server which is used to send bulk emails. This can be used to send email alerts to subscribers and team.
## Important
This will not work on your local machine because email sending is blocked by ISP. You need to run these on the server and test.
## Build Docker Container
```
docker build . -t haraka:latest
```
## Run a Docker Container
Run Redis
```
docker run -d -p 6379:6379 redis:latest
```
Run Fyipe Haraka Container:
```
docker run -d -p 25:25 -e SMTP_USER="user@hackerbay.io" --net="host" -e SMTP_PASSWORD="hackerbay" -e SMTP_PORT="25" haraka:latest
```
## Test
```
# Ubuntu
sudo apt-get update
sudo apt-get install swaks -y
# MacOS
brew install swaks
# Test
swaks --to nawazdhandala@outlook.com --from user@hackerbay.io --server localhost \
--port 25 --auth-user user@hackerbay.io --auth-password hackerbay
```
See if you get a mail in your inbox.

View File

@ -1,29 +0,0 @@
#! /bin/sh
#
# run.sh
echo "${TIMEZONE}" > /etc/TZ
cp /usr/share/zoneinfo/${TIMEZONE} /etc/localtime
#init config when first running
if [[ ! -d "${DATADIR}/config" ]];then
haraka -i ${DATADIR}
echo "listen=[::0]:${SMTP_PORT}" > ${DATADIR}/config/smtp.ini
echo "nodes=cpus" >> ${DATADIR}/config/smtp.ini
#enable spf,dkim and auth_flat_file
echo "auth/flat_file" > ${DATADIR}/config/plugins
touch ${DATADIR}/config/auth_flat_file.ini
cat <<-EOF >> ${DATADIR}/config/auth_flat_file.ini
[core]
methods=PLAIN,LOGIN,CRAM-MD5
[users]
${SMTP_USER}=${SMTP_PASSWORD}
EOF
fi
#start haraka
stat -c "%U" ${DATADIR}|grep -q smtp || chown -R smtp:smtp ${DATADIR}
exec haraka -c ${DATADIR}

View File

@ -0,0 +1,30 @@
#
# Fyipe Docs Dockerfile
#
# Pull base image nodejs image.
FROM node:16
#SET ENV Variables
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
WORKDIR /usr/src/app
# Copy package.json files
COPY ./package.json /usr/src/app/package.json
COPY ./package-lock.json /usr/src/app/package-lock.json
# Install app dependencies
RUN npm install
# Expose ports.
# - 3006: HTTP Fyipe Status Page
EXPOSE 3006
# Expose ports.
# - 3007: HTTPS Fyipe Status Page
EXPOSE 3007
#Run the app
CMD [ "npm", "run", "dev" ]