From 49a54c0a60add6e072ff5c5790d6633ac3749109 Mon Sep 17 00:00:00 2001 From: Melpa Date: Sun, 14 Sep 2014 03:58:33 -0700 Subject: [PATCH] add stable configuration --- cfg/etc/{etc => }/nginx/sites-available/melpa | 0 cfg/etc/nginx/sites-available/melpa-stable | 70 ++++++++++++++ cfg/home/etc/nginx-stable | 92 +++++++++++++++++++ cfg/home/service/builder-stable/run | 25 +++++ cfg/home/service/nginx-stable/run | 4 + cfg/home/service/process_log-stable/run | 8 ++ cfg/home/service/reporter-stable/run | 24 +++++ cfg/home/service/syncer-stable/run | 15 +++ 8 files changed, 238 insertions(+) rename cfg/etc/{etc => }/nginx/sites-available/melpa (100%) create mode 100644 cfg/etc/nginx/sites-available/melpa-stable create mode 100644 cfg/home/etc/nginx-stable create mode 100755 cfg/home/service/builder-stable/run create mode 100755 cfg/home/service/nginx-stable/run create mode 100755 cfg/home/service/process_log-stable/run create mode 100755 cfg/home/service/reporter-stable/run create mode 100755 cfg/home/service/syncer-stable/run diff --git a/cfg/etc/etc/nginx/sites-available/melpa b/cfg/etc/nginx/sites-available/melpa similarity index 100% rename from cfg/etc/etc/nginx/sites-available/melpa rename to cfg/etc/nginx/sites-available/melpa diff --git a/cfg/etc/nginx/sites-available/melpa-stable b/cfg/etc/nginx/sites-available/melpa-stable new file mode 100644 index 00000000..e1698859 --- /dev/null +++ b/cfg/etc/nginx/sites-available/melpa-stable @@ -0,0 +1,70 @@ +# You may add here your +# server { +# ... +# } +# statements for each of your virtual hosts to this file + +## +# You should look at the following URL's in order to grasp a solid understanding +# of Nginx configuration files in order to fully unleash the power of Nginx. +# http://wiki.nginx.org/Pitfalls +# http://wiki.nginx.org/QuickStart +# http://wiki.nginx.org/Configuration +# +# Generally, you will want to move this file somewhere, and start with a clean +# file but keep this around for reference. Or just disable in sites-enabled. +# +# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples. +## + +server { + server_name hiddencameras.milkbox.net; + rewrite ^ $scheme://melpa-stable.milkbox.net$request_uri? permanent; +} + +server { + listen 80; ## listen for ipv4; this line is default and implied + #listen [::]:80 default ipv6only=on; ## listen for ipv6 + + root /usr/share/nginx/www; + + # Make site accessible from http://localhost/ + server_name localhost; + server_name *.milkbox.net; + + # proxy to Apache 2 and mod_python + location / { + proxy_pass http://127.0.0.1:1337/; + proxy_redirect off; + chunked_transfer_encoding off; + + gzip on; + gzip_disable "msie6|Emacs"; + + gzip_vary on; + gzip_proxied any; + gzip_comp_level 6; + gzip_buffers 16 8k; + gzip_http_version 1.1; + gzip_types text/plain text/xhtml text/css text/js text/csv application/javascript application/x-javascript application/json application/xml text/xml application/atom+xml application/rss+xml; + + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_max_temp_file_size 0; + + client_max_body_size 10m; + client_body_buffer_size 128k; + + proxy_connect_timeout 90; + proxy_send_timeout 90; + proxy_read_timeout 90; + + proxy_buffer_size 4k; + proxy_buffers 4 32k; + proxy_busy_buffers_size 64k; + proxy_temp_file_write_size 64k; + } +} + + diff --git a/cfg/home/etc/nginx-stable b/cfg/home/etc/nginx-stable new file mode 100644 index 00000000..1920a365 --- /dev/null +++ b/cfg/home/etc/nginx-stable @@ -0,0 +1,92 @@ +worker_processes 4; +pid /home/melpa/var/run/nginx.pid; +# error_log /dev/null crit; +daemon off; + +events { + worker_connections 768; + # multi_accept on; +} + +http { + ## + # Basic Settings + ## + + sendfile on; + tcp_nopush on; + tcp_nodelay on; + keepalive_timeout 65; + types_hash_max_size 2048; + server_tokens off; + + # server_names_hash_bucket_size 64; + server_name_in_redirect off; + + charset utf-8; + + include /etc/nginx/mime.types; + default_type application/octet-stream; + + ## + # Logging Settings + ## + access_log /home/melpa/log/melpa.access.log combined; + error_log /home/melpa/log/melpa.error.log info; + set_real_ip_from 127.0.0.1; + real_ip_header X-Forwarded-For; + + + ## + # Gzip Settings + ## + + gzip off; + 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/xhtml text/css text/js text/csv application/javascript application/x-javascript application/json application/xml text/xml application/atom+xml application/rss+xml; + + ## + # nginx-naxsi config + ## + # Uncomment it if you installed nginx-naxsi + ## + + #include /etc/nginx/naxsi_core.rules; + + ## + # nginx-passenger config + ## + # Uncomment it if you installed nginx-passenger + ## + + #passenger_root /usr; + #passenger_ruby /usr/bin/ruby; + + ## + # Virtual Host Configs + ## + + server { + server_name melpa-stable.milkbox.net; + server_tokens off; + server_name_in_redirect off; + + root /home/melpa/www; + + listen 1337; + + error_page 500 502 503 504 /50x.html; + location = /50x.html { + root /var/www/nginx-default; + } + + } + + +} + diff --git a/cfg/home/service/builder-stable/run b/cfg/home/service/builder-stable/run new file mode 100755 index 00000000..356c0d63 --- /dev/null +++ b/cfg/home/service/builder-stable/run @@ -0,0 +1,25 @@ +#!/bin/bash -e + +export HOME=/home/melpa +cd ${HOME}/melpa + +export MELPA_BRANCH=master +export STABLE=t + +source $HOME/melpa/scripts/env + +## git pull +cd ${MELPA_HOME} +git fetch origin +git checkout ${MELPA_BRANCH} +git reset --hard origin/${MELPA_BRANCH} +git pull origin ${MELPA_BRANCH} +echo + +# Build all the packages. +scripts/parallel_build_all + +echo '{"completed":' `date "+%s"` '}' > /home/melpa/www/build-status.json + +# Sleep for an hour before rebuilding. +sleep 1h diff --git a/cfg/home/service/nginx-stable/run b/cfg/home/service/nginx-stable/run new file mode 100755 index 00000000..0e5c2e39 --- /dev/null +++ b/cfg/home/service/nginx-stable/run @@ -0,0 +1,4 @@ +#!/bin/bash -e + +exec /usr/sbin/nginx -g 'error_log /dev/null crit;' -c ~/etc/nginx + diff --git a/cfg/home/service/process_log-stable/run b/cfg/home/service/process_log-stable/run new file mode 100755 index 00000000..f74dca9e --- /dev/null +++ b/cfg/home/service/process_log-stable/run @@ -0,0 +1,8 @@ +#!/bin/bash -e + +cd /home/melpa/melpa +/usr/bin/python /home/melpa/melpa/scripts/process_log.py + +/usr/sbin/logrotate -s /home/melpa/var/lib/logrotate/status /home/melpa/etc/logrotate + +sleep 6h diff --git a/cfg/home/service/reporter-stable/run b/cfg/home/service/reporter-stable/run new file mode 100755 index 00000000..0305397c --- /dev/null +++ b/cfg/home/service/reporter-stable/run @@ -0,0 +1,24 @@ +#!/bin/bash -e + +# Service for reporting missing and old packages. + +export HOME=/home/melpa + +BODY=`mktemp` + +cd ${HOME}/melpa + +echo "To: MP " > ${BODY} +echo "Subject: [MELPA] `date "+%Y%m%d %H:%M %z"`" >> ${BODY} +echo >> ${BODY} +echo "# Old Packages" >> ${BODY} +echo >> ${BODY} +emacs --no-site-file --batch -l package-build.el --eval '(setq package-archive-dir (expand-file-name "packages-stable" pb/this-dir)))' scripts/expired >> ${BODY} +echo >> ${BODY} +echo "# Missing Packages" >> ${BODY} +echo >> ${BODY} +emacs --no-site-file --batch -l package-build.el --eval '(setq package-archive-dir (expand-file-name "packages-stable" pb/this-dir)))' sscripts/missing >> ${BODY} + +/usr/sbin/sendmail -t < ${BODY} + +sleep 12h diff --git a/cfg/home/service/syncer-stable/run b/cfg/home/service/syncer-stable/run new file mode 100755 index 00000000..2d1c75ba --- /dev/null +++ b/cfg/home/service/syncer-stable/run @@ -0,0 +1,15 @@ +#!/bin/bash -e + +export STABLE=t + +export HOME=/home/melpa +cd ${HOME}/melpa +[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" + +make cleanup +make json +make html +make sync + +# Sync every 5 minutes. +sleep 5m