Skip to content

Commit

Permalink
Merge branch 'master' into 2323-update-notification-with-new-messaging
Browse files Browse the repository at this point in the history
  • Loading branch information
courtneyc1 authored Nov 30, 2023
2 parents ad418f6 + 8156169 commit cbfa8d3
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 2 deletions.
19 changes: 17 additions & 2 deletions backend/Dockerfile.pe
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,25 @@ RUN pip3.10 install --upgrade pip

RUN apt remove dav1d && apt autoclean && apt autoremove

# Install AWS CLI
RUN curl --insecure "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
RUN unzip awscliv2.zip
RUN ./aws/install

# Install pe-source module
# Sync the latest from cf-staging branch
RUN git clone -b cf-source-staging https://github.com/cisagov/pe-reports.git && cd pe-reports && git checkout c9cbbd73b22ef38cabe1da6ba50aeb2dc0be4f99 && pip install .
RUN git clone -b AL-staging-SQS https://github.com/cisagov/pe-reports.git && \
cd pe-reports && \
git checkout 6dcd017551ba14022e110c073e1bdbc804c795f8 && \
pip install .

RUN python -m spacy download en_core_web_lg

# Create database.ini
RUN echo "[database]" > database.ini \
&& echo "user=$(cat db_user.txt)" >> database.ini \
&& echo "password=$(cat db_password.txt)" >> database.ini

COPY worker worker

CMD ["./worker/pe-worker-entry.sh"]
CMD ["./worker/generate_config.sh", "./worker/pe-worker-entry.sh"]
44 changes: 44 additions & 0 deletions backend/worker/generate_config.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/bin/bash

# Generate database.ini
cat <<EOF > pe-reports/src/pe_reports/data/database.ini
[postgres]
host=$(DB_HOST)
database=$(PE_DB_NAME)
user=$(PE_DB_USERNAME)
password=$(PE_DB_PASSWORD)
port=5432
[shodan]
key1=$(PE_SHODAN_API_KEYS)
[staging]
[cyhy_mongo]
[sixgill]
[whoisxml]
key=
[intelx]
[dnsmonitor]
[pe_db_password_key]
[blocklist]
[dehashed]
[dnstwist]
[hibp]
[API_Client_ID]
[API_Client_secret]
[API_WHOIS]
[pe_api]
EOF

# Find the path to the pe_reports package in site-packages
pe_reports_path=$(pip show pe-reports | grep -E '^Location:' | awk '{print $2}')

# Ensure pe_reports_path ends with /pe_reports
pe_reports_path="${pe_reports_path%/pe-reports}/pe_reports"


# Copy database.ini to the module's installation directory
cp /app/pe-reports/src/pe_reports/data/database.ini "${pe_reports_path}/data/"

exec "$@"

0 comments on commit cbfa8d3

Please sign in to comment.