android.moparisthebest.org/source/docs/deploying/rsync/index.markdown

70 lines
2.4 KiB
Markdown
Raw Normal View History

2011-09-19 13:19:20 -04:00
---
layout: page
2011-12-11 01:32:57 -05:00
title: "Deploying with rsync"
2011-09-19 13:19:20 -04:00
date: 2011-09-10 17:53
sidebar: false
footer: false
---
2011-12-11 01:32:57 -05:00
<h2 id="rsync">Deploying with rsync via SSH</h2>
2011-09-19 13:19:20 -04:00
2011-12-11 01:32:57 -05:00
Add your server configurations to the `Rakefile` under Rsync deploy config. To deploy with rsync, be sure your public key is listed in your server's `~/.ssh/authorized_keys` file.
2011-09-19 13:19:20 -04:00
``` ruby
2011-12-11 01:32:57 -05:00
ssh_user = "user@domain.com"
document_root = "~/website.com/"
rsync_delete = true
deploy_default = "rsync"
2011-09-19 13:19:20 -04:00
```
Now if you run
``` sh
2011-12-11 01:32:57 -05:00
rake generate # If you haven't generated your blog yet
rake deploy # Syncs your blog via ssh
2011-09-19 13:19:20 -04:00
```
in your terminal, your `public` directory will be synced to your server's document root.
2011-12-11 01:55:39 -05:00
<h2 id="delete">Regarding rsync delete</h2>
2011-12-11 01:32:57 -05:00
If you choose to delete on sync, rsync will create a 1:1 match. Files will be added, updated *and deleted* from your deploy directory to mirror your local copy.
If you do not choose to delete:
- You can store files beneath your site's deploy directory which aren't found in your local version.
- Files you have removed from your local site must be removed manually from the server.
<h3 id="exclude">Excluding files from sync</h3>
If you would like to keep your Octopress files synced but also want the convenience of keeping some files or directories on the server without having to mirror them locally, you can exclude them from rsync.
When syncing, rsync can exclude files or directories locally or on the server. Simply add an `rsync-exclude` file to the root directory of your project like this:
2011-12-11 01:55:39 -05:00
```sh rsync-exclude
2011-12-11 01:32:57 -05:00
some-file.txt
some-directory/
*.mp4
```
Note: using excludes will prevent rsync from uploading local files, or if the delete option is specified, it will prevent rsync from deleting excluded items on the server.
## Version control
You'll want to keep your blog source in a remote git repository,
so either [set up a Github repository](https://github.com/repositories/new) or [host your own](#self_hosted_git) and then do this.
```sh
# Since you cloned Octopress, you'll need to change the origin remote
git remote rename origin octopress
git remote add origin (your repository url)
# set your new origin as the default branch
git config branch.master.remote origin
```
{% render_partial docs/deploying/_self_hosted_git.markdown %}
2011-12-11 01:32:57 -05:00
## Deploying to a subdirectory
2011-12-11 01:32:57 -05:00
If for you wanted to host an Octopress blog at `http://yoursite.com/blog/` you would need to configure Octopress for [deploying to a subdirectory](/docs/deploying/subdir).