Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions compose.override.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ services:
condition: service_healthy
infobase:
condition: service_started
mockservices:
condition: service_healthy

fast_web:
build:
Expand Down Expand Up @@ -163,6 +165,24 @@ services:
db:
condition: service_healthy

mockservices:
build:
context: .
dockerfile: docker/mockservices/Dockerfile
networks:
- webnet
ports:
# mailpit web UI — browse captured email at http://localhost:8025
- 8025:8025
healthcheck:
# wget is purged from the image after installing mailpit (see Dockerfile);
# use python, which is always present in the python:3.12-slim base, instead.
test: ["CMD", "python3", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8090/health', timeout=2)"]
interval: 10s
start_period: 5s
timeout: 3s
retries: 5

volumes:
ol-vendor:
ol-build:
Expand Down
17 changes: 10 additions & 7 deletions conf/openlibrary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ report_spam_address: "Open Library <info@archive.org>"
support_case_notification_address: "Open Library <info@archive.org>"
support_case_control_address: "support@archive.org"

smtp_server: localhost
smtp_server: mockservices
smtp_port: 1025

dummy_sendmail: True
# dummy_sendmail disabled: email is captured by mailpit (http://localhost:8025)
dummy_sendmail: False
debug: True

# What is the in-cluster name of the open library server (used for OL API import)
Expand Down Expand Up @@ -158,16 +160,17 @@ ia_ol_xauth_s3:
s3_key: XXX
s3_secret: XXX

ia_loan_api_url: http://web:8080/internal/fake/loans
ia_xauth_api_url: http://web:8080/internal/fake/xauth
ia_s3_auth_url: http://web:8080/internal/fake/s3auth
ia_loan_api_url: http://mockservices:8090/services/loans/loan/
ia_s3_loan_url: http://mockservices:8090/services/loans/loan/
ia_xauth_api_url: http://mockservices:8090/services/xauthn/
ia_s3_auth_url: http://mockservices:8090/services/s3auth/
otp_seed: dev-otp-seed-for-e2e-testing

internal_tests_api_key: 8oPd1tx747YH374ohs48ZO5s2Nt1r9yD
ia_availability_api_v2_url: https://archive.org/services/availability/
ia_availability_api_v2_url: http://mockservices:8090/services/availability/
ia_base_url: https://archive.org

recaptcha_url: "https://www.recaptcha.net/recaptcha/api/siteverify"
recaptcha_url: "http://mockservices:8090/recaptcha/api/siteverify"

sentry:
enabled: false
Expand Down
26 changes: 26 additions & 0 deletions docker/mockservices/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
FROM python:3.12-slim

# Install mailpit (SMTP capture + web UI)
ARG MAILPIT_VERSION=1.21.6
RUN apt-get update && apt-get install -y --no-install-recommends wget ca-certificates \
&& wget -q "https://github.com/axllent/mailpit/releases/download/v${MAILPIT_VERSION}/mailpit-linux-amd64.tar.gz" \
-O /tmp/mailpit.tar.gz \
&& tar -xzf /tmp/mailpit.tar.gz -C /usr/local/bin mailpit \
&& chmod +x /usr/local/bin/mailpit \
&& rm /tmp/mailpit.tar.gz \
&& apt-get purge -y wget \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/*

WORKDIR /app
COPY docker/mockservices/requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

COPY docker/mockservices/main.py .
COPY docker/mockservices/start.sh .
RUN chmod +x start.sh

# FastAPI mock on 8090; mailpit SMTP on 1025; mailpit web UI on 8025
EXPOSE 8090 1025 8025

CMD ["/app/start.sh"]
Loading