Added preliminar support for Docker containers
This commit is contained in:
parent
be8f830ebb
commit
5f17267ff7
6
TODO.md
6
TODO.md
|
@ -77,8 +77,6 @@
|
||||||
|
|
||||||
* prevent @pangea.org email addresses on contacts, enforce at least one email without @pangea.org
|
* prevent @pangea.org email addresses on contacts, enforce at least one email without @pangea.org
|
||||||
|
|
||||||
* forms autocomplete="off", doesn't work in chrome
|
|
||||||
|
|
||||||
ln -s /proc/self/fd /dev/fd
|
ln -s /proc/self/fd /dev/fd
|
||||||
|
|
||||||
|
|
||||||
|
@ -388,3 +386,7 @@ Case
|
||||||
|
|
||||||
# Modsecurity rules template by cms (wordpress, joomla, dokuwiki (973337 973338 973347 958057), ...
|
# Modsecurity rules template by cms (wordpress, joomla, dokuwiki (973337 973338 973347 958057), ...
|
||||||
|
|
||||||
|
|
||||||
|
# saas custom domains support (maybe a new form field with custom url? autoconfigure websites?)
|
||||||
|
custom_url form field and validate/create/delete related website
|
||||||
|
SAAS_PHPLIST_ALLOW_CUSTOM_URL = False
|
||||||
|
|
|
@ -29,18 +29,6 @@ function print_help () {
|
||||||
${bold}install_requirements${normal}
|
${bold}install_requirements${normal}
|
||||||
Installs Orchestra requirements using apt-get and pip
|
Installs Orchestra requirements using apt-get and pip
|
||||||
|
|
||||||
${bold}install_postfix${normal}
|
|
||||||
Installs postfix packages including dovecot, amavis, spamassassin and clamav
|
|
||||||
|
|
||||||
${bold}uninstall_postfix${normal}
|
|
||||||
Uninstall postfix packages including dovecot, amavis, spamassassin and clamav
|
|
||||||
|
|
||||||
${bold}install_certificate${normal}
|
|
||||||
Installs a valid all-purpose self signed certificate that is valid for the next ten years
|
|
||||||
|
|
||||||
${bold}uninstall_certificate${normal}
|
|
||||||
Uninstall certificate
|
|
||||||
|
|
||||||
${bold}startproject${normal}
|
${bold}startproject${normal}
|
||||||
Creates a new Django-orchestra instance
|
Creates a new Django-orchestra instance
|
||||||
|
|
||||||
|
|
|
@ -19,8 +19,10 @@ def get_backends_help_text(backends):
|
||||||
'model': backend.model,
|
'model': backend.model,
|
||||||
'related_models': str(backend.related_models),
|
'related_models': str(backend.related_models),
|
||||||
'script_executable': backend.script_executable,
|
'script_executable': backend.script_executable,
|
||||||
'script_method': '.'.join((backend.script_method.__module__, backend.script_method.__name__)),
|
'script_method': '.'.join(
|
||||||
'function_method': '.'.join((backend.function_method.__module__, backend.function_method.__name__)),
|
(backend.script_method.__module__, backend.script_method.__name__)),
|
||||||
|
'function_method': '.'.join(
|
||||||
|
(backend.function_method.__module__, backend.function_method.__name__)),
|
||||||
'actions': str(backend.actions),
|
'actions': str(backend.actions),
|
||||||
}
|
}
|
||||||
help_text += textwrap.dedent("""
|
help_text += textwrap.dedent("""
|
||||||
|
@ -61,7 +63,9 @@ def send_report(method, args, log):
|
||||||
backend = method.__self__.__class__.__name__
|
backend = method.__self__.__class__.__name__
|
||||||
subject = '[Orchestra] %s execution %s on %s' % (backend, log.state, server)
|
subject = '[Orchestra] %s execution %s on %s' % (backend, log.state, server)
|
||||||
separator = "\n%s\n\n" % ('~ '*40,)
|
separator = "\n%s\n\n" % ('~ '*40,)
|
||||||
operations = '\n'.join([' '.join((op.action, get_instance_url(op))) for op in log.operations.all()])
|
operations = '\n'.join(
|
||||||
|
[' '.join((op.action, get_instance_url(op))) for op in log.operations.all()]
|
||||||
|
)
|
||||||
log_url = reverse('admin:orchestration_backendlog_change', args=(log.pk,))
|
log_url = reverse('admin:orchestration_backendlog_change', args=(log.pk,))
|
||||||
log_url = orchestra_settings.ORCHESTRA_SITE_URL + log_url
|
log_url = orchestra_settings.ORCHESTRA_SITE_URL + log_url
|
||||||
message = separator.join([
|
message = separator.join([
|
||||||
|
@ -143,7 +147,9 @@ def message_user(request, logs):
|
||||||
_('<a href="{url}">{total} backend</a> has been executed'),
|
_('<a href="{url}">{total} backend</a> has been executed'),
|
||||||
_('<a href="{url}">{total} backends</a> have been executed'),
|
_('<a href="{url}">{total} backends</a> have been executed'),
|
||||||
total)
|
total)
|
||||||
msg = msg.format(total=total, url=url, async_url=async_url, async=async, successes=successes)
|
msg = msg.format(
|
||||||
|
total=total, url=url, async_url=async_url, async=async, successes=successes
|
||||||
|
)
|
||||||
messages.success(request, mark_safe(msg + '.'))
|
messages.success(request, mark_safe(msg + '.'))
|
||||||
else:
|
else:
|
||||||
msg = async_msg.format(url=url, async_url=async_url, async=async)
|
msg = async_msg.format(url=url, async_url=async_url, async=async)
|
||||||
|
|
|
@ -48,11 +48,12 @@ class SaaSPasswordForm(SaaSBaseForm):
|
||||||
help_text=_("Passwords are not stored, so there is no way to see this "
|
help_text=_("Passwords are not stored, so there is no way to see this "
|
||||||
"service's password, but you can change the password using "
|
"service's password, but you can change the password using "
|
||||||
"<a href=\"password/\">this form</a>."))
|
"<a href=\"password/\">this form</a>."))
|
||||||
password1 = forms.CharField(label=_("Password"), validators=[validators.validate_password],
|
password1 = forms.CharField(label=_("Password"),
|
||||||
widget=forms.PasswordInput(attrs={'autocomplete': 'off'}))
|
widget=forms.PasswordInput(attrs={'autocomplete': 'off'}),
|
||||||
|
validators=[validators.validate_password])
|
||||||
password2 = forms.CharField(label=_("Password confirmation"),
|
password2 = forms.CharField(label=_("Password confirmation"),
|
||||||
widget=forms.PasswordInput,
|
widget=forms.PasswordInput,
|
||||||
help_text=_("Enter the same password as above, for verification."))
|
help_text=_("Enter the same password as above, for verification."))
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super(SaaSPasswordForm, self).__init__(*args, **kwargs)
|
super(SaaSPasswordForm, self).__init__(*args, **kwargs)
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import ast
|
import ast
|
||||||
import copy
|
import copy
|
||||||
|
import json
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
|
||||||
|
@ -91,7 +92,11 @@ def serialize(obj, init=True):
|
||||||
def _format_setting(name, value):
|
def _format_setting(name, value):
|
||||||
if isinstance(value, Remove):
|
if isinstance(value, Remove):
|
||||||
return ""
|
return ""
|
||||||
value = serialize(eval(value), get_eval_context())
|
value = eval(value, get_eval_context())
|
||||||
|
try:
|
||||||
|
value = json.dumps(value, indent=4)
|
||||||
|
except TypeError:
|
||||||
|
value = serialize(value)
|
||||||
return "{name} = {value}".format(name=name, value=value)
|
return "{name} = {value}".format(name=name, value=value)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
FROM debian:latest
|
||||||
|
RUN apt-get -y update && apt-get install -y git screen sudo python3 python3-pip wget curl dnsutils rsyslog nano ssh-client
|
||||||
|
RUN export TERM=xterm; curl https://raw.githubusercontent.com/glic3rinu/django-orchestra/master/orchestra/bin/orchestra-admin | bash -s install_requirements
|
||||||
|
RUN apt-get clean
|
|
@ -6,8 +6,22 @@
|
||||||
|
|
||||||
set -ue
|
set -ue
|
||||||
|
|
||||||
bold=$(tput bold)
|
function main () {
|
||||||
normal=$(tput sgr0)
|
|
||||||
|
|
||||||
|
bold=$(tput -T ${TERM:-xterm} bold)
|
||||||
|
normal=$(tput -T ${TERM:-xterm} sgr0)
|
||||||
|
|
||||||
|
surun () {
|
||||||
|
echo " ${bold}\$ su $USER -c \"${@}\"${normal}"
|
||||||
|
su $USER -c "${@}"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
run () {
|
||||||
|
echo " ${bold}\$ ${@}${normal}"
|
||||||
|
${@}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
[ $(whoami) != 'root' ] && {
|
[ $(whoami) != 'root' ] && {
|
||||||
|
@ -25,17 +39,6 @@ PYTHON_BIN="python3"
|
||||||
CELERY=false
|
CELERY=false
|
||||||
|
|
||||||
|
|
||||||
surun () {
|
|
||||||
echo " ${bold}\$ su $USER -c \"${@}\"${normal}"
|
|
||||||
su $USER -c "${@}"
|
|
||||||
}
|
|
||||||
|
|
||||||
run () {
|
|
||||||
echo " ${bold}\$ ${@}${normal}"
|
|
||||||
${@}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# Create a system user for running Orchestra
|
# Create a system user for running Orchestra
|
||||||
useradd $USER -s "/bin/bash" || true
|
useradd $USER -s "/bin/bash" || true
|
||||||
echo "$USER:$PASSWORD" | chpasswd
|
echo "$USER:$PASSWORD" | chpasswd
|
||||||
|
@ -72,7 +75,7 @@ fi
|
||||||
|
|
||||||
run "apt-get -y install postgresql"
|
run "apt-get -y install postgresql"
|
||||||
if [[ ! $(sudo su postgres -c "psql -lqt" | awk {'print $1'} | grep '^orchestra$') ]]; then
|
if [[ ! $(sudo su postgres -c "psql -lqt" | awk {'print $1'} | grep '^orchestra$') ]]; then
|
||||||
# orchestra database does not esists
|
# orchestra database does not exists
|
||||||
# Speeding up tests, don't do this in production!
|
# Speeding up tests, don't do this in production!
|
||||||
. /usr/share/postgresql-common/init.d-functions
|
. /usr/share/postgresql-common/init.d-functions
|
||||||
POSTGRES_VERSION=$(psql --version | head -n1 | sed -r "s/^.*\s([0-9]+\.[0-9]+).*/\1/")
|
POSTGRES_VERSION=$(psql --version | head -n1 | sed -r "s/^.*\s([0-9]+\.[0-9]+).*/\1/")
|
||||||
|
@ -142,3 +145,8 @@ ${bold}
|
||||||
- password: $PASSWORD
|
- password: $PASSWORD
|
||||||
${normal}
|
${normal}
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
# Wrap it all on a function to avoid partial executions when running through wget/curl
|
||||||
|
main
|
Loading…
Reference in New Issue