Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove updating of etag and lastmod data #13

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
4 changes: 1 addition & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
FROM mozmeao/bedrock:prod-latest
USER root
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
COPY settings_local.py bedrock/settings/local.py
COPY update_etags.py sitemap_utils.py bin/run-generator.sh ./
COPY update_sitemap_json.py sitemap_utils.py bin/run-generator.sh ./
ARG USER_ID=1000:1000
ENV USER_ID=${USER_ID}
RUN chown -R "${USER_ID}" /app
Expand Down
10 changes: 1 addition & 9 deletions bin/run-generator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,4 @@ set -ex
bin/run-db-download.py
python manage.py l10n_update
python manage.py update_sitemaps
sed -i -E -e 's|<html class="windows x86 no-js".+>|<html class="windows x86 no-js">|' bedrock/base/templates/base-protocol.html
# needed for app to start
touch data/last-run-update_locales data/last-run-download_database
# turn off mutable static files storage
cat bedrock/settings/local.py >> bedrock/settings/__init__.py
bin/run-prod.sh > /dev/null &
urlwait http://localhost:8000 60
sleep 2
python update_etags.py
python update_sitemap_json.py
1 change: 0 additions & 1 deletion requirements.in

This file was deleted.

10 changes: 0 additions & 10 deletions requirements.txt

This file was deleted.

142 changes: 0 additions & 142 deletions update_etags.py

This file was deleted.

28 changes: 28 additions & 0 deletions update_sitemap_json.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env python

import json
import sys

from sitemap_utils import (
DATA_PATH,
load_current_sitemap,
)


SITEMAP_OUT_FILE = DATA_PATH.joinpath("sitemap.json")


def write_sitemap_json(sitemap):
"""Write the sorted sitemap.json file to the repo for use in bedrock"""
sorted_sitemap = {url: sorted(locales) for url, locales in sitemap.items()}
with SITEMAP_OUT_FILE.open("w") as fh:
json.dump(sorted_sitemap, fh, sort_keys=True, indent=2)


def main():
sitemap = load_current_sitemap()
write_sitemap_json(sitemap)


if __name__ == "__main__":
sys.exit(main())