Giter Club home page Giter Club logo

deploy's Introduction

Octopress Deploy

Easily deploy any static site using S3, Git or Rsync. Pull request to support other deployment methods are welcome.

Gem Version License

Installation

Octopress Deploy is bundled with the Octopress Gem, to use it from the command line, install Octopress first.

$ gem install octopress

Usage

For usage instructions, please refer to the Octopress CLI documentation.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

License

Copyright (c) 2014 Brandon Mathis

MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

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.

deploy's People

Contributors

awinder avatar fehwalker avatar florinasavoaie avatar glaszig avatar hazzik avatar imathis avatar jdfrens avatar johnkferguson avatar magikid avatar nhoizey avatar parkr avatar retrography avatar yonbergman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

deploy's Issues

Rsync tries to set permissions - not working

When using rsync, it tries to set the permission the same as local. That's fine if they are the same, but for whatever mysterious reason, it tries to set the permissions on the destination directory to d---------. Which does work, but that's where the syncing will end, obviously.

The culprut is rsync -avz as called from octopress deploy. If the -avz option would be replaced by -rltgoDvz (effectively leaving out the -p option), it will most likely work.

This might be for the best for most folks, because it is very likely that the local user is different from the remote user, therefor having different permissions. On top of that, on a www directory the permissions are usually already set correctly - no need to change them to anything else, imo.

Prioritized pages via rsync?

I have a problem which has only cropped up whilst on vacation with a very slow internet connection.

While syncing my site, the root index page is done first, while the /**/index.html files are done later, presumably in alphabetic order. This presents a problem when syncing takes 10 minutes, as the index pages point to 404 articles rather than the article page that syncs much later.

I want to be able to sync the leafs first, then the index pages and rss feeds etc...

My proposed solution would be to use rsync's "--files-from" option and have the file built automatically based on file tree depth, with the larger depth first. There is no current option I can pass to octopress deploy to accomplish this.

Thoughts?

Question: using octopress-deploy in isolation?

I'm using octopress/octopress for my blog, and deployment with that is such a nice experience that I'd like to use octopress/deploy to deploy another jekyll site which I have - a pretty simple one which doesn't have any posts, and so wouldn't make use of the main functionality of the octopress cli.

I could just add the main octopress gem to my gemfile, but that feels a bit bloat-y so I've made a bin/deploy script so that I can use octopres/deploy in isolation:

#!/usr/bin/env ruby
require 'octopress-deploy'
Octopress::Deploy.push

This works but feels like a bit of a hack. Is octopress/deploy intended to be used in isolation at all, or is it just a way of isolating some of the code from octopress/octopress?

Did you consider giving this gem it's own executable commands? Would it ever make sense to extract Octopress::Command into a tiny gem which could be included in octopress/octopress, octopress/deploy and any other gems which might add commands to the octopress executable in future?

(p.s. thanks again for all your work on these tools)

Crash if site_dir isn't defined in _deploy.yml when using git deployment

site_dir in _deploy.yml is stated to be optional for method: git, defaulting to _site. https://github.com/octopress/deploy#git-deployment-configuration

However, if I do not have it defined and attempt to do octopress deploy or octopress deploy pull <dir> it will crash with: no implicit conversion of nil into String

This is a regression that popped up somewhere between rc5 and rc8.

Here's the full stack trace:

/usr/local/Cellar/ruby/2.1.1/lib/ruby/gems/2.1.0/gems/octopress-deploy-1.0.0.rc.8/lib/octopress-deploy/git.rb:12:in `expand_path': no implicit conversion of nil into String (TypeError)
    from /usr/local/Cellar/ruby/2.1.1/lib/ruby/gems/2.1.0/gems/octopress-deploy-1.0.0.rc.8/lib/octopress-deploy/git.rb:12:in `initialize'
    from /usr/local/Cellar/ruby/2.1.1/lib/ruby/gems/2.1.0/gems/octopress-deploy-1.0.0.rc.8/lib/octopress-deploy.rb:68:in `new'
    from /usr/local/Cellar/ruby/2.1.1/lib/ruby/gems/2.1.0/gems/octopress-deploy-1.0.0.rc.8/lib/octopress-deploy.rb:68:in `deployer'
    from /usr/local/Cellar/ruby/2.1.1/lib/ruby/gems/2.1.0/gems/octopress-deploy-1.0.0.rc.8/lib/octopress-deploy.rb:32:in `push'
    from /usr/local/Cellar/ruby/2.1.1/lib/ruby/gems/2.1.0/gems/octopress-deploy-1.0.0.rc.8/lib/octopress-deploy/commands.rb:12:in `block (2 levels) in init_with_program'
    from /usr/local/Cellar/ruby/2.1.1/lib/ruby/gems/2.1.0/gems/mercenary-0.3.3/lib/mercenary/command.rb:220:in `call'
    from /usr/local/Cellar/ruby/2.1.1/lib/ruby/gems/2.1.0/gems/mercenary-0.3.3/lib/mercenary/command.rb:220:in `block in execute'
    from /usr/local/Cellar/ruby/2.1.1/lib/ruby/gems/2.1.0/gems/mercenary-0.3.3/lib/mercenary/command.rb:220:in `each'
    from /usr/local/Cellar/ruby/2.1.1/lib/ruby/gems/2.1.0/gems/mercenary-0.3.3/lib/mercenary/command.rb:220:in `execute'
    from /usr/local/Cellar/ruby/2.1.1/lib/ruby/gems/2.1.0/gems/mercenary-0.3.3/lib/mercenary/program.rb:35:in `go'
    from /usr/local/Cellar/ruby/2.1.1/lib/ruby/gems/2.1.0/gems/mercenary-0.3.3/lib/mercenary.rb:22:in `program'
    from /usr/local/Cellar/ruby/2.1.1/lib/ruby/gems/2.1.0/gems/octopress-3.0.0.rc.10/bin/octopress:23:in `<top (required)>'
    from /usr/local/opt/ruby/bin/octopress:23:in `load'
    from /usr/local/opt/ruby/bin/octopress:23:in `<main>'

Looks like @options[:site_dir] is nil now and File.expand_path doesn't like that https://github.com/octopress/deploy/blob/v1.0.0.rc.8/lib/octopress-deploy/git.rb#L12

Perhaps a solution would just be to pull the || 'site' into the File.expand_path call like is done with deploy_dir?

Better Documentation...

To the uninitiated the docs are kind of confusing as to how to use properly with Octopress 3. Or it could be for someone not already familiar with Octopress.

For example if the only thing required for the git method is git_url then that should be the only option displayed in _deploy.yml. It's fine to display the other options but they should be commented out with a note as to their default state/purpose. The same holds true for the other methods as well.

This could be accomplished with a standard format of _deploy.yml where the user needs to set the variables required for the method the user choses.

something similar to this:

method: git
site_dir: _site
git_url: [email protected]:Bytesfree/bytesfree.github.io.git
git_branch: master

# if using the rsync method to deploy please note that you'll need to uncomment the
# method and remote_path options below.

# method: rsync
# remote_path:      #Remote destination's document root. REQUIRED
# user:             #ssh user, e.g [email protected] no default
# port:             #ssh port, defaults to 22
# exclude_file:     #Path to a file containing rsync exclusions. no default
# exclude:          #Inline list of rsync exclusions. no default
# include:          #Inline list of inclusions to override exclusions. no default
# delete:           #Delete files in destination not found in source. defaults to false

Running more than once creates a permissions error with .deploy folder

If I deploy to a git repository, update, and then deploy again the .deploy directory left over from the first deploy command creates a permissions error:

octopress 3.0.0.rc.10 | Error: Permission denied @ rb_sysopen - /Users/davidsmith/Sites/Shuttersmith/.deploy/./.git/objects/00/ea5f91d246ced7b53e03512a6689a54a2f3cfc

Deleting the .deploy folder fixes this (obviously) for one iteration and then its the same again - although it does force re-downloading all of the files.

S3 deploy creates files without everyone read access

Deploy works, but files deployed to S3 do not have permission to be read, which means you can't actually use them as a web site unless you otherwise change all the permissions first.

Need to add ':acl => :public_read' to file options before uploading, Could possibly also have a config option to keep permissions private if preferred (why? maybe someone wants it...).

I'll try a fix for this since I want it...

More deploy options?

Hi there,

I've spent the last day updating my octopress blog to 3.0, realizing it's still a work in progress.
Now the issue is that I publish my blog on a server that will (sadly) not support either rsync nor git (not even ssh).

This all leads me to say that I need a deployment method that supports ftp and/or the possibility to just enter a command (I was thinking of lftp).
Is 'FTP' or 'Command' planned as an option?
Although my ruby is pretty much non-existent, I could probably hack it in and submit a pull-request. Are more options welcome or are you trying to keep the deploy low key? I also read the issue about dandelion which actually does do ftp, so this would solve it for me as well.

Can't see --version

octopress deploy --help claims there is a version option I can use, but it doesn't seem to be working:

$ octopress deploy --version
deploy
$ octopress deploy -v
deploy

It exits with status code 1.

Unless, of course, the intended version number is 'deploy' ๐Ÿ˜›

rsync tries relative path when specifying absolute

Here's the relevant part of my _deploy.yml:

method: rsync
site_dir: _site
user: [email protected]
remote_path: /var/www/keytec

And the error:

Syncing _site files to var/www/keytec with rsync.
[email protected]'s password:
sending incremental file list
rsync: mkdir "/home/swadmin/var/www/keytec" failed: No such file or directory (2)
rsync error: error in file IO (code 11) at main.c(605) [Receiver=3.0.9]
rsync: connection unexpectedly closed (9 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at /usr/src/ports/rsync/rsync-3.0.9-1/src/rsync-3.0.9/io.c(605) [sender=3.0.9]

It seems it tries /var/www/keytec as a path relative from the user's home directory, even though it starts with a slash - which indicates it is an absolute path.

Support for adding headers to S3 files?

I'm not sure if this is something you'd want to not tackle in this plugin at all, or something you'd want in a separate plugin, or something you think would make a good addition to the deploy module. But just in case it's the last one, I'd like to be able to set up some kind of configuration for adding sets of HTTP headers to my site files:

  • Adding "Cache-Control" and "expires" headers to javascript/css. I'm using one of the asset pipeline plugins to fingerprint these files, so I can safely set these to a year or more out in the future, and it definitely helps performance.
  • Adding "Content-Type" and "Content-Encoding" headers to javascript/css so that I can upload & utilize gzipped versions of these files.
  • NOT adding these headers to a subset of the files in my site, like my HTML files. I don't want my pages cached for a year.

I'd definitely be willing to help out with coding on this, but I'm not even really sure what a sane configuration for this would look like. Hopefully this gives you at least some idea of what I'd be looking for here.

How do I get `octopress deploy` to use the _config.yml that `jekyll build` uses?

I am using Octopress 3, and when I run jekyll build, it generates the correct set of files (which includes my static files, see list of files below):

      $ cd _site
:_site$ ls -a
.               CNAME               assets              google2d8.html  index-alternative.html
..              about               blog                increase-revenue.html       index.html

Note that my entire jekyll-generated blog is now safely stored within \blog\, which is how I want it.

But once I do octopress deploy, it basically overwrites this entire folder that overwrites my static files, see listing below:

      $ cd _site
:_site$ ls -a
.       ..      Gemfile     Gemfile.lock    about       css     feed.xml    index.html  jekyll

Here is my _config.yml:

title: My Title
email: [email protected]
description: > # this means to ignore newlines until "baseurl:"
     some description
baseurl: "/blog" # the subpath of your site, e.g. /blog
url: "http://example.com" # the base hostname & protocol for your site
twitter_username: myusername

source: '../'

# Build settings
markdown: kramdown
theme: minima

This is my _deploy.yml

method: git                 # How do you want to deploy? git, rsync or s3.
site_dir: _site             # Location of your static site files.
git_url: my_git_url

git_branch: gh-pages-2       # Git branch where static site files are commited

Note: Once I remove the following line from my _config.yml: source: '../', my jekyll build generates that deploy folder like octopress deploy does.

So I guess the real question is, once I customize _config.yml, how do I get octopress deploy to use that same jekyll _config.yml file?

"octopress build" doesn't seem to do anything

Hi,

I'd like to deploy using rsync and I believe that the website needs to be rsynced from default site_dir (_site) to the remote path I specify in the _deploy.yaml. I can't find any documentation on how to build the app in the _site directory, but I have found online that some people are using "octopress build" to accomplish this (still just guessing).

When I run the build command, there is no output and it returns a success code, so I can only assume that "build" was a valid CLI command and execution was successful. But this doesn't seem to be doing anything, so when I actually deploy the blog I get the error:

rsync: change_dir "XXXX/site//_site" failed: No such file or directory (2)

Any ideas?

Add CloudFront invalidation after upload

For sites that are served with S3+CloudFront (for example, any which is served via https) there's an extra step needed after upload, which is invalidating the affected resources so that they are purged from CloudFront's cache.

Please add a new step to invalidate the cache when a CloudFront distribution id is included in the deploy configuration.

deployment to git should check if branch name has changed

I first ran deploy to the gh-pages branch, then re-read the documentation and realized that it should be master. When I changed the deploy branch, however, I could no longer deploy. I would always get this error:

error: src refspec master does not match any. 

This took a while to figure out, but it turned out that the git repository created by octopress deploy was saved in .deploy, and the branch was still gh-pages. Git was failing because the master branch did not exist. To fix this, I had to delete the .deploy directory manually and rerun octopress deploy.

It would be nice if the deploy script checked that the branch in the .deploy directory matched the branch given by the current value of the branch parameter.

@exclude and @include can only be used once

The rsync command allows multiple uses of --exclude and --include, but the _deploy.yml only accepts one filename for exclude: and for include:.

Something like this should work:

Array(@exclude).each { |e| cmd << " --exclude #{e}" }

This works when @exclude is nil, a single value, or an entire array.

I'd try this myself, but I fought for way too long this morning with bundler to use my version of this gem instead of the official one, and bundler won.

Typo in Documentation

Under Configuration options the description for site_dir reads:

Path to comipled site files.

when it should read as:

Path to compiled site files.

How to use with Travis?

Is anybody already using this gem for deploying a GitHub project or user/organization page via TravisCI?

I'm trying to set one up (Parallel-in-Time/parallel-in-time.github.io) but failing hard with Travis' default behaviour of running bundle install --path=${BUNDLE_PATH:-vendor/bundle}. It somehow assumes one is using rake for all the CI tasks and not a binary provided by a gem.

No default directory for pull

The pull command's help states that a default directory of ./site-pull will be used:

$ octopress deploy pull --help
octopress deploy pull -- Pull down the published copy of your site into a directory (default: ./site-pull)

However, this isn't actually true! If you don't supply a directory, you instead get this error:

$ octopress deploy pull --trace
/usr/local/Cellar/ruby/2.1.1/lib/ruby/gems/2.1.0/gems/octopress-deploy-1.0.0.rc.2/lib/octopress-deploy.rb:40:in `exists?': no implicit conversion of nil into String (TypeError)
    from /usr/local/Cellar/ruby/2.1.1/lib/ruby/gems/2.1.0/gems/octopress-deploy-1.0.0.rc.2/lib/octopress-deploy.rb:40:in `pull'
    from /usr/local/Cellar/ruby/2.1.1/lib/ruby/gems/2.1.0/gems/octopress-deploy-1.0.0.rc.2/lib/octopress-deploy/commands.rb:21:in `block (3 levels) in init_with_program'
    from /usr/local/Cellar/ruby/2.1.1/lib/ruby/gems/2.1.0/gems/mercenary-0.3.2/lib/mercenary/command.rb:220:in `call'
    from /usr/local/Cellar/ruby/2.1.1/lib/ruby/gems/2.1.0/gems/mercenary-0.3.2/lib/mercenary/command.rb:220:in `block in execute'
    from /usr/local/Cellar/ruby/2.1.1/lib/ruby/gems/2.1.0/gems/mercenary-0.3.2/lib/mercenary/command.rb:220:in `each'
    from /usr/local/Cellar/ruby/2.1.1/lib/ruby/gems/2.1.0/gems/mercenary-0.3.2/lib/mercenary/command.rb:220:in `execute'
    from /usr/local/Cellar/ruby/2.1.1/lib/ruby/gems/2.1.0/gems/mercenary-0.3.2/lib/mercenary/program.rb:35:in `go'
    from /usr/local/Cellar/ruby/2.1.1/lib/ruby/gems/2.1.0/gems/mercenary-0.3.2/lib/mercenary.rb:22:in `program'
    from /usr/local/Cellar/ruby/2.1.1/lib/ruby/gems/2.1.0/gems/octopress-3.0.0.rc.4/bin/octopress:18:in `<top (required)>'
    from /usr/local/opt/ruby/bin/octopress:23:in `load'
    from /usr/local/opt/ruby/bin/octopress:23:in `<main>'

This scary error happens because nil is set in the options directory and then it is used as an argument to File.exists? in the self.pull method of octopress-deploy.rb.

Boolean options in _deploy.yml don't seem to work

While looking at issue #41 I was trying to add a config file boolean to enable/disable the feature in _deploy.yml, and after a lot of testing I discovered the functionality is generally broken.

For example, if you set verbose to false in _deploy.yml it still prints verbose output.

octopress deploy does not see aws-sdk-v1 gem

I am trying to deploy a test site to an amazon s3 bucket, but octopress deploy seems to nt notice that I have installed the required gem:

chymera@zenbookhost ~/blogs/tutorials_o3 $ octopress deploy
Deploying to S3 requires the aws-sdk-v1 gem. Install with `gem install aws-sdk-v1`.
chymera@zenbookhost ~/blogs/tutorials_o3 $ gem install aws-sdk-v1
Successfully installed aws-sdk-v1-1.66.0
Parsing documentation for aws-sdk-v1-1.66.0
Done installing documentation for aws-sdk-v1 after 18 seconds
1 gem installed
chymera@zenbookhost ~/blogs/tutorials_o3 $ octopress deploy
Deploying to S3 requires the aws-sdk-v1 gem. Install with `gem install aws-sdk-v1`.

This behaviour persists if I close the terminal and try in a new one. Any idea what could be wrong?

--site option

When trying to initialise a config file with the --site option as below:
octopress deploy init git foo/bar --site foo

The site_dir option is set to true instead of foo. Am I doing something wrong?

octopress deploy doesn't work printing : fatal: pathspec ':/' did not match any files

i tried to create a new octopress blog, and pushing it to my github https://github.com/blazeeboy/blazeeboy.github.io using the following steps :

$ gem install octopress --pre
$ octopress new blazeboy
$ cd blazeboy
// then replaced the theme with scrubble
$ gem install octopress-deploy --pre
$ octopress deploy init git
$ octopress build
$ octopress deploy

the octopress deploy step prints the following error

Syncing _site files to [email protected]:blazeeboy/blazeeboy.github.io.git.
From github.com:blazeeboy/blazeeboy.github.io
 * branch            master     -> FETCH_HEAD
fatal: pathspec ':/' did not match any files
Everything up-to-date

so i tried the following:

$ cd .deploy
$ git add .
$ git commit -m"my message"
$ git push deploy

and it worked fine and pushed the site. https://github.com/blazeeboy/blazeeboy.github.io
now, i tried to modify a post and the following.

$ octopress build
$ octopress deploy

and it prints the same error message and doesn't commit or push anything.
my _deploy.yml file content is:

method: git                               # How do you want to deploy? git, rsync or s3.
site_dir: _site                           # Location of your your static site files.

git_url:  [email protected]:blazeeboy/blazeeboy.github.io.git

# Note on git_branch:
# If using GitHub project pages, set the branch to 'gh-pages'.
# For GitHub user/organization pages or Heroku, set the branch to 'master'.
#
git_branch: master                        # Git branch where static site files are commited


# remote_path:                            # Destination directory

and my _config.yml content:

# Site settings
title: Blaze Boy
email: [email protected]
description: "Software Engineer and Particularly a Ruby Addict"
baseurl: ''
url: "http://www.blazeboy.me"
signoff: 'E.E'

# Build settings
markdown: kramdown
permalink: /:title.html

disqus_shortname: blazeboy
facebook_appid:   1400091873588797
google_analytics: UA-53753121-1

links:
  - name:         About
    url:          /about
  - name:         Home
    url:          /
  - name:         Facebook
    url:          https://www.facebook.com/blazeeboy
    external:     true
  - name:         GitHub
    url:          https://github.com/blazeeboy
    external:     true

is there something i'm missing ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.