Skip to content
Snippets Groups Projects
Commit 94f93f63 authored by Karim's avatar Karim
Browse files

Merge branch 'master' of git.ubicast.net:mediaserver/envsetup

parents a4545751 cb94715a
No related branches found
No related tags found
No related merge requests found
......@@ -25,16 +25,9 @@ def setup(interactive=True):
dir_path = utils.get_dir(__file__)
cmds = [
'apt-get install --yes nginx uwsgi uwsgi-plugin-python3',
'[ -f "/etc/nginx/conf.d/ssl.conf" ] || cp "%s/ssl.conf" "/etc/nginx/conf.d/ssl.conf"' % dir_path,
'[ -f "/etc/nginx/nginx.conf.back" ] || cp "/etc/nginx/nginx.conf" "/etc/nginx/nginx.conf.back"',
'cp "%s/nginx.conf" "/etc/nginx/nginx.conf"' % dir_path,
'cp "%s/mime.types" "/etc/nginx/mime.types"' % dir_path,
'cp "%s/uwsgi_params" "/etc/nginx/uwsgi_params"' % dir_path,
'rm -f /etc/nginx/sites-enabled/default',
]
hosts = list()
# Stats vhost (nginx_status for monitoring)
cmds.extend(vhost_write_cmds(dir_path, 'stats', 'localhost'))
# FTP: videos vhost
if os.path.exists('/var/www/videos'):
cmds.append('cp %s/crossdomain.xml /var/www/videos/crossdomain.xml' % dir_path)
......
types {
text/html html htm shtml;
text/css css;
text/xml xml rss;
text/mathml mml;
text/plain txt log md rst;
text/vnd.sun.j2me.app-descriptor jad;
text/vnd.wap.wml wml;
text/x-component htc;
image/gif gif;
image/jpeg jpeg jpg;
image/png png;
image/svg+xml svg;
image/tiff tif tiff;
image/vnd.wap.wbmp wbmp;
image/x-icon ico;
image/x-jng jng;
image/x-ms-bmp bmp;
application/atom+xml atom;
application/java-archive jar war ear;
application/javascript jsonp;
application/json json;
application/mac-binhex40 hqx;
application/msword doc;
application/pdf pdf;
application/postscript ps eps ai;
application/rtf rtf;
application/vnd.ms-excel xls;
application/vnd.ms-powerpoint ppt;
application/vnd.wap.wmlc wmlc;
application/vnd.wap.xhtml+xml xhtml;
application/x-7z-compressed 7z;
application/x-cocoa cco;
application/x-gzip gz tgz;
application/x-java-archive-diff jardiff;
application/x-java-jnlp-file jnlp;
application/x-javascript js;
application/x-makeself run;
application/x-mpegURL m3u8;
application/x-perl pl pm;
application/x-pilot prc pdb;
application/x-rar-compressed rar;
application/x-redhat-package-manager rpm;
application/x-sea sea;
application/x-shockwave-flash swf;
application/x-stuffit sit;
application/x-tar tar;
application/x-tcl tcl tk;
application/x-x509-ca-cert der pem crt;
application/x-xpinstall xpi;
application/x-xz xz;
application/zip zip;
application/octet-stream bin exe dll;
application/octet-stream deb;
application/octet-stream dmg;
application/octet-stream eot;
application/octet-stream iso img;
application/octet-stream msi msp msm;
audio/midi mid midi kar;
audio/mp4 m4a;
audio/mpeg mp3;
audio/ogg oga;
audio/x-realaudio ra;
video/3gpp 3gpp 3gp;
video/mp4 mp4 m4v;
video/mpeg mpeg mpg;
video/ogg ogv ogg;
video/quicktime mov;
video/webm webm;
video/x-flv flv;
video/x-mng mng;
video/x-ms-asf asx asf;
video/x-ms-wmv wmv;
video/x-msvideo avi;
}
\ No newline at end of file
#
# General settings
# This file was customized by the UbiCast company.
#
user nginx;
worker_processes 12;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
multi_accept on;
}
http {
##
# Basic Settings
##
# requêtes maximun par ip
limit_req_zone $binary_remote_addr zone=flood:10m rate=100r/s;
limit_req zone=flood burst=100 nodelay;
# connexions maximum par ip
limit_conn_zone $binary_remote_addr zone=ddos:10m;
limit_conn ddos 100;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 31;
types_hash_max_size 2048;
server_tokens off;
autoindex off;
# server_name_in_redirect off;
# Support very long vhost names
server_names_hash_max_size 1024;
server_names_hash_bucket_size 96;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# Logging Settings
##
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
##
# Gzip Settings
##
gzip on;
gzip_disable "msie6";
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_types text/plain text/css application/json application/x-javascript application/javascript text/xml application/xml application/xml+rss text/javascript image/svg+xml;
##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
ssl_certificate /etc/ssl/certs/ssl-cert-snakeoil.pem;
ssl_certificate_key /etc/ssl/private/ssl-cert-snakeoil.key;
# refs #16437
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ecdh_curve secp384r1;
ssl_session_cache shared:SSL:10m;
ssl_stapling on;
ssl_stapling_verify on;
add_header X-Content-Type-Options nosniff;
# Default settings
uwsgi_param QUERY_STRING $query_string;
uwsgi_param REQUEST_METHOD $request_method;
uwsgi_param CONTENT_TYPE $content_type;
uwsgi_param CONTENT_LENGTH $content_length;
uwsgi_param REQUEST_URI $request_uri;
uwsgi_param PATH_INFO $document_uri;
uwsgi_param DOCUMENT_ROOT $document_root;
uwsgi_param SERVER_PROTOCOL $server_protocol;
uwsgi_param UWSGI_SCHEME $scheme;
uwsgi_param REMOTE_ADDR $remote_addr;
uwsgi_param REMOTE_PORT $remote_port;
uwsgi_param SERVER_PORT $server_port;
uwsgi_param SERVER_NAME $server_name;
# Modified settings
uwsgi_param X_FORWARDED_PROTO $scheme;
uwsgi_param HTTPS $https if_not_empty;
uwsgi_read_timeout 300;
uwsgi_send_timeout 300;
client_max_body_size 5G;
server {
listen 127.0.0.1:80;
server_name localhost;
location /nginx_status {
stub_status on;
access_log off;
allow 127.0.0.1;
deny all;
}
}
......@@ -46,6 +46,7 @@ def clean_kernels():
version = m.groups()[2]
if version[-1] == '-':
version = version[:-1]
version = [int(v) for v in version.replace('-', '.').split('.')]
kernels.append((line.split('\t')[0], version))
log('Installed kernels:\n\t' + '\n\t'.join([n for n, v in kernels]))
# get current kernel
......@@ -57,22 +58,23 @@ def clean_kernels():
log(RED + 'Failed to get current kernel.' + DEFAULT + '\nOut: ' + out + '\nErr: ' + err, error=True)
return 1
try:
current = out.split(' ')[2]
if current.endswith('-generic'):
current = current[:-8]
current_str = out.split(' ')[2]
if current_str.endswith('-generic'):
current_str = current_str[:-8]
current = [int(v) for v in current_str.replace('-', '.').split('.')]
except Exception as e:
log(RED + 'Failed to get current kernel.' + DEFAULT + '\nError: ' + e, error=True)
return 1
log('Current kernel is: ' + PURPLE + current + DEFAULT)
log('Current kernel is: ' + PURPLE + current_str + DEFAULT)
# get most recent kernel
latest = current
for name, version in kernels:
if version > latest:
latest = version
# get kernel packages to purge
to_purge = list()
current_t = current.replace('-', '.').split('.')
latest = current_t
for name, version in kernels:
version_t = version.replace('-', '.').split('.')
if version_t > latest:
latest = version_t
elif version_t < latest and version != current:
if version < latest and version != current:
to_purge.append(name)
if not to_purge:
log('No kernel package to purge.')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment