bedrock/docker-compose.yml

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

137 строки
3.7 KiB
YAML
Исходник Обычный вид История

version: '3.4'
services:
# Run browser-sync and compile static assets.
#
# This is the primary server and it proxies
# the Django app so that it can add the fancy
# browser refresh JS.
assets:
build:
context: .
target: assets
image: mozmeao/bedrock_assets:${GIT_COMMIT:-latest}
platform: linux/amd64
2020-06-01 15:56:19 +03:00
command: npm run watch
ports:
- "8000-8010:8000-8010"
volumes:
- ./media/:/app/media:delegated
- ./bedrock/:/app/bedrock:delegated
2020-06-01 15:56:19 +03:00
- ./assets/:/app/assets:delegated
environment:
BS_PROXY_URL: "app:8080"
# the django app
app:
build:
context: .
target: devapp
image: mozmeao/bedrock_test:${GIT_COMMIT:-latest}
platform: linux/amd64
command: python manage.py runserver 0.0.0.0:8080
env_file: .env
11426: Support separate Mozorg and Pocket modes for Bedrock (#11494) * Refactor Pocket URLConf ahead of making it a first-class URLconf For now, the pages are still available via /externalpages/pocket/ but the URLconf is no longer opinionated about having to have the /externalpages/ namespace in there. This means we can plug it in at the root level when in Pocket-only mode * Add support to package.json for easy use of Pocket mode or Mozorg mode npm run in-mozorg-mode npm run in-pocket-mode * Support running in Mozorg or Pocket modes in dev or prod via Docker, via Makefile commands * Support Mozorg or Pocket mode via env var Setting the SITE_MODE env var to Mozorg or Pocket will now switch the site into serving only the URLs for that particular mode. When in Pocket mode, its pages are served from the root path, not from the 'externalpages' namespace/module name The default behaviour, for now, remains as is: all URLs will be served, and Pocket URLs are served as 'external/pocket/*` * Minor comment shuffle * Flatten externalpages/pocket to just pocket * Make Mozorg the default mode, with Pocket enabled via SITE_MODE env var * Update docs to outline how to invoke Pocket mode * Amend link to infringement reporting to be hard-coded, because can no longer reverse() it * Amend link to bug reporting to be hard-coded, because can no longer reverse() it * Do not use the redirection middleware when in Pocket mode - it clashes with some Pocket URLs * Hard-code a careers listing URL, because can not reverse Mozorg URLs in Pocket mode * Drop redunant Default SITE_MODE from docker config * Disable Pocket integration tests, temporarily * Ensure Pocket mode does not use bedrock.redirects as an INSTALLED_APP * Remove pocket reference from mozorg robots.txt * Add in robots.txt for Pocket mode, based on current state of https://getpocket.com/robots.txt * Revert "Add in robots.txt for Pocket mode, based on current state of https://getpocket.com/robots.txt" This reverts commit 5934b4d613eb3e2b975b3d1c7550998eae19f94f. * Remove straggling markup from diff resolution
2022-04-27 15:59:19 +03:00
environment:
SITE_MODE: "${SITE_MODE:-Mozorg}"
ports:
- "8080:8080"
volumes:
- ./bedrock/:/app/bedrock:delegated
- ./bin/:/app/bin:delegated
- ./docker/:/app/docker:delegated
- ./etc/:/app/etc:delegated
- ./lib/:/app/lib:delegated
- ./docs/:/app/docs:delegated
- ./media/:/app/media:delegated
- ./root_files/:/app/root_files:delegated
- ./scripts/:/app/scripts:delegated
- ./wsgi/:/app/wsgi:delegated
- ./locale/:/app/locale:delegated
- ./l10n/:/app/l10n:delegated
2020-06-01 15:56:19 +03:00
- ./assets/:/app/assets:delegated
# run the tests against local changes
test:
image: mozmeao/bedrock_test:${GIT_COMMIT:-latest}
env_file: docker/envfiles/test.env
volumes:
- ./bedrock/:/app/bedrock:delegated
- ./bin/:/app/bin:delegated
- ./docker/:/app/docker:delegated
- ./etc/:/app/etc:delegated
- ./lib/:/app/lib:delegated
- ./media/:/app/media:delegated
- ./root_files/:/app/root_files:delegated
- ./scripts/:/app/scripts:delegated
- ./tests/:/app/tests:delegated
- ./test_infra/:/app/test_infra:delegated
- ./wsgi/:/app/wsgi:delegated
- ./l10n/:/app/l10n:delegated
# run tests with no volumes
test-image:
image: mozmeao/bedrock_test:${GIT_COMMIT:-latest}
env_file: docker/envfiles/test.env
# the django app
release:
build:
context: .
target: release
args:
GIT_SHA: ${GIT_COMMIT:-latest}
image: mozmeao/bedrock:${GIT_COMMIT:-latest}
platform: linux/amd64
release-local:
image: mozmeao/bedrock:${GIT_COMMIT:-latest}
env_file: .env
environment:
RUN_SUPERVISOR: "true"
11426: Support separate Mozorg and Pocket modes for Bedrock (#11494) * Refactor Pocket URLConf ahead of making it a first-class URLconf For now, the pages are still available via /externalpages/pocket/ but the URLconf is no longer opinionated about having to have the /externalpages/ namespace in there. This means we can plug it in at the root level when in Pocket-only mode * Add support to package.json for easy use of Pocket mode or Mozorg mode npm run in-mozorg-mode npm run in-pocket-mode * Support running in Mozorg or Pocket modes in dev or prod via Docker, via Makefile commands * Support Mozorg or Pocket mode via env var Setting the SITE_MODE env var to Mozorg or Pocket will now switch the site into serving only the URLs for that particular mode. When in Pocket mode, its pages are served from the root path, not from the 'externalpages' namespace/module name The default behaviour, for now, remains as is: all URLs will be served, and Pocket URLs are served as 'external/pocket/*` * Minor comment shuffle * Flatten externalpages/pocket to just pocket * Make Mozorg the default mode, with Pocket enabled via SITE_MODE env var * Update docs to outline how to invoke Pocket mode * Amend link to infringement reporting to be hard-coded, because can no longer reverse() it * Amend link to bug reporting to be hard-coded, because can no longer reverse() it * Do not use the redirection middleware when in Pocket mode - it clashes with some Pocket URLs * Hard-code a careers listing URL, because can not reverse Mozorg URLs in Pocket mode * Drop redunant Default SITE_MODE from docker config * Disable Pocket integration tests, temporarily * Ensure Pocket mode does not use bedrock.redirects as an INSTALLED_APP * Remove pocket reference from mozorg robots.txt * Add in robots.txt for Pocket mode, based on current state of https://getpocket.com/robots.txt * Revert "Add in robots.txt for Pocket mode, based on current state of https://getpocket.com/robots.txt" This reverts commit 5934b4d613eb3e2b975b3d1c7550998eae19f94f. * Remove straggling markup from diff resolution
2022-04-27 15:59:19 +03:00
SITE_MODE: "${SITE_MODE:-Mozorg}"
ports:
- "8000:8000"
volumes:
- ./bedrock/:/app/bedrock:delegated
- ./bin/:/app/bin:delegated
- ./docker/:/app/docker:delegated
- ./etc/:/app/etc:delegated
- ./lib/:/app/lib:delegated
- ./root_files/:/app/root_files:delegated
- ./scripts/:/app/scripts:delegated
- ./wsgi/:/app/wsgi:delegated
- ./locale/:/app/locale:delegated
- ./l10n/:/app/l10n:delegated
docs:
image: mozmeao/bedrock_test:${GIT_COMMIT:-latest}
platform: linux/amd64
command: sphinx-autobuild "docs" "docs/_build/html" --host 0.0.0.0 --port 8100
ports:
- "8100:8100"
volumes:
- ./docs/:/app/docs:delegated
builder:
build:
context: .
target: python-builder
image: mozmeao/bedrock_build:${GIT_COMMIT:-latest}
platform: linux/amd64
app-base:
build:
context: .
target: app-base
image: mozmeao/bedrock_code:${GIT_COMMIT:-latest}
platform: linux/amd64
Upgrade Bedrock to Python 3.9 and update dependency management tooling (#11176) * Move Bedrock to pip-compile-multi for easier Python dependency management This changeset adds tooling to ease dependency management and also rationalises our requirements files. Before, we were just using hashin to manually hash pinned deps straight into a requirements file Now we're using pip-compile-multi, which sits on top of pip-tools to do this. We now get: * Simpler syntax for adding and pinning dependencies via *.in files * Automatic hash generation when the *.txt requirements files are produced The dependency compilation/update tooling runs in a Docker container, so will be compatible with the deployed service's containers. We're also rationalising the existing split of dependency files: * base -> being retired and used as the basis for prod requirements * migration -> being retired and the two deps still useful to us (for moz-l10n-lint) added to dev deps * dev -> now extends from the prod requirements. We're not too concerned about image size for dev and test builds * prod -> still exists, but includes the base deps * docs -> still exists as a standalone file, but also follows the "*.in"-file pattern * Regenerate dependency files using pip-compile-multi Note that to avoid clashes, the following balances were made: * Keep meinheld at the lower version used in prod.txt, not the dev.txt one -- for now at least * Downgrade Markdown to 3.3 to avoid a clash over importlib-metadata version * Remove importlib-metadata==4.10.1 altogether as a hard pin and let pip-compile-multi work out the best fit * Update docs to reference pip-compile-multi, replacing now-redundant notes on hashin * Update Dockerfile to copy over and use freshly recut dependency files * Attempting to tune deps to allow local builds to work, not just Docker ones * Update pip-compile-multi config to inject a custom header that explains how to rebuild reqs * Update Bedrock to use Python 3.9 * Update base images * Update CI * Update dependencies to make install run -- this involved manually using hashin to upgrade two hashed deps (greenlet and meinheld) then re-running make compile-requirements to update the top-level hash in prod.txt. It's a bit of a chicken-and-egg situation when the deps are built/re-locked in a container but you can't build the container itself unless the deps are viable, but it worked * Upgrade everett in order to remove configobj, which is redundant and causing local install issues on MacOS M1 * Drop backports.cached-property and typed-ast from dev reqs because we don't need them on 3.9 * Update docs with local-installation guidance for pyenv and pyenv-virtualenv * Remove 'upgrade requirements' option Given that the --upgrade flag is implicitly / by-default true with pip-compile-multi anyway, plus the fact we're hard-pininng everything, there's no point having an explicit 'upgrade' path - so let's remove it * Docs tweak to suggest simpler virtualenv name * Update help option in Makefile * Pin version of pip in the compile-requirements script When unpinned, the build suddenly broke, so we're keeping it under strict limits for now * Upgrade Django to 2.2.27 * Upgrade newrelic package to latest, incl py3.9 support * Switch to Python 3.9 Debian bullseye image, from buster * Rationalise dependency input files to remove over-pinned subdeps When we moved from hand-managed requirements.txt files, we were taking on files that had literally every dependency and thier sub-deps in them. We don't want the input (*.in) files to reference those subdeps, so this changeset tries to thin things out and remove them Note that the diff shows this was successful - there are very few changes to the dependencies being mentioned in the output *.txt files, and the ones that are there are all deliberate changes (eg removing 'pbr') * Drop unused tenacity dep, bump APScheduler and link to a Python 3.9-patched version of mdx-outline * Add --require-hashes option to pip usage in Dockerfile It's implicitly set because the reqs files feature --hash=XXX but better to be explicit * Drop what appear to be redundant top-level dev dependencies regex, pep8 and wcwidth appear to be subdeps that don't need pinning. The others appear to not be in used, based on a search of the codebase. Tests till pass * Thin out some unnecessary top-level deps in prod.in - funcsigs - old backport, redundant - lxml - over-pinned subdep of BeautifulSoup? - typing_extensions - over-pinned subdep - zipp - over-pinned subdep * Cap pip version to 21 for pip-compile-multi for now * Reinstate lxml as a first-class dep: BeautifulSoup needs it as a user-specified parser * Fix typo in pip-compile-multi header * Hard-pin latest working combo of pip + pip-tools in compile-requirements.sh * Update docs explaining why we're using 3.9.10 locally
2022-02-08 19:59:17 +03:00
# Python dependency management
compile-requirements:
image: mozmeao/bedrock_build:${GIT_COMMIT:-latest}
platform: linux/amd64
command:
./bin/compile-requirements.sh
volumes:
- .:/app