Skip to content

Commit

Permalink
Merge pull request #408 from bluewave-labs/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
erenfn authored Dec 20, 2024
2 parents 5861c70 + acc7881 commit 7f19775
Show file tree
Hide file tree
Showing 381 changed files with 31,665 additions and 6,343 deletions.
Binary file added .DS_Store
Binary file not shown.
1 change: 1 addition & 0 deletions .coderabbit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ reviews:

auto_review:
enabled: true
base_branches: [.*]
drafts: false
chat:
auto_reply: false
Expand Down
110 changes: 55 additions & 55 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,55 +1,55 @@
# name: Deploy to Staging

# on:
# push:
# branches:
# - staging

# jobs:
# deploy:
# runs-on: ubuntu-latest
# strategy:
# matrix:
# node-version: [22.x]

# steps:
# - name: Checkout code
# uses: actions/checkout@v4

# - name: Set up Node.js ${{ matrix.node-version }}
# uses: actions/setup-node@v4
# with:
# node-version: ${{ matrix.node-version }}

# - name: Set up SSH
# env:
# SSH_PRIVATE_KEY_NEW: ${{ secrets.SSH_THIRD_PRIVATE_KEY }}
# KNOWN_HOSTS: ${{ secrets.KNOWN_HOSTS }}
# run: |
# mkdir -p ~/.ssh
# echo "$SSH_PRIVATE_KEY_NEW" > ~/.ssh/id_rsa
# chmod 600 ~/.ssh/id_rsa
# eval $(ssh-agent -s)
# ssh-add ~/.ssh/id_rsa
# echo "$KNOWN_HOSTS" > ~/.ssh/known_hosts


# - name: Configure SSH for easier access
# run: |
# echo "Host staging-server" >> ~/.ssh/config
# echo " HostName ${{ secrets.DO_IP_ADDRESS }}" >> ~/.ssh/config
# echo " User ${{ secrets.DO_USERNAME }}" >> ~/.ssh/config
# echo " IdentityFile ~/.ssh/id_rsa" >> ~/.ssh/config
# echo " StrictHostKeyChecking no" >> ~/.ssh/config

# - name: Deploy to DigitalOcean Droplet
# run: |
# ssh -o StrictHostKeyChecking=no -t staging-server << 'EOF'
# set -e
# cd ~/bluewave-onboarding
# git stash
# git pull
# docker compose down
# docker compose build
# docker compose up -d
# EOF
name: Deploy to Staging

on:
push:
branches:
- staging

jobs:
deploy:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [22.x]

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

- name: Set up SSH
env:
SSH_PRIVATE_KEY_NEW: ${{ secrets.SSH_THIRD_PRIVATE_KEY }}
KNOWN_HOSTS: ${{ secrets.KNOWN_HOSTS }}
run: |
mkdir -p ~/.ssh
echo "$SSH_PRIVATE_KEY_NEW" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
eval $(ssh-agent -s)
ssh-add ~/.ssh/id_rsa
echo "$KNOWN_HOSTS" > ~/.ssh/known_hosts
- name: Configure SSH for easier access
run: |
echo "Host staging-server" >> ~/.ssh/config
echo " HostName ${{ secrets.DO_IP_ADDRESS }}" >> ~/.ssh/config
echo " User ${{ secrets.DO_USERNAME }}" >> ~/.ssh/config
echo " IdentityFile ~/.ssh/id_rsa" >> ~/.ssh/config
echo " StrictHostKeyChecking no" >> ~/.ssh/config
- name: Deploy to DigitalOcean Droplet
run: |
ssh -o StrictHostKeyChecking=no -t staging-server << 'EOF'
set -e
cd ~/bluewave-onboarding
git stash
git pull
git stash apply
docker compose down
docker compose build
docker compose up -d
EOF
46 changes: 23 additions & 23 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
check-latest: true

# Clear npm cache
- name: Clear npm cache
Expand All @@ -43,23 +44,23 @@ jobs:
run: |
rm -rf ./frontend/node_modules ./frontend/package-lock.json
# Cache backend dependencies
- name: Cache backend dependencies
uses: actions/cache@v3
with:
path: ./backend/node_modules
key: backend-node-modules-${{ matrix.node-version }}-${{ hashFiles('backend/package-lock.json') }}
restore-keys: |
backend-node-modules-${{ matrix.node-version }}-
# Cache frontend dependencies
- name: Cache frontend dependencies
uses: actions/cache@v3
with:
path: ./frontend/node_modules
key: frontend-node-modules-${{ matrix.node-version }}-${{ hashFiles('frontend/package-lock.json') }}
restore-keys: |
frontend-node-modules-${{ matrix.node-version }}-
# # Cache backend dependencies
# - name: Cache backend dependencies
# uses: actions/cache@v3
# with:
# path: ./backend/node_modules
# key: backend-node-modules-${{ matrix.node-version }}-${{ hashFiles('backend/package-lock.json') }}
# restore-keys: |
# backend-node-modules-${{ matrix.node-version }}-

# # Cache frontend dependencies
# - name: Cache frontend dependencies
# uses: actions/cache@v3
# with:
# path: ./frontend/node_modules
# key: frontend-node-modules-${{ matrix.node-version }}-${{ hashFiles('frontend/package-lock.json') }}
# restore-keys: |
# frontend-node-modules-${{ matrix.node-version }}-

- name: Install dependencies for backend
working-directory: ./backend
Expand Down Expand Up @@ -87,14 +88,13 @@ jobs:
working-directory: ./frontend
run: npm run build --if-present

# Uncomment the following lines to run tests
# - name: Run tests for backend
# working-directory: ./backend
# run: npm test

- name: Run tests for frontend
working-directory: ./frontend
run: npm test

- name: Run tests for backend
working-directory: ./backend
run: npm test

- name: Run Docker container
run: docker compose up --build -d
run: docker compose up --build -d
3 changes: 2 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ All types of contributions are encouraged and valued. See the [Table of Contents
> - Refer this project in your project's readme
> - Mention the project at local meetups and tell your friends/colleagues

## Table of Contents

- [I Have a Question](#i-have-a-question)
Expand Down Expand Up @@ -98,7 +99,7 @@ We have a Figma file that includes:

You can see the dashboard designs [here](https://www.figma.com/design/MLPbP1HM2L9ON6f88pHTee/User-onboarding?node-id=0-1&t=T58Y7lj90RJBey0k-1), and the style guides [here](https://www.figma.com/design/USQRG7Oacv7uXw8XkTPINq/Style-guide?node-id=170-4048&t=QwZ5JRnYywYsScLj-1). Since they are read-only, we encourage you to copy to your own Figma page, then work on it.

Also make sure you read the [document about how to make a good pull request](/PULLREQUESTS.md).
[This document](https://docs.google.com/document/d/1Gy3LiimGUNoSiWAMbwyK3SeMADcCMjCLu6cQYoawtSE/edit#heading=h.1lj2lgut6m7h) outlines the process every developer should follow for managing the issues lifecycle. Also make sure you read the [document about how to make a good pull request](/PULLREQUESTS.md).

## Attribution
This guide is based on the **contributing.md**. [Make your own](https://contributing.md/)!
Binary file added backend/.DS_Store
Binary file not shown.
37 changes: 26 additions & 11 deletions backend/.env
Original file line number Diff line number Diff line change
@@ -1,11 +1,26 @@
# Node environment
NODE_ENV=development

# Development environment
DEV_DB_USERNAME=user123
DEV_DB_PASSWORD=password123
DEV_DB_NAME=onboarding_db
DEV_DB_HOST=localhost
DEV_DB_PORT=5432

EMAIL_ENABLE=false
# Node environment
NODE_ENV=development

# Development environment
DEV_DB_USERNAME=user123
DEV_DB_PASSWORD=password123
DEV_DB_NAME=onboarding_db
DEV_DB_HOST=db
DEV_DB_PORT=5432

EMAIL_ENABLE=false

# JWT Secret Key
JWT_SECRET="NKrbO2lpCsOpVAlqAPsjZ0tZXzIoKru7gAmYZ7XlHn0=qqwqeq"

TEST_DB_USERNAME=user123
TEST_DB_PASSWORD=password123
TEST_DB_NAME=onboarding_db_test
TEST_DB_HOST=localhost
TEST_DB_PORT=5432

ENABLE_IP_CHECK=false
# Allowed IP range for the API "baseIp/rangeStart-rangeEnd" (e.g. 192.168.1/1-255) separated by comma
ALLOWED_IP_RANGE=11.22.33/10-200, 192.168.65/1-255
# Allowed IP addresses for the API separated by comma
ALLOWED_IPS=127.0.0.1, 11.22.33.44, 11.22.33.45, 11.22.33.46, 192.168.65.1
6 changes: 6 additions & 0 deletions backend/.env.production
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,9 @@ PROD_DB_PORT=5432

# JWT Secret Key
JWT_SECRET=your_prod_jwt_secret_key_here

ENABLE_IP_CHECK=false
# Allowed IP range for the API "baseIp/rangeStart-rangeEnd" (e.g. 192.168.1/1-255) separated by comma
ALLOWED_IP_RANGE=11.22.33/10-200
# Allowed IP addresses for the API separated by comma
ALLOWED_IPS=11.22.33.44, 11.22.33.45, 11.22.33.46
16 changes: 13 additions & 3 deletions backend/.env.test
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
# Test Environment Configuration

# Database Configuration
TEST_DB_USERNAME=test_user
TEST_DB_PASSWORD=test_password
TEST_DB_NAME=test_db
TEST_DB_USERNAME=user123
TEST_DB_PASSWORD=password123
TEST_DB_NAME=onboarding_db_test
TEST_DB_HOST=localhost
TEST_DB_PORT=5432

POSTGRES_USER=user123
POSTGRES_PASSWORD=password123
POSTGRES_DB=onboarding_db_test

# JWT Secret Key
JWT_SECRET=your_test_jwt_secret_key_here

ENABLE_IP_CHECK=false
# Allowed IP range for the API "baseIp/rangeStart-rangeEnd" (e.g. 192.168.1/1-255) separated by comma
ALLOWED_IP_RANGE=11.22.33/10-200, 192.168.65/1-255
# Allowed IP addresses for the API separated by comma
ALLOWED_IPS=127.0.0.1, 11.22.33.44, 11.22.33.45, 11.22.33.46, 192.168.65.1
1 change: 1 addition & 0 deletions backend/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ node_modules/
.env
logs/
dist/
.nyc_output
6 changes: 4 additions & 2 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
FROM node:22
FROM node:22-alpine3.21

RUN apk update && apk add bash && rm -rf /var/cache/apk/*

WORKDIR /app

COPY package*.json ./
COPY package.json ./

RUN npm install

Expand Down
3 changes: 2 additions & 1 deletion backend/config/config.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
require("dotenv").config();
module.exports = {
defaultTeamName: "My Organisation",
development: {
username: process.env.DEV_DB_USERNAME,
password: process.env.DEV_DB_PASSWORD,
database: process.env.DEV_DB_NAME,
host: 'db',
host: process.env.DEV_DB_HOST,
dialect: "postgres",
port: process.env.DEV_DB_PORT,
logging: false,
Expand Down
32 changes: 32 additions & 0 deletions backend/config/settings.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
const constants = require("../src/utils/constants.helper");
const userRole = constants.ROLE;

module.exports = {
user: {
role: {
'admin': userRole.ADMIN,
'member': userRole.MEMBER
},
roleEnum: [userRole.ADMIN, userRole.MEMBER],
roleName: {
[userRole.ADMIN]: 'admin',
[userRole.MEMBER]: 'member'
}
},
team: {
permissions: {
invite: [userRole.ADMIN],
removeUser: [userRole.ADMIN],
update: [userRole.ADMIN],
changeRole: [userRole.ADMIN],
setOrg: [userRole.ADMIN],
serverUrl: [userRole.ADMIN],
popups: [userRole.ADMIN],
hints: [userRole.ADMIN],
banners: [userRole.ADMIN],
links: [userRole.ADMIN],
tours: [userRole.ADMIN],
helpers: [userRole.ADMIN],
}
}
};
Loading

0 comments on commit 7f19775

Please sign in to comment.