Deletions are marked like this. | Additions are marked like this. |
Line 73: | Line 73: |
== Application Directory structure == |
== Rails Application Directory Structure == 1. Capistrano notes: 1. Rails applications are deployed by Capistrano, which imposes a well-defined directory structure 1. Supports keeping the codebase of older revisions, and the ability to rollback releases 1. Provided you can rollback the database migration. 1. Supports a ''common'' directory containing the Rails ''bundle'' and other information doesn't change between releases 1. Local Capistrano extensions === Rails Application === 1. '''usr''' = rails application user. Typically '''v2''' 1. '''name'''' = application installation name {{{ /home/{user}/rails/{name} Symbolic link to {name}-app/current/public /home/{user}/rails/{name}-app Application installation directory }}} === Rails Application Directory Structure === 1. '''name''' = application installation name 1. '''yymmddhhmmss''' = release timestamp {{{ {name} Symbolic link to {name}-app/current/public {name}-app current Symbolic link to releases/{yymmhhmmhhss}. E.g. the current release releases yymmddhhmmss Root rails application directory. Approx. 16 MB. We backup older releases app config ... yymmddhhmmss yymmddhhmmss ... shared assets Small? Appears to be empty backup Small, only contains backups made during software updates bundle Large, 130 MB. On SSD log Can get large, needs log rotation. On SSD pids Small system Empty var Symbolic link to data directory. Very large. Contains all file_assets. On HD }}} === Rails Data Directory Structure === 1. The rails application ''var'', which contains all the file_assets is stored on the hard disk 1. A symbolic link at {name}-app/shared/var points to the applications ''data'' directory {{{ /v01/rails/data/{relpath}/{name}/var }}} === Rails Backup Directory Structure === 1. '''vm''' = VM directory name. E.g. /home/v2/rails/vms/'''vm''' 1. '''path''' = Virtual hostname and relative path. E.g. '''v2.softxs.ch/v2p0-jk1''' {{{ /v01/backup/{vm}/{path} }}} === Rails Application Backup Job === 1. Dump database with timestamp to the ''backup/db'' directory 1. Rsync the following 1. ''releases'' --> ''backup/releases'' 1. ''shared'' --> ''backup/shared'' 1. ''/data/var'' --> ''backup/shared'' == MoinMoin Wiki Directory structure == |
Managing V2 Backups and Application Data
Introduction
This sections describes:
- How application data (e.g. all application data and state) for individual V2 applications are managed
- How backups for individual V2 applications are managed
- How backups for VMs are managed
Definitions
Application - An application that manages its state in a database and a set of data files
VM - A virtual machine, in which supporting services and application are run
One or more Applications run on a VM, limited by the capacity of the VM
Host System - A hardware/software platform supporting a set of services and application VMs
One or more VMs run on a Host System, limited by the capacity of the Host System
Service - A host or network service that supports Applications and their underlying infrastructure (see Services)
The entire infrastructure can be scaled by adding additional VMs and Host Systems
Services
Each Host System must have:
DNS server in a VM that resolves the internal names and IP address of the VMs
forwarding-only DNS server that forward DNS requests to the DNS server VM
rinetd daemon that forwards incoming TCP traffic to the appropriate VM based on the port number. Typically
All web traffic (ports 80 and 443) is forwarded to the Reverse Proxy server
- Note that DNS traffic, which uses both TCP and UDP protocols, is managed by the Host System's forwarding-only DNS server
- If the Host System has a VM with a Puppet server then port 8140 is forwarded to it
Reverse Proxy, an Apache module in a web server VM, that forward web requests to the appropriate VM based on the hostname in the HTTP request
Additional services that might be found on a Host System:
- Outward facing DNS
- Puppet master server
Requirements
Application Data Management Requirements
- To ensure good performance given the host environment, consisting of:
- A limited amount of RAM
- A limited amount of high-speed SSD-based disk space
- A large amount of lower-speed RAID1 hard-disk space
Recommendation:
- Store the base operating system and application support service (web-server, database server, etc.) on SSD
- Store the minimum application footprint, e.g. the actively accessed part of the application (code, configuration, database) on SSD
- Store the applications revision and attachment files on the RAID hard disk
Issue where to store thumbnail images?
Backup Requirements
- To guarantee that the data required to completely restore or duplicate an instance of a application is always available. At a minimum the data to be backed up includes:
- The application's files
- The application's database
- Backups should be made automatically on a nightly basis
- The backup data should be stored:
- On one or more backup servers
- On one or more off-site storage devices (typically USB drives)
- There should not a lot of effort required to re-configure backups if an application is moved from one VM or Host Machine to another
Application Data Management
Rails Application Directory Structure
- Capistrano notes:
- Rails applications are deployed by Capistrano, which imposes a well-defined directory structure
- Supports keeping the codebase of older revisions, and the ability to rollback releases
- Provided you can rollback the database migration.
Supports a common directory containing the Rails bundle and other information doesn't change between releases
- Supports keeping the codebase of older revisions, and the ability to rollback releases
- Rails applications are deployed by Capistrano, which imposes a well-defined directory structure
- Local Capistrano extensions
Rails Application
usr = rails application user. Typically v2
name' = application installation name
/home/{user}/rails/{name} Symbolic link to {name}-app/current/public /home/{user}/rails/{name}-app Application installation directory
Rails Application Directory Structure
name = application installation name
yymmddhhmmss = release timestamp
{name} Symbolic link to {name}-app/current/public {name}-app current Symbolic link to releases/{yymmhhmmhhss}. E.g. the current release releases yymmddhhmmss Root rails application directory. Approx. 16 MB. We backup older releases app config ... yymmddhhmmss yymmddhhmmss ... shared assets Small? Appears to be empty backup Small, only contains backups made during software updates bundle Large, 130 MB. On SSD log Can get large, needs log rotation. On SSD pids Small system Empty var Symbolic link to data directory. Very large. Contains all file_assets. On HD
Rails Data Directory Structure
The rails application var, which contains all the file_assets is stored on the hard disk
A symbolic link at {name}-app/shared/var points to the applications data directory
/v01/rails/data/{relpath}/{name}/var
Rails Backup Directory Structure
vm = VM directory name. E.g. /home/v2/rails/vms/vm
path = Virtual hostname and relative path. E.g. v2.softxs.ch/v2p0-jk1
/v01/backup/{vm}/{path}
Rails Application Backup Job
Dump database with timestamp to the backup/db directory
- Rsync the following
releases --> backup/releases
shared --> backup/shared
/data/var --> backup/shared
MoinMoin Wiki Directory structure
Backup Directory Structures
Application Backup Directories
VM Backup Directories
Backup Server Backup Directories
Summary of Backup System
SoftXS Systems
Description
Host
VM
Local Path
Notes
SoftXS Web Site
zg-3.softxs.ch
web
/home/v2/rails/www.softxs.ch
rails
Hydro Demo
zg-3.softxs.ch
web
/home/v2/rails/demo.softxs.ch/hydro
rails
Tracking System
zg-3.softxs.ch
intern
/home/v2/rails/intern.softxs.ch/tracking
rails
Wiki
loki.softxs.ch
wiki
/home/wiki/www/html
MoinMoin
Customer Systems
Description
Host
VM
Local Path
Notes
Roadnotes PMS
zg-3.softxs.ch
v0402
/home/v2/rails/ intern.softxs.ch/tracking
rails