Compare commits

..

50 Commits

Author SHA1 Message Date
darroyo ebeb4574ad Merge pull request 'd' (#23) from develop into main
Personal/recall/pipeline/head This commit looks good
Reviewed-on: #23
2026-03-27 13:56:05 +00:00
darroyo 7fce46bff2 d 2026-03-27 10:55:43 -03:00
darroyo 9380273cba Merge pull request 'j' (#22) from develop into main
Reviewed-on: #22
2026-03-27 13:52:14 +00:00
darroyo d398226723 j 2026-03-27 10:09:44 -03:00
darroyo e225f2ec2c Merge pull request 'develop' (#21) from develop into main
Personal/recall/pipeline/head This commit looks good
Reviewed-on: #21
2026-03-25 02:08:04 +00:00
darroyo 85bbe7b61f fix: Increase memory limit to 512MB for Prisma db push 2026-03-24 23:07:10 -03:00
darroyo de1de1d3bc fix: Run prisma db push but continue if OOM and DB exists 2026-03-24 23:04:26 -03:00
darroyo ef8a7858b2 fix: Only run prisma db push if database doesn't exist to avoid OOM 2026-03-24 23:02:14 -03:00
darroyo 11615ee4cb Merge pull request 'fix: Make entrypoint more robust to handle volume permission issues' (#20) from develop into main
Reviewed-on: #20
2026-03-24 18:22:31 +00:00
darroyo dc5089c011 fix: Make entrypoint more robust to handle volume permission issues 2026-03-24 15:19:21 -03:00
darroyo aaa04e1d26 Merge pull request 'prueba' (#19) from develop into main
Personal/recall/pipeline/head This commit looks good
Reviewed-on: #19
2026-03-24 18:09:18 +00:00
darroyo 0e22acc077 prueba 2026-03-24 15:08:30 -03:00
darroyo 386dd2d6a2 Merge pull request 'develop' (#18) from develop into main
Personal/recall/pipeline/head This commit looks good
Reviewed-on: #18
2026-03-24 17:48:21 +00:00
darroyo 85e6304bae fix: Use absolute path for DATABASE_URL to avoid working directory issues 2026-03-24 14:46:15 -03:00
darroyo cf6b5785d7 fix: Change to /app directory before running prisma and node 2026-03-24 13:13:09 -03:00
darroyo cf2f3d0255 Merge pull request 'fix: Run container as root to avoid volume permission issues' (#17) from develop into main
Personal/recall/pipeline/head This commit looks good
Reviewed-on: #17
2026-03-24 16:04:05 +00:00
darroyo 66db3de33d fix: Run container as root to avoid volume permission issues 2026-03-24 12:59:09 -03:00
darroyo bfcb7d7fd3 Merge pull request 'fix: Add --skip-generate to avoid memory issues in Prisma 5' (#16) from develop into main
Personal/recall/pipeline/head This commit looks good
Reviewed-on: #16
2026-03-24 15:40:05 +00:00
darroyo a0451a2084 fix: Add --skip-generate to avoid memory issues in Prisma 5 2026-03-24 12:39:20 -03:00
darroyo d003d3c1c7 Merge pull request 'fix: Run prisma db push as root, then switch to nextjs user for app' (#15) from develop into main
Personal/recall/pipeline/head This commit looks good
Reviewed-on: #15
2026-03-24 15:10:27 +00:00
darroyo d91ff3f07c fix: Run prisma db push as root, then switch to nextjs user for app 2026-03-24 12:06:58 -03:00
darroyo 786dc4c825 Merge pull request 'fix: Ensure data directory exists and has proper permissions before prisma db push' (#14) from develop into main
Personal/recall/pipeline/head This commit looks good
Reviewed-on: #14
2026-03-24 14:46:41 +00:00
darroyo d5a6d0bfd7 fix: Ensure data directory exists and has proper permissions before prisma db push 2026-03-24 11:44:39 -03:00
darroyo ef8c4bafe6 Merge pull request 'develop' (#13) from develop into main
Personal/recall/pipeline/head This commit looks good
Reviewed-on: #13
2026-03-24 13:25:26 +00:00
darroyo 97082b0233 fix: Copy @prisma modules needed for prisma CLI 2026-03-24 10:21:05 -03:00
darroyo 93b6c0b17d fix: Simplify entrypoint - remove npm cache directories 2026-03-24 10:03:51 -03:00
darroyo f038f37001 fix: Use local Prisma 5 from node_modules instead of downloading Prisma 7 2026-03-24 09:33:31 -03:00
darroyo e5e976caff fix: Remove --skip-generate flag not supported in Prisma 7 2026-03-24 09:14:59 -03:00
darroyo e5b6ce3bdc fix: Use npx with proper HOME and cache directories for prisma 2026-03-24 09:08:24 -03:00
darroyo 5fb1c5d0b0 fix: Copy .bin folder and use local prisma in entrypoint 2026-03-24 09:04:26 -03:00
darroyo f6218283f1 fix: Create home directory for nextjs user to fix npm permissions 2026-03-24 09:02:54 -03:00
darroyo 58311ba2df Merge pull request 'develop' (#12) from develop into main
Personal/recall/pipeline/head This commit looks good
Reviewed-on: #12
2026-03-24 02:55:18 +00:00
darroyo 3ff5e6b031 fix: Improve entrypoint script with better database initialization 2026-03-23 23:54:32 -03:00
darroyo 1916bc33e4 fix: Add entrypoint script to initialize database on container start 2026-03-23 23:53:18 -03:00
darroyo 410f72caf0 Merge pull request 'fix: Force dynamic rendering on home page to avoid Prisma build error' (#11) from develop into main
Personal/recall/pipeline/head This commit looks good
Reviewed-on: #11
2026-03-24 02:48:14 +00:00
darroyo 9847b4c5cc fix: Force dynamic rendering on home page to avoid Prisma build error 2026-03-23 23:47:28 -03:00
darroyo f0e2c60620 Merge pull request 'fix: Add DATABASE_URL env var in builder stage for Prisma' (#10) from develop into main
Personal/recall/pipeline/head This commit looks good
Reviewed-on: #10
2026-03-24 02:32:58 +00:00
darroyo fc53062eb1 fix: Add DATABASE_URL env var in builder stage for Prisma 2026-03-23 23:32:19 -03:00
darroyo ae0502ce16 Merge pull request 'fix: Remove libc6-compat (Alpine package) from Debian-based Dockerfile' (#9) from develop into main
Personal/recall/pipeline/head There was a failure building this commit
Reviewed-on: #9
2026-03-24 02:17:54 +00:00
darroyo 28366151cf fix: Remove libc6-compat (Alpine package) from Debian-based Dockerfile 2026-03-23 23:17:27 -03:00
darroyo 3378d5c523 Merge pull request 'fix: Change Alpine to Debian-based image for Prisma compatibility' (#8) from develop into main
Personal/recall/pipeline/head There was a failure building this commit
Reviewed-on: #8
2026-03-24 02:14:32 +00:00
darroyo c8674dd56f fix: Change Alpine to Debian-based image for Prisma compatibility
Alpine Linux doesn't have libssl1.1 which Prisma needs.
Using node:20-slim instead with proper OpenSSL libraries.
2026-03-23 23:13:45 -03:00
darroyo b7c4df42e0 Merge pull request 'fix: Exclude id field from noteData in update route' (#7) from develop into main
Personal/recall/pipeline/head There was a failure building this commit
Reviewed-on: #7
2026-03-24 02:09:07 +00:00
darroyo 3a523aafde fix: Exclude id field from noteData in update route 2026-03-23 23:08:17 -03:00
darroyo a8ef158fd7 Merge pull request 'fix: TypeScript error in import route - cast item to access id' (#6) from develop into main
Personal/recall/pipeline/head There was a failure building this commit
Reviewed-on: #6
2026-03-24 02:05:45 +00:00
darroyo 9ca98d96db fix: TypeScript error in import route - cast item to access id 2026-03-23 23:05:03 -03:00
darroyo 52e45a663e Merge pull request 'j' (#5) from develop into main
Personal/recall/pipeline/head There was a failure building this commit
Reviewed-on: #5
2026-03-24 01:49:51 +00:00
darroyo bd1a5bc21c j 2026-03-23 22:49:06 -03:00
darroyo 0c3ffff81c Merge pull request 'a' (#4) from develop into main
Personal/recall/pipeline/head There was a failure building this commit
Reviewed-on: #4
2026-03-24 01:44:13 +00:00
darroyo 2f9233ad41 a 2026-03-23 22:43:43 -03:00
9 changed files with 71 additions and 26 deletions
+23 -9
View File
@@ -1,7 +1,9 @@
# Stage 1: Dependencies # Stage 1: Dependencies
FROM node:20-alpine AS deps FROM node:20-slim AS deps
RUN apk add --no-cache libc6-compat RUN apt-get update && apt-get install -y --no-install-recommends \
openssl \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app WORKDIR /app
@@ -10,41 +12,53 @@ COPY package.json package-lock.json* ./
RUN npm ci RUN npm ci
# Stage 2: Build # Stage 2: Build
FROM node:20-alpine AS builder FROM node:20-slim AS builder
WORKDIR /app WORKDIR /app
RUN apt-get update && apt-get install -y --no-install-recommends \
openssl \
&& rm -rf /var/lib/apt/lists/*
COPY --from=deps /app/node_modules ./node_modules COPY --from=deps /app/node_modules ./node_modules
COPY . . COPY . .
ENV DATABASE_URL="file:./dev.db"
RUN npx prisma generate RUN npx prisma generate
RUN npm run build RUN npm run build
# Stage 3: Production # Stage 3: Production
FROM node:20-alpine AS runner FROM node:20-slim AS runner
WORKDIR /app WORKDIR /app
ENV NODE_ENV=production ENV NODE_ENV=production
RUN addgroup --system --gid 1001 nodejs RUN apt-get update && apt-get install -y --no-install-recommends \
RUN adduser --system --uid 1001 nextjs openssl \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
COPY --from=builder /app/public ./public COPY --from=builder /app/public ./public
COPY --from=builder /app/.next/standalone ./ COPY --from=builder /app/.next/standalone ./
COPY --from=builder /app/.next/static ./.next/static COPY --from=builder /app/.next/static ./.next/static
COPY --from=builder /app/prisma ./prisma COPY --from=builder /app/prisma ./prisma
COPY --from=builder /app/node_modules/.prisma ./node_modules/.prisma COPY --from=builder /app/node_modules/.prisma ./node_modules/.prisma
COPY --from=builder /app/node_modules/prisma ./node_modules/prisma
COPY --from=builder /app/node_modules/@prisma ./node_modules/@prisma
COPY --from=builder /app/prisma/schema.prisma /app/schema.prisma COPY --from=builder /app/prisma/schema.prisma /app/schema.prisma
COPY docker-entrypoint.sh /usr/local/bin/
USER nextjs RUN chmod +x /usr/local/bin/docker-entrypoint.sh
EXPOSE 3000 EXPOSE 3000
ENV PORT=3000 ENV PORT=3000
ENV HOSTNAME="0.0.0.0" ENV HOSTNAME="0.0.0.0"
ENV DATABASE_URL="file:./dev.db" ENV DATABASE_URL="file:/app/data/dev.db"
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
CMD ["node", "server.js"] CMD ["node", "server.js"]
Vendored
+7 -8
View File
@@ -39,13 +39,12 @@ pipeline {
try { try {
sh """ sh """
ls -la ls -la
#ls -la src || echo "Directorio src no encontrado" ls -la src || echo "Directorio src no encontrado"
#ls -la src/main/docker || echo "Directorio src/main/docker no encontrado" ls -la src/main/docker || echo "Directorio src/main/docker no encontrado"
#cat .dockerignore || echo ".dockerignore no encontrado" cat .dockerignore || echo ".dockerignore no encontrado"
docker -v docker -v
docker build \ docker build \
-t ${URL_REGISTRY}/${PROJECT}/${NAME_SERVICE}:${BUILD_NUMBER} \ -t ${URL_REGISTRY}/${PROJECT}/${NAME_SERVICE}:${BUILD_NUMBER} .
-f .
docker tag ${URL_REGISTRY}/${PROJECT}/${NAME_SERVICE}:${BUILD_NUMBER} \ docker tag ${URL_REGISTRY}/${PROJECT}/${NAME_SERVICE}:${BUILD_NUMBER} \
${URL_REGISTRY}/${PROJECT}/${NAME_SERVICE}:latest ${URL_REGISTRY}/${PROJECT}/${NAME_SERVICE}:latest
""" """
@@ -86,13 +85,13 @@ services:
- "traefik.http.routers.${NAME_SERVICE}.rule=Host(`recall.vodorod.cl`)" - "traefik.http.routers.${NAME_SERVICE}.rule=Host(`recall.vodorod.cl`)"
environment: environment:
- TZ=America/Santiago - TZ=America/Santiago
- DATABASE_URL=file:./data/dev.db - DATABASE_URL=file:/app/data/dev.db
volumes: volumes:
- ./data:/app/data - ./data:/app/data
networks: networks:
- homelab-net - homelab-net
mem_limit: 32m mem_limit: 512m
mem_reservation: 16m mem_reservation: 256m
restart: unless-stopped restart: unless-stopped
networks: networks:
homelab-net: homelab-net:
+4
View File
@@ -248,3 +248,7 @@ src/
└── types/ └── types/
└── note.ts └── note.ts
``` ```
nueva prueba
BIN
View File
Binary file not shown.
+1 -1
View File
@@ -8,5 +8,5 @@ services:
volumes: volumes:
- ./data:/app/data - ./data:/app/data
environment: environment:
- DATABASE_URL=file:./data/dev.db - DATABASE_URL=file:/app/data/dev.db
restart: unless-stopped restart: unless-stopped
+25
View File
@@ -0,0 +1,25 @@
#!/bin/bash
set -e
cd /app
echo "Checking database..."
# Ensure data directory exists with proper permissions
mkdir -p /app/data
chmod 777 /app/data
# Run db push (creates/updates database schema)
# If it fails due to OOM but DB exists, continue anyway
./node_modules/prisma/build/index.js db push --skip-generate || {
exit_code=$?
if [ -f /app/data/dev.db ]; then
echo "db push failed (code $exit_code) but database exists, continuing..."
else
echo "db push failed and database does not exist"
exit $exit_code
fi
}
echo "Starting application..."
exec "$@"
+8 -7
View File
@@ -105,21 +105,22 @@ export async function POST(req: NextRequest) {
const createdAt = parseDate((item as { createdAt?: string }).createdAt) const createdAt = parseDate((item as { createdAt?: string }).createdAt)
const updatedAt = parseDate((item as { updatedAt?: string }).updatedAt) const updatedAt = parseDate((item as { updatedAt?: string }).updatedAt)
const itemWithId = item as { id?: string }
if (item.id) { if (itemWithId.id) {
const existing = await tx.note.findUnique({ where: { id: item.id } }) const existing = await tx.note.findUnique({ where: { id: itemWithId.id } })
if (existing) { if (existing) {
await tx.note.update({ await tx.note.update({
where: { id: item.id }, where: { id: itemWithId.id },
data: { ...noteData, createdAt, updatedAt }, data: { ...noteData, createdAt, updatedAt },
}) })
await tx.noteTag.deleteMany({ where: { noteId: item.id } }) await tx.noteTag.deleteMany({ where: { noteId: itemWithId.id } })
processed++ processed++
} else { } else {
await tx.note.create({ await tx.note.create({
data: { data: {
...noteData, ...noteData,
id: item.id, id: itemWithId.id,
createdAt, createdAt,
updatedAt, updatedAt,
creationSource: 'import', creationSource: 'import',
@@ -150,8 +151,8 @@ export async function POST(req: NextRequest) {
processed++ processed++
} }
const noteId = item.id const noteId = itemWithId.id
? (await tx.note.findUnique({ where: { id: item.id } }))?.id ? (await tx.note.findUnique({ where: { id: itemWithId.id } }))?.id
: (await tx.note.findFirst({ where: { title: item.title } }))?.id : (await tx.note.findFirst({ where: { title: item.title } }))?.id
if (noteId && tags.length > 0) { if (noteId && tags.length > 0) {
+1 -1
View File
@@ -33,7 +33,7 @@ export async function PUT(req: NextRequest, { params }: { params: Promise<{ id:
throw new ValidationError(result.error.issues) throw new ValidationError(result.error.issues)
} }
const { tags, ...noteData } = result.data const { tags, id: _, ...noteData } = result.data
const existingNote = await prisma.note.findUnique({ where: { id } }) const existingNote = await prisma.note.findUnique({ where: { id } })
if (!existingNote) { if (!existingNote) {
+2
View File
@@ -1,6 +1,8 @@
import { Dashboard } from '@/components/dashboard' import { Dashboard } from '@/components/dashboard'
import { getDashboardData } from '@/lib/dashboard' import { getDashboardData } from '@/lib/dashboard'
export const dynamic = 'force-dynamic'
export default async function HomePage() { export default async function HomePage() {
const data = await getDashboardData(6) const data = await getDashboardData(6)