diff --git a/apps/web/package.json b/apps/web/package.json index efd524992..41caec804 100644 --- a/apps/web/package.json +++ b/apps/web/package.json @@ -19,7 +19,6 @@ "@documenso/ee": "*", "@documenso/lib": "*", "@documenso/prisma": "*", - "@documenso/tailwind-config": "*", "@documenso/trpc": "*", "@documenso/ui": "*", "@hookform/resolvers": "^3.1.0", @@ -46,18 +45,19 @@ "remeda": "^1.27.1", "sharp": "0.33.1", "ts-pattern": "^5.0.5", - "typescript": "5.2.2", "ua-parser-js": "^1.0.37", "uqr": "^0.1.2", "zod": "^3.22.4" }, "devDependencies": { + "@documenso/tailwind-config": "*", "@types/formidable": "^2.0.6", "@types/luxon": "^3.3.1", "@types/node": "20.1.0", "@types/react": "18.2.18", "@types/react-dom": "18.2.7", - "@types/ua-parser-js": "^0.7.39" + "@types/ua-parser-js": "^0.7.39", + "typescript": "5.2.2" }, "overrides": { "next-auth": { diff --git a/docker/Dockerfile b/docker/Dockerfile index 55012df48..0d6f42e1f 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -93,7 +93,18 @@ COPY --from=installer --chown=nextjs:nodejs /app/apps/web/.next/standalone ./ COPY --from=installer --chown=nextjs:nodejs /app/apps/web/.next/static ./apps/web/.next/static COPY --from=installer --chown=nextjs:nodejs /app/apps/web/public ./apps/web/public -# Get the start script from docker/start.sh -COPY --chown=nextjs:nodejs /docker/start.sh . +# Copy the prisma binary, schema and migrations +COPY --from=installer --chown=nextjs:nodejs /app/packages/prisma/schema.prisma ./packages/prisma/schema.prisma +COPY --from=installer --chown=nextjs:nodejs /app/packages/prisma/migrations ./packages/prisma/migrations +COPY --from=installer --chown=nextjs:nodejs /app/node_modules/prisma/ ./node_modules/prisma/ +COPY --from=installer --chown=nextjs:nodejs /app/node_modules/@prisma/ ./node_modules/@prisma/ -CMD start.sh +# Symlink the prisma binary +RUN mkdir node_modules/.bin +RUN ln -s /app/node_modules/prisma/build/index.js ./node_modules/.bin/prisma + + +# Get the start script from docker/start.sh +COPY --chown=nextjs:nodejs ./docker/start.sh ./start.sh + +CMD ["sh", "start.sh"] diff --git a/docker/production/compose.yml b/docker/production/compose.yml index 76f613467..08abcf050 100644 --- a/docker/production/compose.yml +++ b/docker/production/compose.yml @@ -2,7 +2,7 @@ name: documenso-production services: database: - image: ?:15 + image: postgres:15 environment: - POSTGRES_USER=${POSTGRES_USER:?err} - POSTGRES_PASSWORD=${POSTGRES_PASSWORD:?err} @@ -18,7 +18,8 @@ services: documenso: image: documenso/documenso:latest depends_on: - - database + database: + condition: service_healthy environment: - PORT=${PORT:-3000} - NEXTAUTH_URL=${NEXTAUTH_URL:-${NEXT_PUBLIC_WEBAPP_URL}} diff --git a/docker/start.sh b/docker/start.sh index 0380835cd..e8d3be2e6 100755 --- a/docker/start.sh +++ b/docker/start.sh @@ -1,5 +1,7 @@ #!/bin/sh -npx prisma migrate deploy --schema ./node_modules/.prisma/client/schema.prisma +set -x + +npx prisma migrate deploy --schema ./packages/prisma/schema.prisma node apps/web/server.js diff --git a/docker/testing/compose.yml b/docker/testing/compose.yml index b9ba5cda8..cecb5bf14 100644 --- a/docker/testing/compose.yml +++ b/docker/testing/compose.yml @@ -7,6 +7,11 @@ services: - POSTGRES_USER=documenso - POSTGRES_PASSWORD=password - POSTGRES_DB=documenso + healthcheck: + test: ['CMD-SHELL', 'pg_isready -U documenso'] + interval: 1s + timeout: 5s + retries: 5 ports: - 54322:5432 @@ -22,12 +27,25 @@ services: context: ../../ dockerfile: docker/Dockerfile depends_on: - - database - - inbucket + database: + condition: service_healthy + inbucket: + condition: service_started env_file: - ../../.env.example environment: + - NEXTAUTH_SECRET=secret + - NEXT_PRIVATE_ENCRYPTION_KEY=CAFEBABE + - NEXT_PRIVATE_ENCRYPTION_SECONDARY_KEY=DEADBEEF - NEXT_PRIVATE_DATABASE_URL=postgres://documenso:password@database:5432/documenso - NEXT_PRIVATE_DIRECT_DATABASE_URL=postgres://documenso:password@database:5432/documenso + - NEXT_PUBLIC_UPLOAD_TRANSPORT=database + - NEXT_PRIVATE_SMTP_TRANSPORT=smtp-auth + - NEXT_PRIVATE_SMTP_HOST=inbucket + - NEXT_PRIVATE_SMTP_PORT=2500 + - NEXT_PRIVATE_SMTP_USERNAME=documenso + - NEXT_PRIVATE_SMTP_PASSWORD=password + - NEXT_PRIVATE_SMTP_FROM_NAME="No Reply @ Documenso" + - NEXT_PRIVATE_SMTP_FROM_ADDRESS=noreply@documenso.com ports: - 3000:3000 diff --git a/package-lock.json b/package-lock.json index 27227172c..6096c8df7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -135,7 +135,6 @@ "@documenso/ee": "*", "@documenso/lib": "*", "@documenso/prisma": "*", - "@documenso/tailwind-config": "*", "@documenso/trpc": "*", "@documenso/ui": "*", "@hookform/resolvers": "^3.1.0", @@ -162,18 +161,19 @@ "remeda": "^1.27.1", "sharp": "0.33.1", "ts-pattern": "^5.0.5", - "typescript": "5.2.2", "ua-parser-js": "^1.0.37", "uqr": "^0.1.2", "zod": "^3.22.4" }, "devDependencies": { + "@documenso/tailwind-config": "*", "@types/formidable": "^2.0.6", "@types/luxon": "^3.3.1", "@types/node": "20.1.0", "@types/react": "18.2.18", "@types/react-dom": "18.2.7", - "@types/ua-parser-js": "^0.7.39" + "@types/ua-parser-js": "^0.7.39", + "typescript": "5.2.2" } }, "apps/web/node_modules/@types/node": { @@ -225,6 +225,7 @@ "version": "5.2.2", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.2.2.tgz", "integrity": "sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==", + "dev": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -9700,6 +9701,7 @@ "version": "16.3.1", "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.3.1.tgz", "integrity": "sha512-IPzF4w4/Rd94bA9imS68tZBaYyBWSCE47V1RGuMrB94iyTOIEwRmVL2x/4An+6mETpLrKJ5hQkB8W4kFAadeIQ==", + "dev": true, "engines": { "node": ">=12" }, @@ -9711,6 +9713,7 @@ "version": "7.3.0", "resolved": "https://registry.npmjs.org/dotenv-cli/-/dotenv-cli-7.3.0.tgz", "integrity": "sha512-314CA4TyK34YEJ6ntBf80eUY+t1XaFLyem1k9P0sX1gn30qThZ5qZr/ZwE318gEnzyYP9yj9HJk6SqwE0upkfw==", + "dev": true, "dependencies": { "cross-spawn": "^7.0.3", "dotenv": "^16.3.0", @@ -9725,6 +9728,7 @@ "version": "10.0.0", "resolved": "https://registry.npmjs.org/dotenv-expand/-/dotenv-expand-10.0.0.tgz", "integrity": "sha512-GopVGCpVS1UKH75VKHGuQFqS1Gusej0z4FyQkPdwjil2gNIv+LNsqBlboOzpJFZKVT95GkCyWJbBSdFEFUWI2A==", + "dev": true, "engines": { "node": ">=12" } @@ -21419,12 +21423,12 @@ "license": "MIT", "dependencies": { "@prisma/client": "5.4.2", - "dotenv": "^16.3.1", - "dotenv-cli": "^7.3.0", "prisma": "5.4.2", "ts-pattern": "^5.0.6" }, "devDependencies": { + "dotenv": "^16.3.1", + "dotenv-cli": "^7.3.0", "ts-node": "^10.9.1", "typescript": "5.2.2" } diff --git a/packages/prisma/package.json b/packages/prisma/package.json index 301b51dba..0cd3ed282 100644 --- a/packages/prisma/package.json +++ b/packages/prisma/package.json @@ -19,12 +19,12 @@ }, "dependencies": { "@prisma/client": "5.4.2", - "dotenv": "^16.3.1", - "dotenv-cli": "^7.3.0", "prisma": "5.4.2", "ts-pattern": "^5.0.6" }, "devDependencies": { + "dotenv": "^16.3.1", + "dotenv-cli": "^7.3.0", "ts-node": "^10.9.1", "typescript": "5.2.2" }