Skip to content
Open

Dev #387

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ ADD .git /opt/tulius/.git
RUN python manage.py compilemessages

ADD gunicorn.conf.py /opt/tulius/gunicorn.conf.py
CMD [ "gunicorn" ]
CMD python -m django_h2
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,11 @@ Repo for http://tulius.com project.
```sql
CREATE DATABASE tulius_prod;
CREATE DATABASE tulius_qa;
CREATE DATABASE sentry;
GRANT ALL ON tulius_prod.* TO tulius_prod@'%' IDENTIFIED BY 'tulius prod password';
GRANT ALL ON tulius_qa.* TO tulius_qa@'%' IDENTIFIED BY 'tulius qa password';
GRANT ALL ON sentry.* TO sentry@'%' IDENTIFIED BY 'sentry';
CREATE USER 'tulius_prod'@'%' IDENTIFIED BY 'tulius prod password';
GRANT ALL ON tulius_prod.* TO tulius_prod@'%';
CREATE USER 'tulius_qa'@'%' IDENTIFIED BY 'tulius qa password';
GRANT ALL ON tulius_qa.* TO tulius_qa@'%';
flush privileges;
```
If you have SQL backup file, placed to mysql data folder:
```bash
Expand Down
3 changes: 1 addition & 2 deletions gunicorn.conf.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
bind = ['0.0.0.0:7000']
workers = 2
worker_class = 'uvicorn.workers.UvicornWorker'
django_settings = 'settings_production,settings'
max_requests = 500
keepalive = 60
preload_app = True
wsgi_app = "asgi:application"
accesslog = '-'
disable_redirect_access_to_syslog = True
errorlog = '-'
8 changes: 5 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ pyyaml == 6.0
ua-parser == 0.10.0

# sentry
sentry-sdk == 1.15.0
redis == 4.5.4
sentry-sdk == 1.29.2
redis == 5.0.1
requests == 2.28.2
elasticsearch8 == 8.6.2

Expand All @@ -31,8 +31,10 @@ coverage==6.5.0
coveralls==3.3.1
pytest-asyncio==0.20.3

gunicorn == 20.1.0
gunicorn == 21.2.0
uvicorn == 0.20.0
websockets == 10.4
h2
django_h2 @ git+https://github.com/kozzztik/django_h2.git@324edc8

portalocker == 2.7.0
4 changes: 0 additions & 4 deletions scripts/tulius/dev/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,5 @@ services:

networks:
tuliusnet:
driver: bridge
ipam:
config:
- subnet: 10.5.0.0/16
name: tuliusnet
external: true
2 changes: 1 addition & 1 deletion scripts/tulius/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ services:
container_name: tulius_redis

mysql:
image: mysql/mysql-server:5.7.22
image: mysql:8.1.0
restart: always
networks:
tuliusnet:
Expand Down
19 changes: 15 additions & 4 deletions scripts/tulius/local/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ services:
- 127.0.0.1:6379:6379

mysql:
image: mysql/mysql-server:5.7.22
image: mysql:8.1.0
restart: always
networks:
tuliusnet:
Expand Down Expand Up @@ -69,20 +69,31 @@ services:
ipv4_address: 10.5.0.20
environment:
TULIUS_ENV: local_docker
ports:
- 7000:7000
volumes:
- ../../../data/media:/opt/tulius/data/media
- ../../../data/mail:/opt/tulius/data/mail
- ../../../data/indexing:/opt/tulius/data/indexing
- ../../../settings_production.py:/opt/tulius/settings_production.py
- ../../../../django_h2/:/opt/tulius/django_h2
command: bash -c "pip install -e /opt/tulius/django_h2 && python -m django_h2 --serve_static"
mem_limit: 512M
logging:
driver: json-file
options:
max-size: "100m"
max-file: "10"

nginx:
image: nginx
networks:
tuliusnet:
ipv4_address: 10.5.0.4
ports:
- "127.0.0.1:8080:80"
volumes:
- ./nginx.conf:/etc/nginx/conf.d/tulius.conf:ro
- ../../../data/media:/opt/tulius/data/media
command: ['nginx', '-g', 'daemon off;']

networks:
tuliusnet:
driver: bridge
Expand Down
22 changes: 22 additions & 0 deletions scripts/tulius/local/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
server {
listen 80;
server_name 127.0.0.1;
charset utf-8;

# max upload size
client_max_body_size 75M;

location /media {
alias /opt/tulius/data/media;
}

# Finally, send all non-media requests to the Django server.
location / {
grpc_set_header Host $http_host;
grpc_set_header User-Agent $http_user_agent;
grpc_set_header X-Real-IP $remote_addr;
grpc_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
grpc_set_header X-Forwarded-Proto $scheme;
grpc_pass grpc://10.5.0.20:7000;
}
}
4 changes: 0 additions & 4 deletions scripts/tulius/master/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,5 @@ services:

networks:
tuliusnet:
driver: bridge
ipam:
config:
- subnet: 10.5.0.0/16
name: tuliusnet
external: true
5 changes: 0 additions & 5 deletions scripts/tulius/mysql.cnf
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,6 @@ thread_cache_size = 16
max_connections = 250
table_open_cache = 1000
#thread_concurrency = 10
#
# * Query Cache Configuration
#
query_cache_limit = 1M
query_cache_size = 100M
# InnoDB
innodb_flush_log_at_trx_commit = 0
innodb_buffer_pool_size = 300M
Expand Down
106 changes: 0 additions & 106 deletions scripts/tulius/nginx/tulius.conf

This file was deleted.

18 changes: 8 additions & 10 deletions scripts/tulius/nginx_dev.conf
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

server {
listen 80;
# listen 443 ssl http2;
# the domain name it will serve for
server_name test.tulius.com;
server_name test.tulius.co-de.org;
Expand Down Expand Up @@ -43,15 +44,12 @@ server {
}
# Finally, send all non-media requests to the Django server.
location / {
proxy_http_version 1.1; # websockets not work over http2 :(
proxy_set_header Host $host;
proxy_set_header User-Agent $http_user_agent;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_pass http://10.5.0.20:7000;
grpc_set_header Host $http_host;
grpc_set_header User-Agent $http_user_agent;
grpc_set_header X-Real-IP $remote_addr;
grpc_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
grpc_set_header X-Forwarded-Proto $scheme;
grpc_pass grpc://10.5.0.20:7000;
}
}

Expand All @@ -61,7 +59,7 @@ server {
charset utf-8;
location / {
proxy_pass http://10.5.0.31:5601;
proxy_set_header Host $host;
proxy_set_header Host http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
Expand Down
16 changes: 7 additions & 9 deletions scripts/tulius/nginx_production.conf
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ server {

server {
listen 80;
# listen 443 ssl http2;
server_name tulius.com;
server_name tulius.co-de.org;
server_name master.tulius.co-de.org;
Expand Down Expand Up @@ -38,15 +39,12 @@ server {
}
# Finally, send all non-media requests to the Django server.
location / {
proxy_http_version 1.1; # websockets not work over http2 :(
proxy_set_header Host $host;
proxy_set_header User-Agent $http_user_agent;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_pass http://10.5.0.10:7000;
grpc_set_header Host $host;
grpc_set_header User-Agent $http_user_agent;
grpc_set_header X-Real-IP $remote_addr;
grpc_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
grpc_set_header X-Forwarded-Proto $scheme;
grpc_pass grpc://10.5.0.10:7000;
}
}

Expand Down
8 changes: 5 additions & 3 deletions settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
'tulius.events.EventsConfig',
'tulius.vk',
'tulius.counters',
'tulius.websockets.WebsocketsConfig',
'django_h2.DjangoH2Config',
)

MIDDLEWARE = (
Expand Down Expand Up @@ -196,7 +196,7 @@

LOGGING = {
'version': 1,
'disable_existing_loggers': True,
'disable_existing_loggers': False,
'filters': {
'require_debug_false': {
'()': 'django.utils.log.RequireDebugFalse'
Expand Down Expand Up @@ -257,6 +257,8 @@
'level': 'DEBUG' if env in ['dev', 'local_docker'] else 'WARNING',
'propagate': True,
},
'hpack': {'level': 'WARNING'},
'flake8': {'level': 'ERROR'},
},
'root': {
'handlers':
Expand Down Expand Up @@ -336,7 +338,7 @@
]

RAVEN_CONFIG = {
'integrations': [DjangoIntegration()],
'integrations': [DjangoIntegration(signals_spans=False)],
'send_default_pii': True,
}

Expand Down
Loading