Use docker-compose restart instead of supervisorctl.

* Make also use of setting PYTHONDONTWRITEBYTECODE inside the docker
  image to reduce it's size considerably
* Remove some outdated code-parts
* Rename `olympia` inside our worker image to `olympia-worker`
* remove all build and cache folders after every `make update_deps`
  (which might help avoid any more package update/install ambiquities)

Fixes #7518
This commit is contained in:
Christopher Grebs 2018-02-19 17:07:34 +01:00
Родитель 53aebc3db3
Коммит 07dee02dde
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: D7BCDE311BFC58DD
6 изменённых файлов: 9 добавлений и 12 удалений

Просмотреть файл

@ -1,5 +1,7 @@
FROM python:2.7.14-slim-stretch
ENV PYTHONDONTWRITEBYTECODE=1
# Allow scripts to detect we're running in our own container
RUN touch /addons-server-docker-container
@ -8,13 +10,9 @@ ADD docker/nodesource.gpg.key /etc/pki/gpg/GPG-KEY-nodesource
RUN apt-get update && apt-get install -y \
gnupg2 \
&& rm -rf /var/lib/apt/lists/*
# ADD docker/nodesource.repo /etc/yum.repos.d/nodesource.repo
RUN cat /etc/pki/gpg/GPG-KEY-nodesource | apt-key add -
ADD docker/debian-stretch-nodesource-repo /etc/apt/sources.list.d/nodesource.list
# For git dependencies
# ADD docker/git.repo /etc/yum.repos.d/git.repo
# Upgrade git
RUN apt-get update && apt-get install -y \
# General (dev-) dependencies
@ -64,8 +62,7 @@ ENV SWIG_FEATURES="-D__x86_64__"
# Install all python requires
RUN mkdir -p /deps/{build,cache,src}/ && \
ln -s /code/package.json /deps/package.json && \
make update_deps && \
rm -r /deps/build/ /deps/cache/
make update_deps
# Preserve bash history across image updates.
# This works best when you link your local source code

Просмотреть файл

@ -13,7 +13,6 @@ ADD docker/nodesource.gpg.key /etc/pki/gpg/GPG-KEY-nodesource
RUN apt-get update && apt-get install -y \
gnupg2 \
&& rm -rf /var/lib/apt/lists/*
# ADD docker/nodesource.repo /etc/yum.repos.d/nodesource.repo
RUN cat /etc/pki/gpg/GPG-KEY-nodesource | apt-key add -
ADD docker/debian-stretch-nodesource-repo /etc/apt/sources.list.d/nodesource.list

Просмотреть файл

@ -111,6 +111,7 @@ copy_node_js:
for dest in $(NODE_LIBS_JQUERY_UI) ; do cp $(NODE_MODULES)$$dest $(STATIC_JQUERY_UI) ; done
update_deps: install_python_dependencies install_node_dependencies
rm -rf /deps/build/ /deps/cache/
update_db:
schematic src/olympia/migrations

Просмотреть файл

@ -40,8 +40,8 @@ test_failed:
update_docker:
docker-compose exec worker make update_deps
docker-compose exec web make update
docker-compose exec web supervisorctl restart all
docker-compose exec worker supervisorctl restart all
docker-compose restart web
docker-compose restart worker
initialize_docker:
docker-compose exec web make initialize

Просмотреть файл

@ -94,9 +94,9 @@ jobs:
docker-compose ps
# Make sure dependencies get updated in worker and web container
docker-compose exec worker make -f Makefile-docker update_deps
docker-compose exec worker supervisorctl restart all
docker-compose restart worker
docker-compose exec web make -f Makefile-docker update_deps
docker-compose exec web supervisorctl restart all
docker-compose restart web
# Start Test in Firefox docker container
docker-compose exec --user root selenium-firefox tox -e ui-tests
- store_artifacts:

Просмотреть файл

@ -1,7 +1,7 @@
[supervisord]
logfile=/code/logs/supervisord-celery.log
[program:olympia]
[program:olympia-worker]
# This command mimics how we run it in prod from puppet:
# https://github.com/mozilla-services/puppet-config/blob/master/amo/modules/olympia/manifests/celery.pp#L16-L24
# https://github.com/mozilla-services/puppet-config/blob/master/amo/modules/celery/manifests/service.pp#L20