Nginx and systemd configuration

This commit is contained in:
Jorge Enrique Gómez Gómez 2020-09-27 18:35:41 -05:00
parent de6f723bee
commit 1d6af3cd4f
6 changed files with 577 additions and 1 deletions

View File

@ -0,0 +1,363 @@
<!DOCTYPE html>
<html style="height: 100%">
<head>
<title>Error 502</title>
<style>
body,
html {
padding: 0;
margin: 0;
font-family: 'Quicksand', sans-serif;
font-weight: 400;
overflow: hidden;
}
.writing {
width: 320px;
height: 200px;
background-color: #3f3f3f;
border: 1px solid #bbbbbb;
border-radius: 6px 6px 4px 4px;
position: relative;
}
.writing .topbar{
position: absolute;
width: 100%;
height: 12px;
background-color: #f1f1f1;
border-top-left-radius: 4px;
border-top-right-radius: 4px;
}
.writing .topbar div{
height: 6px;
width: 6px;
border-radius: 50%;
margin: 3px;
float: left;
}
.writing .topbar div.green{
background-color: #60d060;
}
.writing .topbar div.red{
background-color: red;
}
.writing .topbar div.yellow{
background-color: #e6c015;
}
.writing .code {
padding: 15px;
}
.writing .code ul {
list-style: none;
margin: 0;
padding: 0;
}
.writing .code ul li {
background-color: #9e9e9e;
width: 0;
height: 7px;
border-radius: 6px;
margin: 10px 0;
}
.container {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
height: 100vh;
width: 100%;
-webkit-transition: -webkit-transform .5s;
transition: -webkit-transform .5s;
transition: transform .5s;
transition: transform .5s, -webkit-transform .5s;
}
.stack-container {
position: relative;
width: 420px;
height: 210px;
-webkit-transition: width 1s, height 1s;
transition: width 1s, height 1s;
}
.pokeup {
-webkit-transition: all .3s ease;
transition: all .3s ease;
}
.pokeup:hover {
-webkit-transform: translateY(-10px);
transform: translateY(-10px);
-webkit-transition: .3s ease;
transition: .3s ease;
}
.error {
width: 400px;
padding: 40px;
text-align: center;
}
.error h1 {
font-size: 125px;
padding: 0;
margin: 0;
font-weight: 700;
}
.error h2 {
margin: -30px 0 0 0;
padding: 0px;
font-size: 47px;
letter-spacing: 12px;
}
.perspec {
-webkit-perspective: 1000px;
perspective: 1000px;
}
.writeLine{
-webkit-animation: writeLine .4s linear forwards;
animation: writeLine .4s linear forwards;
}
.explode{
-webkit-animation: explode .5s ease-in-out forwards;
animation: explode .5s ease-in-out forwards;
}
.card {
-webkit-animation: tiltcard .5s ease-in-out 1s forwards;
animation: tiltcard .5s ease-in-out 1s forwards;
position: absolute;
}
@-webkit-keyframes tiltcard {
0% {
-webkit-transform: rotateY(0deg);
transform: rotateY(0deg);
}
100% {
-webkit-transform: rotateY(-30deg);
transform: rotateY(-30deg);
}
}
@keyframes tiltcard {
0% {
-webkit-transform: rotateY(0deg);
transform: rotateY(0deg);
}
100% {
-webkit-transform: rotateY(-30deg);
transform: rotateY(-30deg);
}
}
@-webkit-keyframes explode {
0% {
-webkit-transform: translate(0, 0) scale(1);
transform: translate(0, 0) scale(1);
}
100% {
-webkit-transform: translate(var(--spreaddist), var(--vertdist)) scale(var(--scaledist));
transform: translate(var(--spreaddist), var(--vertdist)) scale(var(--scaledist));
}
}
@keyframes explode {
0% {
-webkit-transform: translate(0, 0) scale(1);
transform: translate(0, 0) scale(1);
}
100% {
-webkit-transform: translate(var(--spreaddist), var(--vertdist)) scale(var(--scaledist));
transform: translate(var(--spreaddist), var(--vertdist)) scale(var(--scaledist));
}
}
@-webkit-keyframes writeLine {
0% {
width:0;
}
100% {
width: var(--linelength);
}
}
@keyframes writeLine {
0% {
width:0;
}
100% {
width: var(--linelength);
}
}
@media screen and (max-width: 1000px) {
.container {
-webkit-transform: scale(.85);
transform: scale(.85);
}
}
@media screen and (max-width: 850px) {
.container {
-webkit-transform: scale(.75);
transform: scale(.75);
}
}
@media screen and (max-width: 775px) {
.container {
-ms-flex-wrap: wrap-reverse;
flex-wrap: wrap-reverse;
-webkit-box-align: inherit;
-ms-flex-align: inherit;
align-items: inherit;
}
}
@media screen and (max-width: 370px) {
.container {
-webkit-transform: scale(.6);
transform: scale(.6);
}
}
</style>
</head>
<body>
<div class="container">
<div class="error">
<h1>Error</h1>
<h2>502</h2>
<p>Falla en la aplicación</p>
</div>
<div class="stack-container">
<div class="card-container">
<div class="perspec" style="--spreaddist: 125px; --scaledist: .75; --vertdist: -25px;">
<div class="card">
<div class="writing">
<div class="topbar">
<div class="red"></div>
<div class="yellow"></div>
<div class="green"></div>
</div>
<div class="code">
<ul>
</ul>
</div>
</div>
</div>
</div>
</div>
<div class="card-container">
<div class="perspec" style="--spreaddist: 100px; --scaledist: .8; --vertdist: -20px;">
<div class="card">
<div class="writing">
<div class="topbar">
<div class="red"></div>
<div class="yellow"></div>
<div class="green"></div>
</div>
<div class="code">
<ul>
</ul>
</div>
</div>
</div>
</div>
</div>
<div class="card-container">
<div class="perspec" style="--spreaddist:75px; --scaledist: .85; --vertdist: -15px;">
<div class="card">
<div class="writing">
<div class="topbar">
<div class="red"></div>
<div class="yellow"></div>
<div class="green"></div>
</div>
<div class="code">
<ul>
</ul>
</div>
</div>
</div>
</div>
</div>
<div class="card-container">
<div class="perspec" style="--spreaddist: 50px; --scaledist: .9; --vertdist: -10px;">
<div class="card">
<div class="writing">
<div class="topbar">
<div class="red"></div>
<div class="yellow"></div>
<div class="green"></div>
</div>
<div class="code">
<ul>
</ul>
</div>
</div>
</div>
</div>
</div>
<div class="card-container">
<div class="perspec" style="--spreaddist: 25px; --scaledist: .95; --vertdist: -5px;">
<div class="card">
<div class="writing">
<div class="topbar">
<div class="red"></div>
<div class="yellow"></div>
<div class="green"></div>
</div>
<div class="code">
<ul>
</ul>
</div>
</div>
</div>
</div>
</div>
<div class="card-container">
<div class="perspec" style="--spreaddist: 0px; --scaledist: 1; --vertdist: 0px;">
<div class="card">
<div class="writing">
<div class="topbar">
<div class="red"></div>
<div class="yellow"></div>
<div class="green"></div>
</div>
<div class="code">
<ul>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,11 @@
/var/log/odoo/*.log {
daily
dateext
dateyesterday
rotate 30
compress
delaycompress
copytruncate
missingok
notifempty
}

View File

@ -0,0 +1,73 @@
pstream odoo8 {
server 127.0.0.1:8090 weight=1 fail_timeout=0;
}
upstream odoo8-im {
server 127.0.0.1:8082 weight=1 fail_timeout=0;
}
server {
# server port and name
listen 80;
server_name _;
# Specifies the maximum accepted body size of a client request,
# as indicated by the request header Content-Length.
client_max_body_size 200m;
ssl off;
# increase proxy buffer to handle some Odoo web requests
proxy_buffers 16 64k;
proxy_buffer_size 128k;
# force timeouts if the backend dies
proxy_connect_timeout 180m;
proxy_send_timeout 180m;
proxy_read_timeout 180m;
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503;
gzip on;
gzip_min_length 1100;
gzip_buffers 4 32k;
gzip_types text/plain application/x-javascript text/xml text/css;
gzip_vary on;
# 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;
# by default, do not forward anything
proxy_redirect off;
proxy_buffering off;
error_page 502 /custom_502.html;
location = /custom_502.html {
root /usr/share/nginx/html;
internal;
}
location / {
proxy_pass http://odoo8;
}
location /longpolling {
proxy_pass http://odoo8-im;
}
# Cache some static data in memory for 2 hours.
# Under heavy load this should relieve stress on the Odoo web interface
location /web/static/ {
proxy_cache_valid 200 120m;
proxy_buffering on;
expires 864000;
proxy_pass http://odoo8;
}
location /website/static/ {
proxy_cache_valid 200 120m;
proxy_buffering on;
expires 864000;
proxy_pass http://odoo8;
}
}

View File

@ -0,0 +1,47 @@
[options]
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Configuracion Odoo para Agofer
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
; Contrasena para administracion de base de datos:
admin_passwd = 928333333333333333nc4046564565787444444444444444686783489u394d835n03984mw0d38$
db_user = odoo
db_name = Agofer
list_db = True
dbfilter = ^Agofer$
addons_path = /opt/odoo_agofer/addons,/opt/v8_agofer,/opt/aeroo_report,/opt/contrib
without_demo = True
test_enable = False
timezone = America/Bogota
unaccent = True
#-----------------------------------------------------------------------------
# Registro
#-----------------------------------------------------------------------------
# syslog = True
logfile = /var/log/odoo/odoo-server.log
logrotate = False
# ['debug_rpc_answer', 'debug_rpc', 'debug', 'debug_sql',
# 'info', 'warn', 'error', 'critical']
log_level = warn
#-----------------------------------------------------------------------------
# Rendimiento
#-----------------------------------------------------------------------------
#osv_memory_age_limit = 0.5
workers = 4
limit_time_cpu = 12000
limit_time_real = 24000
limit-memory-soft = 8053063680
limit-memory-hard = 9395240960
#-----------------------------------------------------------------------------
# Acceso
#-----------------------------------------------------------------------------
proxy_mode = True
xmlrpcs = False
longpolling_port = 8082
xmlrpc_port = 8090
xmlrpc_interface = 127.0.0.1
netrpc_interface = 127.0.0.1

View File

@ -0,0 +1,16 @@
[Unit]
Description=Odoo
Requires=postgresql.service
After=network.target postgresql.service
[Service]
Type=simple
SyslogIdentifier=odoo
PermissionsStartOnly=true
User=odoo
Group=odoo
ExecStart=/home/odoo/.virtualenvs/odoo/bin/python /opt/odoo_agofer/openerp-server -c /etc/odoo_agofer-server.conf
StandardOutput=journal+console
[Install]
WantedBy=multi-user.target

View File

@ -60,9 +60,15 @@
- name: Clone current Odoo code - name: Clone current Odoo code
git: git:
repo: 'ssh://git@gitea.agofer.net:22001/Agofer/odoo_running_code.git' repo: 'ssh://git@gitea.agofer.net:22001/Agofer/odoo_running_code.git'
dest: /home/odoo/src/odoo dest: /opt
depth: 1 depth: 1
- name: Install python requirements for Odoo
pip:
virtualenv: /home/odoo/.virtualenvs/odoo
virtualenv_python: python2.7
requirements: /opt/odoo_agofer/requirements.txt
- name: Download and install wkhtmltopdf - name: Download and install wkhtmltopdf
apt: apt:
deb: https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.bionic_amd64.deb deb: https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.bionic_amd64.deb
@ -126,3 +132,63 @@
db: Agofer db: Agofer
path_to_script: /home/odoo/remove_remote_connections.sql path_to_script: /home/odoo/remove_remote_connections.sql
- name: Install Aeroo libs
pip:
virtualenv: /home/odoo/.virtualenvs/odoo
virtualenv_python: python2.7
name: 'git+https://github.com/aeroo/aeroolib.git@py2.x'
- name: Configure Odoo log rotation
copy:
src: logrotate
dest: /etc/logrotate.d/odoo
mode: '0644'
- name: Configure Nginx
copy:
src: custom_502.html
dest: /etc/nginx/custom_502.html
mode: '0644'
- copy:
src: nginx.conf
dest: /etc/nginx/sites-available/odoo8
mode: '0644'
- file:
state: link
src: /etc/nginx/sites-available/odoo8
dest: /etc/nginx/sites-enabled/odoo8
- file:
state: link
src: /etc/nginx/custom_502.html
dest: /usr/share/nginx/html/custom_502.html
- file:
state: absent
path: /etc/nginx/sites-enabled/default
- name: Restart Nginx
systemd:
name: nginx
state: restarted
- name: Configure Odoo
copy:
src: odoo.conf
dest: /etc/odoo_agofer-server.conf
mode: '0640'
owner: odoo
group: odoo
- copy:
src: systemd_unit
dest: /etc/systemd/system/odoo.service
- name: Enable and restart Odoo service
systemd:
name: odoo
enabled: true
state: started