From 1e0a5106d8108cc7967b2cbcc187feb19be0c510 Mon Sep 17 00:00:00 2001 From: Chris Koeritz Date: Thu, 16 Nov 2017 20:51:35 -0500 Subject: [PATCH] tastier yet --- .../docs/manual/cakelampvm_guide_v002.html | 68 +++++++++++++------ 1 file changed, 48 insertions(+), 20 deletions(-) diff --git a/production/sites/cakelampvm.com/docs/manual/cakelampvm_guide_v002.html b/production/sites/cakelampvm.com/docs/manual/cakelampvm_guide_v002.html index 279fd5f3..25811392 100644 --- a/production/sites/cakelampvm.com/docs/manual/cakelampvm_guide_v002.html +++ b/production/sites/cakelampvm.com/docs/manual/cakelampvm_guide_v002.html @@ -227,48 +227,76 @@ meow

Adding a new website and domain on the guest VM

+

Note: these instructions, even the quick approaches below, pale in + comparison to the ease of use of the "standup" command in feisty meow's + site avenger scripts.  The standup command is detailed in the feisty + meow command reference document.  These instructions are for + situations when the domain or site is idiosyncratic in some way that + standup doesn't support.

To add a new website, you will first need to pick one of the DNS options - below (A or B) depending on how you want to name the site.

+ below (A or B) depending on how you want to name the site.  If the + DNS name of the site is contained within another existing domain (e.g., + "A.B.C" has subdomain A contained in domain B.C), use Option A.  If + the DNS name is a so-called "Second Level Domain" (SLD), then it stands on + its own (e.g., "B.C" is an SLD).

+

Once the DNS option has been picked and implemented, continue to the next + section of "Creating a New Apache Site".

+

DNS Option A: Adding a sub-domain in an existing domain

Let us say a customer needs an application called "excalibur".  It will be a new subdomain within an existing domain, such as the "cakelampvm.com" domain, meaning we want the VM to start answering requests for "excalibur.cakelampvm.com".

-

DNS Option A: Adding a sub-domain in an existing domain

Note that this option requires the containing domain "cakelampvm.com" to already exist before adding the subdomain; see DNS Option B below for details on how to add a containing domain for the first time. -

Quick approach: Use the feisty meow add_domain command.

+

Quick approach: Use the feisty meow "add_domain" command.

+

Connect to the cakelampvm via ssh as the developer user, e.g.: ssh + developer@cakelampvm.com

Run this command in a bash shell on the VM:

-
add_domain excalibur.cakelampvm.com
+
# add_domain excalibur.cakelampvm.com

Done.

Manual approach: Edit the bind9 configuration.

+

Note: the manual approach is not compatible with later use of feisty + meow's "remove_domain".

Connect to the cakelampvm via ssh as the developer user, e.g.: ssh developer@cakelampvm.com

Execute the following command to edit the DNS file for the cakelampvm domain:

-
sudo vi /etc/bind/cakelampvm.com.conf
+
# sudo vi /etc/bind/cakelampvm.com.conf

Add a stanza for the new site at the end of this file:

-
greatsite.cakelampvm.com    IN A    10.28.42.20
        IN HINFO "linux server" "ubuntu"
-

Restart the DNS server: sudo service bind9 restart

-

Afterwards, pinging greatsite.cakelampvm.com should work from either the - guest or the host.

+
excalibur.cakelampvm.com    IN A    10.28.42.20
        IN HINFO "linux server" "ubuntu"
+

Restart the DNS server:

+
# sudo service bind9 restart
+

Afterwards, pinging excalibur.cakelampvm.com should work from both the + guest VM and the host PC.

DNS Option B: Using an entirely new domain for the site

-

Similar procedure to above, but we will create a new file for the new - domain and add it to the bind directory.  For this example, we will - create a file called /etc/bind/greatsite.tv.conf for our new domain - greatsite.tv with these contents:

-
$TTL 1W
@       IN SOA          @       fred.cakelampvm.com. (
                        2017100801      ; serial
                        2H              ; refresh
                        8M              ; retry
                        14D             ; expiry
                        6H )            ; minimum

        IN NS           ns.cakelampvm.com.
        IN MX   10      mail.cakelampvm.com.

# main domain for machine.
greatsite.tv.                 IN A            10.28.42.20
                              IN HINFO        "linux server" "ubuntu"
- The gnarly prefix stuff above the "greatsite.tv." listing establishes +

This is a similar procedure to Option A, but we will create a totally new + config file for the new domain and add it to the bind directory.  For + this example, we need to add the site "excalibur.tv" into the DNS.

+

Quick approach: Use the feisty meow "add_domain" command.

+

Connect to the cakelampvm via ssh as the developer user, e.g.: ssh + developer@cakelampvm.com

+

Run this command in a bash shell on the VM:

+
# add_domain excalibur.tv
+

Done.

+

Manual approach: Edit a new DNS config file

+

Create a file called /etc/bind/excalibur.tv.conf for our new domain + excalibur.tv with these contents:

+
$TTL 1W
@       IN SOA          @       fred.cakelampvm.com. (
                        2017100801      ; serial
                        2H              ; refresh
                        8M              ; retry
                        14D             ; expiry
                        6H )            ; minimum

        IN NS           ns.cakelampvm.com.
        IN MX   10      mail.cakelampvm.com.

# main domain for machine.
excalibur.tv.                 IN A            10.28.42.20
                              IN HINFO        "linux server" "ubuntu"
+ The gnarly prefix stuff above the "excalibur.tv." listing establishes configuration info for the new domain.  This file relies on the existing cakelampvm.com infrastructure in DNS, such as the "ns" host, which - is the domain's name server. + is the domain's name server.  However, the new domain does not + live inside the cakelampvm.com domain.

Now that the config file is in place, edit "named.conf.local" to add the new file by adding this bit of configuration at the end:

-
zone "greatsite.tv" in {
        file "/etc/bind/greatsite.tv.conf";
        type master;
        allow-query { any; };
};
-

Restart the DNS server: sudo service bind9 restart

-

Afterwards, pinging greatsite.tv should work from either the guest or the +

zone "excalibur.tv" in {
        file "/etc/bind/excalibur.tv.conf";
        type master;
        allow-query { any; };
};
+

Restart the DNS server:

+
# sudo service bind9 restart
+

Afterwards, pinging excalibur.tv should work from both the guest and the host.

-

Create a new apache configuration file and load it

+

Creating a New Apache site

Start with the following template file for the new website, and modify it for the appropriate host name:

<VirtualHost *:80>
    ServerName greatsite.cakelampvm.com
    ServerAlias greatsite.cakelampvm.com *.greatsite.cakelampvm.com
    DocumentRoot /var/www/greatsite
    ErrorLog ${APACHE_LOG_DIR}/greatsite.cakelampvm.com-error.log
    CustomLog ${APACHE_LOG_DIR}/greatsite.cakelampvm.com-access.log combined
    Alias /statistics "/var/www/webwork.repository/webwork/maps_demo/webroot/statistics"
    Include /etc/apache2/conf-library/basic-options.conf
    Include /etc/apache2/conf-library/rewrite-enabling.conf
</VirtualHost>
-- 2.34.1