WIP: Docker updates #13

Draft
mravi wants to merge 19 commits from docker into master
11 changed files with 146 additions and 57 deletions

1
.gitignore vendored
View file

@ -15,6 +15,7 @@ media/
!media/keep
/CACHE/
/static/
/venv/
\#*#
.\#*

View file

@ -1,6 +1,8 @@
FROM python:3.10.0-alpine3.15
FROM python:3.7-alpine3.15
WORKDIR /usr/src/app
WORKDIR /app
COPY . /app/
RUN apk add --update --no-cache \
git \
@ -8,11 +10,35 @@ RUN apk add --update --no-cache \
openldap-dev \
python3-dev \
libpq-dev \
libjpeg \
libmemcached-dev \
libxml2-dev \
libxslt-dev \
zlib \
jpeg-dev \
zlib-dev \
&& rm -rf /var/cache/apk/*
# FIX https://github.com/python-ldap/python-ldap/issues/432
RUN echo 'INPUT ( libldap.so )' > /usr/lib/libldap_r.so
COPY requirements.txt ./
#RUN LIBRARY_PATH=/lib:/usr/lib /bin/sh -c "pip install --no-cache-dir -r requirements.txt"
# Create a virtual environment
RUN python3 -m venv /venv
ENV PATH="/venv/bin:$PATH"
RUN pip install --no-cache-dir --upgrade pip
#RUN CFLAGS="-Wno-cpp -Wno-unused-function -Wno-unused-variable -Wno-missing-noreturn -I/usr/include/libxml2" pip install lxml
RUN pip install --no-cache-dir -r requirements.txt
COPY ./ .
# Copy entrypoint.sh script and grant execute permissions
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
# Run migrations and start the server
ENTRYPOINT ["/entrypoint.sh"]

View file

@ -9,7 +9,7 @@ from django.core.urlresolvers import reverse
from django.utils import translation
from django.utils.translation import ugettext_lazy as _
from dynamicweb.celery import app
from dynamicweb.pr_celery import app
from hosting.models import HostingOrder
from membership.models import CustomUser
from opennebula_api.models import OpenNebulaManager

42
docker-compose.yml Normal file
View file

@ -0,0 +1,42 @@
version: '3'
services:
# Django app service
web:
build:
context: .
dockerfile: Dockerfile
container_name: dynamicweb
command: python manage.py runserver 0.0.0.0:8000
volumes:
- .:/app
ports:
- "8000:8000"
depends_on:
- db
# PostgreSQL database service
db:
image: postgres:13
container_name: my_postgres_db
environment:
POSTGRES_USER: your_postgres_username
POSTGRES_PASSWORD: your_postgres_password
POSTGRES_DB: your_database_name
volumes:
- postgres_data:/var/lib/postgresql/data
# Nginx service
nginx:
image: nginx:latest
container_name: my_nginx_server
volumes:
- ./nginx/default.conf:/etc/nginx/conf.d/default.conf
ports:
- "80:80"
depends_on:
- web
volumes:
postgres_data:

View file

@ -1,5 +1,5 @@
# This will make sure the app is always imported when
# Django starts so that shared_task will use this app.
from .celery import app as celery_app
__all__ = ['celery_app']
#from .celery import app as celery_app
#
#__all__ = ['celery_app']

View file

@ -113,7 +113,7 @@ INSTALLED_APPS = (
'aldryn_common',
'aldryn_newsblog',
'aldryn_people',
'aldryn_reversion',
#'aldryn_reversion',
'aldryn_translation_tools',
'treebeard', # utilities for implementing a tree
'sekizai', # for javascript and css management
@ -156,7 +156,7 @@ INSTALLED_APPS = (
'webhook',
)
MIDDLEWARE_CLASSES = (
MIDDLEWARE = (
'django.contrib.sessions.middleware.SessionMiddleware',
'utils.middleware.MultipleProxyMiddleware',
'django.middleware.common.CommonMiddleware',
@ -239,8 +239,12 @@ CMS_TEMPLATES = (
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'app',
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'your_database_name',
'USER': 'your_postgres_username',
'PASSWORD': 'your_postgres_password',
'HOST': 'db',
'PORT': '5432'
}
}

View file

@ -15,7 +15,7 @@ CACHES = {
}
}
MIDDLEWARE_CLASSES += ("debug_toolbar.middleware.DebugToolbarMiddleware",)
MIDDLEWARE += ("debug_toolbar.middleware.DebugToolbarMiddleware",)
INSTALLED_APPS += (
'django_extensions',

15
entrypoint.sh Normal file
View file

@ -0,0 +1,15 @@
#!/bin/sh
# Wait for the database to be available
while ! nc -z db 5432; do
sleep 0.1
done
# Apply database migrations
python manage.py migrate
# Collect static files
python manage.py collectstatic --no-input
# Start the server
python manage.py runserver 0.0.0.0:8000

View file

@ -1,56 +1,57 @@
setuptools<58.0.0
Babel==2.3.4
Django==1.9.4
Django==1.11.18
Django-Select2==4.3.2
Pillow==3.2.0
Pillow==9.5.0
URLObject==2.4.0
Unidecode==0.04.19
Unidecode==1.0.23
YURL==0.13
aldryn-apphooks-config==0.2.7
aldryn-boilerplates==0.7.4
aldryn-categories==1.0.3
aldryn-common==1.0.1
aldryn-newsblog==1.2.1
aldryn-people==1.2.0
aldryn-reversion==1.0.8
#aldryn-apphooks-config==0.2.7
#aldryn-boilerplates==0.7.4
aldryn-categories==1.2.0
aldryn-common==1.0.5
aldryn-newsblog==2.2.1
aldryn-people==2.2.0
#aldryn-reversion==1.0.8
aldryn-search==0.2.11
aldryn-translation-tools==0.2.1
aldryn-translation-tools==0.3.0
backport-collections==0.1
cmsplugin-filer==1.0.1
#cmsplugin-filer==1.1.3
django-appconf==1.0.2
django-appdata==0.1.5
django-appdata==0.2.1
django-bootstrap3==7.0.1
django-classy-tags==0.7.2
django-cms==3.2.5
django-cms==3.6.0
django-compressor==2.0
django-debug-toolbar==1.4
python-dotenv==0.10.3
django-extensions==1.6.7
django-filer==2.1.2
django-filer==1.5.0
django-filter==0.13.0
django-formtools==1.0
django-formtools==2.1
django-guardian==1.4.4
django-haystack==2.4.1
django-meta==1.2
django-meta-mixin==0.3.0
django-model-utils==2.5
django-mptt==0.8.4
django-parler==1.6.3
django-mptt==0.11
django-parler==1.9.2
django-phonenumber-field==1.1.0
django-polymorphic==0.9.2
django-polymorphic==2.0.2
django-reversion==1.10.2
django-sekizai==0.9.0
django-sortedm2m==1.2.2
django-sortedm2m==3.1.1
django-spurl==0.6.4
django-standard-form==1.1.1
django-stored-messages==1.4.0
django-taggit==0.18.3
django-taggit==0.23.0
django-taggit-autosuggest==0.2.8
django-taggit-templatetags==0.2.5
django-templatetag-sugar==1.0
django-treebeard==4.0.1
djangocms-admin-style==1.1.1
django-treebeard==4.3
djangocms-admin-style>=1.2
djangocms-apphook-setup==0.1.2
djangocms-blog==0.9.0
djangocms-blog==0.8.13
djangocms-file==1.0
djangocms-flash==0.3.0
djangocms-googlemap==0.4.0
@ -59,26 +60,25 @@ djangocms-link==1.7.2
djangocms-page-meta==0.5.11
djangocms-picture==1.0.0
djangocms-teaser==0.2.0
djangocms-text-ckeditor==2.9.3
djangocms-text-ckeditor==3.7.0
djangocms-video==1.0.0
easy-thumbnails==2.3
html5lib==0.9999999
easy-thumbnails==2.4.1
html5lib==0.999999999
ldap3==2.6.1
lxml==3.6.0
lxml
model-mommy==1.2.6
phonenumbers==7.4.0
phonenumberslite==7.4.0
psycopg2==2.7.3.2
pycryptodome==3.6.6
pylibmc==1.5.1
phonenumbers==8.13.11
psycopg2==2.8.4
pycryptodome==3.8.0
pylibmc==1.6.3
python-dateutil==2.5.3
python-slugify==1.2.0
pytz==2016.4
python-slugify==1.2.6
pytz>=2023.3
rcssmin==1.0.6
requests==2.10.0
requests>=2.20
rjsmin==1.0.12
six==1.10.0
sqlparse==0.1.19
sqlparse==0.4.4
stripe==2.41.0
wheel==0.29.0
django-admin-honeypot==1.0.0
@ -87,16 +87,17 @@ git+https://github.com/ungleich/python-oca.git#egg=oca
djangorestframework==3.6.3
flake8==3.3.0
python-memcached==1.58
celery==4.0.2
celery==4.4.7
redis==2.10.5
django-celery-results==1.0.1
kombu==4.1.0
django-celery-results==1.0.2
kombu>=4.6.10
mccabe==0.6.1
pycodestyle==2.3.1
pyflakes==1.5.0
billiard==3.5.0.3
amqp==2.2.1
vine==1.1.4
billiard==3.6.4.0
amqp>=2.6.0
vine==1.3.0
cdist==5.0.1
git+https://github.com/ungleich/djangocms-multisite.git#egg=djangocms_multisite
pyotp
importlib_metadata<5

View file

@ -8,7 +8,7 @@ from celery.utils.log import get_task_logger
from django.conf import settings
from django.core.mail import EmailMessage
from dynamicweb.celery import app
from dynamicweb.pr_celery import app
logger = get_task_logger(__name__)