我正在使用
apache2
和 docker
运行一个网络应用程序,
但是当我执行一个长请求时,我总是会收到超时错误。我想编辑 apache2 中的超时选项,以便花费更多时间,我尝试将 docker-compose
添加到 TimeOut 2400
文件但仍然无法正常工作。这是项目结构的样子:
demo_site.conf
docker-compose.yaml
-www
-docker-compose.yaml
-Dockerfile
-website.conf
version: "2"
services:
db:
image: postgres:14
restart: always
volumes:
- ./data/db:/var/lib/postgresql/data
- ./www/:/var/www/html
- ./www/demo_app/kml_files:/var/www/html/demo_app/kml_files
- ./www/demo_app/temp_kml_file:/var/www/html/demo_app/temp_kml_file
- ./www/demo_app/upload:/var/www/html/demo_app/upload
- ./data/log:/var/log/apache2
ports:
- '5432:5432'
environment:
- POSTGRES_DB=qweqwe
- POSTGRES_USER=qweqwe
- POSTGRES_PASSWORD=qwewqe
django-apache2:
build: .
container_name: water_maps
restart: always
environment:
- POSTGRES_DB=qwewqe
- POSTGRES_USER=qwewqe
- POSTGRES_PASSWORD=qwewqe
ports:
- 4000:80
- 4001:443
volumes:
- ./www/:/var/www/html
- ./www/demo_app/kml_files:/var/www/html/demo_app/kml_files
- ./www/demo_app/temp_kml_file:/var/www/html/demo_app/temp_kml_file
- ./www/demo_app/upload:/var/www/html/demo_app/upload
- ./data/log:/var/log/apache2
# - ./data/config/etc/apache2:/etc/apache2
# command: sh -c 'python manage.py migrate && python manage.py loaddata the_db.json '
command: sh -c 'wait-for-it db:5432 -- python manage.py makemigrations && python manage.py migrate && python manage.py collectstatic --noinput &&python manage.py compilemessages && apache2ctl -D FOREGROUND'
# command: sh -c 'wait-for-it db:5432 -- python manage.py migrate && python manage.py loaddata last.json && apache2ctl -D FOREGROUND'
depends_on:
- db
FROM ubuntu
RUN apt-get update
# Avoid tzdata infinite waiting bug
ARG DEBIAN_FRONTEND=noninteractive
ENV TZ=Africa/Cairo
RUN apt clean
RUN apt-get install -y apt-utils vim curl apache2 apache2-utils
RUN apt-get -y install python3 libapache2-mod-wsgi-py3
RUN apt -y install certbot python3-certbot-apache
RUN ln /usr/bin/python3 /usr/bin/python
RUN apt-get -y install python3-pip
RUN apt -y install software-properties-common
RUN add-apt-repository universe
RUN apt update
#Add sf to avoid ln: failed to create hard link '/usr/bin/pip': File exists
RUN ln -sf /usr/bin/pip3 /usr/bin/pip
RUN pip install --upgrade pip
RUN pip install django ptvsd
RUN apt install wait-for-it
RUN apt-get -y install gettext
RUN apt-get -y install poppler-utils
RUN a2enmod headers
RUN service apache2 restart
COPY www/demo_app/water_maps/requirements.txt requirements.txt
RUN pip install -r requirements.txt
ADD ./demo_site.conf /etc/apache2/sites-available/000-default.conf
EXPOSE 80 5432
WORKDIR /var/www/html/demo_app
#CMD ["apache2ctl", "-D", "FOREGROUND"]
#CMD ["python", "manage.py", "migrate", "--no-input"]