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.
TypeScript ai-agentai-resume-analyzerapplication-trackerapplication-tracking-systematscareerjob-applicationjob-automationjob-huntingjob-searchjob-seeker-toolsjob-trackerjob-trackingjobsearchjobseekersmcpollamaresumeresume-reviewself-hosted
auto generate auth secret
Khuram Niazabefaacb8080
diff --git a/.env.example b/.env.exampleindex 589bd1a..6e9b047 100644--- a/.env.example+++ b/.env.example@@ -1,19 +1,18 @@# Note: Copy these variables in your .env file# DATABASE_URL=file:./dev.db-# Change your username and password here-USER_PASSWORD=password123# If you are running it on a remote server/homelab, you must update timezone otherwise activities times may shiftTZ=America/Edmonton-# 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:3000NEXTAUTH_URL=http://localhost:3000AUTH_TRUST_HOST=true+# AUTH_SECRET is auto-generated by deploy.sh and docker-entrypoint.sh+# To set manually, uncomment and provide your own value:+# AUTH_SECRET=+OPENAI_API_KEY=your-openai-api-key-here# DeepSeek API Key - get from https://platform.deepseek.comdiff --git a/Dockerfile b/Dockerfileindex ce523e9..1a0e806 100644--- a/Dockerfile+++ b/Dockerfile@@ -49,10 +49,11 @@ COPY --from=builder /app/prisma ./prismaCOPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static+COPY docker-entrypoint.sh /app/docker-entrypoint.sh+RUN chmod +x /app/docker-entrypoint.sh+EXPOSE 3000ENV PORT=3000-# Start as root, fix /data permissions, then run app as nextjs user-CMD chown -R nextjs:nodejs /data && \- exec su -s /bin/sh nextjs -c "npx -y [email protected] migrate deploy && node server.js"+ENTRYPOINT ["/app/docker-entrypoint.sh"]diff --git a/README.md b/README.mdindex 9d06cdf..61268bd 100644--- a/README.md+++ b/README.md@@ -49,40 +49,29 @@ JobSync Assistant is completely free to use and open source. It provides a powergit clone https://github.com/Gsync/jobsync.git```-#### Step 2 - Change environment variables-* ** You must create a .env file before proceeding. Refer to .env.example and create or change to .env with your environment variables**--#### 2.1 Generate auth secret (Optional)+#### Step 2 - Environment setup-These methods will generate a random string that you can use as your AUTH_SECRET. Make sure to set this in your environment variables:+When using `deploy.sh`, the `.env` file is automatically created from `.env.example` and `AUTH_SECRET` is auto-generated if missing. For `docker compose up` or `docker run` without a `.env` file, the container entrypoint auto-generates a temporary `AUTH_SECRET` at startup.-For example, add it to your .env local file:--```sh-AUTH_SECRET="your_generated_secret"-```+You can also create `.env` manually from `.env.example` and customize variables as needed.**Important**If you are running it on a remote server/homelab, you must update timezone otherwise activities times may shift-```sh+```shTZ=America/Edmonton```-##### For npm+##### Manual AUTH_SECRET generation (Optional)++If you prefer to set your own `AUTH_SECRET`, use one of these methods and add it to your `.env` file:```sh- npm exec auth secret+openssl rand -base64 32```OR```sh- npx auth secret-```--##### Using the openssl command available on Linux and Mac OS X:--```sh- openssl rand -base64 33+npx auth secret```#### 2.2 Change username and password (Optional)diff --git a/deploy.sh b/deploy.shindex 260e806..b3c7027 100755--- a/deploy.sh+++ b/deploy.sh@@ -26,7 +26,7 @@ echo ""SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"cd "$SCRIPT_DIR"-echo -e "${GREEN}[1/5]${NC} Current directory: $SCRIPT_DIR"+echo -e "${GREEN}[1/6]${NC} Current directory: $SCRIPT_DIR"echo ""# Detect Docker Compose (standalone v2 or plugin)@@ -48,23 +48,56 @@ if [ ! -d ".git" ]; thenexit 1fi+# Ensure .env exists and AUTH_SECRET is set+echo -e "${GREEN}[2/6]${NC} Checking environment configuration..."++if [ ! -f ".env" ]; then+ if [ -f ".env.example" ]; then+ cp .env.example .env+ echo -e " Created ${YELLOW}.env${NC} from .env.example"+ else+ echo -e " ${RED}Warning: No .env.example found. Creating empty .env${NC}"+ touch .env+ fi+fi++# Generate AUTH_SECRET if missing or empty+if ! grep -q '^AUTH_SECRET=.\+' .env 2>/dev/null; then+ NEW_SECRET=$(openssl rand -base64 32)+ if grep -q '^AUTH_SECRET=' .env 2>/dev/null; then+ # AUTH_SECRET line exists but is empty — replace it (handle macOS vs Linux sed)+ if sed --version >/dev/null 2>&1; then+ sed -i "s|^AUTH_SECRET=.*|AUTH_SECRET=$NEW_SECRET|" .env+ else+ sed -i '' "s|^AUTH_SECRET=.*|AUTH_SECRET=$NEW_SECRET|" .env+ fi+ else+ echo "AUTH_SECRET=$NEW_SECRET" >> .env+ fi+ echo -e " Generated ${YELLOW}AUTH_SECRET${NC} in .env"+else+ echo -e " AUTH_SECRET already set in .env"+fi++echo ""+# Fetch latest changes-echo -e "${GREEN}[2/5]${NC} Fetching latest changes from GitHub..."+echo -e "${GREEN}[3/6]${NC} Fetching latest changes from GitHub..."git fetch origin# Checkout and pull the specified branch-echo -e "${GREEN}[3/5]${NC} Checking out branch: ${YELLOW}$BRANCH${NC}"+echo -e "${GREEN}[4/6]${NC} Checking out branch: ${YELLOW}$BRANCH${NC}"git checkout "$BRANCH"-echo -e "${GREEN}[3/5]${NC} Pulling latest changes..."+echo -e "${GREEN}[4/6]${NC} Pulling latest changes..."git pull origin "$BRANCH"# Stop existing containers-echo -e "${GREEN}[4/5]${NC} Stopping existing containers..."+echo -e "${GREEN}[5/6]${NC} Stopping existing containers..."$COMPOSE_CMD down# Build and start containers-echo -e "${GREEN}[5/5]${NC} Building and starting containers..."+echo -e "${GREEN}[6/6]${NC} Building and starting containers..."$COMPOSE_CMD up -d --buildecho ""diff --git a/docker-compose.yml b/docker-compose.ymlindex d13652d..f739373 100644--- a/docker-compose.yml+++ b/docker-compose.yml@@ -7,16 +7,15 @@ services:ports:- "3000:3000"environment:- # Please do not forget to create and update your .env file- NODE_ENV=production- DATABASE_URL=file:/data/dev.db- - USER_EMAIL=${USER_EMAIL}- - USER_PASSWORD=${USER_PASSWORD}- - AUTH_SECRET=${AUTH_SECRET}+ - AUTH_SECRET=${AUTH_SECRET:-}- NEXTAUTH_URL=${NEXTAUTH_URL}- AUTH_TRUST_HOST=${AUTH_TRUST_HOST}- OLLAMA_BASE_URL=${OLLAMA_BASE_URL}- OPENAI_API_KEY=${OPENAI_API_KEY}+ - DEEPSEEK_API_KEY=${DEEPSEEK_API_KEY}+ - RAPIDAPI_KEY=${RAPIDAPI_KEY}volumes:- ./jobsyncdb/data:/datarestart: unless-stoppeddiff --git a/docker-entrypoint.sh b/docker-entrypoint.shnew file mode 100755index 0000000..4f8e248--- /dev/null+++ b/docker-entrypoint.sh@@ -0,0 +1,12 @@+#!/bin/sh+set -e++# Auto-generate AUTH_SECRET if not provided+if [ -z "$AUTH_SECRET" ]; then+ export AUTH_SECRET=$(openssl rand -base64 32)+ echo "AUTH_SECRET was not set — generated a temporary secret for this container."+fi++# Fix /data permissions and run app as nextjs user+chown -R nextjs:nodejs /data+exec su -s /bin/sh nextjs -c "npx -y [email protected] migrate deploy && node server.js"