From deb9977110648742be3031f90669190af0d25d0a Mon Sep 17 00:00:00 2001 From: Abhay Rana Date: Sat, 22 Aug 2015 20:41:30 +0530 Subject: [PATCH] Automated builds and deploys --- .gitignore | 3 +++ .ruby-version | 1 + .travis.yml | 9 +++++-- Gemfile | 1 + Gemfile.lock | 6 +++++ README.md | 2 +- config/deploy.rb | 66 +++++++++++++++++++++++++++++++++++++++++++++++ deploy-rsa | Bin 0 -> 1680 bytes 8 files changed, 85 insertions(+), 3 deletions(-) create mode 100644 .gitignore create mode 100644 .ruby-version create mode 100644 config/deploy.rb create mode 100644 deploy-rsa diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f0e2493 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +lightsaber-deploy +thin.pid +thin.log \ No newline at end of file diff --git a/.ruby-version b/.ruby-version new file mode 100644 index 0000000..7e541ae --- /dev/null +++ b/.ruby-version @@ -0,0 +1 @@ +2.2.2 \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index b35b430..3f8fcea 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,9 @@ language: ruby rvm: - - 2.2.2 -script: ruby test.rb \ No newline at end of file +- 2.2.2 +script: ruby test.rb +deploy: + provider: script + script: bundle exec mina deploy + on: + branch: master diff --git a/Gemfile b/Gemfile index f29f606..aeb8ca3 100644 --- a/Gemfile +++ b/Gemfile @@ -5,6 +5,7 @@ gem 'sinatra' group :test do gem 'minitest' + gem 'mina' end group :production do diff --git a/Gemfile.lock b/Gemfile.lock index 7f94cc3..7bd4cfb 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -3,10 +3,15 @@ GEM specs: daemons (1.2.3) eventmachine (1.0.8) + mina (0.3.7) + open4 (~> 1.3.4) + rake minitest (5.7.0) + open4 (1.3.4) rack (1.6.4) rack-protection (1.5.3) rack + rake (10.4.2) sinatra (1.4.6) rack (~> 1.4) rack-protection (~> 1.4) @@ -21,6 +26,7 @@ PLATFORMS ruby DEPENDENCIES + mina minitest sinatra thin diff --git a/README.md b/README.md index 674ec2b..1092320 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ To add a DNS record, point your domain via a CNAME entry to `lightsaber.captnemo Next, you will need to do the following: 1. Fork this repo -2. Edit the config.yml file and add your redirect in the relevant section +2. Edit the redirects.yml file and add your redirect in the relevant section 3. File a Pull Request with your edit Once the Pull Request is approved, the redirect will automatically be deployed diff --git a/config/deploy.rb b/config/deploy.rb new file mode 100644 index 0000000..0af57ae --- /dev/null +++ b/config/deploy.rb @@ -0,0 +1,66 @@ +require 'mina/bundler' +require 'mina/git' +require 'mina/rvm' + +set :user, 'lightsaber' +set :domain, 'lightsaber.captnemo.in' +set :deploy_to, '/home/lightsaber/lightsaber' +set :repository, 'https://github.com/captn3m0/lightsaber.git' +set :branch, 'master' +set :identity_file, 'lightsaber-deploy' +set :rvm_path, "$HOME/.rvm/scripts/rvm" + +# For system-wide RVM install. +# set :rvm_path, '/usr/local/rvm/bin/rvm' + +# Manually create these paths in shared/ (eg: shared/config/database.yml) in your server. +# They will be linked in the 'deploy:link_shared_paths' step. +# set :shared_paths, ['config/database.yml', 'config/secrets.yml', 'log'] + +# Optional settings: +# set :user, 'foobar' # Username in the server to SSH to. +# set :port, '30000' # SSH port number. +# set :forward_agent, true # SSH forward_agent. + +# This task is the environment that is loaded for most commands, such as +# `mina deploy` or `mina rake`. +task :environment do + # If you're using rbenv, use this to load the rbenv environment. + # Be sure to commit your .ruby-version or .rbenv-version to your repository. + queue! "whoami" + invoke :'rvm:use[default]' + + # For those using RVM, use this to load an RVM version@gemset. + # invoke :'rvm:use[ruby-1.9.3-p125@default]' +end + +# Put any custom mkdir's in here for when `mina setup` is ran. +# For Rails apps, we'll make some of the shared paths that are shared between +# all releases. +task :setup => :environment do + +end + +desc "Deploys the current version to the server." +task :deploy => :environment do + to :before_hook do + # Don't try to decrypt it locally + if ENV['CI'] === 'true' + queue "openssl aes-256-cbc -K $encrypted_82a37ece568a_key -iv $encrypted_82a37ece568a_iv -in deploy-rsa -out lightsaber-deploy -d" + end + end + deploy do + # Put things that will set up an empty directory into a fully set-up + # instance of your project. + invoke :'git:clone' + invoke :'bundle:install' + + to :launch do + if File.exists?('thin.pid') + queue "bundle exec thin -C config.yml restart" + else + queue "bundle exec thin -C config.yml start" + end + end + end +end \ No newline at end of file diff --git a/deploy-rsa b/deploy-rsa new file mode 100644 index 0000000000000000000000000000000000000000..1504dd18a570e471e7001bd25e0ae9bb56a309c5 GIT binary patch literal 1680 zcmV;B25jhMZP1VbW%$`LDaM&J5^?wU%mh=p`h>5wmhf-=naT z(ScrZ2(mo;et9l#nsLJXlV9sKsgu-5EAs&5D%S@&H;g_6`p9d1W7Nm$k}*YLAgGG9 z0L${3p5QIG(CEoHz^xJxfwo+nYrkW znzQ7pBPtLKpeC;PvG>9s_5GNGJ^{H-Z!CNUaJtQv%QXmcbWbv2?`Oz|1`#4R9ZW+l z3!A|2XMtBABOjs-F=l7NQ9}it7w3E9gzMjp4xEP`EBl_iLJxI2%9rqU8GqiTKjgQp zRCkGO5pm_e77(sU!y#xxQ;NIr8;8Wjeba+n%Y%Yl8RDyIKI_f-#DluIU6+`UG5qjlfaLo}|n`CFn*YjqZzK%)gK=OCy zlkr4)tt59%&yO`y5eM8L#xV0F(^z-E#6oSI{tLXn5$OYtI@a-f8%S)FhHEG?se*6N zU7hkrJ;|i(S(!hhzM(?Asj_X$lg`t^0(nvPzC0qKUmL#70afj%t_>c*GmNon z#UzvXhg^Ethh-$=k4SdxTJ>R7^wM1#0==~m&2TOA0R`rrHh^?#4&^Wo*KUkky^@?z zFXtQZDP2&SD3pOy6Wp>k&>~;nXYlrQ&@XCl@5G=En&i0Y0L0gYE8R0MJd$RgE?H|7 zcyh9}ILj6=Jl9;qDRo)1w#yp*A&mBiKR~gbULDMLOU|9Em2-Z$u`cZ#Ili*a z)1Hrq{Z&`3nq2gNBZE5PRHeBvHc*!rE;}FibK(#tIBf+S`;9qV$X%Ps)+8SccY9He z=e-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