Fixes on deployment
This commit is contained in:
parent
95a6a0c37d
commit
8a5a1fa94f
3
TODO.md
3
TODO.md
|
@ -390,8 +390,7 @@ Case
|
|||
|
||||
deploy --dev
|
||||
deploy.sh and deploy-dev.sh autoupgrade
|
||||
chown orchestra:orchestra /home/orchestra/panel/orchestra.log
|
||||
orchestra home autocomplete
|
||||
orchestra home autocomplete skeleton
|
||||
|
||||
short URLS: https://github.com/rsvp/gitio
|
||||
|
||||
|
|
|
@ -51,6 +51,8 @@ INSTALLED_APPS = [
|
|||
'orchestra.contrib.bills',
|
||||
'orchestra.contrib.payments',
|
||||
'orchestra.contrib.tasks',
|
||||
'orchestra.contrib.mailer',
|
||||
'orchestra.contrib.history',
|
||||
|
||||
# Third-party apps
|
||||
'django_extensions',
|
||||
|
@ -65,7 +67,6 @@ INSTALLED_APPS = [
|
|||
'rest_framework.authtoken',
|
||||
'passlib.ext.django',
|
||||
'django_countries',
|
||||
# 'django_mailer',
|
||||
# 'debug_toolbar',
|
||||
|
||||
# Django.contrib
|
||||
|
@ -82,21 +83,6 @@ INSTALLED_APPS = [
|
|||
]
|
||||
|
||||
|
||||
MIDDLEWARE_CLASSES = [
|
||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||
'django.middleware.common.CommonMiddleware',
|
||||
'django.middleware.csrf.CsrfViewMiddleware',
|
||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
|
||||
'django.contrib.messages.middleware.MessageMiddleware',
|
||||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||
'django.middleware.security.SecurityMiddleware',
|
||||
'orchestra.core.caches.RequestCacheMiddleware',
|
||||
# also handles transations, ATOMIC_REQUESTS does not wrap middlewares
|
||||
'orchestra.contrib.orchestration.middlewares.OperationsMiddleware',
|
||||
]
|
||||
|
||||
|
||||
ROOT_URLCONF = '{{ project_name }}.urls'
|
||||
|
||||
TEMPLATES = [
|
||||
|
@ -173,6 +159,22 @@ LOCALE_PATHS = (
|
|||
ORCHESTRA_SITE_NAME = '{{ project_name }}'
|
||||
|
||||
|
||||
MIDDLEWARE_CLASSES = (
|
||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||
'corsheaders.middleware.CorsMiddleware',
|
||||
'django.middleware.common.CommonMiddleware',
|
||||
'django.middleware.csrf.CsrfViewMiddleware',
|
||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
|
||||
'django.contrib.messages.middleware.MessageMiddleware',
|
||||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||
'django.middleware.security.SecurityMiddleware',
|
||||
'orchestra.core.caches.RequestCacheMiddleware',
|
||||
# also handles transations, ATOMIC_REQUESTS does not wrap middlewares
|
||||
'orchestra.contrib.orchestration.middlewares.OperationsMiddleware',
|
||||
)
|
||||
|
||||
|
||||
AUTH_USER_MODEL = 'accounts.Account'
|
||||
|
||||
|
||||
|
@ -182,48 +184,7 @@ AUTHENTICATION_BACKENDS = [
|
|||
]
|
||||
|
||||
|
||||
LOGGING = {
|
||||
'version': 1,
|
||||
'disable_existing_loggers': False,
|
||||
'formatters': {
|
||||
'simple': {
|
||||
'format': '%(asctime)s %(name)s %(levelname)s %(message)s'
|
||||
},
|
||||
},
|
||||
'filters': {
|
||||
'require_debug_false': {
|
||||
'()': 'django.utils.log.RequireDebugFalse',
|
||||
},
|
||||
'require_debug_true': {
|
||||
'()': 'django.utils.log.RequireDebugTrue',
|
||||
},
|
||||
},
|
||||
'handlers': {
|
||||
'file': {
|
||||
'level': 'DEBUG',
|
||||
'class': 'logging.FileHandler',
|
||||
'filename': os.path.join(BASE_DIR, 'orchestra.log'),
|
||||
'formatter': 'simple'
|
||||
},
|
||||
'console': {
|
||||
'level': 'INFO',
|
||||
'filters': ['require_debug_true'],
|
||||
'class': 'logging.StreamHandler',
|
||||
},
|
||||
},
|
||||
'loggers': {
|
||||
'orchestra': {
|
||||
'handlers': ['file', 'console'],
|
||||
'level': 'INFO',
|
||||
'propagate': True,
|
||||
},
|
||||
'orm': {
|
||||
'handlers': ['file',],
|
||||
'level': 'INFO',
|
||||
'propagate': True,
|
||||
},
|
||||
},
|
||||
}
|
||||
EMAIL_BACKEND = 'orchestra.contrib.mailer.backends.EmailBackend'
|
||||
|
||||
|
||||
#################################
|
||||
|
@ -242,3 +203,37 @@ FLUENT_DASHBOARD_ICON_THEME = '../orchestra/icons'
|
|||
import djcelery
|
||||
djcelery.setup_loader()
|
||||
CELERYBEAT_SCHEDULER = 'djcelery.schedulers.DatabaseScheduler'
|
||||
|
||||
|
||||
# rest_framework
|
||||
REST_FRAMEWORK = {
|
||||
'DEFAULT_PERMISSION_CLASSES': (
|
||||
'orchestra.permissions.api.OrchestraPermissionBackend',
|
||||
),
|
||||
'DEFAULT_AUTHENTICATION_CLASSES': (
|
||||
'rest_framework.authentication.SessionAuthentication',
|
||||
'rest_framework.authentication.TokenAuthentication',
|
||||
),
|
||||
'DEFAULT_FILTER_BACKENDS': (
|
||||
('rest_framework.filters.DjangoFilterBackend',)
|
||||
),
|
||||
}
|
||||
|
||||
|
||||
# Use a UNIX compatible hash
|
||||
PASSLIB_CONFIG = (
|
||||
"[passlib]\n"
|
||||
"schemes = sha512_crypt, django_pbkdf2_sha256, django_pbkdf2_sha1, "
|
||||
" django_bcrypt, django_bcrypt_sha256, django_salted_sha1, des_crypt, "
|
||||
" django_salted_md5, django_des_crypt, hex_md5, bcrypt, phpass\n"
|
||||
"default = sha512_crypt\n"
|
||||
"deprecated = django_pbkdf2_sha1, django_salted_sha1, django_salted_md5, "
|
||||
" django_des_crypt, des_crypt, hex_md5\n"
|
||||
"all__vary_rounds = 0.05\n"
|
||||
"django_pbkdf2_sha256__min_rounds = 10000\n"
|
||||
"sha512_crypt__min_rounds = 80000\n"
|
||||
"staff__django_pbkdf2_sha256__default_rounds = 12500\n"
|
||||
"staff__sha512_crypt__default_rounds = 100000\n"
|
||||
"superuser__django_pbkdf2_sha256__default_rounds = 15000\n"
|
||||
"superuser__sha512_crypt__default_rounds = 120000\n"
|
||||
)
|
||||
|
|
|
@ -18,17 +18,19 @@ class MoodleMuBackend(ServiceController):
|
|||
// "<HTTP_HOST>" => ["<SITE_NAME>", "<WWWROOT>"],
|
||||
);
|
||||
|
||||
wwwroot = "https://{$site}-courses.pangea.org";
|
||||
$site = getenv("SITE");
|
||||
$wwwroot = "https://{$site}-courses.pangea.org";
|
||||
if ( $site == '' ) {
|
||||
http_host = $_SERVER['HTTP_HOST'];
|
||||
$http_host = $_SERVER['HTTP_HOST'];
|
||||
if (array_key_exists($http_host, $site_map)) {
|
||||
$site = $site_map[$http_host][0];
|
||||
$wwwroot = $site_map[$http_host][1];
|
||||
} elseif (strpos($http_host, '-courses.') !== false) {
|
||||
$site = array_shift((explode("-courses.", $http_host)));
|
||||
$wwwroot = "https://{$site}-courses.pangea.org";
|
||||
} else {
|
||||
$site = array_shift((explode(".", $http_host)));
|
||||
$wwwroot = "https://{$site}-courses.pangea.org";
|
||||
}
|
||||
}
|
||||
$CFG->prefix = "${site}_";
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
from django.core.management.base import BaseCommand
|
||||
|
||||
from orchestra import settings
|
||||
from orchestra.management.commands.startservices import ManageServiceCommand
|
||||
from orchestra.settings import ORCHESTRA_RESTART_SERVICES
|
||||
|
||||
|
||||
class Command(ManageServiceCommand):
|
||||
services = ORCHESTRA_RESTART_SERVICES
|
||||
services = settings.ORCHESTRA_RESTART_SERVICES
|
||||
action = 'restart'
|
||||
option_list = BaseCommand.option_list
|
||||
help = 'Restart all related services. Usefull for reload configuration and files.'
|
||||
|
|
|
@ -38,7 +38,9 @@ class Command(BaseCommand):
|
|||
'LOGGING': settings_parser.Remove(),
|
||||
})
|
||||
setuplogrotate = textwrap.dedent("""\
|
||||
mkdir %(log_dir)s && chown $(ls -dl %(site_dir)s|awk {'print $3":"$4'}) %(log_dir)s
|
||||
mkdir %(log_dir)s && chown -reference=%(site_dir)s %(log_dir)s
|
||||
touch %(log_path)s
|
||||
chown --reference=%(log_dir)s %(log_path)s
|
||||
echo '%(log_dir)s/*.log {
|
||||
copytruncate
|
||||
daily
|
||||
|
|
|
@ -2,7 +2,7 @@ from optparse import make_option
|
|||
|
||||
from django.core.management.base import BaseCommand
|
||||
|
||||
from orchestra.settings import ORCHESTRA_START_SERVICES
|
||||
from orchestra import settings
|
||||
from orchestra.utils.sys import run, check_root
|
||||
|
||||
|
||||
|
@ -27,7 +27,6 @@ def flatten(nested, depth=0):
|
|||
yield nested
|
||||
|
||||
|
||||
|
||||
class ManageServiceCommand(BaseCommand):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(ManageServiceCommand, self).__init__(*args, **kwargs)
|
||||
|
@ -53,7 +52,7 @@ class ManageServiceCommand(BaseCommand):
|
|||
|
||||
|
||||
class Command(ManageServiceCommand):
|
||||
services = ORCHESTRA_START_SERVICES
|
||||
services = settings.ORCHESTRA_START_SERVICES
|
||||
action = 'start'
|
||||
option_list = BaseCommand.option_list
|
||||
help = 'Start all related services. Usefull for reload configuration and files.'
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
from django.core.management.base import BaseCommand
|
||||
|
||||
from orchestra import settings
|
||||
from orchestra.management.commands.startservices import ManageServiceCommand
|
||||
from orchestra.settings import ORCHESTRA_STOP_SERVICES
|
||||
|
||||
|
||||
class Command(ManageServiceCommand):
|
||||
services = ORCHESTRA_STOP_SERVICES
|
||||
services = settings.ORCHESTRA_STOP_SERVICES
|
||||
action = 'stop'
|
||||
option_list = BaseCommand.option_list
|
||||
help = 'Stop all related services. Usefull for reload configuration and files.'
|
||||
|
|
|
@ -36,9 +36,9 @@ ORCHESTRA_SITE_VERBOSE_NAME = Setting('ORCHESTRA_SITE_VERBOSE_NAME',
|
|||
ORCHESTRA_START_SERVICES = Setting('ORCHESTRA_START_SERVICES',
|
||||
default=(
|
||||
'postgresql',
|
||||
'celeryevcam',
|
||||
'celeryd',
|
||||
'celerybeat',
|
||||
# 'celeryevcam',
|
||||
# 'celeryd',
|
||||
# 'celerybeat',
|
||||
('uwsgi', 'nginx'),
|
||||
),
|
||||
)
|
||||
|
@ -46,8 +46,8 @@ ORCHESTRA_START_SERVICES = Setting('ORCHESTRA_START_SERVICES',
|
|||
|
||||
ORCHESTRA_RESTART_SERVICES = Setting('ORCHESTRA_RESTART_SERVICES',
|
||||
default=(
|
||||
'celeryd',
|
||||
'celerybeat',
|
||||
# 'celeryd',
|
||||
# 'celerybeat',
|
||||
'uwsgi'
|
||||
),
|
||||
)
|
||||
|
@ -56,9 +56,9 @@ ORCHESTRA_RESTART_SERVICES = Setting('ORCHESTRA_RESTART_SERVICES',
|
|||
ORCHESTRA_STOP_SERVICES = Setting('ORCHESTRA_STOP_SERVICES',
|
||||
default=(
|
||||
('uwsgi', 'nginx'),
|
||||
'celerybeat',
|
||||
'celeryd',
|
||||
'celeryevcam',
|
||||
# 'celerybeat',
|
||||
# 'celeryd',
|
||||
# 'celeryevcam',
|
||||
'postgresql'
|
||||
),
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue