Skip to content

Instantly share code, notes, and snippets.

@omega8cc
Created July 20, 2010 03:22
Show Gist options
  • Save omega8cc/482445 to your computer and use it in GitHub Desktop.
Save omega8cc/482445 to your computer and use it in GitHub Desktop.
diff -urp /var/backups/8/2/aegir/.drush/provision/aegir.make /var/aegir/.drush/provision/aegir.make
--- /var/backups/8/2/aegir/.drush/provision/aegir.make 2010-07-18 14:03:28.000000000 +0000
+++ /var/aegir/.drush/provision/aegir.make 2010-07-20 00:43:13.000000000 +0000
@@ -3,5 +3,5 @@ projects[] = "drupal"
projects[hostmaster][type] = "profile"
projects[hostmaster][download][type] = "git"
-projects[hostmaster][download][url] = "git://git.aegirproject.org/hostmaster.git"
+projects[hostmaster][download][url] = "git://github.com/omega8cc/hostmaster.git"
projects[hostmaster][download][branch] = "master"
Only in /var/aegir/.drush/provision: diff.txt
diff -urp /var/backups/8/2/aegir/.drush/provision/http/http.config.inc /var/aegir/.drush/provision/http/http.config.inc
--- /var/backups/8/2/aegir/.drush/provision/http/http.config.inc 2010-07-18 14:03:28.000000000 +0000
+++ /var/aegir/.drush/provision/http/http.config.inc 2010-07-20 00:43:13.000000000 +0000
@@ -101,6 +101,32 @@ class provisionConfig_http_site extends
return $this->data['http_vhostd_path'] . '/' . $this->uri;
}
+ function write() {
+ parent::write();
+
+ // We also leave a record of this IP in the site's drushrc.php
+ // This way we can pass the info back to the front end.
+ $ip_addresses = drush_get_option('site_ip_addresses', array(), 'site');
+
+ if ($this->data['ip_address'] != '*') {
+ $ip_addresses[$this->data['server']->name] = $this->data['ip_address'];
+ }
+ elseif (isset($context['site_ip_addresses'][$this->data['server']->name])) {
+ unset($ip_addresses[$this->data['server']->name]);
+ }
+ drush_set_option('site_ip_addresses', $ip_addresses, 'site');
+ }
+
+ function unlink() {
+ parent::unlink();
+
+ // We also remove the record of this IP in the site's drushrc.php
+ // This way we can pass the info back to the front end.
+ $ip_addresses = drush_get_option('site_ip_addresses', array(), 'site');
+ unset($ip_addresses[$this->data['server']->name]);
+ drush_set_option('site_ip_addresses', $ip_addresses, 'site');
+ }
+
function process() {
parent::process();
diff -urp /var/backups/8/2/aegir/.drush/provision/http/http.ssl.inc /var/aegir/.drush/provision/http/http.ssl.inc
--- /var/backups/8/2/aegir/.drush/provision/http/http.ssl.inc 2010-07-18 14:03:28.000000000 +0000
+++ /var/aegir/.drush/provision/http/http.ssl.inc 2010-07-20 00:43:13.000000000 +0000
@@ -64,13 +64,6 @@ class provisionService_http_ssl extends
else {
$data['ip_address'] = $ip;
- // We also leave a record of this IP in the site's drushrc.php
- // This way we can pass the info back to the front end.
- $context =& drush_get_context('site');
- if (!is_array($context['site_ip_addresses'])) {
- $context['site_ip_addresses'] = array();
- }
- $context['site_ip_addresses'][$this->server->name] = $ip;
}
}
}
@@ -340,11 +333,6 @@ class provisionConfig_http_ssl_site exte
'%site' => $this->uri,
'%server' => $this->data['server']->remote_host)));
-
- $ip_addresses = drush_get_option('site_ip_addresses', array(), 'site');
- unset($ip_addresses[$this->data['server']->name]);
- drush_set_option('site_ip_addresses', $ip_addresses, 'site');
-
$used = provisionService_http_ssl::certificate_in_use($this->ssl_key, $this->data['server']);
if (!$used) {
Only in /var/aegir/.drush/provision/http/nginx: nginx_advanced_include.conf
diff -urp /var/backups/8/2/aegir/.drush/provision/http/nginx/nginx.conf /var/aegir/.drush/provision/http/nginx/nginx.conf
--- /var/backups/8/2/aegir/.drush/provision/http/nginx/nginx.conf 2010-07-18 14:03:28.000000000 +0000
+++ /var/aegir/.drush/provision/http/nginx/nginx.conf 2010-07-20 00:43:13.000000000 +0000
@@ -1,28 +1,41 @@
###########################################################
-# This file should replace existing /etc/nginx/nginx.conf #
+# This is vanilla /etc/nginx/nginx.conf file +comments #
###########################################################
#
# HOW-TO:
#
# ln -s /var/aegir/config/nginx.conf /etc/nginx/conf.d/aegir.conf
-# ln -s /var/aegir/config/includes/fastcgi_params.conf /etc/nginx/fastcgi_params.conf
# sudo /etc/init.d/nginx restart
#
+# /etc/sudoers configuration:
+# aegir ALL=NOPASSWD: /etc/init.d/nginx
#
-# /etc/sudoers configuration::
-# aegir ALL=NOPASSWD: /etc/init.d/nginx
#
-#
-pid /var/run/nginx.pid;
-user www-data www-data;
-worker_processes 4;
-worker_rlimit_nofile 8192;
+user www-data;
+worker_processes 1;
+
+error_log /var/log/nginx/error.log;
+pid /var/run/nginx.pid;
events {
- worker_connections 4096;
- use epoll;
+ worker_connections 1024;
}
http {
- include /etc/nginx/conf.d/aegir.conf;
+ include /etc/nginx/mime.types;
+ default_type application/octet-stream;
+
+ access_log /var/log/nginx/access.log;
+
+ sendfile on;
+ #tcp_nopush on;
+
+ #keepalive_timeout 0;
+ keepalive_timeout 65;
+ tcp_nodelay on;
+
+ gzip on;
+
+ include /etc/nginx/conf.d/*.conf;
+ include /etc/nginx/sites-enabled/*;
}
diff -urp /var/backups/8/2/aegir/.drush/provision/http/nginx/nginx_service.inc /var/aegir/.drush/provision/http/nginx/nginx_service.inc
--- /var/backups/8/2/aegir/.drush/provision/http/nginx/nginx_service.inc 2010-07-18 14:03:28.000000000 +0000
+++ /var/aegir/.drush/provision/http/nginx/nginx_service.inc 2010-07-20 00:43:13.000000000 +0000
@@ -15,14 +15,28 @@ class provisionService_http_nginx extend
parent::init();
$this->configs['server'][] = 'provisionConfig_nginx_server';
$this->configs['site'][] = 'provisionConfig_nginx_site';
+
+ /**
+ * TODO: This is ugly, we need a different hook for save commands probably.
+ */
+ $command = drush_get_command();
+
+ if ($command['command'] == 'provision-save') {
+ // Check if some nginx features are supported and save them for later.
+ $this->server->shell_exec('nginx -V');
+ $this->server->nginx_has_gzip = preg_match("/(with-http_gzip_static_module)/", implode('', trim(drush_shell_exec_output())), $match);
+ $this->server->nginx_has_upload_progress = preg_match("/(nginx-upload-progress-module)/", implode('', trim(drush_shell_exec_output())), $match);
+ $this->server->nginx_has_new_version = preg_match("/(nginx\/0\.8\.)/", implode('', trim(drush_shell_exec_output())), $match);
+ }
+
}
function verify() {
if ($this->context->type === 'server') {
- provision_file()->copy(dirname(__FILE__) . '/nginx_include.conf', $this->server->include_path . '/nginx_include.conf');
- $this->sync($this->server->include_path . '/nginx_include.conf');
- provision_file()->copy(dirname(__FILE__) . '/fastcgi_params.conf', $this->server->include_path . '/fastcgi_params.conf');
- $this->sync($this->server->include_path . '/fastcgi_params.conf');
+ provision_file()->copy(dirname(__FILE__) . '/nginx_advanced_include.conf', $this->server->include_path . '/nginx_advanced_include.conf');
+ $this->sync($this->server->include_path . '/nginx_advanced_include.conf');
+ provision_file()->copy(dirname(__FILE__) . '/nginx_simple_include.conf', $this->server->include_path . '/nginx_simple_include.conf');
+ $this->sync($this->server->include_path . '/nginx_simple_include.conf');
}
// Call the parent at the end. it will restart the server when it finishes.
parent::verify();
Only in /var/aegir/.drush/provision/http/nginx: nginx_simple_include.conf
diff -urp /var/backups/8/2/aegir/.drush/provision/http/nginx/server.tpl.php /var/aegir/.drush/provision/http/nginx/server.tpl.php
--- /var/backups/8/2/aegir/.drush/provision/http/nginx/server.tpl.php 2010-07-18 14:03:28.000000000 +0000
+++ /var/aegir/.drush/provision/http/nginx/server.tpl.php 2010-07-20 00:43:13.000000000 +0000
@@ -4,10 +4,26 @@
### nginx.conf main
#######################################################
- ## MIME types & FastCGI params
- include /etc/nginx/fastcgi_params.conf;
- include /etc/nginx/mime.types;
- default_type application/octet-stream;
+ ## FastCGI params
+ fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
+ fastcgi_param QUERY_STRING $query_string;
+ fastcgi_param REQUEST_METHOD $request_method;
+ fastcgi_param CONTENT_TYPE $content_type;
+ fastcgi_param CONTENT_LENGTH $content_length;
+ fastcgi_param SCRIPT_NAME $fastcgi_script_name;
+ fastcgi_param REQUEST_URI $request_uri;
+ fastcgi_param DOCUMENT_URI $document_uri;
+ fastcgi_param DOCUMENT_ROOT $document_root;
+ fastcgi_param SERVER_PROTOCOL $server_protocol;
+ fastcgi_param GATEWAY_INTERFACE CGI/1.1;
+ fastcgi_param SERVER_SOFTWARE ApacheSolaris/$nginx_version;
+ fastcgi_param REMOTE_ADDR $remote_addr;
+ fastcgi_param REMOTE_PORT $remote_port;
+ fastcgi_param SERVER_ADDR $server_addr;
+ fastcgi_param SERVER_PORT $server_port;
+ fastcgi_param SERVER_NAME $server_name;
+ fastcgi_param REDIRECT_STATUS 200;
+ fastcgi_index index.php;
## Size Limits
client_body_buffer_size 64k;
@@ -21,33 +37,33 @@
## Timeouts
client_body_timeout 60;
client_header_timeout 60;
- keepalive_timeout 75 20;
send_timeout 60;
## General Options
ignore_invalid_headers on;
limit_zone gulag $binary_remote_addr 10m;
recursive_error_pages on;
- sendfile on;
## TCP options
- tcp_nodelay on;
tcp_nopush on;
## Compression
- gzip on;
gzip_buffers 16 8k;
gzip_comp_level 9;
gzip_http_version 1.1;
gzip_min_length 10;
gzip_types text/plain text/css image/png image/gif image/jpeg application/x-javascript text/xml application/xml application/xml+rss text/javascript image/x-icon;
gzip_vary on;
- gzip_static on;
gzip_proxied any;
gzip_disable "MSIE [1-6]\.";
-
- ## Upload Progress
- upload_progress uploads 1m;
+<?php
+if ($server->nginx_has_gzip) {
+ print ' gzip_static on\;';
+}
+if ($server->nginx_has_upload_progress) {
+ print ' upload_progress uploads 1m\;';
+}
+?>
## Log Format
log_format main '"$remote_addr" $host [$time_local] '
@@ -55,9 +71,9 @@
'$request_length $bytes_sent "$http_referer" '
'"$http_user_agent" $request_time "$gzip_ratio"';
- client_body_temp_path /var/cache/nginx/client_body_temp 1 2;
- access_log /var/log/nginx/access.log main;
- error_log /var/log/nginx/error.log crit;
+ client_body_temp_path /var/lib/nginx/body 1 2;
+ access_log /var/log/nginx/access.log main;
+ error_log /var/log/nginx/error.log crit;
#######################################################
@@ -66,20 +82,14 @@
server {
limit_conn gulag 10; # like mod_evasive - this allows max 10 simultaneous connections from one IP address
- listen <?php print $ip_address . ':' . $http_port; ?>;
-
+<?php foreach ($server->ip_addresses as $ip) : ?>
+ listen <?php print $ip . ':' . $http_port; ?>;
+<?php endforeach; ?>
server_name _;
-
location / {
root /var/www/nginx-default;
index index.html index.htm;
}
-
- error_page 500 502 503 504 /50x.html;
- location = /50x.html {
- root /var/www/nginx-default;
- }
-
}
#######################################################
diff -urp /var/backups/8/2/aegir/.drush/provision/http/nginx/vhost_disabled.tpl.php /var/aegir/.drush/provision/http/nginx/vhost_disabled.tpl.php
--- /var/backups/8/2/aegir/.drush/provision/http/nginx/vhost_disabled.tpl.php 2010-07-18 14:03:28.000000000 +0000
+++ /var/aegir/.drush/provision/http/nginx/vhost_disabled.tpl.php 2010-07-20 00:43:13.000000000 +0000
@@ -3,7 +3,6 @@ server {
server_name <?php print $this->uri; ?><?php if (is_array($this->aliases)) : foreach ($this->aliases as $alias_url) : if (trim($alias_url)) : ?> <?php print $alias_url; ?><?php endif; endforeach; endif; ?>;
root <?php print $this->root; ?>;
index index.php index.html;
-
location / {
root /var/www/nginx-default;
index index.html index.htm;
diff -urp /var/backups/8/2/aegir/.drush/provision/http/nginx/vhost.tpl.php /var/aegir/.drush/provision/http/nginx/vhost.tpl.php
--- /var/backups/8/2/aegir/.drush/provision/http/nginx/vhost.tpl.php 2010-07-18 14:03:28.000000000 +0000
+++ /var/aegir/.drush/provision/http/nginx/vhost.tpl.php 2010-07-20 00:43:13.000000000 +0000
@@ -1,11 +1,17 @@
-
server {
limit_conn gulag 10; # like mod_evasive - this allows max 10 simultaneous connections from one IP address
listen <?php print $ip_address . ':' . $http_port; ?>;
server_name <?php print $this->uri; ?><?php if (!$this->redirection && is_array($this->aliases)) : foreach ($this->aliases as $alias_url) : if (trim($alias_url)) : ?> <?php print $alias_url; ?><?php endif; endforeach; endif; ?>;
root <?php print $this->root; ?>;
index index.php index.html;
- include <?php print $server->include_path ?>/nginx_include.conf;
+<?php
+ if ($server->nginx_has_new_version || $server->nginx_has_upload_progress) {
+ print ' include ' . $server->include_path . '/nginx_advanced_include.conf';
+ }
+ else {
+ print ' include ' . $server->include_path . '/nginx_simple_include.conf';
+ }
+?>;
}
<?php
diff -urp /var/backups/8/2/aegir/.drush/provision/http/nginx_ssl/nginx_ssl_service.inc /var/aegir/.drush/provision/http/nginx_ssl/nginx_ssl_service.inc
--- /var/backups/8/2/aegir/.drush/provision/http/nginx_ssl/nginx_ssl_service.inc 2010-07-18 14:03:28.000000000 +0000
+++ /var/aegir/.drush/provision/http/nginx_ssl/nginx_ssl_service.inc 2010-07-20 00:43:13.000000000 +0000
@@ -45,14 +45,28 @@ class provisionService_http_nginx_ssl ex
// Replace the server config with our own. See the class for more info.
$this->configs['server'][] = 'provisionConfig_nginx_ssl_server';
$this->configs['site'][] = 'provisionConfig_nginx_ssl_site';
+
+ /**
+ * TODO: This is ugly, we need a different hook for save commands probably.
+ */
+ $command = drush_get_command();
+
+ if ($command['command'] == 'provision-save') {
+ // Check if some nginx features are supported and save them for later.
+ $this->server->shell_exec('nginx -V');
+ $this->server->nginx_has_gzip = preg_match("/(with-http_gzip_static_module)/", implode('', trim(drush_shell_exec_output())), $match);
+ $this->server->nginx_has_upload_progress = preg_match("/(nginx-upload-progress-module)/", implode('', trim(drush_shell_exec_output())), $match);
+ $this->server->nginx_has_new_version = preg_match("/(nginx\/0\.8\.)/", implode('', trim(drush_shell_exec_output())), $match);
+ }
+
}
function verify() {
if ($this->context->type === 'server') {
- provision_file()->copy(dirname(__FILE__) . '/nginx_include.conf', $this->server->include_path . '/nginx_include.conf');
- $this->sync($this->server->include_path . '/nginx_include.conf');
- provision_file()->copy(dirname(__FILE__) . '/fastcgi_params.conf', $this->server->include_path . '/fastcgi_params.conf');
- $this->sync($this->server->include_path . '/fastcgi_params.conf');
+ provision_file()->copy(dirname(__FILE__) . '/nginx_advanced_include.conf', $this->server->include_path . '/nginx_advanced_include.conf');
+ $this->sync($this->server->include_path . '/nginx_advanced_include.conf');
+ provision_file()->copy(dirname(__FILE__) . '/nginx_simple_include.conf', $this->server->include_path . '/nginx_simple_include.conf');
+ $this->sync($this->server->include_path . '/nginx_simple_include.conf');
}
// Call the parent at the end. it will restart the server when it finishes.
parent::verify();
diff -urp /var/backups/8/2/aegir/.drush/provision/http/nginx_ssl/server_ssl.tpl.php /var/aegir/.drush/provision/http/nginx_ssl/server_ssl.tpl.php
--- /var/backups/8/2/aegir/.drush/provision/http/nginx_ssl/server_ssl.tpl.php 2010-07-18 14:03:28.000000000 +0000
+++ /var/aegir/.drush/provision/http/nginx_ssl/server_ssl.tpl.php 2010-07-20 00:43:13.000000000 +0000
@@ -11,17 +11,9 @@ server {
<?php
endforeach;
?>
-
server_name _;
-
location / {
root /var/www/nginx-default;
index index.html index.htm;
}
-
- error_page 500 502 503 504 /50x.html;
- location = /50x.html {
- root /var/www/nginx-default;
- }
-
}
diff -urp /var/backups/8/2/aegir/.drush/provision/http/nginx_ssl/vhost_ssl.tpl.php /var/aegir/.drush/provision/http/nginx_ssl/vhost_ssl.tpl.php
--- /var/backups/8/2/aegir/.drush/provision/http/nginx_ssl/vhost_ssl.tpl.php 2010-07-18 14:03:28.000000000 +0000
+++ /var/aegir/.drush/provision/http/nginx_ssl/vhost_ssl.tpl.php 2010-07-20 00:43:13.000000000 +0000
@@ -14,7 +14,14 @@ server {
ssl_protocols SSLv2 SSLv3 TLSv1;
ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
ssl_prefer_server_ciphers on;
- include <?php print $server->include_path ?>/nginx_include.conf;
+<?php
+ if ($server->nginx_has_new_version || $server->nginx_has_upload_progress) {
+ print ' include ' . $server->include_path . '/nginx_advanced_include.conf';
+ }
+ else {
+ print ' include ' . $server->include_path . '/nginx_simple_include.conf';
+ }
+?>;
}
<?php endif; ?>
@@ -33,18 +40,11 @@ server {
server_name <?php print $this->uri; ?> <?php if (!$this->redirection && is_array($this->aliases)) : foreach ($this->aliases as $alias_url) : if (trim($alias_url)) : ?> <?php $alias_url = "." . $alias_url; ?> <?php print $alias_url; ?> <?php endif; endforeach; endif; ?>;
root <?php print $this->root; ?>;
index index.php index.html;
-
location / {
root /var/www/nginx-default;
index index.html index.htm;
rewrite ^/(.*)$ <?php print $ssl_redirect_url ?>/$1 permanent;
}
-
- error_page 500 502 503 504 /50x.html;
- location = /50x.html {
- root /var/www/nginx-default;
- }
-
}
<?php endif; ?>
Only in /var/backups/8/2/aegir/.drush/provision/http: nginx_ssl
diff -urp /var/backups/8/2/aegir/.drush/provision/platform/provision_drupal.drush.inc /var/aegir/.drush/provision/platform/provision_drupal.drush.inc
--- /var/backups/8/2/aegir/.drush/provision/platform/provision_drupal.drush.inc 2010-07-18 14:03:28.000000000 +0000
+++ /var/aegir/.drush/provision/platform/provision_drupal.drush.inc 2010-07-20 00:43:13.000000000 +0000
@@ -238,10 +238,18 @@ function _provision_find_profiles() {
$profile->filename = $file;
_provision_cvs_deploy($profile);
+
+ $profile->info = array();
+
+ $info_file = "./profiles/$name/$name.info";
+ if (file_exists($info_file)) {
+ $profile->info = provision_parse_info_file($info_file);
+ }
+
require_once($profile->filename);
$func = $profile->name . "_profile_details";
if (function_exists($func)) {
- $profile->info = $func();
+ $profile->info = array_merge($profile->info, $func());
}
$languages['en'] = 1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment