fix(docker): install openssl in alpine and refine scraper readiness loop

This commit is contained in:
JobsBoard Deployer 2026-09-05 11:39:47 -04:00
parent 00775c48ed
commit 3aad6705d0
3 changed files with 14 additions and 8 deletions

View file

@ -119,21 +119,23 @@ def _upsert_postgres(jobs_list: list, db_url: str):
# Wait for postgres and Prisma migrations to be ready # Wait for postgres and Prisma migrations to be ready
conn = None conn = None
for attempt in range(15): for attempt in range(40):
try: try:
conn = psycopg2.connect(db_url) conn = psycopg2.connect(db_url)
cursor = conn.cursor() cursor = conn.cursor()
cursor.execute("SELECT to_regclass('\"Job\"');") cursor.execute("SELECT to_regclass('\"Job\"');")
table_exists = cursor.fetchone()[0] result = cursor.fetchone()
table_exists = result[0] if result else None
if table_exists: if table_exists:
break break
cursor.close() cursor.close()
conn.close() conn.close()
print(f"[Scraper] Waiting for database tables to initialize (attempt {attempt + 1}/15)...") conn = None
time.sleep(3) print(f"[Scraper] Waiting for database tables to initialize (attempt {attempt + 1}/40)...")
time.sleep(5)
except Exception as conn_err: except Exception as conn_err:
print(f"[Scraper] Waiting for PostgreSQL readiness ({conn_err}) (attempt {attempt + 1}/15)...") print(f"[Scraper] Waiting for PostgreSQL readiness ({conn_err}) (attempt {attempt + 1}/40)...")
time.sleep(3) time.sleep(5)
if not conn or conn.closed: if not conn or conn.closed:
try: try:

View file

@ -32,7 +32,7 @@ def run_jobspy_scrapes() -> List[Dict[Any, Any]]:
try: try:
print(f"[JobSpy] Searching CT Local: '{query}'") print(f"[JobSpy] Searching CT Local: '{query}'")
jobs_df = scrape_jobs( jobs_df = scrape_jobs(
site_name=["indeed", "zip_recruiter"], site_name=["indeed"],
search_term=query, search_term=query,
location="Connecticut", location="Connecticut",
results_wanted=15, results_wanted=15,
@ -68,7 +68,7 @@ def run_jobspy_scrapes() -> List[Dict[Any, Any]]:
try: try:
print(f"[JobSpy] Searching Remote: '{query}'") print(f"[JobSpy] Searching Remote: '{query}'")
jobs_df = scrape_jobs( jobs_df = scrape_jobs(
site_name=["indeed", "zip_recruiter"], site_name=["indeed"],
search_term=query, search_term=query,
results_wanted=15, results_wanted=15,
hours_old=72, hours_old=72,

View file

@ -1,6 +1,8 @@
FROM node:20-alpine AS builder FROM node:20-alpine AS builder
WORKDIR /app WORKDIR /app
RUN apk add --no-cache openssl libc6-compat
COPY package*.json ./ COPY package*.json ./
RUN npm ci RUN npm ci
@ -12,6 +14,8 @@ RUN npm run build
FROM node:20-alpine AS runner FROM node:20-alpine AS runner
WORKDIR /app WORKDIR /app
RUN apk add --no-cache openssl libc6-compat
ENV NODE_ENV=production ENV NODE_ENV=production
COPY package*.json ./ COPY package*.json ./