docker config + elasticsearch

stage8
Slava 9 years ago
parent 70a6d2605f
commit e9fb64a2ef
  1. 1
      .gitignore
  2. 35
      Dockerfile
  3. 5
      README.md
  4. 56
      docker-compose.yml
  5. 28
      proj/settings.py
  6. 1
      requirements.txt

1
.gitignore vendored

@ -18,3 +18,4 @@ collected_static
# gulp # gulp
node_modules node_modules
npm-debug.log npm-debug.log
data

@ -0,0 +1,35 @@
FROM python:2.7.13
ENV PYTHONUNBUFFERED 1
ENV LANG ru_RU.UTF-8
RUN apt-get update \
\
&& DEBIAN_FRONTEND=noninteractive apt-get install -y \
\
build-essential \
libtiff5-dev \
libjpeg62-turbo-dev \
zlib1g-dev \
libfreetype6-dev \
liblcms2-dev \
libwebp-dev \
tcl8.5-dev \
tk8.5-dev \
python-tk \
pngquant \
gifsicle \
libmemcached-dev \
locales \
\
&& rm -rf /var/lib/apt/lists/*
RUN sed -i -e 's/# ru_RU.UTF-8 UTF-8/ru_RU.UTF-8 UTF-8/' /etc/locale.gen && \
echo 'LANG="ru_RU.UTF-8"'>/etc/default/locale && \
dpkg-reconfigure --frontend=noninteractive locales && \
update-locale LANG=ru_RU.UTF-8
RUN mkdir /code
WORKDIR /code
ADD requirements.txt /code/
RUN pip install -r requirements.txt
ADD . /code/
# docker rmi $(docker images -q -f dangling=true)

@ -22,9 +22,6 @@ RAVEN_CONFIG = {
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from settings import * from settings import *
DEBUG = True
# emencia.django.newsletter
LOCAL_DEV = True
# sorl.thumbnail # sorl.thumbnail
THUMBNAIL_DEBUG = True THUMBNAIL_DEBUG = True
@ -56,8 +53,6 @@ TEMPLATE_LOADERS = (
'django.template.loaders.app_directories.Loader', 'django.template.loaders.app_directories.Loader',
) )
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
INSTALLED_APPS += ('south',) INSTALLED_APPS += ('south',)
# debug_toolbar settings # debug_toolbar settings

@ -0,0 +1,56 @@
version: '2'
services:
web:
restart: always
container_name: exmap-web
build: .
command: /bin/bash -c "python manage.py runserver 0.0.0.0:8000"
volumes:
- .:/code
ports:
- "8000:8000"
links:
- mysql:exmap-mysql
- redis:exmap-redis
- elastic:exmap-elastic
environment:
- DEBUG=True
- LOCAL_DEV=True
- REDIS_HOST=redis
- REDIS_PORT=6379
- MYSQL_HOST=mysql
- MYSQL_USER=root
- MYSQL_PASSWORD=root
- MYSQL_DATABASE=expomap
- ELASTICSEARCH_HOST=elastic
- EMAIL_BACKEND=django.core.mail.backends.console.EmailBackend
mysql:
restart: always
image: mysql:5.5.57
container_name: exmap-mysql
environment:
- MYSQL_ROOT_PASSWORD=root
- MYSQL_DATABASE=expomap
ports:
- "3305:3306"
volumes:
- ./data/mysql/db:/var/lib/mysql
redis:
restart: always
image: redis:3.2.10
container_name: exmap-redis
volumes:
- ./data/redis:/var/lib/redis
elastic:
restart: always
image: elasticsearch:2.4.6
container_name: exmap-elastic
ports:
- 9200:9200
- 9300:9300
volumes:
- ./data/elasticsearch:/usr/share/elasticsearch/data

@ -14,7 +14,11 @@ SITE_ROOT = os.path.split(os.path.dirname(os.path.realpath(__file__)))[0]
# Adding modules directory to python path # Adding modules directory to python path
sys.path.insert(0, os.path.join(SITE_ROOT, 'apps')) sys.path.insert(0, os.path.join(SITE_ROOT, 'apps'))
DEBUG = True DEBUG = False
if os.environ.get('DEBUG') == 'True':
DEBUG = True
LOCAL_DEV = os.environ.get('DEBUG', False)
ADMINS = ( ADMINS = (
@ -26,10 +30,10 @@ MANAGERS = ADMINS
DATABASES = { DATABASES = {
'default': { 'default': {
'ENGINE': 'django.db.backends.mysql', 'ENGINE': 'django.db.backends.mysql',
'NAME': 'expomap', 'NAME': os.environ.get('MYSQL_DATABASE'),
'USER': 'kotzilla', 'USER': os.environ.get('MYSQL_USER'),
'PASSWORD': 'qazedc', 'PASSWORD': os.environ.get('MYSQL_PASSWORD'),
'HOST': '', 'HOST': os.environ.get('MYSQL_HOST'),
'PORT': '', 'PORT': '',
'TEST_CHARSET': 'utf8', 'TEST_CHARSET': 'utf8',
} }
@ -39,7 +43,7 @@ DATABASES = {
CACHES = { CACHES = {
"default": { "default": {
"BACKEND": "redis_cache.RedisCache", "BACKEND": "redis_cache.RedisCache",
"LOCATION": "localhost:6379", "LOCATION": "%s:%s" % (os.environ.get('REDIS_HOST'), os.environ.get('REDIS_PORT')),
'OPTIONS': { 'OPTIONS': {
'CLIENT_CLASS': 'redis_cache.client.DefaultClient', 'CLIENT_CLASS': 'redis_cache.client.DefaultClient',
} }
@ -224,7 +228,9 @@ LOGIN_URL='/'
#registration info #registration info
ACCOUNT_ACTIVATION_DAYS=2 ACCOUNT_ACTIVATION_DAYS=2
# mail settings # mail settings
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' EMAIL_BACKEND = os.environ.get(
'EMAIL_BACKEND', 'django.core.mail.backends.smtp.EmailBackend'
)
EMAIL_HOST = 'mail.expomap.ru' EMAIL_HOST = 'mail.expomap.ru'
EMAIL_HOST_USER = 'noreply@expomap.ru' EMAIL_HOST_USER = 'noreply@expomap.ru'
EMAIL_HOST_PASSWORD = 'Very$tr0ngPa$$word' EMAIL_HOST_PASSWORD = 'Very$tr0ngPa$$word'
@ -433,8 +439,9 @@ PYMORPHY_DICTS = {
# search backend # search backend
HAYSTACK_CONNECTIONS = { HAYSTACK_CONNECTIONS = {
'default': { 'default': {
'ENGINE': 'haystack.backends.solr_backend.SolrEngine', 'ENGINE': 'haystack.backends.elasticsearch_backend.ElasticsearchSearchEngine',
'URL': 'http://localhost:8983/solr' 'URL': 'http://%s:9200/' % os.environ.get('ELASTICSEARCH_HOST'),
'INDEX_NAME': 'haystack',
}, },
} }
@ -504,6 +511,9 @@ RECAPTCHA_PUBLIC_KEY = '6LffshgUAAAAALQSBrZusJgfqNsREZbiL9ZT4Jlv'
RECAPTCHA_PRIVATE_KEY = '6LffshgUAAAAAF7zZnMbONB36CmOueKKD097UvMg' RECAPTCHA_PRIVATE_KEY = '6LffshgUAAAAAF7zZnMbONB36CmOueKKD097UvMg'
NOCAPTCHA = True NOCAPTCHA = True
if not os.path.exists(MEDIA_ROOT + '/upload'):
os.makedirs(MEDIA_ROOT + '/upload')
try: try:
from proj.local import * from proj.local import *
except ImportError, e: except ImportError, e:

@ -39,6 +39,7 @@ pandas==0.19.2
phonenumbers==6.0.0 phonenumbers==6.0.0
Pillow==3.4.2 Pillow==3.4.2
polib==1.0.8 polib==1.0.8
pyelasticsearch==1.4
pylibmc==1.2.3 pylibmc==1.2.3
pymorphy==0.5.6 pymorphy==0.5.6
pymorphy2==0.8 pymorphy2==0.8

Loading…
Cancel
Save