mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-04-13 09:42:01 +00:00
change redis port to 6579 when DOCKERBUILD is an env variable
This commit is contained in:
parent
5877fd979e
commit
54dfbe9c41
6 changed files with 39 additions and 38 deletions
|
@ -65,7 +65,7 @@ services:
|
||||||
redis:
|
redis:
|
||||||
image: redis:3
|
image: redis:3
|
||||||
ports:
|
ports:
|
||||||
- '6379:6379'
|
- '6579:6579'
|
||||||
container_name: redis
|
container_name: redis
|
||||||
volumes:
|
volumes:
|
||||||
- ./docker/volumes/redis:/data
|
- ./docker/volumes/redis:/data
|
||||||
|
|
|
@ -33,7 +33,7 @@ ENFORCE_SIGNUP_CAPTCHA = False
|
||||||
CACHES = {
|
CACHES = {
|
||||||
'default': {
|
'default': {
|
||||||
'BACKEND': 'redis_cache.RedisCache',
|
'BACKEND': 'redis_cache.RedisCache',
|
||||||
'LOCATION': 'redis:6379',
|
'LOCATION': 'redis:6579',
|
||||||
'OPTIONS': {
|
'OPTIONS': {
|
||||||
'DB': 6,
|
'DB': 6,
|
||||||
'PARSER_CLASS': 'redis.connection.HiredisParser'
|
'PARSER_CLASS': 'redis.connection.HiredisParser'
|
||||||
|
@ -99,7 +99,7 @@ MONGODB_SLAVE = {
|
||||||
}
|
}
|
||||||
|
|
||||||
# Celery RabbitMQ/Redis Broker
|
# Celery RabbitMQ/Redis Broker
|
||||||
BROKER_URL = "redis://redis:6379/0"
|
BROKER_URL = "redis://redis:6579/0"
|
||||||
CELERY_RESULT_BACKEND = BROKER_URL
|
CELERY_RESULT_BACKEND = BROKER_URL
|
||||||
|
|
||||||
REDIS = {
|
REDIS = {
|
||||||
|
@ -113,7 +113,7 @@ REDIS_STORY = {
|
||||||
}
|
}
|
||||||
REDIS_SESSIONS = {
|
REDIS_SESSIONS = {
|
||||||
'host': 'redis',
|
'host': 'redis',
|
||||||
'port': 6379
|
'port': 6579
|
||||||
}
|
}
|
||||||
|
|
||||||
CELERY_REDIS_DB_NUM = 4
|
CELERY_REDIS_DB_NUM = 4
|
||||||
|
|
|
@ -578,8 +578,10 @@ S3_AVATARS_BUCKET_NAME = 'avatars.newsblur.com'
|
||||||
# ==================
|
# ==================
|
||||||
if os.getenv("DOCKERBUILD"):
|
if os.getenv("DOCKERBUILD"):
|
||||||
from newsblur_web.docker_local_settings import *
|
from newsblur_web.docker_local_settings import *
|
||||||
|
REDIS_PORT = 6579
|
||||||
else:
|
else:
|
||||||
from newsblur_web.local_settings import *
|
from newsblur_web.local_settings import *
|
||||||
|
REDIS_PORT = 6379
|
||||||
|
|
||||||
if not DEBUG:
|
if not DEBUG:
|
||||||
INSTALLED_APPS += (
|
INSTALLED_APPS += (
|
||||||
|
@ -680,12 +682,14 @@ MONGOANALYTICSDB = connect(MONGO_ANALYTICS_DB_NAME, **MONGO_ANALYTICS_DB)
|
||||||
# = Redis =
|
# = Redis =
|
||||||
# =========
|
# =========
|
||||||
|
|
||||||
CELERY_BROKER_URL = "redis://%s:6379/%s" % (REDIS['host'], CELERY_REDIS_DB_NUM)
|
CELERY_REDIS_DB_NUM = 4
|
||||||
|
SESSION_REDIS_DB = 5
|
||||||
|
CELERY_BROKER_URL = "redis://%s:%s/%s" % (REDIS['host'], REDIS_PORT,CELERY_REDIS_DB_NUM)
|
||||||
CELERY_RESULT_BACKEND = CELERY_BROKER_URL
|
CELERY_RESULT_BACKEND = CELERY_BROKER_URL
|
||||||
|
|
||||||
SESSION_REDIS = {
|
SESSION_REDIS = {
|
||||||
'host': REDIS_SESSIONS['host'],
|
'host': REDIS_SESSIONS['host'],
|
||||||
'port': 6379,
|
'port': REDIS_PORT,
|
||||||
'db': SESSION_REDIS_DB,
|
'db': SESSION_REDIS_DB,
|
||||||
# 'password': 'password',
|
# 'password': 'password',
|
||||||
'prefix': '',
|
'prefix': '',
|
||||||
|
@ -696,7 +700,7 @@ SESSION_REDIS = {
|
||||||
CACHES = {
|
CACHES = {
|
||||||
'default': {
|
'default': {
|
||||||
'BACKEND': 'redis_cache.RedisCache',
|
'BACKEND': 'redis_cache.RedisCache',
|
||||||
'LOCATION': '%s:6379' % REDIS['host'],
|
'LOCATION': '%s:%s' % REDIS['host'], REDIS_PORT,
|
||||||
'OPTIONS': {
|
'OPTIONS': {
|
||||||
'DB': 6,
|
'DB': 6,
|
||||||
'PARSER_CLASS': 'redis.connection.HiredisParser',
|
'PARSER_CLASS': 'redis.connection.HiredisParser',
|
||||||
|
@ -705,18 +709,18 @@ CACHES = {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
REDIS_POOL = redis.ConnectionPool(host=REDIS['host'], port=6379, db=0, decode_responses=True)
|
REDIS_POOL = redis.ConnectionPool(host=REDIS['host'], port=REDIS_PORT, db=0, decode_responses=True)
|
||||||
REDIS_ANALYTICS_POOL = redis.ConnectionPool(host=REDIS['host'], port=6379, db=2, decode_responses=True)
|
REDIS_ANALYTICS_POOL = redis.ConnectionPool(host=REDIS['host'], port=REDIS_PORT, db=2, decode_responses=True)
|
||||||
REDIS_STATISTICS_POOL = redis.ConnectionPool(host=REDIS['host'], port=6379, db=3, decode_responses=True)
|
REDIS_STATISTICS_POOL = redis.ConnectionPool(host=REDIS['host'], port=REDIS_PORT, db=3, decode_responses=True)
|
||||||
REDIS_FEED_UPDATE_POOL = redis.ConnectionPool(host=REDIS['host'], port=6379, db=4, decode_responses=True)
|
REDIS_FEED_UPDATE_POOL = redis.ConnectionPool(host=REDIS['host'], port=REDIS_PORT, db=4, decode_responses=True)
|
||||||
# REDIS_STORY_HASH_POOL2 = redis.ConnectionPool(host=REDIS['host'], port=6379, db=8) # Only used when changing DAYS_OF_UNREAD
|
# REDIS_STORY_HASH_POOL2 = redis.ConnectionPool(host=REDIS['host'], port=REDIS_PORT, db=8) # Only used when changing DAYS_OF_UNREAD
|
||||||
REDIS_STORY_HASH_TEMP_POOL = redis.ConnectionPool(host=REDIS['host'], port=6379, db=10, decode_responses=True)
|
REDIS_STORY_HASH_TEMP_POOL = redis.ConnectionPool(host=REDIS['host'], port=REDIS_PORT, db=10, decode_responses=True)
|
||||||
# REDIS_CACHE_POOL = redis.ConnectionPool(host=REDIS['host'], port=6379, db=6) # Duped in CACHES
|
# REDIS_CACHE_POOL = redis.ConnectionPool(host=REDIS['host'], port=REDIS_PORT, db=6) # Duped in CACHES
|
||||||
REDIS_STORY_HASH_POOL = redis.ConnectionPool(host=REDIS_STORY['host'], port=6379, db=1, decode_responses=True)
|
REDIS_STORY_HASH_POOL = redis.ConnectionPool(host=REDIS_STORY['host'], port=REDIS_PORT, db=1, decode_responses=True)
|
||||||
REDIS_FEED_READ_POOL = redis.ConnectionPool(host=REDIS_SESSIONS['host'], port=6379, db=1, decode_responses=True)
|
REDIS_FEED_READ_POOL = redis.ConnectionPool(host=REDIS_SESSIONS['host'], port=REDIS_PORT, db=1, decode_responses=True)
|
||||||
REDIS_FEED_SUB_POOL = redis.ConnectionPool(host=REDIS_SESSIONS['host'], port=6379, db=2, decode_responses=True)
|
REDIS_FEED_SUB_POOL = redis.ConnectionPool(host=REDIS_SESSIONS['host'], port=REDIS_PORT, db=2, decode_responses=True)
|
||||||
REDIS_SESSION_POOL = redis.ConnectionPool(host=REDIS_SESSIONS['host'], port=6379, db=5, decode_responses=True)
|
REDIS_SESSION_POOL = redis.ConnectionPool(host=REDIS_SESSIONS['host'], port=REDIS_PORT, db=5, decode_responses=True)
|
||||||
REDIS_PUBSUB_POOL = redis.ConnectionPool(host=REDIS_PUBSUB['host'], port=6379, db=0, decode_responses=True)
|
REDIS_PUBSUB_POOL = redis.ConnectionPool(host=REDIS_PUBSUB['host'], port=REDIS_PORT, db=0, decode_responses=True)
|
||||||
|
|
||||||
# ==========
|
# ==========
|
||||||
# = Celery =
|
# = Celery =
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import sys
|
import sys
|
||||||
from newsblur_web.settings import *
|
from newsblur_web.settings import *
|
||||||
import os
|
|
||||||
# if 'test' in sys.argv:
|
if 'test' in sys.argv:
|
||||||
# DATABASES['default']['ENGINE'] = 'django.db.backends.sqlite3'
|
DATABASES['default']['ENGINE'] = 'django.db.backends.sqlite3'
|
||||||
# DATABASES['default']['OPTIONS'] = {}
|
DATABASES['default']['OPTIONS'] = {}
|
||||||
# # DATABASES['default']['NAME'] = 'nb.db'
|
DATABASES['default']['NAME'] = 'nb.db'
|
||||||
# # DATABASES['default']['TEST_NAME'] = 'nb2.db'
|
DATABASES['default']['TEST_NAME'] = 'nb2.db'
|
||||||
|
|
||||||
# DATABASES = {
|
# DATABASES = {
|
||||||
# 'default':{
|
# 'default':{
|
||||||
|
@ -14,17 +14,10 @@ import os
|
||||||
# 'TEST_NAME': ':memory:',
|
# 'TEST_NAME': ':memory:',
|
||||||
# },
|
# },
|
||||||
# }
|
# }
|
||||||
|
MONGO_DB = {
|
||||||
if os.getenv("DOCKERBUILD"):
|
'name': 'newsblur_test',
|
||||||
MONGO_DB = {
|
'host': '127.0.0.1:27017',
|
||||||
'name': 'newsblur_test',
|
}
|
||||||
'host': 'db_mongo:27017'
|
|
||||||
}
|
|
||||||
else:
|
|
||||||
MONGO_DB = {
|
|
||||||
'name': 'newsblur_test',
|
|
||||||
'host': '127.0.0.1:27017',
|
|
||||||
}
|
|
||||||
|
|
||||||
MONGO_DATABASE_NAME = 'test_newsblur'
|
MONGO_DATABASE_NAME = 'test_newsblur'
|
||||||
# TEST_DATABASE_NAME = ":memory:"
|
# TEST_DATABASE_NAME = ":memory:"
|
||||||
|
@ -35,6 +28,7 @@ TEST_DEBUG = True
|
||||||
DEBUG = True
|
DEBUG = True
|
||||||
SITE_ID = 2
|
SITE_ID = 2
|
||||||
RAVEN_CLIENT = None
|
RAVEN_CLIENT = None
|
||||||
|
HOMEPAGE_USERNAME = 'conesus'
|
||||||
# from django.db import connection
|
# from django.db import connection
|
||||||
# cursor = connection.cursor()
|
# cursor = connection.cursor()
|
||||||
# cursor.execute('PRAGMA temp_store = MEMORY;')
|
# cursor.execute('PRAGMA temp_store = MEMORY;')
|
||||||
|
|
|
@ -5,6 +5,7 @@ log = require './log.js'
|
||||||
DEV = process.env.NODE_ENV == 'development'
|
DEV = process.env.NODE_ENV == 'development'
|
||||||
DOCKER = process.env.NODE_ENV == 'docker'
|
DOCKER = process.env.NODE_ENV == 'docker'
|
||||||
REDIS_SERVER = if process.env.NODE_ENV == 'development' then 'localhost' else if DOCKER then 'redis' else 'db_redis_pubsub'
|
REDIS_SERVER = if process.env.NODE_ENV == 'development' then 'localhost' else if DOCKER then 'redis' else 'db_redis_pubsub'
|
||||||
|
REDIS_PORT = process.env.env.NODE_ENV == 'docker' then 6579 else 6379
|
||||||
SECURE = !!process.env.NODE_SSL
|
SECURE = !!process.env.NODE_SSL
|
||||||
# client = redis.createClient 6379, REDIS_SERVER
|
# client = redis.createClient 6379, REDIS_SERVER
|
||||||
|
|
||||||
|
@ -65,7 +66,7 @@ io.on 'connection', (socket) ->
|
||||||
socket.on "error", (err) ->
|
socket.on "error", (err) ->
|
||||||
log.debug "Error (socket): #{err}"
|
log.debug "Error (socket): #{err}"
|
||||||
socket.subscribe?.quit()
|
socket.subscribe?.quit()
|
||||||
socket.subscribe = redis.createClient 6379, REDIS_SERVER
|
socket.subscribe = redis.createClient REDIS_PORT, REDIS_SERVER
|
||||||
socket.subscribe.on "error", (err) =>
|
socket.subscribe.on "error", (err) =>
|
||||||
log.info @username, "Error: #{err} (#{@feeds.length} feeds)"
|
log.info @username, "Error: #{err} (#{@feeds.length} feeds)"
|
||||||
socket.subscribe?.quit()
|
socket.subscribe?.quit()
|
||||||
|
|
|
@ -14,6 +14,8 @@
|
||||||
|
|
||||||
REDIS_SERVER = process.env.NODE_ENV === 'development' ? 'localhost' : DOCKER ? 'redis' : 'db_redis_pubsub';
|
REDIS_SERVER = process.env.NODE_ENV === 'development' ? 'localhost' : DOCKER ? 'redis' : 'db_redis_pubsub';
|
||||||
|
|
||||||
|
REDIS_PORT = process.env.NODE_ENV === 'docker' ? 6379 : 6579;
|
||||||
|
|
||||||
SECURE = !!process.env.NODE_SSL;
|
SECURE = !!process.env.NODE_SSL;
|
||||||
|
|
||||||
log.debug("Starting NewsBlur unread count server...");
|
log.debug("Starting NewsBlur unread count server...");
|
||||||
|
@ -70,7 +72,7 @@
|
||||||
if ((_ref = socket.subscribe) != null) {
|
if ((_ref = socket.subscribe) != null) {
|
||||||
_ref.quit();
|
_ref.quit();
|
||||||
}
|
}
|
||||||
socket.subscribe = redis.createClient(6379, REDIS_SERVER);
|
socket.subscribe = redis.createClient(REDIS_PORT, REDIS_SERVER);
|
||||||
socket.subscribe.on("error", (function(_this) {
|
socket.subscribe.on("error", (function(_this) {
|
||||||
return function(err) {
|
return function(err) {
|
||||||
var _ref1;
|
var _ref1;
|
||||||
|
|
Loading…
Add table
Reference in a new issue