whimsical-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sam Ruby <ru...@apache.org>
Subject [whimsy.git] [1/1] Commit de7a1b3: rebase 'advanced' configuration on vhosts
Date Sat, 05 Mar 2016 21:08:16 GMT
Commit de7a1b3e1d29629982ce9134e45a58303b44a544:
    rebase 'advanced' configuration on vhosts


Branch: refs/heads/master
Author: Sam Ruby <rubys@intertwingly.net>
Committer: Sam Ruby <rubys@intertwingly.net>
Pusher: rubys <rubys@apache.org>

------------------------------------------------------------
DEVELOPMENT.md                                               | ++++++ ----------
www/test/vhost-generator.cgi                                 | ++++++++++++++ -
------------------------------------------------------------
89 changes: 51 additions, 38 deletions.
------------------------------------------------------------


diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md
index db85bc4..6e5dc2e 100644
--- a/DEVELOPMENT.md
+++ b/DEVELOPMENT.md
@@ -183,47 +183,33 @@ command `bundle install`.
 Advanced configuration
 ======================
 
-Note: these instructions are for Ubuntu.  Tailor as necessary for Mac OSX or
-Red Hat.
+Setting things up so that the **entire** whimsy website is available as
+a virtual host, complete with authentication:
 
-Setting things up so that the entire whimsy website is available as
-http://localhost/whimsy/:
-
-1. Add an alias
-
-        Alias /whimsy /srv/whimsy/www
-        <Directory /srv/whimsy/www>
-           Order allow,deny
-           Allow from all
-           Require all granted
-           Options Indexes FollowSymLinks MultiViews ExecCGI
-           MultiViewsMatch Any
-           DirectoryIndex index.html index.cgi
-           AddHandler cgi-script .cgi
-        </Directory>
-
-2. Configure `suexec` by editing `/etc/apache2/suexec/www-data`:
-
-        /srv
-        public_html
-
-3. Install passenger by running either running 
+1. Install passenger by running either running 
    `passenger-install-apache2-module` and following its instructions, or
    by visiting https://www.phusionpassenger.com/library/install/apache/install/oss/.
 
-4. Configure individual rack applications:
-
-        Alias /whimsy/board/agenda/ /srv/whimsy/www/board/agenda
-        <Location /whimsy/board/agenda>
-          PassengerBaseURI /whimsy/board/agenda
-          PassengerAppRoot /srv/whimsy/www/board/agenda
-          PassengerAppEnv development
-          Options -Multiviews
-        </Location>
-
-5. (Optional) run a service that will restart your passenger applications
-   whenever the source to that application is modified by creating a
-   `~/.config/upstart/whimsy-listener` file with the following contents:
+2. Visit [vhost-generator](https://whimsy.apache.org/test/vhost-generator) to
+   generate a custom a vhost definition, and to see which apache modules need
+   to be installed.
+
+   a. On Ubuntu, place the generated vhost definition into
+      `/etc/apache2/sites-available` and enable the site using `a2ensite`.
+      Enable the modules you need using `a2ensite`.  Restart the Apache httpd
+      web server using `service apache2 restart`.
+
+   b. On Mac OS/X, place the generated vhost definition into
+      `/private/etc/apache2/extra/httpd-vhosts.conf`.  Edit
+      `/etc/apache2/httpd.conf` and uncomment out the line that includes
+      `httpd-vhosts.conf`, and
+      enable the modules you need by uncommenting out the associated lines.
+      Restart the Apache httpd web server using `apachectl restart`.
+
+3. (Optional) run a service that will restart your passenger applications
+   whenever the source to that application is modified.  On Ubuntu, this is
+   done  by creating a `~/.config/upstart/whimsy-listener` file with the
+   following contents:
 
        description "listen for changes to whimsy applications"
        start on dbus SIGNAL=SessionNew
diff --git a/www/test/vhost-generator.cgi b/www/test/vhost-generator.cgi
index d67fc90..f7f49b4 100755
--- a/www/test/vhost-generator.cgi
+++ b/www/test/vhost-generator.cgi
@@ -6,12 +6,28 @@ require 'wunderbar'
 if ENV['REQUEST_METHOD'].upcase == 'POST'
   cgi = CGI.new
   cgi.out 'type' => 'text/plain' do
+    # extract parameters
     hostname = cgi.params['hostname'].first
     docroot = cgi.params['docroot'].first
 
+    # read live configuration
     conf = File.read(Dir['/etc/apache2/sites-available/*whimsy*.conf'].first)
 
-    conf[/<VirtualHost (.*)>/, 1] = hostname
+    # enable all interfaces
+    conf[/<VirtualHost (.*):\d+>/, 1] = '*'
+
+    # replace hostname
+    conf[/ServerName (.*)/, 1] = hostname
+
+    # don't override error or custom logs
+    conf[/()ErrorLog/, 1] = '# '
+    conf[/()CustomLog/, 1] = '# '
+
+    # disable Passenger Default user and group
+    conf[/()PassengerDefaultUser/, 1] = '# '
+    conf[/()PassengerDefaultGroup/, 1] = '# '
+
+    # global replace docroot
     conf.gsub! '/srv/whimsy', docroot.chomp('/')
 
     conf
@@ -31,6 +47,9 @@ _html do
     select {width: 3.06in}
     input[type=checkbox] {margin-left: 6em; width: 1em}
     input[type=submit] {margin-top: 0.5em; margin-left: 3em; width: 8em}
+
+    ul {padding: 0; display: flex; flex-wrap: wrap}
+    li {width: 10%; list-style-type: none; margin: 0 2em}
   }
 
   _form method: 'post' do
@@ -53,12 +72,20 @@ _html do
 
       _input type: 'submit', value: 'Submit'
     end
+
+    _h3 'Modules required'
+    _ul do
+      Dir['/etc/apache2/mods-enabled/*.conf'].sort.each do |conf|
+        _li File.basename(conf, '.conf')
+      end
+    end
   end
 
   _script %{
     var inputs = Array.prototype.slice.call(document.querySelectorAll("input"));
     var submit = document.querySelector("input[type=submit]");
 
+    // only enable submit button when all inputs are valid
     inputs.forEach(function(input) {
       input.addEventListener("input", function() {
         if (inputs.some(function(input) {

Mime
View raw message