Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User profile #4

Merged
merged 155 commits into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
155 commits
Select commit Hold shift + click to select a range
f0c6f09
chore: add open api into the system
Sivanwol Aug 28, 2024
9d3c86a
chore: more work for link trpc with open api
Sivanwol Aug 28, 2024
2dda8ea
chore: add the basic for onboarding user api
Sivanwol Aug 29, 2024
18832b5
refactor: Update rewrite user system db layout
Sivanwol Aug 29, 2024
549dfb9
chore: Update turbo dependency to version 2.1.0
Sivanwol Aug 29, 2024
ffc141f
chore: format and lint
Sivanwol Aug 29, 2024
bdde257
chore: Rename settings page to security page
Sivanwol Aug 29, 2024
9159966
chore: more work on the ui system
Sivanwol Aug 29, 2024
59607d1
chore: Update UI system and add support for user security page
Sivanwol Aug 29, 2024
32d2d74
chore: Remove unused runtime variable in page.tsx
Sivanwol Aug 29, 2024
231a158
chore: Remove unused runtime variable in page.tsx
Sivanwol Aug 29, 2024
1840fbc
chore: Remove unused runtime variable in page.tsx
Sivanwol Aug 30, 2024
34f348a
chore: Remove unused runtime variable in page.tsx
Sivanwol Aug 30, 2024
aa9fb47
chore: Add @vercel/speed-insights package and component for performan…
Sivanwol Aug 30, 2024
df0b35e
chore: Add @faker-js/faker package for generating mock data as well b…
Sivanwol Aug 31, 2024
43feb47
chore: Refactor user page and support page components
Sivanwol Aug 31, 2024
3be09de
chore: it kinda run have many issues but passed build and so of
Sivanwol Aug 31, 2024
c26350f
chore: user test page and table components
Sivanwol Aug 31, 2024
69eac5d
chore: add export option
Sivanwol Aug 31, 2024
48574f4
chore: Update dependencies and add drag-and-drop support to table com…
Sivanwol Sep 1, 2024
c6be6ae
chore: Update dependencies and fix package.json formatting
Sivanwol Sep 1, 2024
0cdb1aa
chore: Update dependencies and fix package.json formatting
Sivanwol Sep 1, 2024
ab3e679
chore: Update dependencies and add prettier configuration
Sivanwol Sep 1, 2024
bcb276a
chore: Remove commented out code in route.ts
Sivanwol Sep 1, 2024
8b25b5f
chore: Remove commented out code and update dependencies in route.ts
Sivanwol Sep 1, 2024
dd7ecff
chore: Update dependencies and add drag-and-drop support to table com…
Sivanwol Sep 1, 2024
d8e7aa5
chore: Refactor useSort hook and buildColumnDef function
Sivanwol Sep 1, 2024
14665f2
feat: Add sorting functionality to UserTestPage table
Sivanwol Sep 1, 2024
787a371
chore: Add initial pagination state to Table component
Sivanwol Sep 1, 2024
081bd8b
chore: Update dependencies and add react-resizable to Table component
Sivanwol Sep 1, 2024
e8b5acf
feat: Add sorting and paging functionality to Table as well add Conte…
Sivanwol Sep 2, 2024
67ab697
chore: Update npm dependency to latest stable version
Sivanwol Sep 2, 2024
7e5770f
chore: Refactor sidebar component styles and remove unused code
Sivanwol Sep 2, 2024
5ef3f28
Refactor table component styles and remove unused code, add state mgt
Sivanwol Sep 5, 2024
2ed519b
refactor: Refactor table component styles, remove unused code, and ad…
Sivanwol Sep 5, 2024
1f58078
chore: more work on the table layout and start added state
Sivanwol Sep 5, 2024
4dee769
refactor: tableBuilder component to use tableId for sorting and pagin…
Sivanwol Sep 5, 2024
8715539
refactor: Add tableId prop to TableWarpProps interface
Sivanwol Sep 5, 2024
45f88a9
refactor: Refactor tableTest component to add pagination and sorting …
Sivanwol Sep 5, 2024
2ac8942
refactor: Add client-side rendering support to store-backoffice
Sivanwol Sep 6, 2024
7217c43
refactor: Update tableTest component to use tableId for pagination an…
Sivanwol Sep 6, 2024
e51f781
refactor: Update tableTest component to use tableId for pagination an…
Sivanwol Sep 6, 2024
66e58b7
refactor: Update tableTest component to use tableId for pagination an…
Sivanwol Sep 7, 2024
4f55714
fix: formatting
Sivanwol Sep 7, 2024
951be2e
fix: lint
Sivanwol Sep 7, 2024
d212a2f
fix: formatting
Sivanwol Sep 7, 2024
62c449f
chore: bit of clean up
Sivanwol Sep 7, 2024
06aa6b2
refactor: add user history component to use tableId for pagination an…
Sivanwol Sep 7, 2024
abb1234
refactor: add tableId to UserPageProps for pagination and sorting
Sivanwol Sep 8, 2024
ed55af7
refactor: add tableId to UserPageProps for pagination and sorting
Sivanwol Sep 8, 2024
804db76
refactor: add date format to "Occurred" column in UserPageProps
Sivanwol Sep 9, 2024
3036832
refactor: add "usehooks-ts" to dependencies in pnpm-workspace.yaml an…
Sivanwol Sep 9, 2024
40aa3b0
refactor: add profile page for user
Sivanwol Sep 9, 2024
62cc1f5
refactor: update authConfig in config.ts and borderRadius in tailwind…
Sivanwol Sep 9, 2024
a2ae4fb
refactor: update user profile page and tableBuilder component
Sivanwol Sep 9, 2024
163191f
chore: test
Sivanwol Sep 9, 2024
09757ae
ci: test
Sivanwol Sep 10, 2024
76d1cb4
ci: make sure node 20 on server
Sivanwol Sep 10, 2024
9ffa78e
refactor: update buildImage and install commands in nixpacks.toml
Sivanwol Sep 10, 2024
6eb518c
Update Node.js version to 20 in package.json
Sivanwol Sep 10, 2024
fb919c0
Update Node.js version to 20 in package.json
Sivanwol Sep 10, 2024
5249d5d
refactor: Update buildImage and install commands in nixpacks.toml
Sivanwol Sep 10, 2024
4fad1c1
refactor: Update .npmrc configuration
Sivanwol Sep 10, 2024
0eb6b72
refactor: Remove unnecessary npmrc configurations
Sivanwol Sep 10, 2024
2e3fea9
refactor: Update nixpacks.toml with additional setup phase and nixPkg…
Sivanwol Sep 10, 2024
efcd3da
Refactor nixpacks.toml: Remove unnecessary setup and install commands
Sivanwol Sep 10, 2024
fddc194
Refactor nixpacks.toml: Add .nix file for package dependencies
Sivanwol Sep 10, 2024
5e68be5
Update package.json with updated node and pnpm versions
Sivanwol Sep 10, 2024
493afef
Refactor user profile page: Remove unnecessary console.log statement
Sivanwol Sep 10, 2024
a7e9610
Refactor user profile page: Remove unnecessary console.log statement
Sivanwol Sep 10, 2024
d33bb82
Refactor user profile page: Remove unnecessary console.log statement
Sivanwol Sep 10, 2024
d3fbb22
Refactor package management: Update package dependencies and add Nix …
Sivanwol Sep 10, 2024
a50eff2
Refactor package management: Update .dockerignore and next.config.mjs
Sivanwol Sep 10, 2024
03f8003
Refactor package management: Update dockerfile.backoffice and dockerf…
Sivanwol Sep 10, 2024
107f871
Refactor package management: Update dockerfile.backoffice, dockerfile…
Sivanwol Sep 10, 2024
2e92b9f
Refactor package management: Update .dockerignore, dockerfile.backoff…
Sivanwol Sep 10, 2024
a183d14
Refactor package management: Update dockerfile.backoffice and dockerf…
Sivanwol Sep 10, 2024
601e486
Refactor package management: Remove nixpacks.toml
Sivanwol Sep 10, 2024
9cec7ec
Refactor package management: Update dockerfile.backoffice to use corr…
Sivanwol Sep 10, 2024
92d8733
Refactor package management: Remove unnecessary copy of tsconfig.json…
Sivanwol Sep 10, 2024
0b3d8cd
Refactor package management: Update dockerfile.backoffice to use corr…
Sivanwol Sep 10, 2024
867e94b
Refactor package management: Update dependencies in package.json and …
Sivanwol Sep 10, 2024
b63f093
Refactor package management: Update dockerfile.backoffice to use corr…
Sivanwol Sep 10, 2024
0f7aef5
Refactor package management: Update dockerfile.backoffice to optimize…
Sivanwol Sep 10, 2024
3dd276f
Refactor package management: Update dockerfile.backoffice to optimize…
Sivanwol Sep 10, 2024
7ca2a7e
Refactor dockerfile.backoffice: Update package management and build p…
Sivanwol Sep 10, 2024
d4fb24a
Refactor dockerfile.backoffice: Update package management and build p…
Sivanwol Sep 10, 2024
d5f6de7
Refactor dockerfile.backoffice: Remove unnecessary package installation
Sivanwol Sep 10, 2024
db212e7
Refactor dockerfile.backoffice: Remove unnecessary package installati…
Sivanwol Sep 10, 2024
eede557
Refactor dockerfile.backoffice: Remove unnecessary package installati…
Sivanwol Sep 10, 2024
8a73996
Refactor dockerfile.backoffice: Remove unnecessary files and update p…
Sivanwol Sep 10, 2024
00692ab
fix: remove all edge runtime setup
Sivanwol Sep 10, 2024
9bcdc2f
Refactor dockerfile.backoffice: Set environment variables for applica…
Sivanwol Sep 10, 2024
ba72529
Refactor turbo.json: Add environment variables for application
Sivanwol Sep 10, 2024
48329fd
Refactor dockerfile.backoffice: Update environment variables for appl…
Sivanwol Sep 10, 2024
9cd481b
Refactor dockerfile.backoffice: Add environment variables for applica…
Sivanwol Sep 10, 2024
e5aa351
Refactor dockerfile.backoffice: Update environment variables for appl…
Sivanwol Sep 10, 2024
9d6b562
Refactor dockerfile.backoffice: Update environment variable handling
Sivanwol Sep 10, 2024
120c18c
Refactor dockerfile.backoffice: Update environment variable handling …
Sivanwol Sep 10, 2024
9e80019
Refactor dockerfile.backoffice: Update environment variable handling …
Sivanwol Sep 10, 2024
de9d2c3
Refactor dockerfile.backoffice: Update environment variable handling …
Sivanwol Sep 10, 2024
a18aece
Refactor dockerfile.backoffice: Update build command to use array syntax
Sivanwol Sep 10, 2024
d6b4a4e
Refactor dockerfile.backoffice: Update build command to use array syn…
Sivanwol Sep 10, 2024
2f4d18d
Refactor dockerfile.backoffice: Update build command to use sh instea…
Sivanwol Sep 10, 2024
5391b67
Refactor dockerfile.backoffice: Update build command to use sh instea…
Sivanwol Sep 10, 2024
546b6b4
Refactor dockerfile.backoffice: Update build command to use sh instea…
Sivanwol Sep 10, 2024
e29e2b2
Refactor dockerfile.backoffice: Update build command to use sh instea…
Sivanwol Sep 10, 2024
b67e2df
Refactor dockerfile.backoffice: Update build command to use sh instea…
Sivanwol Sep 10, 2024
5ddab6a
Refactor dockerfile.backoffice: Update PM2 command to start the appli…
Sivanwol Sep 10, 2024
86e68f2
Refactor dockerfile.backoffice: Update PM2 command to start the appli…
Sivanwol Sep 10, 2024
5141040
Refactor dockerfile.backoffice: Update PM2 command to start the appli…
Sivanwol Sep 10, 2024
f300c1a
Refactor dockerfile.backoffice: Update PM2 command to start the appli…
Sivanwol Sep 10, 2024
ad6e861
Refactor dockerfile.backoffice: Update PM2 command to start the appli…
Sivanwol Sep 10, 2024
2364276
Refactor dockerfile.backoffice: Update PM2 command to start the appli…
Sivanwol Sep 10, 2024
a70fc23
Refactor dockerfile.backoffice: Update PM2 command to start the appli…
Sivanwol Sep 10, 2024
eac26d1
Refactor dockerfile.backoffice: Update PM2 command to start the appli…
Sivanwol Sep 10, 2024
43f40e3
Refactor dockerfile.backoffice: Update PM2 command to start the appli…
Sivanwol Sep 10, 2024
ed9526a
Refactor dockerfile.backoffice: Update PM2 command to start the appli…
Sivanwol Sep 10, 2024
9e670f0
Refactor dockerfile.backoffice: Update working directory and start co…
Sivanwol Sep 10, 2024
04a6751
Refactor dockerfile.backoffice: Update working directory and start co…
Sivanwol Sep 10, 2024
f527f62
Refactor dockerfile.backoffice: Update working directory and start co…
Sivanwol Sep 10, 2024
beeead3
Refactor dockerfile.backoffice: Add command to list files in the work…
Sivanwol Sep 10, 2024
29c304c
Refactor dockerfile.backoffice: Update .dockerignore and dockerfile
Sivanwol Sep 11, 2024
a68d3f0
Refactor dockerfile.backoffice: Update start command to use "CMD" ins…
Sivanwol Sep 11, 2024
b373cda
Refactor dockerfile.backoffice: Remove unused dependencies and imports
Sivanwol Sep 11, 2024
e5ed238
Refactor dockerfile.backoffice: Update dependencies, working director…
Sivanwol Sep 11, 2024
4b672b1
Refactor dockerfile.backoffice: Update start command to use "CMD" ins…
Sivanwol Sep 11, 2024
c066cc0
Refactor dockerfile.backoffice: Update start command to use "CMD" ins…
Sivanwol Sep 11, 2024
10b0d93
Refactor dockerfile.backoffice: Update start command to use "CMD" ins…
Sivanwol Sep 11, 2024
90d1cfd
Refactor dockerfile.backoffice: Update start command to use "CMD" ins…
Sivanwol Sep 11, 2024
a239e53
Refactor dockerfile.backoffice: Update start command to use "CMD" ins…
Sivanwol Sep 11, 2024
adb4b52
Refactor dockerfile.backoffice: Update start command to use "CMD" ins…
Sivanwol Sep 11, 2024
d4297ed
Refactor dockerfile.backoffice: Update start command to use "CMD" ins…
Sivanwol Sep 11, 2024
0d0bbb1
Refactor dockerfile.backoffice: Update start command to use "CMD" ins…
Sivanwol Sep 11, 2024
f30dcb0
Refactor dockerfile.backoffice: Update start command to use "CMD" ins…
Sivanwol Sep 11, 2024
3aa0928
Refactor dockerfile.backoffice: Update start command to use "npm run …
Sivanwol Sep 11, 2024
9b679ad
Refactor dockerfile.backoffice: Update .env file location
Sivanwol Sep 11, 2024
6982328
Refactor dockerfile.develop: Set NODE_ENV to development and optimize…
Sivanwol Sep 11, 2024
9ccd3d7
chore: add better logs, change the way docker flow works
Sivanwol Sep 11, 2024
7401a44
Remove unused API documentation files
Sivanwol Sep 11, 2024
a23068d
Refactor npm configuration and Dockerfile for backoffice app
Sivanwol Sep 12, 2024
f4002b9
Refactor prettier configuration and ignore files
Sivanwol Sep 13, 2024
0dd0619
Refactor dockerfile.develop: Copy static files to standalone directory
Sivanwol Sep 13, 2024
7d07736
Refactor dockerfile.develop: Update environment variable name for bet…
Sivanwol Sep 13, 2024
603f936
Refactor environment variable name for better logs
Sivanwol Sep 13, 2024
08bcc73
Refactor package.json: Remove trailing newline at end of file
Sivanwol Sep 13, 2024
4292ae0
Refactor Debug dockerfile.develop: Remove unnecessary environment var…
Sivanwol Sep 13, 2024
6f39576
Refactor dockerfile: Remove unnecessary environment variable logging
Sivanwol Sep 14, 2024
36b4eb0
Refactor dockerfile: Remove unnecessary environment variable logging
Sivanwol Sep 14, 2024
0611ea6
Refactor DrizzleLogger.ts: Remove unused import and commented code
Sivanwol Sep 14, 2024
8d7b3c6
Refactor user security route: Remove unnecessary code
Sivanwol Sep 14, 2024
69aba3c
Refactor .dockerignore: Remove unnecessary entries
Sivanwol Sep 14, 2024
7dba0b3
Refactor dockerfile: Update file paths and remove unnecessary code
Sivanwol Sep 14, 2024
8850f30
Refactor dockerfile: Update file paths and remove unnecessary code
Sivanwol Sep 14, 2024
8a5d591
Refactor .dockerignore: Remove unnecessary entries
Sivanwol Sep 15, 2024
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
22 changes: 22 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
.env

dockerfile
./**/*/dockerfile

.dockerignore

node_modules
./**/*/node_modules

pnpm-debug.log
./**/*/pnpm-debug.log
.next
./**/*/.next
dist
./**/*/dist
.turbo
./**/*/.turbo
.output
./**/*/.output
README.md
.git
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,7 @@ NEXT_PUBLIC_AUTH_DESCOPE_ID=""
AUTH_DESCOPE_SECRET=""
AUTH_DESCOPE_ISSUER=""
AUTH_DESCOPE_MGT_KEY=""
AUTH_DESCOPE_MAIN_TENANT_ID=""
# In case you're using the Auth Proxy (apps/auth-proxy)
# AUTH_REDIRECT_PROXY_URL='https://auth.your-server.com/r'
NEXT_PUBLIC_BETTER_LOGS_TOKEN=""
3 changes: 3 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
node-linker=hoisted
strict-peer-dependencies=false
save-workspace-protocol=false
prefer-workspace-packages=true
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
**/*/next.config.cjs
**/*/next.config.mjs
17 changes: 3 additions & 14 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,7 @@
"next/dist/client/router.d.ts"
],
"typescript.tsdk": "node_modules/typescript/lib",
"sqltools.connections": [
{
"pgOptions": {
"ssl": {
"rejectUnauthorized": true
}
},
"previewLimit": 50,
"server": "localhost",
"driver": "PostgreSQL",
"connectString": "postgres://default:tUW0yLFZHVh7@ep-cool-dew-a2z4kc7y-pooler.eu-central-1.aws.neon.tech:5432/verceldb?sslmode=require",
"name": "Remote Local PDB"
}
]
"[jsonc]": {
"editor.defaultFormatter": "svipas.prettier-plus"
}
}
39 changes: 38 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ packages
├─ validators
| └─ all validators both platform and backoffice
└─ ui
└─ Start of a UI package for the webapp using shadcn-ui(will be removed later) , flowbite-react and mui (some element not existed in the first so use both)
└─ Start of a UI package for the webapp using shadcn-ui(will be removed later) , tailwind and mui (some element not existed in the first so use both)
tooling
├─ eslint
| └─ shared, fine-grained, eslint presets
Expand All @@ -75,7 +75,44 @@ tooling
```

> In this template, we use `@app` as a placeholder for package names. As a user, you might want to replace it with your own organization or project name. You can use find-and-replace to change all the instances of `@app` to something like `@my-company` or `@project-name`.
## Docker

To get it running with docker, follow the steps below:

Inside `next.config.mjs` set, you can read more about why we need to set this here: https://nextjs.org/docs/advanced-features/output-file-tracing

```diff
output: "standalone",
```

Option 1:

1. Build and run the images with:

```bash
docker compose up --build
# You can specify a specific service: docker compose up nextjs --build
```

2. Visit `http://localhost:3000` to see your app.

Option 2:

1. Build the images

```bash
docker compose build
# You can specify a specific service: docker compose build nextjs
```

2. Run the images

```bash
docker compose up
# You can specify a specific service: docker compose up nextjs
```

3. Visit `http://localhost:3000` to see your app.
## Quick Start

> **Note**
Expand Down
8 changes: 5 additions & 3 deletions apps/auth-proxy/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
"scripts": {
"build": "nitro build",
"clean": "rm -rf .turbo .output .nitro node_modules",
"lint": "eslint",
"format": "prettier --check . --ignore-path ../../.gitignore",
"lint": "eslint",
"sort:packages": "sort-package-json",
"typecheck": "tsc --noEmit"
},
"prettier": "@app/prettier-config",
"dependencies": {
"@auth/core": "0.32.0"
},
Expand All @@ -22,7 +24,7 @@
"h3": "^1.12.0",
"nitropack": "^2.9.7",
"prettier": "catalog:",
"sort-package-json": "catalog:",
"typescript": "catalog:"
},
"prettier": "@app/prettier-config"
}
}
8 changes: 5 additions & 3 deletions apps/backoffice-auth-proxy/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
"scripts": {
"build": "nitro build",
"clean": "rm -rf .turbo .output .nitro node_modules",
"lint": "eslint",
"format": "prettier --check . --ignore-path ../../.gitignore",
"lint": "eslint",
"sort:packages": "sort-package-json",
"typecheck": "tsc --noEmit"
},
"prettier": "@app/prettier-config",
"dependencies": {
"@auth/core": "0.32.0"
},
Expand All @@ -22,7 +24,7 @@
"h3": "^1.12.0",
"nitropack": "^2.9.7",
"prettier": "catalog:",
"sort-package-json": "catalog:",
"typescript": "catalog:"
},
"prettier": "@app/prettier-config"
}
}
17 changes: 17 additions & 0 deletions apps/backoffice/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
.env

Dockerfile
./**/*/Dockerfile

.dockerignore

node_modules
./**/*/node_modules

pnpm-debug.log
./**/*/pnpm-debug.log
./**/*/dist

README.md
.next
.git
96 changes: 96 additions & 0 deletions apps/backoffice/dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
FROM node:20-alpine AS base
RUN apk add python3 make g++ gcc libc-dev linux-headers libc6-compat
RUN npm install -g turbo
RUN corepack enable
RUN corepack prepare [email protected] --activate

FROM base AS builder
WORKDIR /app
RUN echo -e "\e[1;33mInstall globally packages for application backoffice\e[0m"
COPY . .
RUN turbo prune --scope=@app/backoffice --docker

FROM base AS installer
WORKDIR /app
RUN echo -e "\e[1;33mWired environment variables for application backoffice\e[0m"
ARG TURBO_TEAM
ARG TURBO_TOKEN

ENV TURBO_TEAM $TURBO_TEAM
ENV TURBO_TOKEN $TURBO_TOKEN
ENV CI true
ENV SKIP_ENV_VALIDATION true

# Set environment variables for application

ARG POSTGRES_URL
ARG BLOB_STORAGE_URL
ARG BLOB_READ_WRITE_TOKEN
ARG KV_URL
ARG KV_REST_API_URL
ARG BLOB_READ_WRITE_TOKEN
ARG KV_REST_API_READ_ONLY_TOKEN
ARG EDGE_CONFIG
ARG AUTH_SECRET
ARG NEXT_PUBLIC_AUTH_DESCOPE_ID
ARG AUTH_DESCOPE_SECRET
ARG AUTH_DESCOPE_ISSUER
ARG AUTH_DESCOPE_MGT_KEY
ARG AUTH_DESCOPE_MAIN_TENANT_ID
ARG NEXT_PUBLIC_BETTER_LOGS_TOKEN

ENV POSTGRES_URL ${POSTGRES_URL}
ENV BLOB_STORAGE_URL ${BLOB_STORAGE_URL}
ENV KV_URL ${KV_URL}
ENV KV_REST_API_URL ${KV_REST_API_URL}
ENV KV_REST_API_TOKEN ${KV_REST_API_TOKEN}
ENV KV_REST_API_READ_ONLY_TOKEN ${KV_REST_API_READ_ONLY_TOKEN}
ENV EDGE_CONFIG ${EDGE_CONFIG}
ENV AUTH_SECRET ${AUTH_SECRET}
ENV NEXT_PUBLIC_AUTH_DESCOPE_ID ${NEXT_PUBLIC_AUTH_DESCOPE_ID}
ENV AUTH_DESCOPE_SECRET ${AUTH_DESCOPE_SECRET}
ENV AUTH_DESCOPE_ISSUER ${AUTH_DESCOPE_ISSUER}
ENV AUTH_DESCOPE_MGT_KEY ${AUTH_DESCOPE_MGT_KEY}
ENV AUTH_DESCOPE_MAIN_TENANT_ID ${AUTH_DESCOPE_MAIN_TENANT_ID}
ENV NEXT_PUBLIC_BETTER_LOGS_TOKEN ${NEXT_PUBLIC_BETTER_LOGS_TOKEN}

RUN echo -e "\e[1;33mENVIRONMENT VARIABLES\e[0m";
# Create a .env file with all the environment variables but CI
RUN env >> .env
RUN cat .env

RUN echo -e "\e[1;33mBuilding application backoffice\e[0m"
# First install dependencies (as they change less often)
COPY --from=builder /app/out/json .
COPY --from=builder /app/out/pnpm-lock.yaml ./
COPY --from=builder /app/out/full .
RUN pnpm install
RUN pnpm build --filter=@app/backoffice

FROM base AS runner
WORKDIR /app

ENV NEXT_TELEMETRY_DISABLED 1
# Don't run production as root
RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs
USER nextjs
# COPY --from=installer --chown=nextjs:nodejs /app/apps/backoffice/.next/standalone /app/apps/backoffice
COPY --from=installer /app/apps/backoffice/next.config.mjs .
COPY --from=installer /app/apps/backoffice/package.json .

# Automatically leverage output traces to reduce image size
# https://nextjs.org/docs/advanced-features/output-file-tracing

COPY --from=installer --chown=nextjs:nodejs /app/apps/backoffice/.next ./
COPY --from=installer --chown=nextjs:nodejs /app/apps/backoffice/.next/standalone ./
COPY --from=installer --chown=nextjs:nodejs /app/apps/backoffice/.next/static ./standalone/apps/backoffice/.next/static
COPY --from=installer --chown=nextjs:nodejs /app/apps/backoffice/public ./standalone/apps/backoffice/public
COPY --from=installer /app/.env .
RUN ls -la ./standalone/apps/backoffice

RUN echo -e "\e[1;33mRunning application backoffice\e[0m"
EXPOSE 3000
ENV PORT 3000
CMD ["sh", "-c", "node --experimental-modules ./standalone/apps/backoffice/server.js"]
RUN echo -e "\e[1;33mApplication backoffice is running deployment done\e[0m"
19 changes: 19 additions & 0 deletions apps/backoffice/ecosystem.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
module.exports = {
apps: [
{
name: "backoffice",
script: "npm",
args: "run start:docker",
env: {
PORT: 3001,
},
// Additional settings
instances: 1, // Number of instances to run
autorestart: true, // Automatically restart the app if it crashes
watch: false, // Disable watching file changes
max_restarts: 5, // Limit the number of restart attempts
restart_delay: 1000, // Delay between restart attempts in milliseconds
max_memory_restart: "300M", // Restart the app if it exceeds 300MB memory usage
},
],
};
33 changes: 26 additions & 7 deletions apps/backoffice/next.config.mjs
Original file line number Diff line number Diff line change
@@ -1,24 +1,33 @@
// @ts-nocheck
import path from "path";
import { fileURLToPath } from "url";
import createJiti from "jiti";

/**
* Run `build` or `dev` with `SKIP_ENV_VALIDATION` to skip env validation.
* This is especially useful for Docker builds and Linting.
*/
console.log("process.env.SKIP_ENV_VALIDATION", process.env.SKIP_ENV_VALIDATION);
console.log("process.env.NODE_ENV", process.env.NODE_ENV);
console.log("pwd", process.cwd());

// Import env files to validate at build time. Use jiti so we can load .ts files in here.
createJiti(fileURLToPath(import.meta.url))("./src/env");
!process.env.SKIP_ENV_VALIDATION &&
createJiti(fileURLToPath(import.meta.url))("./src/env");
/** @type {import("next").NextConfig} */
const config = {
reactStrictMode: true,

productionBrowserSourceMaps: true,
webpack(config) {
config.module.rules.push({
test: /\.svg$/,
use: ["@svgr/webpack"],
});
config.resolve.fallback = {
...config.resolve.fallback, // if you miss it, all the other options in fallback, specified
// by next.js will be dropped. Doesn't make much sense, but how it is
fs: false, // the solution
};
return config;
},
optimization: {
minimize: false,
},

async headers() {
return [
Expand Down Expand Up @@ -57,6 +66,8 @@ const config = {
// 'next-intl/config': './src/i18n.ts',
// },
// },

esmExternals: true,
instrumentationHook: true,
},
images: {
Expand All @@ -67,9 +78,17 @@ const config = {
},
],
},

logging: {
fetches: {
fullUrl: true,
},
},
/** We already do linting and typechecking as separate tasks in CI */
eslint: { ignoreDuringBuilds: true },
typescript: { ignoreBuildErrors: true },
// output: "standalone",
};

// export default withTm(config);
export default config;
Loading