Browse Source

Add Capistrano and bootstrap it

tags/0.1.1^2^2
Bèr Kessels 1 year ago
parent
commit
bbcdf19240
6 changed files with 235 additions and 0 deletions
  1. 38
    0
      Capfile
  2. 7
    0
      Gemfile
  3. 29
    0
      Gemfile.lock
  4. 39
    0
      config/deploy.rb
  5. 61
    0
      config/deploy/production.rb
  6. 61
    0
      config/deploy/staging.rb

+ 38
- 0
Capfile View File

@@ -0,0 +1,38 @@
1
+# Load DSL and set up stages
2
+require "capistrano/setup"
3
+
4
+# Include default deployment tasks
5
+require "capistrano/deploy"
6
+
7
+# Load the SCM plugin appropriate to your project:
8
+#
9
+# require "capistrano/scm/hg"
10
+# install_plugin Capistrano::SCM::Hg
11
+# or
12
+# require "capistrano/scm/svn"
13
+# install_plugin Capistrano::SCM::Svn
14
+# or
15
+require "capistrano/scm/git"
16
+install_plugin Capistrano::SCM::Git
17
+
18
+# Include tasks from other gems included in your Gemfile
19
+#
20
+# For documentation on these, see for example:
21
+#
22
+#   https://github.com/capistrano/rvm
23
+#   https://github.com/capistrano/rbenv
24
+#   https://github.com/capistrano/chruby
25
+#   https://github.com/capistrano/bundler
26
+#   https://github.com/capistrano/rails
27
+#   https://github.com/capistrano/passenger
28
+#
29
+# require "capistrano/rvm"
30
+# require "capistrano/rbenv"
31
+# require "capistrano/chruby"
32
+# require "capistrano/bundler"
33
+# require "capistrano/rails/assets"
34
+# require "capistrano/rails/migrations"
35
+# require "capistrano/passenger"
36
+
37
+# Load custom tasks from `lib/capistrano/tasks` if you have any defined
38
+Dir.glob("lib/capistrano/tasks/*.rake").each { |r| import r }

+ 7
- 0
Gemfile View File

@@ -0,0 +1,7 @@
1
+# frozen_string_literal: true
2
+
3
+source "https://rubygems.org"
4
+
5
+git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
6
+
7
+gem "capistrano"

+ 29
- 0
Gemfile.lock View File

@@ -0,0 +1,29 @@
1
+GEM
2
+  remote: https://rubygems.org/
3
+  specs:
4
+    airbrussh (1.3.0)
5
+      sshkit (>= 1.6.1, != 1.7.0)
6
+    capistrano (3.10.2)
7
+      airbrussh (>= 1.0.0)
8
+      i18n
9
+      rake (>= 10.0.0)
10
+      sshkit (>= 1.9.0)
11
+    concurrent-ruby (1.0.5)
12
+    i18n (1.0.1)
13
+      concurrent-ruby (~> 1.0)
14
+    net-scp (1.2.1)
15
+      net-ssh (>= 2.6.5)
16
+    net-ssh (4.2.0)
17
+    rake (12.3.1)
18
+    sshkit (1.16.0)
19
+      net-scp (>= 1.1.2)
20
+      net-ssh (>= 2.8.0)
21
+
22
+PLATFORMS
23
+  ruby
24
+
25
+DEPENDENCIES
26
+  capistrano
27
+
28
+BUNDLED WITH
29
+   1.16.1

+ 39
- 0
config/deploy.rb View File

@@ -0,0 +1,39 @@
1
+# config valid for current version and patch releases of Capistrano
2
+lock "~> 3.10.2"
3
+
4
+set :application, "my_app_name"
5
+set :repo_url, "git@example.com:me/my_repo.git"
6
+
7
+# Default branch is :master
8
+# ask :branch, `git rev-parse --abbrev-ref HEAD`.chomp
9
+
10
+# Default deploy_to directory is /var/www/my_app_name
11
+# set :deploy_to, "/var/www/my_app_name"
12
+
13
+# Default value for :format is :airbrussh.
14
+# set :format, :airbrussh
15
+
16
+# You can configure the Airbrussh format using :format_options.
17
+# These are the defaults.
18
+# set :format_options, command_output: true, log_file: "log/capistrano.log", color: :auto, truncate: :auto
19
+
20
+# Default value for :pty is false
21
+# set :pty, true
22
+
23
+# Default value for :linked_files is []
24
+# append :linked_files, "config/database.yml"
25
+
26
+# Default value for linked_dirs is []
27
+# append :linked_dirs, "log", "tmp/pids", "tmp/cache", "tmp/sockets", "public/system"
28
+
29
+# Default value for default_env is {}
30
+# set :default_env, { path: "/opt/ruby/bin:$PATH" }
31
+
32
+# Default value for local_user is ENV['USER']
33
+# set :local_user, -> { `git config user.name`.chomp }
34
+
35
+# Default value for keep_releases is 5
36
+# set :keep_releases, 5
37
+
38
+# Uncomment the following to require manually verifying the host key before first deploy.
39
+# set :ssh_options, verify_host_key: :secure

+ 61
- 0
config/deploy/production.rb View File

@@ -0,0 +1,61 @@
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
+
10
+
11
+
12
+# role-based syntax
13
+# ==================
14
+
15
+# Defines a role with one or multiple servers. The primary server in each
16
+# group is considered to be the first unless any hosts have the primary
17
+# property set. Specify the username and a domain or IP for the server.
18
+# Don't use `:all`, it's a meta role.
19
+
20
+# role :app, %w{deploy@example.com}, my_property: :my_value
21
+# role :web, %w{user1@primary.com user2@additional.com}, other_property: :other_value
22
+# role :db,  %w{deploy@example.com}
23
+
24
+
25
+
26
+# Configuration
27
+# =============
28
+# You can set any configuration variable like in config/deploy.rb
29
+# These variables are then only loaded and set in this stage.
30
+# For available Capistrano configuration variables see the documentation page.
31
+# http://capistranorb.com/documentation/getting-started/configuration/
32
+# Feel free to add new variables to customise your setup.
33
+
34
+
35
+
36
+# Custom SSH Options
37
+# ==================
38
+# You may pass any option but keep in mind that net/ssh understands a
39
+# limited set of options, consult the Net::SSH documentation.
40
+# http://net-ssh.github.io/net-ssh/classes/Net/SSH.html#method-c-start
41
+#
42
+# Global options
43
+# --------------
44
+#  set :ssh_options, {
45
+#    keys: %w(/home/rlisowski/.ssh/id_rsa),
46
+#    forward_agent: false,
47
+#    auth_methods: %w(password)
48
+#  }
49
+#
50
+# The server-based syntax can be used to override options:
51
+# ------------------------------------
52
+# server "example.com",
53
+#   user: "user_name",
54
+#   roles: %w{web app},
55
+#   ssh_options: {
56
+#     user: "user_name", # overrides user setting above
57
+#     keys: %w(/home/user_name/.ssh/id_rsa),
58
+#     forward_agent: false,
59
+#     auth_methods: %w(publickey password)
60
+#     # password: "please use keys"
61
+#   }

+ 61
- 0
config/deploy/staging.rb View File

@@ -0,0 +1,61 @@
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
+
10
+
11
+
12
+# role-based syntax
13
+# ==================
14
+
15
+# Defines a role with one or multiple servers. The primary server in each
16
+# group is considered to be the first unless any hosts have the primary
17
+# property set. Specify the username and a domain or IP for the server.
18
+# Don't use `:all`, it's a meta role.
19
+
20
+# role :app, %w{deploy@example.com}, my_property: :my_value
21
+# role :web, %w{user1@primary.com user2@additional.com}, other_property: :other_value
22
+# role :db,  %w{deploy@example.com}
23
+
24
+
25
+
26
+# Configuration
27
+# =============
28
+# You can set any configuration variable like in config/deploy.rb
29
+# These variables are then only loaded and set in this stage.
30
+# For available Capistrano configuration variables see the documentation page.
31
+# http://capistranorb.com/documentation/getting-started/configuration/
32
+# Feel free to add new variables to customise your setup.
33
+
34
+
35
+
36
+# Custom SSH Options
37
+# ==================
38
+# You may pass any option but keep in mind that net/ssh understands a
39
+# limited set of options, consult the Net::SSH documentation.
40
+# http://net-ssh.github.io/net-ssh/classes/Net/SSH.html#method-c-start
41
+#
42
+# Global options
43
+# --------------
44
+#  set :ssh_options, {
45
+#    keys: %w(/home/rlisowski/.ssh/id_rsa),
46
+#    forward_agent: false,
47
+#    auth_methods: %w(password)
48
+#  }
49
+#
50
+# The server-based syntax can be used to override options:
51
+# ------------------------------------
52
+# server "example.com",
53
+#   user: "user_name",
54
+#   roles: %w{web app},
55
+#   ssh_options: {
56
+#     user: "user_name", # overrides user setting above
57
+#     keys: %w(/home/user_name/.ssh/id_rsa),
58
+#     forward_agent: false,
59
+#     auth_methods: %w(publickey password)
60
+#     # password: "please use keys"
61
+#   }

Loading…
Cancel
Save