Differences between revisions 4 and 5
Deletions are marked like this. Additions are marked like this.
Line 11: Line 11:
== Configure DNS Names ==

 1. C
onfigure new DNS names in the Puppet server mgt.vh01.softxs.ch.
 1. DNS configuration is performed on the Puppet server mgt.vh01.softxs.ch
Line 17: Line 15:
cd /etc/puppet/modules/bind9/files

# -- Edit the following two files

vi master/zones/all/{domain_name}.
# Update the 'Serial' with today's date and the sequence number, normally '01'.
cd /etc/puppet
  }}}

 1. Configure new DNS names. As ''root'' on the Puppet server

  {{{
cd /etc/puppet/modules/bind9/files/master

# -- Edit the following two files:

vi zones/all/{domain_name}.
# Update the 'Serial' with today's date and the sequence number (normally '01')
Line 25: Line 29:
vi master/generic/all/{domain_name}. vi generic/all/{domain_name}.
Line 30: Line 34:
== Test DNS Names ==

 1
. Make sure the new DNS name is defined on the all following DNS server:
    1. zg-1.softxs.ch - Public server
    1. zg-3.softxs.ch - Public server
    1. loki.softxs.ch - LU DMZ
    1. odin.softxs.ch - LU DMZ
    1. modi.softxs.ch - LU Internal network
 1. Test DNS Names. Make sure the new DNS name is defined on the all following DNS servers:

    1. '''
zg-1.softxs.ch''' - Public server
    1. '''zg-3.softxs.ch''' - Public server
    1. '''loki.softxs.ch''' - LU DMZ
    1. '''odin.softxs.ch''' - LU DMZ
    1. '''modi.softxs.ch''' - LU Internal network
Line 41: Line 44:

Requires the following steps:
Line 46: Line 51:
 1. Log into VM and perform initial OS update and Puppet agent run  1. Log into VM and perform the initial OS update and first ''puppet agent'' run
Line 54: Line 59:
ssh -p 10104 root@loki ssh -p 10104 root@lu-4.softxs.ch # loki.softxs.ch
Line 56: Line 61:
Line 59: Line 65:
# Add a v2:server::vm definition, similar to the following: # Add a ''v2_server::vm'' definition, similar to the following:
Line 90: Line 96:
    1. Virtual bas box     1. Virtual machine ''box''
Line 95: Line 101:

 1. Define a ''reverse proxy'' entry on the host machine, to forward http requests to the VM. As user ''root'' on the Puppet server

    {{{
cd /etc/puppet
vi manifests/nodes.pp

node "zg-3.softxs.ch" { # Find the node of the host machine
  ...
  create_resources( rproxy::vhost, {
    ...
    # Add an entry similar to the following:
    'v0402' => { host => 'v030402.softxs.ch', ip => '172.16.4.2' },
    ...
  }
  ...
}
    }}}
    1. Where:
       1. ''v0402'' is the hostname of the VM
       1. ''host'' is the external (public) DNS name
       1. ''ip'' is the internal IP address of the VM

 1. Define Backup & Data directories for the VM. As user ''root'' on the Puppet server

    {{{
cd /etc/puppet
vi manifests/nodes.pp

node "zg-3.softxs.ch" { # Find the node of the host machine
  ...
  create_resources( v2_server::mkdir, {
    ...
    # Add entries similar to the following
    "v0402-backup" => { target => "/v01/backup/local/v0402" },
    "v0402-data" => { target => "/v01/data/v0402" },
    ...
  }
  ...
}
    }}}
    1. Where:
       1. ''v0402'' is the hostname of the VM
       1. ''/v01/backup/local'' is the top-level directory of host machine's local backup tree
       1. ''/v01/data'' is the top-level directory of host machine's application directory tree
Line 175: Line 226:
       1. Apache configuration files
       1.
       1. Apache configuration files, located at
          1. /etc/apache2/sites-available
          1. /etc/apache2/sites-enabled
       1. Base
Line 180: Line 233:
 1. In order to allow automatic login for application deployment, planc a  1. In order to allow automatic login for application deployment, you must
Line 186: Line 239:
       * ''port'' is the SSH pot number defined in the VM's Vagrantfile        * ''port'' is the SSH port number defined in the VM's Vagrantfile
Line 192: Line 245:
mkdir .ssh

    }}}


= Configure Reverse Proxy =

= Setup Data Partition =
mkdir .ssh # If the directory doesn't already exist
chmod 0700 .ssh

cd .ssh
vi authorized_keys
# Add your SSH public key, typically from your local machine, in the file ''~/.ssh/identity.pub'' or ''~/.ssh/id_dsa.pub''
:x

chmod 0600 authorized_keys
    }}}

 1. Test the key. As your local user on your development (or other) system, from which you plan to do application deployment:
    {{{
ssh -p {port} v2@host
    }}}
    1. Where:
       * ''port'' is the SSH port number defined in the VM's Vagrantfile
       * ''host'' is the base servers domain name

V2 Deployment Checklist

V2Master | V2Deployment

Introduction

DNS Name Configuration

  1. DNS configuration is performed on the Puppet server mgt.vh01.softxs.ch
    • ssh -p 10104 root@loki
      cd /etc/puppet
  2. Configure new DNS names. As root on the Puppet server

    • cd /etc/puppet/modules/bind9/files/master
      
      # -- Edit the following two files:
      
      vi zones/all/{domain_name}.
      # Update the 'Serial' with today's date and the sequence number (normally '01')
      :x
      
      vi generic/all/{domain_name}.
      # Add CNAME record for the sub-domain pointing to the host server
      :x
  3. Test DNS Names. Make sure the new DNS name is defined on the all following DNS servers:
    1. zg-1.softxs.ch - Public server

    2. zg-3.softxs.ch - Public server

    3. loki.softxs.ch - LU DMZ

    4. odin.softxs.ch - LU DMZ

    5. modi.softxs.ch - LU Internal network

Setup Virtual Machine & Virtual Host

Requires the following steps:

  1. Define VM Vagrantfile generation
  2. Define VM configuration
  3. Define Virtual Host configuration
  4. Start new VM
  5. Log into VM and perform the initial OS update and first puppet agent run

  6. Setup SSH login certificate

Configuration for Vagrantfile Generation

  1. Configure the Vagrant generation in the Puppet server mgt.vh01.softxs.ch.
    • ssh -p 10104 root@lu-4.softxs.ch # loki.softxs.ch 
      cd /etc/puppet/modules/manifests
      
      vi nodes.pp
      
      # Find the node definition for the host server (zg-1, loki, odin, etc.)
      # Add a ''v2_server::vm'' definition, similar to the following:
      
      node "zg-3.softxs.ch" { # host VM
        ...
        create_resources( v2_server::vm, { # VM definition
            ...
            'v0402' => {
                vm_hostname   => 'v0402',
                vm_fqdn       => 'v0402.vh03.softxs.ch',
                vm_box        => 'precise64_rails',
                vm_memory     => 3072,
                vm_ip         => '172.16.4.2',
                vm_netmask    => '255.240.0.0',
                vm_ssh_port   => 20402,
                vm_synched_folders => {
                  'vagrant'  => { vm_dir => "/vagrant",       host_dir => "." },
                  'data'     => { vm_dir => "/data", host_dir => "/v01/data/v0402",
                                  owner => "www-data", group => "v2", mount_options => ["dmode=775", "fmode=764"],
                  },
                  'backup'   => { vm_dir => "/backup", host_dir => "/v01/backup/local/v0402",
                                  owner => "www-data", group => "v2", mount_options => ["dmode=775", "fmode=764"],
                  },
                },
            },
        ...
  2. The critical parameters are: (See V2VirtualServers for example configurations and the setup conventions)

    1. Hostname
    2. Fully qualified domain name (fqdn)
    3. Virtual machine box

    4. Memory
    5. IP address
    6. Port number
    7. Paths for the /data & /backup directories

  3. Define a reverse proxy entry on the host machine, to forward http requests to the VM. As user root on the Puppet server

    • cd /etc/puppet
      vi manifests/nodes.pp
      
      node "zg-3.softxs.ch" { # Find the node of the host machine
        ...
        create_resources( rproxy::vhost, {
          ...
          # Add an entry similar to the following:
          'v0402' => { host => 'v030402.softxs.ch', ip => '172.16.4.2' },
          ...
        }
        ...
      }
    • Where:
      1. v0402 is the hostname of the VM

      2. host is the external (public) DNS name

      3. ip is the internal IP address of the VM

  4. Define Backup & Data directories for the VM. As user root on the Puppet server

    • cd /etc/puppet
      vi manifests/nodes.pp
      
      node "zg-3.softxs.ch" { # Find the node of the host machine
        ...
        create_resources( v2_server::mkdir, {
          ...
          # Add entries similar to the following
          "v0402-backup"   => { target => "/v01/backup/local/v0402" },
          "v0402-data"     => { target => "/v01/data/v0402" },
          ...
        }
        ...
      }
    • Where:
      1. v0402 is the hostname of the VM

      2. /v01/backup/local is the top-level directory of host machine's local backup tree

      3. /v01/data is the top-level directory of host machine's application directory tree

  5. Wait for puppet agent to run on the host machine to generate the new Vagrantfile.

    1. Or run it by hand:
      • puppet agent --onetime --no-daemonize --verbose
    2. This will also create a new VM directory on the host machine:
      • /home/vagrant/vms/{name}

        Where name is the VM new host name

  6. Register the new VM in the Wiki page: V2VirtualServers

Define a Puppet Node for the VM

  1. Define a new puppet node for the vm, named with the VM's fully qualified domain name:

    • node "v0402.vh03.softxs.ch" { # VM FQDN
        class { 'puppet_agent': period => 10 }
        class { 'postfix_satellite': node_name => $name, mailname => 'softxs.ch', relayhost => 'smtp.softxs.ch' }
        include apache
        include www
        include mysql
        include passenger
        class { 'rails_user': user => 'v2' }
      
        # ..place for vhost definition (see next section)..
      }

Define a Virtual Host on the VM

  1. Add an apache::vhost definition to the VM node:

    • node "v0402.vh03.softxs.ch" { # VM node
        ...
        apache::vhost {'trial.softxs.ch':
          template => 'apache/vhost-v2.conf.erb',
          docroot => '/home/v2/rails/trial.softxs.ch',
          priority => 25,
          servername => 'trial.softxs.ch',
          options => '-Indexes',
          subvhosts => {
            'trial1' => { },
            'trial2' => { },
        },
        ...
      }
  2. The subvhosts are used to define the relative paths for the individual applications

Start Virtual Machine

  1. As user vagrant on the host machine start the VM:

    • cd /home/vagrant/vms/{name} # Where 'name' is the new VM host name
      vagrant up # Starts the VM
  2. Log into the VM
    • vagrant ssh
  3. Perform an initial software update on the VM
    • su -
      apt-get update
  4. Perform an initial puppet agent run on the VM

    • puppet agent --onetime --no-daemonize --verbose
    • This should create a vhost, including
      1. Apache configuration files, located at
        1. /etc/apache2/sites-available
        2. /etc/apache2/sites-enabled
      2. Base

Setup V2 User SSH Certificate

  1. In order to allow automatic login for application deployment, you must
    • ssh -p {port} v2@{host}
    • Where
      • port is the SSH port number defined in the VM's Vagrantfile

      • host is the base servers domain name

  2. Create a .ssh directory. As user v2 on the VM:

    • cd ~
      mkdir .ssh # If the directory doesn't already exist
      chmod 0700 .ssh
      
      cd .ssh
      vi authorized_keys
      # Add your SSH public key, typically from your local machine, in the file ''~/.ssh/identity.pub'' or ''~/.ssh/id_dsa.pub''
      :x
      
      chmod 0600 authorized_keys
  3. Test the key. As your local user on your development (or other) system, from which you plan to do application deployment:
    • ssh -p {port} v2@host
    • Where:
      • port is the SSH port number defined in the VM's Vagrantfile

      • host is the base servers domain name

Setup V2 Deployment Instance

deploy.rb

settings.local.yml

database.yml

Email Secret Key

Home Page Setup

Deploy Initial V2 System

Capistrano Deployment

Test Local Login

Test Invitation & MAPS Login

Start Delayed Job Task

Register Application in MAPS

Test Outgoing Email

Configure & Test Incoming Email

Install V2 Configuration

Import Configuration

Import Data & Documents

End-to-End Test

Setup Backups

Setup Monitoring

V2DeploymentChecklist (last edited 2015-05-12 08:55:54 by 172)

Copyright 2008-2014, SoftXS GmbH, Switzerland