Skip to content

Instantly share code, notes, and snippets.

@scpike
scpike / README.md
Created March 2, 2016 16:21 — forked from renchap/README.md
One-line certificate generation/renews with Letsencrypt and nginx

Prerequisites : the letsencrypt CLI tool

This method allows your to generate and renew your Lets Encrypt certificates with 1 command. This is easily automatable to renew each 60 days, as advised.

You need nginx to answer on port 80 on all the domains you want a certificate for. Then you need to serve the challenge used by letsencrypt on /.well-known/acme-challenge. Then we invoke the letsencrypt command, telling the tool to write the challenge files in the directory we used as a root in the nginx configuration.

I redirect all HTTP requests on HTTPS, so my nginx config looks like :

server {
@scpike
scpike / copy-s3-bucket.rb
Created September 18, 2012 20:29 — forked from scharfie/copy-s3-bucket.rb
Copy contents of an S3 bucket to a another bucket using an EC2 instance and a simple Ruby script. Maintains acl
require 'rubygems'
require 'right_aws'
aws_access_key_id = ''
aws_secret_access_key = ''
target_bucket = 'bucket_with_data_to_copy'
destination_bucket = 'to_copy_into'
s3 = RightAws::S3Interface.new(aws_access_key_id, aws_secret_access_key)
@scpike
scpike / copy-s3-bucket.rb
Created September 18, 2012 20:26 — forked from scharfie/copy-s3-bucket.rb
Copy contents of an S3 bucket to a another bucket using an EC2 instance and a simple Ruby script. Useful for transferring large amounts of data and will work across geographic regions.
require 'rubygems'
require 'right_aws'
require 'yaml'
filename = ENV['FILE'].to_s
source = ENV['FROM'].to_s
destination = ENV['TO'].to_s
dry_run = true
puts "Please provide filename of s3 configuration" and exit(1) if filename == ""
@scpike
scpike / copy-s3-bucket.rb
Created September 18, 2012 20:26 — forked from scharfie/copy-s3-bucket.rb
Copy contents of an S3 bucket to a another bucket using an EC2 instance and a simple Ruby script. Useful for transferring large amounts of data and will work across geographic regions.
require 'rubygems'
require 'right_aws'
require 'yaml'
filename = ENV['FILE'].to_s
source = ENV['FROM'].to_s
destination = ENV['TO'].to_s
dry_run = true
puts "Please provide filename of s3 configuration" and exit(1) if filename == ""
@scpike
scpike / Deploy
Created November 23, 2011 00:42 — forked from coop/Deploy
Deploy to S3 - Asset Pipeline, S3 and Heroku
namespace :deploy do
desc "Deploy to Heroku"
task :heroku do
Rake::Task["deploy:precompile_assets_and_upload_to_s3"].invoke
Rake::Task["deploy:push_heroku"].invoke
end
desc "Precompile assets and upload to s3"
task :precompile_assets_and_upload_to_s3 do
storage = Fog::Storage.new :provider => 'AWS', :aws_access_key_id => "123", :aws_secret_access_key => "123"