Info
Notice: This site is no created using Octopress. I have since moved to a plain Jekyll setup. Content exists mostly for reference and will not be updated in the future.
This post will go over how I upload my octopress site from my computer to Amazon s3 cloud service using s3cmd.
Firstly, you will need to sign up for an Amazon AWS account if you do not have one already. It is quite cheap and you only pay for what you use.
Installing s3tools
This is available in most Linux distributions, via Homebrew, directly from s3tools.org, or the source directory on github. Run the following commands on the tar ball. (use at least version 1.0.X)
tar xzvf s3cmd-1.5.0-alpha1.tar.gz
cd s3cmd-1.5.0-alpha1
python setup.py install
You will need to copy & paste access_key
and secret_key
from the Security Credentials page of Amazon AWS into s3cmd’s configuration wizard. Use this article if you need help looking for keys. Then you will need to configure the c3cmd command with the following:
s3cmd --configure # Begin interactive configuration
When finished, your ~/.s3cfg file should end up looking something like this.
[default]
# ...snip...
access_key = ALRJCALDDZUDEGNSSIPE
secret_key = 9DJWHga1Y+uBAFXntDM1Ujd6FrnnUZb/9dLMOqzn
# ...snip...
Creating your s3 bucket
You will have to create your s3 bucket with in the Amazon AWS console. Create a bucket using the fully-qualified domain name of your blog (e.g., www.example.com)
. Open the Properties pane for your bucket, and then enable “Static web hosting”. Make note of the “endpoint”, something like example.com.s3-website-us-east-1.amazonaws.com
. You can use this directly, but most people will create a DNS CNAME pointing to it instead.
Modifying your Rakefile
Inside your octopress directory, you have a file Rakefile
that we need to make a few modifications to so that we can upload to Amazon s3. Start by editing the deploy_default
variable to be s3
. Next establish a new variable by adding this line into the file s3_bucket = "www.mywebsite.com"
modifying the website name.
## -- Rsync Deploy config -- ##
# Be sure your public key is listed in your server's ~/.ssh/authorized_keys file
ssh_user = "[email protected]"
ssh_port = "22"
document_root = "~/website.com/"
rsync_delete = false
rsync_args = "" # Any extra arguments to pass to rsync
deploy_default = "s3"
s3_bucket = "www.clburlison.com"
Lastly, you need to make a new task in the Rakefile
. Add the following text lines to the end of your file.
desc "Deploy website via s3cmd"
task :s3 do
puts "## Deploying website via s3cmd"
ok_failed system("s3cmd sync --acl-public --reduced-redundancy public/* s3://#{s3_bucket}/")
end
Deployment is now only a matter of running the usual command:
rake deploy
Articles: Jacob Elder, Jerome Bernard