-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
automate code deploys with sql dumps and tars, ui and script ready, n…
…eeds runner ref #78
- Loading branch information
1 parent
42e9a04
commit 26afc29
Showing
8 changed files
with
124 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
#per site in .env | ||
REPO_NAME=coyote | ||
REPO_URL=https://github.com/coyote-team/coyote.git | ||
SUPPORT_EMAIL="[email protected]" | ||
SUPPORT_EMAIL="[email protected]" | ||
SUPPORT_PASSWORD="" | ||
ASSET_SYNC_GZIP_COMPRESSION=true | ||
ASSET_SYNC_MANIFEST=true | ||
ROLLBAR_ACCESS_TOKEN= | ||
|
@@ -10,4 +11,8 @@ FLOWDOCK_API_TOKEN="" | |
SERVER_USER="" | ||
PRODUCTION_IP="" | ||
STAGING_IP="" | ||
BOOKMARKLET="true" | ||
BOOKMARKLET="false" | ||
WEBSITE_URL="" | ||
WEBSITE_TITLE="" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,3 +48,4 @@ | |
= link_to user_session_path do | ||
%i.fa.fa-fw.fa-sign-in{"aria-hidden" => "true"} | ||
Log in | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/bash | ||
#usage: deploy_self production | ||
|
||
cd ~/code/coyote | ||
|
||
DATE=$(date +"%Y%m%d%H%M") | ||
DIR=~/backups/coyote_$DATE | ||
|
||
mkdir -p $DIR | ||
rsync -az --copy-links ~/data/coyote/current/* $DIR | ||
RAILS_ENV=$1 bundle exec rake db:backup | ||
mv ../coyote*.sql $DIR | ||
|
||
tar -zcvf ~/backups/$DIR.tar.gz ~/backups | ||
rm -rf $DIR | ||
|
||
#deploy | ||
git pull; bundle exec cap production deploy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
namespace :backup do | ||
desc "Backup database" | ||
task :db do | ||
app_root = File.join(File.dirname(__FILE__), "..", "..") | ||
output_file = File.join(app_root, "..", "#{ENV['DATABASE_NAME']}-#{Time.now.strftime('%Y%m%d')}.sql") | ||
if ENV['DATABASE_PASSWORD'] and !ENV['DATABASE_PASSWORD'].blank? | ||
command = "/usr/bin/env mysqldump -h #{ENV['DATABASE_HOST']} -u #{ENV['DATABASE_USERNAME']} -p#{ENV['DATABASE_PASSWORD']} #{ENV['DATABASE_NAME']} > #{output_file}" | ||
else | ||
command = "/usr/bin/env mysqldump -h #{ENV['DATABASE_HOST']} -u #{ENV['DATABASE_USERNAME']} #{ENV['DATABASE_NAME']} > #{output_file}" | ||
end | ||
puts command | ||
system(command) | ||
end | ||
end |