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

Experimental PyPy version of Caluma #518

Closed
wants to merge 1 commit into from
Closed
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
8 changes: 8 additions & 0 deletions caluma/settings.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
import os
import re
import sys

import environ
from django.conf import global_settings

if hasattr(sys, "pypy_version_info"): # pragma: no cover
# in pypy, override psycopg2 with cffi version
from psycopg2cffi import compat

compat.register()


env = environ.Env()
django_root = environ.Path(__file__) - 2

Expand Down
35 changes: 35 additions & 0 deletions pypy/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
FROM pypy:3.6

# pypy image still has /usr/bin/python being cpython, we don't want that
RUN rm /usr/bin/python && cp /usr/local/bin/pypy3 /usr/local/bin/python

WORKDIR /app

RUN wget -q https://raw.githubusercontent.com/vishnubob/wait-for-it/master/wait-for-it.sh -P /usr/local/bin \
&& chmod +x /usr/local/bin/wait-for-it.sh \
&& mkdir -p /app \
&& useradd -u 901 -r caluma --create-home \
# all project specific folders need to be accessible by newly created user but also for unknown users (when UID is set manually). Such users are in group root.
&& chown -R caluma:root /home/caluma \
&& chmod -R 770 /home/caluma

# needs to be set for users with manually set UID
ENV HOME=/home/caluma

ENV PYTHONUNBUFFERED=1
ENV APP_HOME=/app
ENV DJANGO_SETTINGS_MODULE caluma.settings
ENV UWSGI_INI /app/uwsgi.ini

ARG REQUIREMENTS=requirements-pypy.txt
COPY requirements.txt requirements-dev.txt pypy/requirements-pypy.txt $APP_HOME/
RUN pip install --no-cache-dir --upgrade -r $REQUIREMENTS --disable-pip-version-check


USER caluma

COPY . $APP_HOME

EXPOSE 8000

CMD /bin/sh -c "wait-for-it.sh $DATABASE_HOST:${DATABASE_PORT:-5432} -- ./manage.py migrate && uwsgi"
2 changes: 2 additions & 0 deletions pypy/requirements-pypy.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-f requirements.txt
psycopg2cffi==2.8.1