README.md in shuttle-deploy-0.2.0.beta1 vs README.md in shuttle-deploy-0.2.0.beta2

- old
+ new

@@ -6,13 +6,19 @@ *Under heavy development* ## Install -Clone repository and run: +Install from Rubygems: ``` +gem install shuttle-deploy +``` + +Or install manually (clone repo first): + +``` rake install ``` Supported ruby versions: @@ -40,20 +46,19 @@ - `pids` - Shared process IDs files - `log` - Shared log files ## Process -Deployment flow is split into steps: +Deployment flow consists of steps: -- Establish connection with target server -- Prepare application structure. It'll create all required directories or skip if they already exist. -- Clone repository or check out latest code. Submodules will be automatically updated as well. -- Switch to specified branch (`master` by default) -- Create a new release directory and checkout application code -- Perform strategy-related tasks. -- Create a symbolic link to the latest release -- Clean up old releases (default count: 5) +- Connect to remote server +- Prepare application structure (releases, shared dirs, etc) +- Clone or update git/svn repository code from specified branch +- Create a new release and checkout application code +- Perform strategy-defined tasks +- Make new release current +- Cleanup old releases ## Strategies Available deployment strategies: @@ -69,25 +74,68 @@ Example configuration: ```yaml app: name: my-application - strategy: static git: git@github.com:my-site.git target: host: my-host.com user: username password: password deploy_to: /home/deployer/www ``` -### Wordpress Strategy +### WordPress Strategy This strategy is designed to deploy wordpress sites developed as a separate theme. It requires `subversion` installed on the server (will be automatically installed). +### Rails Strategy + +Rails deployment strategy will deploy your basic application: install dependencies, +migrate database, precompile assets and start web server. Most of the steps are automatic. + +Define strategy first: + +```yml +app: + name: myapp + strategy: rails +``` + +Then add a separate section: + +```yml +rails: + environment: production + precompile_assets: true + start_server: true +``` + +If using `start_server`, shuttle will try to start thin server. +You can modify settings for thin: + +```yml +thin: + host: 127.0.0.1 + port: 9000 + servers: 5 +``` + +You can also use `foreman` to run application: + +```yml +rails: + start_server: false + +hooks: + before_link_release: + - "sudo bundle exec foreman export upstart /etc/init -a $DEPLOY_APP -u $DEPLOY_USER -p 9000 -l $DEPLOY_SHARED_PATH/log" + - "sudo start $DEPLOY_APP || sudo restart $DEPLOY_APP" +``` + ## Deployment Config Deployment config has a few main sections: `app` and `target`. ### Application @@ -156,10 +204,31 @@ host: mydomain.com user: deployer deploy_to: /home/staging/myapp ``` +### Deployment environment + +During deployment shuttle sets a few environment variables: + +- `DEPLOY_APP` - Application name +- `DEPLOY_USER` - Current deployment user +- `DEPLOY_PATH` - Path to application releases +- `DEPLOY_RELEASE` - New release number +- `DEPLOY_RELEASE_PATH` - Path to currently executing release +- `DEPLOY_CURRENT_PATH` - Path to current release (symlinked) +- `DEPLOY_SHARED_PATH` - Path to shared resources +- `DEPLOY_SCM_PATH` - Path to code repository + +These could be used in hooks. Example: + +``` +hooks: + before_link_release: + - "cp $DEPLOY_SHARED_PATH/myconfig $DEPLOY_RELEASE_PATH/myconfig" +``` + ## Usage To execute a new deploy, simply type (in your project folder): ``` @@ -175,11 +244,10 @@ -----> Preparing application structure -----> Fetching latest code -----> Using branch 'master' -----> Linking release -----> Release v35 has been deployed ------> Cleaning up old releases: 1 Execution time: 2s ``` If using multiple targets in config, you can specify which target to use with: @@ -225,6 +293,6 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file