Entfernt puppet
parent
1fd4949ddc
commit
f2b0c32733
|
|
@ -1,436 +0,0 @@
|
|||
# Agent: sudo puppet agent --test
|
||||
|
||||
class odoo {
|
||||
|
||||
class { 'sudo':
|
||||
purge => false,
|
||||
config_file_replace => false,
|
||||
}
|
||||
|
||||
user { odoo:
|
||||
ensure => present,
|
||||
shell => '/bin/bash',
|
||||
managehome => 'true',
|
||||
}
|
||||
|
||||
$sudo_entry="odoo ALL=NOPASSWD: ALL"
|
||||
sudo::conf { 'sudo_odoo':
|
||||
priority => 10,
|
||||
content => $sudo_entry,
|
||||
}
|
||||
|
||||
ssh_authorized_key { "andreas@datenpol":
|
||||
user => odoo,
|
||||
type => 'ssh-rsa',
|
||||
key => 'AAAAB3NzaC1yc2EAAAADAQABAAABAQDBIg6NZV4tTs+J5qUP4/zQAn+Xi3muKqbaSDV8yYm50mH77PcLwbkZVlxdF0/OFCl5f5FCNp4Ag4Px97M35Nv+BweOTCZNMKOHmvtXY1fCRUQnk6ca3NlipImppL0U47SUzt9KkNIsz0FWxLu74LANgxKwrf8Hgim8Nkq8WrlvuoJCqf+542N15cGrf/9eD6yRm7AmdFi7VIYrP4m7TPbXJBGX+cXOo0bKTyaq8mtinbUN5UCi/eJ08wYkm/CGVxL+9cm6HOABw332A8OadAliCZBWqhFT0rBKdoWLxBbTsILALskrddpKLwBLOUIU79YeT0OfNpLCnVi8u67X9inl',
|
||||
}
|
||||
|
||||
sshkey { "gitlab.datenpol.at":
|
||||
ensure => present,
|
||||
type => "rsa",
|
||||
key => "AAAAB3NzaC1yc2EAAAABIwAAAQEA06iMjK8mfl0MYClE91ilueqOA4Kx394xLZ4bJHFYUdalySAIPLJPQbtfO2cAjSDqJaq+lvCGdDyzQ8L+ZnNIhWea1FNA/QBHBSZEzsKsUPXUiL1gb0RUdPIgr24NJ4gQlLVf5SBRYPXv/JRE80TwEa7st1vkNiBzY+wt2IsLeEr+ekq0YufaODUxMfrHoAbqM4izdlWS9KVSWXdtnaFLnvYuY0d7nU9id8+ZSdLFzLrzIVuPRLVaRg00TYlxyUfLnyhKP+74GAtX9IG+yOwbzXONEjQYXsz6Ivhe6Z+fnWUrtAqyCvlvQxWXPgLNf3tCH9gnXXr3psjzNWpZDTGo6w=="
|
||||
}
|
||||
|
||||
file { '/etc/ssh/ssh_known_hosts':
|
||||
ensure => file,
|
||||
owner => 'root',
|
||||
group => 'root',
|
||||
mode => '0644',
|
||||
}
|
||||
|
||||
class { 'postgresql::server':
|
||||
listen_addresses => '*',
|
||||
locale => 'de_AT.UTF-8',
|
||||
encoding => 'UTF8',
|
||||
}
|
||||
|
||||
file { "/var/log/odoo":
|
||||
owner => 'root',
|
||||
group => 'root',
|
||||
mode => '0777',
|
||||
ensure => "directory",
|
||||
}
|
||||
|
||||
package { ['antiword',
|
||||
'bzr',
|
||||
'git',
|
||||
'nginx',
|
||||
'ntp',
|
||||
'poppler-utils',
|
||||
'postgresql',
|
||||
'python-dateutil',
|
||||
'python-decorator',
|
||||
'python-docutils',
|
||||
'python-egenix-mxdatetime',
|
||||
'python-feedparser',
|
||||
'python-gevent',
|
||||
'python-imaging',
|
||||
'python-jinja2',
|
||||
'python-ldap',
|
||||
'python-libxslt1',
|
||||
'python-lxml',
|
||||
'python-mako',
|
||||
'python-matplotlib',
|
||||
'python-mock',
|
||||
'python-openid',
|
||||
'python-openssl',
|
||||
'python-paramiko',
|
||||
'python-pdftools',
|
||||
'python-pip',
|
||||
'python-psutil',
|
||||
'python-psycopg2',
|
||||
#'python-pybabel',
|
||||
'python-pychart',
|
||||
'python-pydot',
|
||||
'python-pyparsing',
|
||||
#'python-pypdf',
|
||||
'python-reportlab-accel',
|
||||
'python-reportlab',
|
||||
# 'python-requests', ist bei debian version 0.12.1 => daher install mit pip
|
||||
'python-setuptools',
|
||||
'python-simplejson',
|
||||
'python-tz',
|
||||
'python-unittest2',
|
||||
#'python-vatnumber',
|
||||
'python-vobject',
|
||||
'python-webdav',
|
||||
'python-werkzeug',
|
||||
'python-xlwt',
|
||||
'python-yaml',
|
||||
'python-zsi',
|
||||
'wget',
|
||||
# für wkhtmltox
|
||||
'xfonts-base',
|
||||
'xfonts-75dpi',
|
||||
'node-less',
|
||||
'libxslt-dev', # lxml
|
||||
'libxml2-dev', # lxml
|
||||
'lib32z1-dev'. # lxml
|
||||
'libldap2-dev', #ldap
|
||||
'libsasl2-dev', #ldap
|
||||
]:
|
||||
ensure => present,
|
||||
}
|
||||
|
||||
exec { "/usr/bin/wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.1/wkhtmltox-0.12.1_linux-trusty-amd64.deb":
|
||||
alias => "wkhtmltox",
|
||||
cwd => "/tmp",
|
||||
creates => '/tmp/wkhtmltox-0.12.1_linux-trusty-amd64.deb'
|
||||
}
|
||||
|
||||
file { "wkthmltox":
|
||||
name => "/tmp/wkhtmltox-0.12.1_linux-trusty-amd64.deb",
|
||||
owner => root,
|
||||
group => root,
|
||||
ensure => present,
|
||||
alias => "wkhtmltox",
|
||||
require => Exec["wkhtmltox"] }
|
||||
|
||||
package { 'wkhtmltox':
|
||||
provider => dpkg,
|
||||
ensure => installed,
|
||||
source => "/tmp/wkhtmltox-0.12.1_linux-trusty-amd64.deb",
|
||||
require => [FILE['wkhtmltox'],Package['xfonts-base']],
|
||||
}
|
||||
|
||||
package {['passlib',
|
||||
'psycogreen',
|
||||
'gdata',
|
||||
'requests',
|
||||
'vatnumber',
|
||||
'xlsxwriter',
|
||||
'ofxparse',
|
||||
'babel',
|
||||
'pypdf',
|
||||
]:
|
||||
ensure => installed,
|
||||
provider => 'pip',
|
||||
require => Package['python-pip'],
|
||||
}
|
||||
|
||||
# Update python lib distribute if required ("sudo easy_install -U distribute")
|
||||
$upg_cmd = "sudo easy_install -U distribute"
|
||||
$unless_upg_cmd = "sudo pip freeze | grep distribute==0.7"
|
||||
exec { 'upgrade_distribute':
|
||||
command => $upg_cmd,
|
||||
unless => $unless_upg_cmd,
|
||||
path => ['/bin', '/sbin', '/usr/bin', '/usr/sbin'],
|
||||
}
|
||||
|
||||
|
||||
# TODO, benötigt: "sudo easy_install -U distribute"
|
||||
package {'gevent_psycopg2':
|
||||
ensure => present,
|
||||
provider => 'pip',
|
||||
require => [Package['python-pip'],Package['python-psycopg2'],Exec['upgrade_distribute'], Class['postgresql::server']],
|
||||
}
|
||||
|
||||
# main directory for odoo backups
|
||||
file { "/var/pgdump":
|
||||
owner => 'root',
|
||||
group => 'root',
|
||||
mode => '0777',
|
||||
ensure => "directory",
|
||||
}
|
||||
|
||||
# Default nginx file (prevent default server) REQUIRES SSL-key!!!
|
||||
# Conf file
|
||||
file { "/etc/nginx/conf.d/default.conf":
|
||||
owner => 'www-data',
|
||||
group => 'www-data',
|
||||
mode => '0600',
|
||||
ensure => present,
|
||||
content => template('odoo/default.nginx.erb'),
|
||||
notify => Service['nginx'],
|
||||
}
|
||||
|
||||
# NGINX SSL
|
||||
file { "/etc/nginx/ssl":
|
||||
owner => 'www-data',
|
||||
group => 'www-data',
|
||||
mode => '0700',
|
||||
ensure => "directory",
|
||||
require => Package['nginx'],
|
||||
notify => Service['nginx'],
|
||||
}
|
||||
|
||||
# Delete Default Server
|
||||
file { "/etc/nginx/sites-enabled/default":
|
||||
ensure => "absent",
|
||||
require => Package['nginx'],
|
||||
notify => Service['nginx'],
|
||||
}
|
||||
}
|
||||
|
||||
define odoo::instance ($db_pw,$ssl = false, $servername, $odooport, $odooport_longpolling, $gitrepo, $gitbranch) {
|
||||
$instance = $title
|
||||
|
||||
include odoo
|
||||
|
||||
user {$instance:
|
||||
ensure => present,
|
||||
groups => ["sudo"],
|
||||
shell => '/bin/bash',
|
||||
managehome => 'true',
|
||||
}
|
||||
|
||||
$key_andreas="andreas@$instance"
|
||||
ssh_authorized_key { $key_andreas:
|
||||
user => $instance,
|
||||
type => 'ssh-rsa',
|
||||
key => 'AAAAB3NzaC1yc2EAAAADAQABAAABAQDBIg6NZV4tTs+J5qUP4/zQAn+Xi3muKqbaSDV8yYm50mH77PcLwbkZVlxdF0/OFCl5f5FCNp4Ag4Px97M35Nv+BweOTCZNMKOHmvtXY1fCRUQnk6ca3NlipImppL0U47SUzt9KkNIsz0FWxLu74LANgxKwrf8Hgim8Nkq8WrlvuoJCqf+542N15cGrf/9eD6yRm7AmdFi7VIYrP4m7TPbXJBGX+cXOo0bKTyaq8mtinbUN5UCi/eJ08wYkm/CGVxL+9cm6HOABw332A8OadAliCZBWqhFT0rBKdoWLxBbTsILALskrddpKLwBLOUIU79YeT0OfNpLCnVi8u67X9inl',
|
||||
}
|
||||
|
||||
ssh_keygen { $instance: }
|
||||
|
||||
$sudo_entry="$instance ALL = (root) NOPASSWD: /etc/init.d/odoo-server-$instance, /usr/sbin/service odoo-server-$instance *"
|
||||
sudo::conf { $instance:
|
||||
priority => 10,
|
||||
content => $sudo_entry,
|
||||
}
|
||||
|
||||
# Logfile
|
||||
file { "/var/log/odoo/$instance":
|
||||
owner => $instance,
|
||||
group => $instance,
|
||||
mode => '0700',
|
||||
ensure => "directory",
|
||||
#require => file['/var/log/odoo'],
|
||||
}
|
||||
|
||||
file { "/home/$instance/logs":
|
||||
ensure => "link",
|
||||
owner => $instance,
|
||||
group => $instance,
|
||||
mode => '0600',
|
||||
target => "/var/log/odoo/$instance/odoo-server.log",
|
||||
}
|
||||
|
||||
$require_log = "file[/var/log/odoo/$instance]"
|
||||
file { "/var/log/odoo/$instance/odoo-server.log":
|
||||
owner => $instance,
|
||||
group => $instance,
|
||||
mode => '0600',
|
||||
ensure => present,
|
||||
require => $require_log,
|
||||
}
|
||||
|
||||
$logrotate_file = "/etc/logrotate.d/odoo-$instance"
|
||||
file { $logrotate_file:
|
||||
owner => 'root',
|
||||
group => 'root',
|
||||
mode => '0644',
|
||||
ensure => present,
|
||||
content => template('odoo/logrotate.erb'),
|
||||
}
|
||||
|
||||
# init file
|
||||
# sudo ln -s /opt/odoo/odoo/config/odoo-server.init /etc/init.d/odoo-server
|
||||
$init_odoo_notify = "Service[odoo-server-$instance]"
|
||||
file { "/etc/init.d/odoo-server-$instance":
|
||||
owner => $instance,
|
||||
group => $instance,
|
||||
mode => '0755',
|
||||
ensure => present,
|
||||
content => template('odoo/odoo-server.init.erb'),
|
||||
notify => $init_odoo_notify,
|
||||
}
|
||||
|
||||
file { "/home/$instance/restart.sh":
|
||||
owner => $instance,
|
||||
group => $instance,
|
||||
mode => '0755',
|
||||
ensure => present,
|
||||
content => template('odoo/restart.sh.erb'),
|
||||
}
|
||||
|
||||
file { "/home/$instance/update-source.sh":
|
||||
owner => $instance,
|
||||
group => $instance,
|
||||
mode => '0755',
|
||||
ensure => present,
|
||||
content => template('odoo/update-source.sh.erb'),
|
||||
}
|
||||
|
||||
$gitdir="/home/$instance/ext"
|
||||
$giturl="ssh://git@gitlab.datenpol.at:122/odoo/$gitrepo.git"$gituser="$instance"
|
||||
vcsrepo { $gitdir:
|
||||
ensure => present,
|
||||
provider => git,
|
||||
source => $giturl,
|
||||
revision => $gitbranch,
|
||||
user => $instance,
|
||||
}
|
||||
|
||||
file { "/home/$instance/config":
|
||||
owner => $instance,
|
||||
group => $instance,
|
||||
mode => '0700',
|
||||
ensure => "directory",
|
||||
}
|
||||
|
||||
# Odoo config
|
||||
file { "/home/$instance/config/odoo-server.conf":
|
||||
owner => $instance,
|
||||
group => $instance,
|
||||
mode => '0700',
|
||||
ensure => present,
|
||||
content => template('odoo/odoo-server.conf.erb'),
|
||||
}
|
||||
|
||||
# file { "/home/$instance/ext.git":
|
||||
# owner => $instance,
|
||||
# group => $instance,
|
||||
# mode => '0600',
|
||||
# ensure => "directory",
|
||||
# recurse => true,
|
||||
# require => Package[git],
|
||||
# }
|
||||
|
||||
# file { "/home/$instance/ext":
|
||||
# owner => $instance,
|
||||
# group => $instance,
|
||||
# mode => '0700',
|
||||
# ensure => "directory",
|
||||
# }
|
||||
|
||||
# $git_requires = "File[/home/$instance/ext.git]"
|
||||
# $git_create_cmd = "sudo -u $instance git init --bare /home/$instance/ext.git"
|
||||
# $git_unless_cmd = "sudo -u $instance test -e /home/$instance/ext.git/HEAD"
|
||||
# $git_repo = "git_repo_$instance"
|
||||
# exec { $git_repo:
|
||||
# command => $git_create_cmd,
|
||||
# unless => $git_unless_cmd,
|
||||
# path => ['/bin', '/sbin', '/usr/bin', '/usr/sbin'],
|
||||
# require => $git_requires,
|
||||
# }
|
||||
|
||||
# file { "/home/$instance/ext.git/hooks/post-receive":
|
||||
# owner => $instance,
|
||||
# group => $instance,
|
||||
# mode => '0700',
|
||||
# ensure => present,
|
||||
# content => "#!/bin/bash
|
||||
#git --work-tree=/home/$instance/ext --git-dir=/home/$instance/ext.git checkout -f",
|
||||
# require => Exec[$git_repo],
|
||||
# }
|
||||
|
||||
|
||||
# backup
|
||||
file { "/home/$instance/odoo-backup.sh":
|
||||
owner => $instance,
|
||||
group => $instance,
|
||||
mode => '0700',
|
||||
ensure => present,
|
||||
content => template('odoo/odoo-backup.sh.erb'),
|
||||
}
|
||||
|
||||
$cron_cmd = "/home/$instance/odoo-backup.sh"
|
||||
$cron_require = "file[/home/$instance/odoo-backup.sh]"
|
||||
$odoo_backup = "odoo-backup-$instance"
|
||||
cron { $odoo_backup:
|
||||
command => $cron_cmd,
|
||||
user => $instance,
|
||||
hour => 1,
|
||||
minute => 30,
|
||||
require => $cron_require,
|
||||
}
|
||||
|
||||
# dictionaly for odoo backups
|
||||
file { "/var/pgdump/$instance":
|
||||
owner => $instance,
|
||||
group => $instance,
|
||||
mode => '0700',
|
||||
ensure => "directory",
|
||||
}
|
||||
|
||||
$odoo_service = "odoo-server-$instance"
|
||||
$odoo_service_req = "file[/etc/init.d/odoo-server-$instance]"
|
||||
# Run server
|
||||
service {$odoo_service:
|
||||
ensure => running,
|
||||
require => $odoo_service_req,
|
||||
enable => true,
|
||||
}
|
||||
|
||||
# Postgresql User
|
||||
# sudo su - postgres -c "createuser -s $OE_USER" 2> /dev/null || true
|
||||
postgresql::server::role { "$instance":
|
||||
password_hash => postgresql_password($instance, $db_pw),
|
||||
createdb => true,
|
||||
#require => Exec['utf8 postgres'],
|
||||
}
|
||||
|
||||
# NGINX
|
||||
# Run server
|
||||
service {'nginx':
|
||||
ensure => running,
|
||||
require => Package['nginx'],
|
||||
enable => true,
|
||||
}
|
||||
|
||||
if str2bool("$ssl") {
|
||||
$key_file_test = "test -e /etc/nginx/ssl/$instance.key"
|
||||
$key_file_cmd = "sudo openssl req -x509 -nodes -days 3650 -newkey rsa:2048 -keyout /etc/nginx/ssl/$instance.key -out /etc/nginx/ssl/$instance.crt -subj \"/C=AT/ST=Vienna/L=Vienna/O=Security/OU=IT-Department/CN=dummy\""
|
||||
$certname = "ssl_cert_$instance"
|
||||
exec { $certname:
|
||||
command => $key_file_cmd,
|
||||
unless => $key_file_test,
|
||||
path => ['/bin', '/sbin', '/usr/bin', '/usr/sbin'],
|
||||
notify => Service['nginx'],
|
||||
require => [Package[nginx], File['/etc/nginx/ssl']],
|
||||
}
|
||||
}
|
||||
|
||||
# Conf file
|
||||
file { "/etc/nginx/conf.d/odoo-$instance.conf":
|
||||
owner => 'www-data',
|
||||
group => 'www-data',
|
||||
mode => '0600',
|
||||
ensure => present,
|
||||
content => template('odoo/odoo.nginx.erb'),
|
||||
require => Package[nginx],
|
||||
notify => Service['nginx'],
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
server {
|
||||
listen 80 default_server;
|
||||
return 444;
|
||||
server_name _;
|
||||
}
|
||||
|
||||
|
||||
#server {
|
||||
# listen 443 ssl default_server;
|
||||
# return 444;
|
||||
# server_name _;
|
||||
|
||||
# THIS IS REQUIRED FOR SSL!!!!
|
||||
#ssl_certificate /etc/nginx/ssl/camadeus.at.crt;
|
||||
#ssl_certificate_key /etc/nginx/ssl/camadeus.at.key;
|
||||
#ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
|
||||
#ssl_ciphers HIGH:!aNULL:!MD5;
|
||||
|
||||
#}
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
/var/log/odoo/<%= @instance %>/*.log {
|
||||
copytruncate
|
||||
missingok
|
||||
notifempty
|
||||
size 5M
|
||||
rotate 10
|
||||
}
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
#!/bin/sh
|
||||
#dump the OpenERP DB (postgreSQL)
|
||||
#author: Camadeus GmbH
|
||||
|
||||
hostname=`/bin/hostname`
|
||||
|
||||
|
||||
dbnames=`psql -d postgres -c "SELECT datname FROM pg_database WHERE NOT datistemplate AND datname <> 'postgres' AND datname like '<%= @instance %>%'" --tuples-only`
|
||||
|
||||
# Dump DBs
|
||||
for db in $dbnames
|
||||
do
|
||||
echo "creating backup for db: " $db
|
||||
date=`date +"%Y%m%d_%H%M%N"`
|
||||
filename="/var/pgdump/<%= @instance %>/${hostname}_${db}_${date}.sql"
|
||||
pg_dump -E UTF-8 -F p -b -f $filename $db
|
||||
chmod 600 $filename
|
||||
gzip $filename
|
||||
done
|
||||
|
||||
|
||||
##########################################
|
||||
## Housekeeping
|
||||
##########################################
|
||||
for file in `find /var/pgdump/<%= @instance %> -mtime +30 -type f -name '*.sql.gz'`
|
||||
do
|
||||
echo "deleting: " $file
|
||||
rm $file
|
||||
done
|
||||
|
||||
|
||||
exit 0
|
||||
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
[options]
|
||||
addons_path = ~/ext/ext/custom-addons,~/ext/ext/odoo/addons,~/ext/ext/enterprise-addons
|
||||
admin_passwd = 9f8TTx34kk23
|
||||
|
||||
db_host = False
|
||||
db_name = False
|
||||
db_password = False
|
||||
db_port = False
|
||||
db_user = False
|
||||
|
||||
proxy_mode = True
|
||||
|
||||
debug_mode = False
|
||||
list_db = True
|
||||
log_level = info
|
||||
|
||||
#max_cron_threads = 1
|
||||
workers = 0
|
||||
|
||||
xmlrpc_interface = 127.0.0.1
|
||||
timezone = Europe/Brussels
|
||||
|
||||
# 5 min
|
||||
#limit_time_cpu = 300
|
||||
# 10 min
|
||||
#limit_time_real = 600
|
||||
|
||||
# input DMI:
|
||||
limit_time_cpu = 3000
|
||||
limit_time_real = 6000
|
||||
|
||||
# if DB > 150MB, otherwise "AccessDenied" error occurs
|
||||
# 10 GB
|
||||
limit_memory_hard = 10000000000
|
||||
|
|
@ -1,91 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: odoo-server-<%= @instance %>
|
||||
# Required-Start: $remote_fs $syslog
|
||||
# Required-Stop: $remote_fs $syslog
|
||||
# Should-Start: $network
|
||||
# Should-Stop: $network
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: Enterprise Resource Management software
|
||||
# Description: Open ERP is a complete ERP and CRM software.
|
||||
### END INIT INFO
|
||||
|
||||
PATH=/bin:/sbin:/usr/bin:/usr/local/bin
|
||||
DAEMON=/home/<%= @instance %>/ext/ext/odoo/odoo-bin
|
||||
NAME=odoo-server-<%= @instance %>
|
||||
DESC=odoo-server-<%= @instance %>
|
||||
WORKING_DIR=/home/<%= @instance %>/ext/ext/odoo
|
||||
|
||||
FILTER="^<%= @instance %>"
|
||||
# Specify the user name (Default: openerp).
|
||||
USER=<%= @instance %>
|
||||
|
||||
# Specify an alternate config file (Default: /etc/openerp-server.conf).
|
||||
CONFIGFILE="/home/<%= @instance %>/config/odoo-server.conf"
|
||||
|
||||
PIDFILE=/var/run/$NAME.pid
|
||||
LOGFILE=/var/log/odoo/<%= @instance %>/odoo-server.log
|
||||
|
||||
# Additional options that are passed to the Daemon.
|
||||
DAEMON_OPTS="-c $CONFIGFILE --db-filter $FILTER --xmlrpc-port <%= @odooport %> --longpolling-port <%= @odooport_longpolling %> --logfile $LOGFILE"
|
||||
|
||||
[ -x $DAEMON ] || exit 0
|
||||
[ -f $CONFIGFILE ] || exit 0
|
||||
|
||||
checkpid() {
|
||||
[ -f $PIDFILE ] || return 1
|
||||
pid=`cat $PIDFILE`
|
||||
[ -d /proc/$pid ] && return 0
|
||||
return 1
|
||||
}
|
||||
|
||||
# Required, otherwise there are problems with sudoers-File,
|
||||
# see file "Odoo_sudo_Startup_Error_20510316.odt" on Share
|
||||
export LOGNAME=<%= @instance %>
|
||||
|
||||
case "${1}" in
|
||||
start)
|
||||
echo -n "Starting ${DESC}: "
|
||||
|
||||
start-stop-daemon --start --quiet --pidfile ${PIDFILE} \
|
||||
--chuid ${USER} --background --make-pidfile \
|
||||
--exec ${DAEMON} -d $WORKING_DIR -- ${DAEMON_OPTS}
|
||||
|
||||
echo "${NAME}."
|
||||
;;
|
||||
|
||||
stop)
|
||||
echo -n "Stopping ${DESC}: "
|
||||
|
||||
start-stop-daemon --stop --quiet --pidfile ${PIDFILE} \
|
||||
--oknodo
|
||||
|
||||
echo "${NAME}."
|
||||
;;
|
||||
|
||||
restart|force-reload)
|
||||
echo -n "Restarting ${DESC}: "
|
||||
|
||||
start-stop-daemon --stop --quiet --pidfile ${PIDFILE} \
|
||||
--oknodo
|
||||
|
||||
sleep 1
|
||||
|
||||
start-stop-daemon --start --quiet --pidfile ${PIDFILE} \
|
||||
--chuid ${USER} --background --make-pidfile \
|
||||
--exec ${DAEMON} -d $WORKING_DIR -- ${DAEMON_OPTS}
|
||||
|
||||
echo "${NAME}."
|
||||
;;
|
||||
|
||||
*)
|
||||
N=/etc/init.d/${NAME}
|
||||
echo "Usage: ${NAME} {start|stop|restart|force-reload}" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
|
||||
|
|
@ -1,89 +0,0 @@
|
|||
<% if @ssl == true %>
|
||||
server {
|
||||
listen 80;
|
||||
server_name <%= @servername %>;
|
||||
return 301 https://$host$request_uri;
|
||||
}
|
||||
<% end %>
|
||||
|
||||
# Should be higher for DMI!
|
||||
upstream odoo-server-<%= @instance %> {
|
||||
server 127.0.0.1:<%= @odooport %> fail_timeout=3000s;
|
||||
}
|
||||
|
||||
upstream odoo-server-<%= @instance %>-long {
|
||||
server 127.0.0.1:<%= @odooport_longpolling %> fail_timeout=300s;
|
||||
}
|
||||
|
||||
server {
|
||||
<% if @ssl == true %>
|
||||
listen 443 ssl;
|
||||
<% else %>
|
||||
listen 80;
|
||||
<% end %>
|
||||
|
||||
server_name <%= @servername %>;
|
||||
|
||||
# Specifies the maximum accepted body size of a client request,
|
||||
# as indicated by the request header Content-Length.
|
||||
client_max_body_size 200m;
|
||||
|
||||
# log files
|
||||
access_log /var/log/nginx/odoo-access-<%= @instance %>.log;
|
||||
error_log /var/log/nginx/odoo-error-<%= @instance %>.log;
|
||||
|
||||
# increase proxy buffer to handle some OpenERP web requests
|
||||
proxy_buffers 16 64k;
|
||||
proxy_buffer_size 128k;
|
||||
|
||||
<% if @ssl == true %>
|
||||
# SSL config
|
||||
ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
|
||||
ssl_ciphers HIGH:!aNULL:!MD5;
|
||||
|
||||
<% if @servername =~ /.*datenpol.at$/ %>
|
||||
ssl_certificate /etc/nginx/ssl/datenpol.at.crt;
|
||||
ssl_certificate_key /etc/nginx/ssl/datenpol.at.key;
|
||||
<% else %>
|
||||
ssl_certificate /etc/nginx/ssl/<%= @instance %>.crt;
|
||||
ssl_certificate_key /etc/nginx/ssl/<%= @instance %>.key;
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
location / {
|
||||
proxy_pass http://odoo-server-<%= @instance %>;
|
||||
# force timeouts if the backend dies
|
||||
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503;
|
||||
proxy_read_timeout 300s;
|
||||
|
||||
# set headers
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forward-For $proxy_add_x_forwarded_for;
|
||||
|
||||
# Let the OpenERP web service know that we're using HTTPS, otherwise
|
||||
# it will generate URL using http:// and not https://
|
||||
# proxy_set_header X-Forwarded-Proto https;
|
||||
|
||||
# by default, do not forward anything
|
||||
proxy_redirect off;
|
||||
|
||||
location /longpollling {
|
||||
proxy_pass http://odoo-server-<%= @instance %>-long;
|
||||
}
|
||||
|
||||
|
||||
# cache some static data in memory for 60mins.
|
||||
# under heavy load this should relieve stress on the OpenERP web interface a bit.
|
||||
location ~* /web/static/ {
|
||||
proxy_cache_valid 200 60m;
|
||||
proxy_buffering on;
|
||||
expires 864000;
|
||||
proxy_pass http://odoo-server-<%= @instance %>;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
#!/bin/sh
|
||||
# info: restart Odoo server
|
||||
# author: datenpol gmbh
|
||||
|
||||
|
||||
LOGFILE=deployment-history.txt
|
||||
sudo /etc/init.d/odoo-server-<%= @instance %> restart
|
||||
echo "Restart `date`" >> $LOGFILE
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
#!/bin/bash
|
||||
# author: datenpol gmbh
|
||||
|
||||
LOGFILE=../deployment-history.txt
|
||||
|
||||
cd ext
|
||||
git pull
|
||||
git log --pretty=format:"%h - %an, %ad : %s" -1 >> $LOGFILE
|
||||
echo "" >> $LOGFILE
|
||||
|
|
@ -1 +0,0 @@
|
|||
class { 'odoo': }
|
||||
|
|
@ -1,47 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
|
||||
HOST='xxx.datenpol.at'
|
||||
PORT=22
|
||||
|
||||
if [ $# -lt 1 ] || [ $# -gt 1 ]; then
|
||||
echo "Usage: ./setup_server.sh <init|update>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Are you sure? [Press Y to confirm!]"
|
||||
read ANSWER
|
||||
|
||||
if [ "$ANSWER" != "Y" ]; then
|
||||
echo "Ok, good bye!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
TYPE=$1
|
||||
USER=root
|
||||
|
||||
if [ "$TYPE" = "init" ]; then
|
||||
ssh -p ${PORT} ${USER}@$HOST "apt-get update; apt-get install puppet;"
|
||||
ssh -p ${PORT} ${USER}@${HOST} "sudo apt-get install rsync"
|
||||
ssh -p ${PORT} ${USER}@${HOST} "sudo puppet module install puppetlabs-postgresql"
|
||||
ssh -p ${PORT} ${USER}@${HOST} "sudo puppet module install saz-sudo"
|
||||
ssh -p ${PORT} ${USER}@${HOST} "sudo puppet module install maestrodev-ssh_keygen"
|
||||
ssh -p ${PORT} ${USER}@${HOST} "sudo puppet module install puppetlabs-vcsrepo"
|
||||
ssh -p ${PORT} ${USER}@${HOST} "sudo puppet module install maestrodev-wget"
|
||||
|
||||
fi
|
||||
|
||||
if [ "$TYPE" = "update" ]; then
|
||||
USER=odoo
|
||||
fi
|
||||
|
||||
# Copy to server
|
||||
rsync -av -e "ssh -p ${PORT}" --copy-links "site.pp" "${USER}@${HOST}:/tmp/site.pp"
|
||||
rsync -arv -e "ssh -p ${PORT}" --copy-links "modules" "${USER}@${HOST}:/tmp"
|
||||
|
||||
ssh -p ${PORT} ${USER}@${HOST} "sudo mv -f /tmp/site.pp /etc/puppet/manifests/site.pp"
|
||||
# Achtung für Debian werden die Puppet-Module unter /etc/puppet/code/modules abgelegt
|
||||
ssh -p ${PORT} ${USER}@${HOST} "sudo rm -rf /etc/puppet/modules/odoo; sudo mv /tmp/modules/odoo /etc/puppet/modules; sudo rm -rf /tmp/modules"
|
||||
|
||||
ssh -p ${PORT} ${USER}@${HOST} "sudo puppet apply /etc/puppet/manifests/site.pp"
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
|
||||
node default {
|
||||
|
||||
odoo::instance {'TODO-prod':
|
||||
db_pw => 'x54ef6t77t6ZZul3',
|
||||
ssl => true,
|
||||
servername => 'TODO.datenpol.at',
|
||||
odooport => 8069,
|
||||
odooport_longpolling => 8070,
|
||||
gitrepo => 'TODO',
|
||||
gitbranch => 'master'
|
||||
}
|
||||
|
||||
odoo::instance {'TODO-test':
|
||||
db_pw => '9fd87sdfXXdfTs',
|
||||
ssl => true,
|
||||
servername => 'TODO.datenpol.at',
|
||||
odooport => 8169,
|
||||
odooport_longpolling => 8170,
|
||||
gitrepo => 'TODO',
|
||||
gitbranch => 'develop'
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue