feature/docker
Dmitriy Shesterkin 9 years ago
parent ed2a36599d
commit 7e840cc3bd
  1. 8
      .dockerignore
  2. 58
      .editorconfig
  3. 6
      .gitignore
  4. 0
      DockerMakefile
  5. 10
      bin/loaddata.sh
  6. 7
      compose/Dockerfile.celery.local
  7. 7
      compose/Dockerfile.celery.production
  8. 8
      compose/Dockerfile.web.local
  9. 8
      compose/Dockerfile.web.production
  10. 61
      docker-compose.yml
  11. 2
      requirements/base.txt
  12. 3
      requirements/prodaction.txt
  13. 2
      requirements/production.txt
  14. 1
      requirements/staging.txt
  15. 6
      src/dokumentor/settings/base.py
  16. 2
      src/dokumentor/templates/base.html
  17. 0
      var/log/.gitkeep

@ -0,0 +1,8 @@
env
compose
public
node_modules
bower_components
tmp_emails
tmp
var

@ -0,0 +1,58 @@
# EditorConfig is awesome: http://EditorConfig.org
# Howto with your editor: http://editorconfig.org/#download
# Sublime: https://github.com/sindresorhus/editorconfig-sublime
# top-most EditorConfig file
root = true
# Unix-style newlines with a newline ending every file
[**]
end_of_line = lf
insert_final_newline = true
# Standard at: https://github.com/felixge/node-style-guide
[**.{js,json}]
trim_trailing_whitespace = true
indent_style = space
indent_size = 2
quote_type = single
curly_bracket_next_line = false
spaces_around_operators = true
space_after_control_statements = true
space_after_anonymous_functions = true
spaces_in_brackets = false
# No Standard. Please document a standard if different from .js
[**.{yml,css}]
trim_trailing_whitespace = true
indent_style = tab
[**.html]
trim_trailing_whitespace = true
indent_style = space
indent_size = 2
# No standard. Please document a standard if different from .js
[**.md]
indent_style = tab
[**.py]
indent_style = space
indent_size = 4
trim_trailing_whitespace = true
# Standard at:
[Makefile]
indent_style = tab
[**.yml]
trim_trailing_whitespace = true
indent_style = space
indent_size = 2
# The indentation in package.json will always need to be 2 spaces
# https://github.com/npm/npm/issues/4718
[{package, bower}.json]
indent_style = space
indent_size = 2

6
.gitignore vendored

@ -18,4 +18,10 @@ yandex_money.log
/src/dokumentor/media/
/tmp/
/conf/env
/data/
/public/
!parts
!.gitkeep

@ -0,0 +1,10 @@
#!/usr/bin/env bash
python src/manage.py loaddata src/myauth/fixtures/myauth.json
python src/manage.py loaddata src/commons/fixtures/cms.json
python src/manage.py loaddata src/commons/fixtures/djangocms_text_ckeditor.json
python src/manage.py loaddata src/commons/fixtures/sites.json
python src/manage.py loaddata src/customer/fixtures/price.json
python src/manage.py loaddata src/docs/fixtures/country.json
python src/manage.py loaddata src/docs/fixtures/currency.json
python src/manage.py loaddata src/docs/fixtures/measure.json

@ -0,0 +1,7 @@
FROM python:3.6
ENV PYTHONUNBUFFERED 1
RUN mkdir -p /code/public/
WORKDIR /code/src
COPY requirements /code/requirements
RUN pip install --upgrade pip && pip install -r ../requirements/local.txt
ADD . /code/

@ -0,0 +1,7 @@
FROM python:3.6
ENV PYTHONUNBUFFERED 1
RUN mkdir -p /code/public/
WORKDIR /code/src
COPY requirements /code/requirements
RUN pip install --upgrade pip && pip install -r ../requirements/production.txt
ADD . /code/

@ -0,0 +1,8 @@
FROM python:3.6
ENV PYTHONUNBUFFERED 1
RUN mkdir -p /code/public/
WORKDIR /code
COPY requirements /code/requirements
RUN apt-get update && apt-get -y install ghostscript && apt-get clean
RUN pip install --upgrade pip && pip install -r requirements/local.txt
ADD . /code/

@ -0,0 +1,8 @@
FROM python:3.6
ENV PYTHONUNBUFFERED 1
RUN mkdir -p /code/public/
WORKDIR /code
COPY requirements /code/requirements
RUN apt-get update && apt-get -y install ghostscript && apt-get clean
RUN pip install --upgrade pip && pip install -r requirements/production.txt
ADD . /code/

@ -0,0 +1,61 @@
version: '2'
services:
db:
restart: always
image: postgres
container_name: db
environment:
POSTGRES_USER: 'dokumentor'
POSTGRES_PASSWORD: 'dokumentor'
volumes:
- ./data:/var/lib/postgresql/data
rabbitmq:
restart: always
container_name: rabbitmq
image: rabbitmq:latest
environment:
- RABBITMQ_DEFAULT_USER=dokumentor
- RABBITMQ_DEFAULT_PASS=dokumentor
ports:
- "8080:15672"
- "5672:5672"
- "5671:5671"
celery:
build:
context: .
dockerfile: compose/Dockerfile.celery.local
container_name: celery
command: bash -c 'celery -A dokumentor worker -l info -E'
volumes:
- .:/code
env_file: conf/env
environment:
DJANGO_DB: 'postgres://dokumentor:dokumentor@db:5432/dokumentor'
CELERY_BROKER_URL: 'amqp://dokumentor:dokumentor@rabbitmq:5672//'
CELERY_RESULT_BACKEND: 'amqp://dokumentor:dokumentor@rabbitmq:5672//'
links:
- db
- rabbitmq
web:
restart: always
container_name: web
build:
context: .
dockerfile: compose/Dockerfile.web.local
command: bash -c 'python src/manage.py makemigrations && python src/manage.py migrate && python src/manage.py runserver 0.0.0.0:8000'
volumes:
- .:/code
ports:
- "8000:8000"
env_file: conf/env
environment:
DJANGO_DB: 'postgres://dokumentor:dokumentor@db:5432/dokumentor'
CELERY_BROKER_URL: 'amqp://dokumentor:dokumentor@rabbitmq:5672//'
CELERY_RESULT_BACKEND: 'amqp://dokumentor:dokumentor@rabbitmq:5672//'
depends_on:
- db
- rabbitmq

@ -52,7 +52,6 @@ pyparsing==2.2.0
PyPDF2==1.26.0
python-dateutil==2.6.0
python-memcached==1.58
python3-ghostscript==0.5.0
pytils==0.3
pytz==2017.2
reportlab==3.4.0
@ -70,3 +69,4 @@ xlutils==2.0.0
xlwt==1.2.0
dj-database-url==0.4.2
envvars==0.3.0
psycopg2==2.6

@ -1,3 +0,0 @@
-r base.txt
psycopg2==2.6
gunicorn==19.4.5

@ -0,0 +1,2 @@
-r base.txt
gunicorn==19.4.5

@ -1,3 +1,2 @@
-r base.txt
psycopg2==2.6
gunicorn==19.4.5

@ -62,15 +62,14 @@ USE_TZ = True
# Absolute filesystem path to the directory that will hold user-uploaded files.
# Example: "/var/www/example.com/media/"
MEDIA_ROOT = os.path.join(PROJECT_DIR, 'media')
MEDIA_ROOT = os.path.join(ROOT_DIR, 'public', 'media')
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash.
# Examples: "http://example.com/media/", "http://media.example.com/"
MEDIA_URL = '/media/'
STATIC_ROOT = os.path.join(ROOT_DIR, 'static')
STATIC_ROOT = os.path.join(ROOT_DIR, 'public', 'static')
# URL prefix for static files.
# Example: "http://example.com/static/", "http://static.example.com/"
@ -260,7 +259,6 @@ CELERY_RESULT_BACKEND = e.get('CELERY_RESULT_BACKEND')
CELERY_TIMEZONE = 'Europe/Moscow'
CALLBACK_SETTINGS = {
'EMAIL_SENDER': '!DEFINE',
'MANAGERS_EMAILS': ['!DEFINE'],

@ -136,7 +136,7 @@
<script src="{% static 'js/commons.js' %}"></script>
<script src="{% static 'js/dialogs.js' %}"></script>
<script src="{% static 'js/callback.js' %}"></script>
{# {% include 'autocomplete_light/static.html' %}#}
{% include 'autocomplete_light/static.html' %}
<script>
$(document).ready(function() {
window.daDataExternalApiKey = "{{ dadata_api_key }}";

Loading…
Cancel
Save