Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
VietTH-VenShop
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tran Hoang Viet
VietTH-VenShop
Commits
167428c9
Commit
167428c9
authored
Jul 16, 2015
by
Tran Hoang Viet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
VietTH: Deploy with mina
parent
65a31567
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
215 additions
and
5 deletions
+215
-5
Gemfile
+3
-0
Gemfile.lock
+5
-0
config/deploy.rb
+1
-1
config/mina/production.rb
+94
-0
config/mina/staging.rb
+97
-0
config/unicorn/production.rb
+2
-2
config/unicorn/staging.rb
+2
-2
lib/tasks/deploy.rake
+11
-0
No files found.
Gemfile
View file @
167428c9
...
@@ -99,3 +99,5 @@ gem 'font-awesome-rails', '~> 4.3.0.0'
...
@@ -99,3 +99,5 @@ gem 'font-awesome-rails', '~> 4.3.0.0'
gem
'
meta-tags
'
,
'~> 2.0.0'
gem
'
meta-tags
'
,
'~> 2.0.0'
gem
'
rolify
'
,
'~> 4.0.0'
gem
'
rolify
'
,
'~> 4.0.0'
gem
'
mina
'
\ No newline at end of file
Gemfile.lock
View file @
167428c9
...
@@ -159,6 +159,9 @@ GEM
...
@@ -159,6 +159,9 @@ GEM
actionpack (>= 3.0.0)
actionpack (>= 3.0.0)
method_source (0.8.2)
method_source (0.8.2)
mime-types (2.6.1)
mime-types (2.6.1)
mina (0.3.7)
open4 (~> 1.3.4)
rake
mini_magick (3.8.1)
mini_magick (3.8.1)
subexec (~> 0.2.1)
subexec (~> 0.2.1)
mini_portile (0.6.2)
mini_portile (0.6.2)
...
@@ -171,6 +174,7 @@ GEM
...
@@ -171,6 +174,7 @@ GEM
net-ssh (2.9.2)
net-ssh (2.9.2)
nokogiri (1.6.6.2)
nokogiri (1.6.6.2)
mini_portile (~> 0.6.0)
mini_portile (~> 0.6.0)
open4 (1.3.4)
orm_adapter (0.5.0)
orm_adapter (0.5.0)
parser (2.2.2.6)
parser (2.2.2.6)
ast (>= 1.1, < 3.0)
ast (>= 1.1, < 3.0)
...
@@ -347,6 +351,7 @@ DEPENDENCIES
...
@@ -347,6 +351,7 @@ DEPENDENCIES
kaminari (~> 0.16.3)
kaminari (~> 0.16.3)
letter_opener (~> 1.4.1)
letter_opener (~> 1.4.1)
meta-tags (~> 2.0.0)
meta-tags (~> 2.0.0)
mina
mini_magick (~> 3.8.1)
mini_magick (~> 3.8.1)
mysql2
mysql2
pry-rails (~> 0.3.4)
pry-rails (~> 0.3.4)
...
...
config/deploy.rb
View file @
167428c9
...
@@ -4,7 +4,7 @@ set :deploy_to, '/home/alicuche/Web/venshop'
...
@@ -4,7 +4,7 @@ set :deploy_to, '/home/alicuche/Web/venshop'
set
:app_path
,
"
#{
deploy_to
}
/
#{
current_path
}
"
set
:app_path
,
"
#{
deploy_to
}
/
#{
current_path
}
"
set
:repository
,
'git@gitlab.zigexn.vn:vietth/VietTH-VenShop.git'
set
:repository
,
'git@gitlab.zigexn.vn:vietth/VietTH-VenShop.git'
set
:branch
,
'deploy_mina'
set
:branch
,
'deploy_mina'
set
:user
,
'
ventura
'
set
:user
,
'
alicuche
'
set
:forward_agent
,
true
set
:forward_agent
,
true
set
:port
,
'22'
set
:port
,
'22'
set
:shared_paths
,
[
'config/database.yml'
,
'log'
,
'config/application.yml'
]
set
:shared_paths
,
[
'config/database.yml'
,
'log'
,
'config/application.yml'
]
...
...
config/mina/production.rb
0 → 100644
View file @
167428c9
require
'mina/bundler'
require
'mina/rails'
require
'mina/git'
require
'mina/rvm'
# Config
# ==============================================================================
set
:term_mode
,
:system
set
:rails_env
,
'production'
set
:domain
,
'alicuche.koding.io'
set
:port
,
37894
set
:deploy_to
,
"/home/alicuche/Web/venshop"
set
:app_path
,
"
#{
deploy_to
}
/
#{
current_path
}
"
set
:repository
,
'git@gitlab.zigexn.vn:vietth/VietTH-VenShop.git'
set
:brach
,
'deploy_mina'
set
:user
,
'apps'
set
:shared_paths
,
[
'config/database.yml'
,
'log'
,
'tmp'
,
'config/application.yml'
]
set
:keep_releases
,
5
# RVM
# ==============================================================================
set
:rvm_path
,
'/home/alicuche/.rvm/scripts/rvm'
task
:environment
do
invoke
'rvm:use[2.1.5]'
end
# Setup task
# ==============================================================================
task
:setup
do
queue!
%{
mkdir -p "#{deploy_to}/shared/tmp/pids"
}
end
# Deploy task
# ==============================================================================
desc
"deploys the current version to the server."
task
:deploy
=>
:environment
do
deploy
do
invoke
'git:clone'
invoke
'bundle:install'
invoke
'rails:db_migrate'
invoke
'rails:assets_precompile'
invoke
'deploy:link_shared_paths'
to
:launch
do
invoke
:'unicorn:restart'
end
end
end
# Unicorn
# ==============================================================================
namespace
:unicorn
do
set
:unicorn_pid
,
"
#{
app_path
}
/tmp/pids/unicorn.pid"
set
:start_unicorn
,
%{
cd #{app_path}
bundle exec unicorn -c #{app_path}/config/unicorn/#{rails_env}.rb -E #{rails_env} -D
}
# Start task
# ------------------------------------------------------------------------------
desc
"Start unicorn"
task
:start
=>
:environment
do
queue
'echo "-----> Start Unicorn"'
queue!
start_unicorn
end
# Stop task
# ------------------------------------------------------------------------------
desc
"Stop unicorn"
task
:stop
do
queue
'echo "-----> Stop Unicorn"'
queue!
%{
test -s "#{unicorn_pid}" && kill -QUIT `cat "#{unicorn_pid}"` && echo "Stop Ok" && exit 0
echo >&2 "Not running"
}
end
# Restart task
# ------------------------------------------------------------------------------
desc
"Restart unicorn using 'upgrade'"
task
:restart
=>
:environment
do
invoke
'unicorn:stop'
invoke
'unicorn:start'
end
end
\ No newline at end of file
config/mina/staging.rb
0 → 100644
View file @
167428c9
require
'mina/bundler'
require
'mina/rails'
require
'mina/git'
require
'mina/rvm'
# Config
# ==============================================================================
set
:term_mode
,
:system
set
:rails_env
,
'staging'
set
:domain
,
'alicuche.koding.io'
# set :port, 37894
set
:deploy_to
,
"/home/alicuche/Web/venshop"
set
:app_path
,
"
#{
deploy_to
}
/
#{
current_path
}
"
set
:repository
,
'git@bitbucket.org:alicuche/venshop.git'
set
:branch
,
'deploy_mina'
set
:user
,
'alicuche'
set
:shared_paths
,
[
'config/database.yml'
,
'log'
,
'tmp'
,
'config/application.yml'
]
set
:keep_releases
,
5
# RVM
# ==============================================================================
set
:rvm_path
,
'/home/alicuche/.rvm/scripts/rvm'
task
:environment
do
invoke
'rvm:use[2.1.5]'
end
# Setup task
# ==============================================================================
task
:setup
do
queue!
%{
mkdir -p "#{deploy_to}/shared/tmp/pids"
}
queue!
%{
mkdir -p "#{deploy_to}/log"
}
end
# Deploy task
# ==============================================================================
desc
"deploys the current version to the server."
task
:deploy
=>
:environment
do
deploy
do
invoke
'git:clone'
invoke
'bundle:install'
invoke
'rails:db_migrate'
invoke
'rails:assets_precompile'
invoke
'deploy:link_shared_paths'
to
:launch
do
invoke
:'unicorn:restart'
end
end
end
# Unicorn
# ==============================================================================
namespace
:unicorn
do
set
:unicorn_pid
,
"
#{
app_path
}
/tmp/pids/unicorn.pid"
set
:start_unicorn
,
%{
cd #{app_path}
bundle exec unicorn -c #{app_path}/config/unicorn/#{rails_env}.rb -E #{rails_env} -D
}
# Start task
# ------------------------------------------------------------------------------
desc
"Start unicorn"
task
:start
=>
:environment
do
queue
'echo "-----> Start Unicorn"'
queue!
start_unicorn
end
# Stop task
# ------------------------------------------------------------------------------
desc
"Stop unicorn"
task
:stop
do
queue
'echo "-----> Stop Unicorn"'
queue!
%{
test -s "#{unicorn_pid}" && kill -QUIT `cat "#{unicorn_pid}"` && echo "Stop Ok" && exit 0
echo >&2 "Not running"
}
end
# Restart task
# ------------------------------------------------------------------------------
desc
"Restart unicorn using 'upgrade'"
task
:restart
=>
:environment
do
invoke
'unicorn:stop'
invoke
'unicorn:start'
end
end
\ No newline at end of file
config/unicorn/production.rb
View file @
167428c9
...
@@ -3,8 +3,8 @@ working_directory root
...
@@ -3,8 +3,8 @@ working_directory root
pid
"
#{
root
}
/tmp/pids/unicorn.pid"
pid
"
#{
root
}
/tmp/pids/unicorn.pid"
stderr_path
"
#{
root
}
/log/unicorn.log"
stderr_path
"
/web/training/vietth
/log/unicorn.log"
stdout_path
"
#{
root
}
/log/unicorn.log"
stdout_path
"
/web/training/vietth
/log/unicorn.log"
listen
"/tmp/unicorn.vietth.sock"
listen
"/tmp/unicorn.vietth.sock"
...
...
config/unicorn/staging.rb
View file @
167428c9
...
@@ -3,8 +3,8 @@ working_directory root
...
@@ -3,8 +3,8 @@ working_directory root
pid
"
#{
root
}
/tmp/pids/unicorn.pid"
pid
"
#{
root
}
/tmp/pids/unicorn.pid"
stderr_path
"
#{
root
}
/log/unicorn.log"
stderr_path
"
#{
root
}
/
../
log/unicorn.log"
stdout_path
"
#{
root
}
/log/unicorn.log"
stdout_path
"
#{
root
}
/
../
log/unicorn.log"
listen
"/tmp/unicorn.venshop.sock"
listen
"/tmp/unicorn.venshop.sock"
...
...
lib/tasks/deploy.rake
0 → 100644
View file @
167428c9
namespace
:deploy
do
desc
'Deploy to staging environment'
task
:staging
do
exec
'mina deploy -f config/mina/staging.rb'
end
task
:production
do
exec
'mina deploy -f config/mina/production.rb'
end
end
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment