Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
module.exports = {
parser: '@typescript-eslint/parser',
parserOptions: {
project: 'tsconfig.json',
tsconfigRootDir: __dirname,
sourceType: 'module',
},
plugins: ['@typescript-eslint/eslint-plugin', 'import'],
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
'plugin:prettier/recommended',
'plugin:import/warnings',
'plugin:import/errors',
'plugin:import/typescript',
],
settings: {
'import/resolver': {
[require.resolve('eslint-import-resolver-typescript')]: {},
node: {},
},
},
root: true,
env: {
node: true,
jest: true,
es6: true,
},
rules: {
'@typescript-eslint/no-floating-promises': 'off',
'@typescript-eslint/interface-name-prefix': 'off',
'prettier/prettier': 'error',
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'no-console': 'error',
'keyword-spacing': 'error',
'space-before-blocks': 'error',
'arrow-spacing': 'error',
'key-spacing': 'error',
'switch-colon-spacing': 'error',
'semi-spacing': 'error',
'comma-spacing': 'error',
'func-call-spacing': 'error',
'no-multi-spaces': ['error', { ignoreEOLComments: true }],
'object-curly-spacing': ['error', 'always'],
'@typescript-eslint/no-unused-vars': 'error',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'space-before-function-paren': [
'error',
{
anonymous: 'always',
named: 'never',
asyncArrow: 'always',
},
],
yoda: 'warn',
'import/newline-after-import': 'warn',
'import/no-cycle': 'off',
'import/order': 'warn',
'import/no-named-as-default-member': 'off',
},
};
34 changes: 34 additions & 0 deletions .github/workflows/github-actions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: CI/CD Pipeline

on:
push:
branches:
- main
- test*

jobs:
build:
uses: Passimx/ci-cd-workflows/.github/workflows/build.yml@main
with:
ORGANIZATION_NAME: ${{ vars.ORGANIZATION_NAME }}
IMAGE_NAME: ${{ vars.IMAGE_NAME }}
secrets:
DOCKER_TOKEN: ${{ secrets.DOCKER_HUB_TOKEN }}

release:
needs: build
uses: Passimx/ci-cd-workflows/.github/workflows/release.yml@main
with:
ORGANIZATION_NAME: ${{ vars.ORGANIZATION_NAME }}
IMAGE_NAME: ${{ vars.IMAGE_NAME }}
secrets:
DOCKER_TOKEN: ${{ secrets.DOCKER_HUB_TOKEN }}

deploy:
needs: release
uses: Passimx/ci-cd-workflows/.github/workflows/deploy.yml@main
secrets:
SSH_USER: ${{ secrets.SSH_USER }}
SSH_HOST: ${{ secrets.SSH_HOST }}
DEPLOY_SCRIPT: ${{ secrets.DEPLOY_SCRIPT }}
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
38 changes: 38 additions & 0 deletions .github/workflows/njsscan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

# This workflow integrates njsscan with GitHub's Code Scanning feature
# nodejsscan is a static security code scanner that finds insecure code patterns in your Node.js applications

name: njsscan sarif

on:
pull_request:
types: [opened, synchronize, reopened]
branches: [ "main" ]

permissions:
contents: read

jobs:
njsscan:
permissions:
contents: read # for actions/checkout to fetch code
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
runs-on: ubuntu-latest
name: njsscan code scanning
steps:
- name: Checkout the code
uses: actions/checkout@v4
- name: nodejsscan scan
id: njsscan
uses: ajinabraham/njsscan-action@7237412fdd36af517e2745077cedbf9d6900d711
with:
args: '. --sarif --output results.sarif || true'
- name: Upload njsscan report
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: results.sarif
1 change: 1 addition & 0 deletions .husky/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_
5 changes: 5 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npm run build && npm run lint

8 changes: 8 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"singleQuote": true,
"trailingComma": "all",
"bracketSpacing": true,
"endOfLine": "auto",
"printWidth": 120,
"tabWidth": 4
}
112 changes: 1 addition & 111 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,121 +1,11 @@
version: '3.8'
services:
notifications-service:
image: passimx/notifications-service
container_name: passimx-notifications-service
restart: always
env_file: .env
networks:
- main
depends_on:
- kafka
ports:
- ${APP_PORT_NOTIFICATION}:${APP_PORT_NOTIFICATION}
- ${SOCKET_PORT_NOTIFICATION}:${SOCKET_PORT_NOTIFICATION}

chats-service:
image: passimx/chats-service
container_name: passimx-chats-service
depends_on:
- postgres
- kafka
restart: always
env_file: .env
networks:
- main
ports:
- ${APP_PORT}:${APP_PORT}

postgres:
image: postgres:17-alpine
container_name: passimx-postgres
restart: always
env_file: .env
environment:
POSTGRES_DB: ${PG_DATABASE}
POSTGRES_USER: ${PG_USERNAME}
POSTGRES_PASSWORD: ${PG_PASSWORD}
command: -p ${PG_PORT}
expose:
- ${PG_PORT}
networks:
- main
ports:
- ${PG_PORT}:${PG_PORT}

kafka:
image: 'bitnami/kafka:latest'
container_name: passimx-kafka
restart: always
networks:
- main
env_file: .env
environment:
- KAFKA_ENABLE_KRAFT=yes
- KAFKA_BROKER_ID=1
- KAFKA_CFG_NODE_ID=1
- KAFKA_CFG_PROCESS_ROLES=broker,controller
- KAFKA_CFG_LISTENERS=CLIENT://:${KAFKA_CLIENT_PORT},INTERNAL://:${KAFKA_INTERNAL_PORT},EXTERNAL://:${KAFKA_EXTERNAL_PORT},
- KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP=INTERNAL:PLAINTEXT,CLIENT:SASL_PLAINTEXT,EXTERNAL:SASL_PLAINTEXT
- KAFKA_CFG_ADVERTISED_LISTENERS=CLIENT://kafka:${KAFKA_CLIENT_PORT},EXTERNAL://kafka:${KAFKA_EXTERNAL_PORT}
- KAFKA_CFG_INTER_BROKER_LISTENER_NAME=CLIENT
- KAFKA_CFG_SASL_MECHANISM_INTER_BROKER_PROTOCOL=PLAIN
- KAFKA_CFG_SASL_ENABLED_MECHANISMS=PLAIN
- KAFKA_CFG_AUTO_CREATE_TOPICS_ENABLE=true
- KAFKA_CLIENT_USERS=${KAFKA_CLIENT_USERS}
- KAFKA_CLIENT_PASSWORDS=${KAFKA_USER_PASSWORD}
- KAFKA_CFG_CONTROLLER_LISTENER_NAMES=INTERNAL
- KAFKA_CFG_CONTROLLER_QUORUM_VOTERS=1@127.0.0.1:9093
- ALLOW_PLAINTEXT_LISTENER=yes
- PRE_CREATE_TOPICS=${PRE_CREATE_TOPICS}
ports:
- ${KAFKA_CLIENT_PORT}:${KAFKA_CLIENT_PORT}
- ${KAFKA_EXTERNAL_PORT}:${KAFKA_EXTERNAL_PORT}
command:
- bash
- -c
- |
(
IFS="," read -ra TOPICS <<< "$$PRE_CREATE_TOPICS";
for T in "$${TOPICS[@]}"; do
/opt/bitnami/kafka/bin/kafka-topics.sh \
--bootstrap-server kafka:9092 \
--create --topic "$$T" --if-not-exists &&
echo "Created $$T" ||
echo "Failed to create $$T";
done;
) & /opt/bitnami/scripts/kafka/run.sh

kafka-ui:
container_name: passimx-kafka-ui
image: provectuslabs/kafka-ui:latest
restart: always
depends_on:
- kafka
networks:
- main
env_file: .env
environment:
- SERVER_SERVLET_CONTEXT_PATH=${SERVER_SERVLET_CONTEXT_PATH}
- KAFKA_CLUSTERS_0_NAME=${KAFKA_UI_HOST}
- KAFKA_CLUSTERS_0_BOOTSTRAPSERVERS=${KAFKA_HOST}:${KAFKA_CLIENT_PORT}
- KAFKA_CLUSTERS_0_PROPERTIES_SECURITY_PROTOCOL=SASL_PLAINTEXT
- KAFKA_CLUSTERS_0_PROPERTIES_SASL_MECHANISM=PLAIN
- >
KAFKA_CLUSTERS_0_PROPERTIES_SASL_JAAS_CONFIG=org.apache.kafka.common.security.plain.PlainLoginModule
required
username="${KAFKA_CLIENT_USERS}"
password="${KAFKA_USER_PASSWORD}";
ports:
- ${KAFKA_UI_PORT}:${KAFKA_UI_PORT}


webdav:
image: bytemark/webdav
ports:
- ${WEBDAV_PORT}:80
volumes:
- ./dav-data:/var/lib/dav
- ./data/dav-data:/var/lib/dav
environment:
- AUTH_TYPE=Basic
- USERNAME=${USER_NAME_WEBDAV}
Expand Down
17 changes: 17 additions & 0 deletions env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# main
APP_HOST_FILES=localhost
APP_PORT_FILES=7021

# webdav
WEBDAV_HOST=http://localhost
WEBDAV_PORT=80
USER_NAME_WEBDAV=admin
PASSWORD_WEBDAV=secrets

# kafka
KAFKA_HOST=localhost
KAFKA_EXTERNAL_PORT=9094
KAFKA_CLIENT_USERS=user
KAFKA_USER_PASSWORD=bitnami
KAFKA_GROUP_ID=ramil-notifications-service
KAFKA_IS_CONNECT=true
Loading