chaoss / chaoss/grimoirelab-hatstall
Dockerize Hatstall with Gunicorn instead of Apache + mod_wsgi
- Dominant language
- HTML
- Stars
- 11
- Forks
- 16
- PR merge metrics
- No merged PRs in 30d
Description
Current dockerized Hatstall uses Apache to serve content which adds complexity. See:
* installation https://github.com/chaoss/grimoirelab-hatstall/blob/master/docker/stage#L11
* setup https://github.com/chaoss/grimoirelab-hatstall/blob/master/docker/apache-hatstall.conf
Instead of that, the dockerized app could use a lightweight server as Gunicorn which would make the setup easier and the container more efficient in term of resources. We would not need to install the apache dependencies and we could get rid of its setup. That setup would be then managed by the front-end server if needed (it would be needed for production even with the Apache setup).
In order to see how this can be done I've created a minimalist django app which reads a config file named `shdb.cfg`. TheDockerfile looks like this:
```
FROM python:3.6
ENV PYTHONUNBUFFERED 1
RUN mkdir /django
WORKDIR /django
ADD . /django/
RUN pip install -r requirements.txt
COPY start.sh /start.sh
COPY shdb.cfg /shdb.cfg
EXPOSE 8000
RUN python3 /django/helloworld/manage.py migrate
CMD ["/start.sh"]
```
The start script will just launch a gunicorn which will serve the wsgi created by django.
```
#!/bin/bash
# Start Gunicorn processes
echo Starting Gunicorn.
exec gunicorn helloworld.wsgi:application \
--bind 0.0.0.0:8000 \
--workers 3 \
--chdir /django/helloworld
```
The docker-compose would be quite simple. E.g:
```
web-uno:
image: django-hello-world
volumes:
- "/home/luis/Workshop/django/compose/conf1.cfg:/shdb.cfg"
ports:
- "9000:8000"
web-dos:
image: django-hello-world
volumes:
- "/home/luis/Workshop/django/compose/conf2.cfg:/shdb.cfg"
ports:
- "9001:8000"
```
Contributor guide
Research direction
Start by reading docker/stage and docker/apache-hatstall.conf to understand the current Apache installation and setup. Inspect the Docker configuration and Django WSGI entry point, then replace the Apache-based container serving with Gunicorn and remove the Apache dependencies and configuration. Done means the Dockerized app starts and serves content through the new setup.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- apache, django, docker, python
- Domain
- backend, devops, infrastructure
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100