diff --git a/Makefile b/Makefile index 15a04b4..d36e784 100644 --- a/Makefile +++ b/Makefile @@ -41,14 +41,14 @@ run: .docker-build ${DOCKERCOMPOSE} up web shell: .docker-build - ${DOCKERCOMPOSE} run web python3 manage.py shell + ${DOCKERCOMPOSE} run web python manage.py shell restore-db: .docker-build -${DOCKERCOMPOSE} run web dropdb -h db -U postgres -w postgres ${DOCKERCOMPOSE} run web createdb -h db -U postgres -w postgres -${DOCKERCOMPOSE} run web pg_restore -d "postgres://postgres@db/postgres" < ${PG_DUMP_FILE} - ${DOCKERCOMPOSE} run web python3 manage.py migrate --fake-initial - ${DOCKERCOMPOSE} run web python3 manage.py createsuperuser + ${DOCKERCOMPOSE} run web python manage.py migrate --fake-initial + ${DOCKERCOMPOSE} run web python manage.py createsuperuser clean: # python related things @@ -80,7 +80,7 @@ test-image: .docker-build ${DOCKERCOMPOSE} run test-image test-smoketest: .docker-build - ${DOCKERCOMPOSE} run -e SERVER_URL=${SERVER_URL} test python3 tests/smoketest.py + ${DOCKERCOMPOSE} run -e SERVER_URL=${SERVER_URL} test python tests/smoketest.py docs: .docker-build ${DOCKERCOMPOSE} run web $(MAKE) -C docs/ clean diff --git a/bin/phb-manage.sh b/bin/phb-manage.sh index 4da2660..fad69a3 100755 --- a/bin/phb-manage.sh +++ b/bin/phb-manage.sh @@ -17,4 +17,4 @@ export DATABASE_URL=sqlite:// # export AUTH0_DOMAIN=foo # export AUTH0_CALLBACK_URL=foo -python3 manage.py $@ +python manage.py $@ diff --git a/bin/run-common.sh b/bin/run-common.sh index 42c5e97..7a7b910 100755 --- a/bin/run-common.sh +++ b/bin/run-common.sh @@ -3,4 +3,4 @@ # Migrate the db # --fake-initial will fake the migration only if the table # already exists. Needed for the initial migration in prod. -python3 manage.py migrate --noinput --fake-initial +python manage.py migrate --noinput --fake-initial diff --git a/bin/run-dev.sh b/bin/run-dev.sh index fe7c396..3cabf8c 100755 --- a/bin/run-dev.sh +++ b/bin/run-dev.sh @@ -2,4 +2,4 @@ urlwait ./bin/run-common.sh -exec python3 manage.py runserver 0.0.0.0:8000 +exec python manage.py runserver 0.0.0.0:8000 diff --git a/bin/run-supervisor.sh b/bin/run.sh similarity index 67% rename from bin/run-supervisor.sh rename to bin/run.sh index d0d76eb..66c305e 100755 --- a/bin/run-supervisor.sh +++ b/bin/run.sh @@ -2,4 +2,4 @@ export SERVER_MODE="${1:-dev}" export LOG_LEVEL="${LOG_LEVEL:-info}" -exec supervisord -c etc/supervisord.conf +exec "bin/run-${SERVER_MODE}.sh" diff --git a/bin/standup-cmd b/bin/standup-cmd index b3394a6..0d1bbde 100755 --- a/bin/standup-cmd +++ b/bin/standup-cmd @@ -1,4 +1,4 @@ -#!/usr/bin/env python3 +#!/usr/bin/env python """ This is the command-line script for standups. Makes testing easier. diff --git a/docker-compose.yml b/docker-compose.yml index 9448c28..a065b01 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -18,7 +18,7 @@ services: - DEBUG=True - ALLOWED_HOSTS=localhost,127.0.0.1,web - SECRET_KEY=itsasekrit - command: ./bin/run-supervisor.sh dev + command: ./bin/run.sh dev # run the site in a prod-like environment prod: @@ -34,7 +34,7 @@ services: - DEBUG=False - ALLOWED_HOSTS=localhost,127.0.0.1 - SECRET_KEY=itsasekrit - command: ./bin/run-supervisor.sh prod + command: ./bin/run.sh prod # run the tests test: diff --git a/docker/standup_base b/docker/standup_base index 22eb62b..440b930 100644 --- a/docker/standup_base +++ b/docker/standup_base @@ -1,11 +1,8 @@ -FROM quay.io/mozmar/base - -# Set Python-related environment variables to reduce annoying-ness -ENV PYTHONUNBUFFERED=1 -ENV PYTHONDONTWRITEBYTECODE=1 -ENV PIP_DISABLE_PIP_VERSION_CHECK=1 -ENV LANG=C.UTF-8 -ENV PATH=/usr/local/lib/node_modules/standup/node_modules/.bin:$PATH +FROM mozmeao/base:python-3.6-alpine + +RUN apk add --update --no-cache nodejs postgresql-dev + +ENV PATH=/usr/lib/node_modules/standup/node_modules/.bin:$PATH ENV PIPELINE_LESS_BINARY=lessc ENV PIPELINE_UGLIFYJS_BINARY=uglifyjs ENV PIPELINE_CLEANCSS_BINARY=cleancss @@ -14,22 +11,15 @@ ENV PIPELINE_CLEANCSS_BINARY=cleancss ENV DJANGO_SETTINGS_MODULE standup.settings EXPOSE 8000 -CMD ["./bin/run-supervisor.sh", "prod"] +CMD ["./bin/run.sh", "prod"] WORKDIR /app -RUN update-alternatives --install /bin/sh sh /bin/bash 10 - -RUN apt-get update && \ - apt-get install -y --no-install-recommends \ - build-essential python3-{dev,pip,setuptools} libmemcached-dev nodejs-legacy \ - npm gettext libpq-dev postgresql-client supervisor && \ - rm -rf /var/lib/apt/lists/* # First copy requirements.txt so we can take advantage of docker caching. COPY package.json ./ RUN npm install -g COPY requirements.txt ./ -RUN pip3 install --require-hashes --no-cache-dir -r requirements.txt +RUN pip install --require-hashes --no-cache-dir -r requirements.txt COPY . /app diff --git a/docker/standup_dev b/docker/standup_dev index b4eaf81..9430897 100644 --- a/docker/standup_dev +++ b/docker/standup_dev @@ -1,6 +1,6 @@ FROM local/standup_base COPY requirements-dev.txt ./ -RUN pip3 install --require-hashes --no-cache-dir -r requirements-dev.txt +RUN pip install --require-hashes --no-cache-dir -r requirements-dev.txt -CMD ["./bin/run-supervisor.sh", "dev"] +CMD ["./bin/run.sh", "dev"] diff --git a/etc/supervisord.conf b/etc/supervisord.conf deleted file mode 100644 index 512c169..0000000 --- a/etc/supervisord.conf +++ /dev/null @@ -1,13 +0,0 @@ -[supervisord] -nodaemon = true -logfile = /dev/null -pidfile = /dev/null -loglevel = %(ENV_LOG_LEVEL)s - -[program:standup] -command = /app/bin/run-%(ENV_SERVER_MODE)s.sh -numprocs = 1 -autostart = true -redirect_stderr = true -stdout_logfile = /dev/stdout -stdout_logfile_maxbytes = 0 diff --git a/manage.py b/manage.py index a71b4f7..b60e340 100755 --- a/manage.py +++ b/manage.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python3 +#!/usr/bin/env python import os import sys