Skip to content

Commit

Permalink
Fix wsgi tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rycus86 committed Oct 26, 2023
1 parent e38821c commit 447ba87
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
16 changes: 10 additions & 6 deletions examples/wsgi/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,19 @@ FROM httpd

RUN apt-get update \
&& apt-get install --no-install-recommends -y \
python3 python3-dev python3-setuptools python3-pip \
libapr1-dev libaprutil1-dev gcc \
&& pip install mod_wsgi
python3 python3-dev python3-pip python3-venv \
libapr1-dev libaprutil1-dev gcc

ADD examples/wsgi/requirements.txt /tmp/requirements.txt
RUN pip install -r /tmp/requirements.txt
WORKDIR /usr/local/apache2

ADD examples/wsgi/requirements.txt /tmp/requirements.txt
ADD . /tmp/latest
RUN pip install -e /tmp/latest --upgrade

RUN python3 -m venv venv \
&& . venv/bin/activate \
&& pip install mod_wsgi \
&& pip install -r /tmp/requirements.txt \
&& pip install -e /tmp/latest --upgrade

ADD examples/wsgi/httpd.conf /usr/local/apache2/conf/httpd.conf
ADD examples/wsgi/app.py examples/wsgi/wsgi.py /var/flask/
4 changes: 2 additions & 2 deletions examples/wsgi/httpd.conf
Original file line number Diff line number Diff line change
Expand Up @@ -546,8 +546,8 @@ SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>

LoadModule wsgi_module "/usr/local/lib/python3.9/dist-packages/mod_wsgi/server/mod_wsgi-py39.cpython-39-x86_64-linux-gnu.so"
WSGIPythonHome "/usr"
LoadModule wsgi_module "/usr/local/apache2/venv/lib/python3.11/site-packages/mod_wsgi/server/mod_wsgi-py311.cpython-311-x86_64-linux-gnu.so"
WSGIPythonHome "/usr/local/apache2/venv"

WSGISocketPrefix /var/run/wsgi

Expand Down
4 changes: 2 additions & 2 deletions examples/wsgi/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ _fail() {
exit 1
}

docker build -f Dockerfile -t wsgi-sample ../../. > /dev/null || _fail
docker build --platform linux/amd64 -f Dockerfile -t wsgi-sample ../../. > /dev/null || _fail
docker run -d --name wsgi-sample -p 8889:80 wsgi-sample > /dev/null || _fail

echo 'Waiting for the server to start...'

for _ in $(seq 1 10); do
if curl -fs http://localhost:8889/ping > /dev/null; then
if curl --max-time 1 -fs http://localhost:8889/ping > /dev/null; then
break
else
sleep 0.2
Expand Down

0 comments on commit 447ba87

Please sign in to comment.