Skip to content

Job application tracker and AI-powered job search assistant. Helps job seekers manage their search journey with AI resume review, job matching, task logging, and application analytics, all while keeping your data private.

Fix sqlite error on server

Khuram Niaz66f16e790fd7
diff --git a/.env.example b/.env.example
index 48231b7..9296d9f 100644
--- a/.env.example
+++ b/.env.example
@@ -6,5 +6,11 @@ USER_PASSWORD=password123
# Refer to readme to generate auth secret
AUTH_SECRET=generate-with-openssl-rand-base64
+# For homelab server, change the following to your server ip ex: http://192.168.x.x:3000
+NEXTAUTH_URL=http://localhost:3000
+AUTH_TRUST_HOST=true
OPENAI_API_KEY=your-openai-api-key-here
+
+# For homelab server, if you ollama is running on server, change the following to your ollamma ip ex: http://192.168.x.x:12345
+OLLAMA_BASE_URL=http://host.docker.internal:11434
diff --git a/Dockerfile b/Dockerfile
index 00ca19a..4db1b97 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -26,10 +26,6 @@ COPY . .
ENV DATABASE_URL=file:/data/dev.db
-# Add the wait script to ensure the database is ready before running migrations
-# ADD https://github.com/ufoscout/docker-compose-wait/releases/download/2.9.0/wait /wait
-# RUN chmod +x /wait
-
# Generate Prisma client
RUN npx prisma generate
@@ -59,7 +55,7 @@ RUN chown nextjs:nodejs .next
# Set up /data directory with the right permissions
RUN mkdir -p /data/files/resumes && chown -R nextjs:nodejs /data/files/resumes
-RUN npm install [email protected] --no-save
+RUN npm install [email protected] --no-save
# Automatically leverage output traces to reduce image size
# https://nextjs.org/docs/advanced-features/output-file-tracing
@@ -70,11 +66,11 @@ COPY --from=builder /app/node_modules/bcryptjs ./node_modules/bcryptjs
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
-USER nextjs
-
EXPOSE 3000
-ENV PORT 3000
+ENV PORT=3000
-# Start the jobsync application
-CMD npx prisma migrate deploy && npm run seed && node server.js
+# Start as root, fix /data permissions, then run app as nextjs user
+# Using 'su' which is built into Alpine base image
+CMD chown -R nextjs:nodejs /data && \
+ exec su -s /bin/sh nextjs -c "npx prisma migrate deploy && npm run seed && node server.js"
diff --git a/README.md b/README.md
index 7a53ff6..b4476af 100644
--- a/README.md
+++ b/README.md
@@ -48,7 +48,7 @@ git clone https://github.com/Gsync/jobsync.git
```
#### Step 2 (Optional) - Change environment variables
-* **Alternativey you can also download the source code using download link**
+* **Refer to .env.example and change to .env with your environment variables**
#### 2.1 Generate auth secret (Optional)
@@ -78,11 +78,11 @@ OR
#### 2.2 Change username and password (Optional)
-You can use default username (admin@example) and password (password123) or change it in the Dockerfile
+You can use default username (admin@example) and password (password123) or change it in you .env file
#### Step 3 - Build docker image and run container
* **Please make sure you have <a href="https://www.docker.com">docker</a> installed and running**
-* Please make sure you are in the root folder in your terminal
+* Please make sure you are in you project directory in your terminal
```sh
docker compose up
@@ -125,6 +125,3 @@ You must add your valid API key in the docker file, also please make sure openai
ENV OPENAI_API_KEY=sk-xxx
```
-### Note ###
-
-This app is not yet recommended for use on a remote server whether its cloud or local network, it has only been tested in a local environment with ollama running locally.
\ No newline at end of file
diff --git a/docker-compose.yml b/docker-compose.yml
index 2d7d399..1f26ebb 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -14,9 +14,10 @@ services:
- USER_EMAIL=${USER_EMAIL}
- USER_PASSWORD=${USER_PASSWORD}
- AUTH_SECRET=${AUTH_SECRET}
- - NEXTAUTH_URL=http://localhost:3000
- - AUTH_TRUST_HOST=http://localhost:3000
- - OLLAMA_BASE_URL=http://host.docker.internal:11434
+ - NEXTAUTH_URL=${NEXTAUTH_URL}
+ - AUTH_TRUST_HOST=${AUTH_TRUST_HOST}
+ - OLLAMA_BASE_URL=${OLLAMA_BASE_URL}
- OPENAI_API_KEY=${OPENAI_API_KEY}
volumes:
- ./jobsyncdb/data:/data
+ restart: unless-stopped