Compare commits

..

2 Commits

Author SHA1 Message Date
Ahmed Bouhuolia
9103b60653 feat: New Relic tracking (#429) 2024-04-28 18:12:59 +02:00
Ahmed Bouhuolia
7e5c6b6487 hotfix: parse the mail secure env variable (#424) 2024-04-24 21:09:56 +02:00
20 changed files with 42129 additions and 1251 deletions

View File

@@ -105,24 +105,6 @@
"contributions": [ "contributions": [
"bug" "bug"
] ]
},
{
"login": "benpsnyder",
"name": "Ben Snyder",
"avatar_url": "https://avatars.githubusercontent.com/u/707567?v=4",
"profile": "https://snyder.tech",
"contributions": [
"code"
]
},
{
"login": "cloudsbird",
"name": "Vederis Leunardus",
"avatar_url": "https://avatars.githubusercontent.com/u/13505006?v=4",
"profile": "http://vederis.id",
"contributions": [
"code"
]
} }
], ],
"contributorsPerLine": 7, "contributorsPerLine": 7,

View File

@@ -12,33 +12,16 @@ env:
jobs: jobs:
build-publish-webapp: build-publish-webapp:
strategy:
fail-fast: false
matrix:
platform:
- linux/amd64
- linux/arm64
name: Build and deploy webapp container name: Build and deploy webapp container
runs-on: ubuntu-latest runs-on: ubuntu-latest
environment: production environment: production
steps: steps:
- name: Prepare
run: |
platform=${{ matrix.platform }}
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
# Login to Container registry. # Login to Container registry.
- name: Log in to the Container registry - name: Log in to the Container registry
uses: docker/login-action@v3 uses: docker/login-action@v1
with: with:
registry: ${{ env.REGISTRY }} registry: ${{ env.REGISTRY }}
username: ${{ github.actor }} username: ${{ github.actor }}
@@ -52,29 +35,14 @@ jobs:
# Builds and push the Docker image. # Builds and push the Docker image.
- name: Build and push Docker image - name: Build and push Docker image
uses: docker/build-push-action@v5 uses: docker/build-push-action@v2
id: build
with: with:
context: . context: .
file: ./packages/webapp/Dockerfile file: ./packages/webapp/Dockerfile
platforms: ${{ matrix.platform }}
push: true push: true
tags: ghcr.io/bigcapitalhq/webapp:latest tags: ghcr.io/bigcapitalhq/webapp:latest
labels: ${{ steps.meta.outputs.labels }} labels: ${{ steps.meta.outputs.labels }}
- name: Export digest
run: |
mkdir -p /tmp/digests
digest="${{ steps.build.outputs.digest }}"
touch "/tmp/digests/${digest#sha256:}"
- name: Upload digest
uses: actions/upload-artifact@v4
with:
name: digests-main-${{ env.PLATFORM_PAIR }}
path: /tmp/digests/*
if-no-files-found: error
retention-days: 1
# Send notification to Slack channel. # Send notification to Slack channel.
- name: Slack Notification built and published webapp container successfully. - name: Slack Notification built and published webapp container successfully.
uses: rtCamp/action-slack-notify@v2 uses: rtCamp/action-slack-notify@v2
@@ -85,23 +53,12 @@ jobs:
name: Build and deploy server container name: Build and deploy server container
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Prepare - name: Checkout code
run: | uses: actions/checkout@v2
platform=${{ matrix.platform }}
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
# Login to Container registry. # Login to Container registry.
- name: Log in to the Container registry - name: Log in to the Container registry
uses: docker/login-action@v3 uses: docker/login-action@v1
with: with:
registry: ${{ env.REGISTRY }} registry: ${{ env.REGISTRY }}
username: ${{ github.actor }} username: ${{ github.actor }}
@@ -109,30 +66,14 @@ jobs:
# Builds and push the Docker image. # Builds and push the Docker image.
- name: Build and push Docker image - name: Build and push Docker image
uses: docker/build-push-action@v5 uses: docker/build-push-action@v2
id: build
with: with:
context: ./ context: ./
file: ./packages/server/Dockerfile file: ./packages/server/Dockerfile
platforms: ${{ matrix.platform }}
push: true push: true
tags: ghcr.io/bigcapitalhq/server:latest tags: ghcr.io/bigcapitalhq/server:latest
labels: ${{ steps.meta.outputs.labels }} labels: ${{ steps.meta.outputs.labels }}
- name: Export digest
run: |
mkdir -p /tmp/digests
digest="${{ steps.build.outputs.digest }}"
touch "/tmp/digests/${digest#sha256:}"
- name: Upload digest
uses: actions/upload-artifact@v4
with:
name: digests-main-${{ env.PLATFORM_PAIR }}
path: /tmp/digests/*
if-no-files-found: error
retention-days: 1
# Send notification to Slack channel. # Send notification to Slack channel.
- name: Slack Notification built and published server container successfully. - name: Slack Notification built and published server container successfully.
uses: rtCamp/action-slack-notify@v2 uses: rtCamp/action-slack-notify@v2

View File

@@ -8,14 +8,14 @@ on:
- '**.ts' - '**.ts'
- '**.tsx' - '**.tsx'
- '**/tsconfig.json' - '**/tsconfig.json'
- 'pnpm-lock.yaml' - 'yarn.lock'
- '.github/workflows/e2e.yml' - '.github/workflows/e2e.yml'
pull_request: pull_request:
paths: paths:
- '**.ts' - '**.ts'
- '**.tsx' - '**.tsx'
- '**/tsconfig.json' - '**/tsconfig.json'
- 'pnpm-lock.yaml' - 'yarn.lock'
- '.github/workflows/e2e.yml' - '.github/workflows/e2e.yml'
defaults: defaults:

View File

@@ -1,4 +1,4 @@
#!/usr/bin/env sh #!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh" . "$(dirname -- "$0")/_/husky.sh"
pnpx commitlint --edit yarn commitlint --edit

View File

@@ -122,8 +122,6 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
<td align="center" valign="top" width="14.28%"><a href="https://github.com/ANasouf"><img src="https://avatars.githubusercontent.com/u/19536487?v=4?s=100" width="100px;" alt="ANasouf"/><br /><sub><b>ANasouf</b></sub></a><br /><a href="https://github.com/bigcapitalhq/bigcapital/commits?author=ANasouf" title="Code">💻</a></td> <td align="center" valign="top" width="14.28%"><a href="https://github.com/ANasouf"><img src="https://avatars.githubusercontent.com/u/19536487?v=4?s=100" width="100px;" alt="ANasouf"/><br /><sub><b>ANasouf</b></sub></a><br /><a href="https://github.com/bigcapitalhq/bigcapital/commits?author=ANasouf" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://ragnarlaud.dev"><img src="https://avatars.githubusercontent.com/u/3042904?v=4?s=100" width="100px;" alt="Ragnar Laud"/><br /><sub><b>Ragnar Laud</b></sub></a><br /><a href="https://github.com/bigcapitalhq/bigcapital/issues?q=author%3Axprnio" title="Bug reports">🐛</a></td> <td align="center" valign="top" width="14.28%"><a href="https://ragnarlaud.dev"><img src="https://avatars.githubusercontent.com/u/3042904?v=4?s=100" width="100px;" alt="Ragnar Laud"/><br /><sub><b>Ragnar Laud</b></sub></a><br /><a href="https://github.com/bigcapitalhq/bigcapital/issues?q=author%3Axprnio" title="Bug reports">🐛</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/asenawritescode"><img src="https://avatars.githubusercontent.com/u/67445192?v=4?s=100" width="100px;" alt="Asena"/><br /><sub><b>Asena</b></sub></a><br /><a href="https://github.com/bigcapitalhq/bigcapital/issues?q=author%3Aasenawritescode" title="Bug reports">🐛</a></td> <td align="center" valign="top" width="14.28%"><a href="https://github.com/asenawritescode"><img src="https://avatars.githubusercontent.com/u/67445192?v=4?s=100" width="100px;" alt="Asena"/><br /><sub><b>Asena</b></sub></a><br /><a href="https://github.com/bigcapitalhq/bigcapital/issues?q=author%3Aasenawritescode" title="Bug reports">🐛</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://snyder.tech"><img src="https://avatars.githubusercontent.com/u/707567?v=4?s=100" width="100px;" alt="Ben Snyder"/><br /><sub><b>Ben Snyder</b></sub></a><br /><a href="https://github.com/bigcapitalhq/bigcapital/commits?author=benpsnyder" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="http://vederis.id"><img src="https://avatars.githubusercontent.com/u/13505006?v=4?s=100" width="100px;" alt="Vederis Leunardus"/><br /><sub><b>Vederis Leunardus</b></sub></a><br /><a href="https://github.com/bigcapitalhq/bigcapital/commits?author=cloudsbird" title="Code">💻</a></td>
</tr> </tr>
</tbody> </tbody>
</table> </table>

View File

@@ -102,6 +102,14 @@ services:
- LEMONSQUEEZY_WEBHOOK_SECRET=${LEMONSQUEEZY_WEBHOOK_SECRET} - LEMONSQUEEZY_WEBHOOK_SECRET=${LEMONSQUEEZY_WEBHOOK_SECRET}
- HOSTED_ON_BIGCAPITAL_CLOUD=${HOSTED_ON_BIGCAPITAL_CLOUD} - HOSTED_ON_BIGCAPITAL_CLOUD=${HOSTED_ON_BIGCAPITAL_CLOUD}
# New Relic matrics tracking.
- NEW_RELIC_DISTRIBUTED_TRACING_ENABLED=${NEW_RELIC_DISTRIBUTED_TRACING_ENABLED}
- NEW_RELIC_LOG=${NEW_RELIC_LOG}
- NEW_RELIC_AI_MONITORING_ENABLED=${NEW_RELIC_AI_MONITORING_ENABLED}
- NEW_RELIC_CUSTOM_INSIGHTS_EVENTS_MAX_SAMPLES_STORED=${NEW_RELIC_CUSTOM_INSIGHTS_EVENTS_MAX_SAMPLES_STORED}
- NEW_RELIC_SPAN_EVENTS_MAX_SAMPLES_STORED=${NEW_RELIC_SPAN_EVENTS_MAX_SAMPLES_STORED}
database_migration: database_migration:
container_name: bigcapital-database-migration container_name: bigcapital-database-migration
build: build:

View File

@@ -2,7 +2,6 @@
"$schema": "node_modules/lerna/schemas/lerna-schema.json", "$schema": "node_modules/lerna/schemas/lerna-schema.json",
"version": "independent", "version": "independent",
"npmClient": "pnpm", "npmClient": "pnpm",
"packages": [ "useWorkspaces": true,
"packages/*" "packages": ["packages/*"]
]
} }

View File

@@ -19,8 +19,7 @@
"@faker-js/faker": "^8.0.2", "@faker-js/faker": "^8.0.2",
"@playwright/test": "^1.32.3", "@playwright/test": "^1.32.3",
"husky": "^8.0.3", "husky": "^8.0.3",
"lerna": "^8.1.2", "lerna": "^6.4.1"
"pnpm": "^9.0.5"
}, },
"engines": { "engines": {
"node": "16.x || 17.x || 18.x" "node": "16.x || 17.x || 18.x"

View File

@@ -4,5 +4,3 @@ stdout.log
/dist /dist
/build /build
/public/imports /public/imports
dist

View File

@@ -78,6 +78,9 @@ ENV MAIL_HOST=$MAIL_HOST \
SIGNUP_ALLOWED_DOMAINS=$SIGNUP_ALLOWED_DOMAINS \ SIGNUP_ALLOWED_DOMAINS=$SIGNUP_ALLOWED_DOMAINS \
SIGNUP_ALLOWED_EMAILS=$SIGNUP_ALLOWED_EMAILS SIGNUP_ALLOWED_EMAILS=$SIGNUP_ALLOWED_EMAILS
# New Relic config file.
ENV NEW_RELIC_NO_CONFIG_FILE=true
# Create app directory. # Create app directory.
WORKDIR /app WORKDIR /app

17747
packages/server/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -82,6 +82,7 @@
"mustache": "^3.0.3", "mustache": "^3.0.3",
"mysql": "^2.17.1", "mysql": "^2.17.1",
"mysql2": "^1.6.5", "mysql2": "^1.6.5",
"newrelic": "^11.15.0",
"node-cache": "^4.2.1", "node-cache": "^4.2.1",
"nodemailer": "^6.3.0", "nodemailer": "^6.3.0",
"nodemon": "^1.19.1", "nodemon": "^1.19.1",

View File

@@ -55,7 +55,7 @@ module.exports = {
mail: { mail: {
host: process.env.MAIL_HOST, host: process.env.MAIL_HOST,
port: process.env.MAIL_PORT, port: process.env.MAIL_PORT,
secure: !!parseInt(process.env.MAIL_SECURE, 10), secure: parseBoolean(defaultTo(process.env.MAIL_SECURE, false), false),
username: process.env.MAIL_USERNAME, username: process.env.MAIL_USERNAME,
password: process.env.MAIL_PASSWORD, password: process.env.MAIL_PASSWORD,
from: process.env.MAIL_FROM_ADDRESS, from: process.env.MAIL_FROM_ADDRESS,

View File

@@ -1,4 +1,5 @@
import 'reflect-metadata'; // We need this in order to use @Decorators import 'reflect-metadata'; // We need this in order to use @Decorators
import 'newrelic';
import './before'; import './before';
import '@/config'; import '@/config';

View File

@@ -20,5 +20,4 @@
.env.production.local .env.production.local
npm-debug.log* npm-debug.log*
yarn-debug.log*
dist

3138
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

2
pnpm-workspace.yaml Normal file
View File

@@ -0,0 +1,2 @@
packages:
- "packages/*"

View File

@@ -1,24 +0,0 @@
# Takes a backup of database Docker volume and compress into one .tar.gz
# file and upload to s3 package through s3cmd.
S3_BUCKET="s3://bigcapital-backup"
# Generate the current date and time formatted as YYYY-MM-DD-HH-MM-SS
CURRENT_DATETIME=$(date +"%Y-%m-%d-%H-%M-%S")
# Define the filename with the current date and time
FILE_NAME="bigcapital-mariadb-${CURRENT_DATETIME}.tar.gz"
# Create a sample file (replace this with your actual file creation process)
echo "This is a sample file created on ${CURRENT_DATETIME}" > "$FILE_NAME"
docker run --rm \
--mount source=bigcapital_prod_mysql,target=/data/db \
-v $(pwd):/backup \
busybox \
tar -czvf "/backup/$FILE_NAME" /data/db
# Upload the file to S3 using s3cmd
s3cmd put "$FILE_NAME" "$S3_BUCKET/"
# Remove the temporary file
rm "$FILE_NAME"

View File

@@ -1,7 +0,0 @@
# Store the backup.
docker run --rm \
--mount source=bigcapital_dev_mysql,target=/data/db \
-v $(pwd):/backup \
busybox \
tar -xzvf /backup/bigcapital-mariadb-2024-04-24-15-14-40.tar.gz -C /

22315
yarn.lock Normal file

File diff suppressed because it is too large Load Diff