Skip to content

Commit c335e9c

Browse files
author
Zachery Moneypenny
committed
Adds capistrano configuration
1 parent eed61bb commit c335e9c

File tree

3 files changed

+56
-0
lines changed

3 files changed

+56
-0
lines changed

Capfile

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Load DSL and set up stages
2+
require "capistrano/setup"
3+
4+
# Include default deployment tasks
5+
require "capistrano/deploy"
6+
7+
# Include tasks from other gems included in your Gemfile
8+
#
9+
# For documentation on these, see for example:
10+
#
11+
# https://github.com/capistrano/rvm
12+
# https://github.com/capistrano/rbenv
13+
# https://github.com/capistrano/chruby
14+
# https://github.com/capistrano/bundler
15+
# https://github.com/capistrano/rails
16+
# https://github.com/capistrano/passenger
17+
#
18+
# require 'capistrano/rvm'
19+
# require 'capistrano/rbenv'
20+
# require 'capistrano/chruby'
21+
# require 'capistrano/bundler'
22+
# require 'capistrano/rails/assets'
23+
# require 'capistrano/rails/migrations'
24+
# require 'capistrano/passenger'
25+
26+
# Load custom tasks from `lib/capistrano/tasks` if you have any defined
27+
Dir.glob("lib/capistrano/tasks/*.rake").each { |r| import r }

config/deploy.rb

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# config valid only for current version of Capistrano
2+
lock '3.5.0'
3+
4+
set :image_name, 'dockertest'
5+
set :account, 'whazzmaster'
6+
7+
namespace :deploy do
8+
task :docker do
9+
on roles(:docker) do |host|
10+
image_name = fetch(:image_name)
11+
account = fetch(:account)
12+
13+
puts "============= Starting Docker Update ============="
14+
execute "docker stop #{image_name}; echo 0"
15+
execute "docker rm -f #{image_name}; echo 0"
16+
execute "docker pull #{account}/#{image_name}:latest"
17+
execute "docker run -p 80:80 -d --name #{image_name} #{account}/#{image_name}:latest"
18+
end
19+
end
20+
end

config/deploy/production.rb

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# server-based syntax
2+
# ======================
3+
# Defines a single server with a list of roles and multiple properties.
4+
# You can define all roles on a single server, or split them:
5+
6+
# server 'example.com', user: 'deploy', roles: %w{app db web}, my_property: :my_value
7+
# server 'example.com', user: 'deploy', roles: %w{app web}, other_property: :other_value
8+
# server 'db.example.com', user: 'deploy', roles: %w{db}
9+
server '45.55.182.112', user: 'root', roles: %w{docker}

0 commit comments

Comments
 (0)