shiplane 0.2.2 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 24630dde655efe6157f41b56971d38dae1756785a8986a56b2a29dd159a9ff32
4
- data.tar.gz: f1a246d2253e9042b9d63034de457cc48fceec19d818a30aaaca83e605788fe0
3
+ metadata.gz: 5b5acdecf601b6e3dcc169a7034ba182339401e432a4ede3a718f0fce112f400
4
+ data.tar.gz: 311b91b9388650ccdf260dca0a92f99c776019e182a05044b31fb352a0a5a51b
5
5
  SHA512:
6
- metadata.gz: 3e3277e0f480bd4f1762dc1e49e064c856aed3dbae1c94577610b155f27daa400da97294f13006302dcfb116c3be8e458f831177eec53a82967210dde567deeb
7
- data.tar.gz: 6f686d80e59aded2d251c17b155624ce1f005c8182426e8c13c34a323f7c12b9d4e253b0dd7a0ddbca1ba3508381ddae9de4c45567d9b0fc22bb083ad1dbc35d
6
+ metadata.gz: 3fd03c6026a3a18cbcbdf974830f826c4c766712b7859de225a86b50c15e45970e9ac03a531204af708a5e81ffa8e79f3fbe39b8640f7e9443b2b68c19c0a7eb
7
+ data.tar.gz: dda7a3732b07058709461b24deccf24a9c471381af8667e915344e0ee1dcb9f7ac3b4e969e7e9d93ef1f541eeb064c491858aa104733e7485258f838bc90b926
data/README.md CHANGED
@@ -131,6 +131,12 @@ You can run a deployment like so:
131
131
  bundle exec cap production deploy
132
132
  ```
133
133
 
134
+ You can also deploy a specific Git SHA using the following syntax:
135
+
136
+ ```sh
137
+ bundle exec cap production deploy[<sha>]
138
+ ```
139
+
134
140
  ### Troubleshooting
135
141
  This is as much a reminder to me as anyone else. If a new version of the gem has just been released and you are trying to pull it, make sure to run the following if bundler fails:
136
142
  ```
@@ -12,6 +12,22 @@ namespace :deploy do
12
12
  end
13
13
  end
14
14
 
15
+ Rake::Task["deploy"].clear
16
+ task :deploy, :sha do |t, args|
17
+ sha = args[:sha] || fetch(:sha) || `git rev-parse HEAD`.chomp
18
+ set :sha, sha
19
+
20
+ set(:deploying, true)
21
+ %w{ starting started
22
+ updating updated
23
+ publishing published
24
+ finishing finished }.each do |task|
25
+ invoke "deploy:#{task}"
26
+ end
27
+ end
28
+ Rake::Task["default"].clear
29
+ task default: :deploy
30
+
15
31
 
16
32
  # deploy
17
33
  # deploy:check
@@ -8,7 +8,7 @@ lock '3.11.0'
8
8
  set :application, 'podcaster'
9
9
  set :repo_url, 'git@github.com:kirillian/podcaster.git'
10
10
 
11
- set :deploy_to, '/var/www/battlecryforfreedom'
11
+ set :deploy_to, '/var/www/my_app_network'
12
12
 
13
13
  # Default value for :log_level is :debug
14
14
  # set :log_level, :debug
@@ -54,8 +54,21 @@ set :sha, `git rev-parse HEAD`.chomp
54
54
  set :shiplane_docker_registry_username, ENV['DOCKERHUB_USERNAME']
55
55
  set :shiplane_docker_registry_password, ENV['DOCKERHUB_PASSWORD']
56
56
 
57
+
58
+ set :shiplane_build_environment_variables, {
59
+ # The following example Fetches RAILS_ENV from your Capistrano environment-specific configuration
60
+ # RAILS_ENV: proc { fetch(:rails_env, 'production') },
61
+ }
62
+
63
+ # The following setting points shiplane to Github's Registry
64
+ # set :shiplane_docker_registry_url, 'ghcr.io'
65
+
66
+ # The following settings assign the username and token/password needed to login to a given registry
67
+ # set :shiplane_docker_registry_username, ENV['SHIPLANE_CONTAINER_REGISTRY_USERNAME']
68
+ # set :shiplane_docker_registry_token, ENV['SHIPLANE_CONTAINER_REGISTRY_TOKEN']
69
+
57
70
  set :shiplane_networks, {
58
- battlecryforfreedom: {
71
+ my_app_network: {
59
72
  connections: [
60
73
  "nginx_reverse_proxy",
61
74
  "nginx-proxy-letsencrypt",
@@ -65,28 +78,28 @@ set :shiplane_networks, {
65
78
 
66
79
  set :shiplane_containers, {
67
80
  app: {
68
- alias: 'battlecryforfreedom-app',
81
+ alias: 'my_app-app',
69
82
  volumes: [],
70
83
  environment: [],
71
84
  expose: 3000,
72
85
  capistrano_role: "docker",
73
- repo: "kirillian2/podcaster",
86
+ repo: "my_docker_repo_account_name/my_docker_repo",
74
87
  command: 'bin/start',
75
- virtual_host: "battlecryforfreedom.com",
76
- letsencrypt_email: "john.epperson@battlecryforfreedom.com",
88
+ virtual_host: "my_app.com",
89
+ letsencrypt_email: "john.epperson@my_app_network.com",
77
90
  networks: [
78
- "battlecryforfreedom"
91
+ "my_app_network"
79
92
  ],
80
93
  },
81
94
  sidekiq: {
82
- alias: 'battlecryforfreedom-sidekiq',
95
+ alias: 'my_app-sidekiq',
83
96
  volumes: [],
84
97
  environment: [],
85
98
  capistrano_role: "docker",
86
- repo: "kirillian2/podcaster",
99
+ repo: "my_docker_repo_account_name/my_docker_repo",
87
100
  command: 'bin/start_sidekiq_workers',
88
101
  networks: [
89
- "battlecryforfreedom"
102
+ "my_app_network"
90
103
  ],
91
104
  },
92
105
  redis: {
@@ -101,22 +114,37 @@ set :shiplane_containers, {
101
114
  repo: "redis",
102
115
  tag: "4.0.9-alpine",
103
116
  networks: [
104
- "battlecryforfreedom"
117
+ "my_app_network"
105
118
  ],
119
+ deploy: {
120
+ # This setting will tell shiplane NOT to restart this container every deploy
121
+ restart: false,
122
+ },
106
123
  },
107
124
  postgres: {
108
125
  alias: 'postgres',
109
126
  volumes: [
110
127
  "/var/lib/postgres/data:/var/lib/postgresql/data",
111
128
  ],
129
+ environment: {
130
+ POSTGRES_PASSWORD: ENV['DATABASE_PASSWORD'],
131
+ POSTGRES_USER: ENV['DATABASE_USERNAME'],
132
+ },
133
+ flags: {
134
+ 'shm-size' => '256MB',
135
+ },
112
136
  expose: 5432,
113
137
  publish: 5432,
114
138
  capistrano_role: "docker",
115
139
  repo: "postgres",
116
140
  tag: "9.6",
117
141
  networks: [
118
- "battlecryforfreedom"
142
+ "my_app_network"
119
143
  ],
144
+ deploy: {
145
+ # This setting will tell shiplane NOT to restart this container every deploy
146
+ restart: false,
147
+ },
120
148
  },
121
149
  }
122
150
 
@@ -6,6 +6,8 @@ COPY . $APP_PATH
6
6
 
7
7
  WORKDIR $APP_PATH
8
8
 
9
+ ARG RAILS_ENV production
10
+ ENV RAILS_ENV $RAILS_ENV
9
11
  ARG GITHUB_TOKEN
10
12
  ENV GITHUB_TOKEN $GITHUB_TOKEN
11
13
  ENV SHIPLANE building
@@ -36,7 +38,8 @@ WORKDIR $APP_PATH
36
38
  RUN bundle config --local path vendor/bundle
37
39
  RUN bundle config --local without development:test:assets
38
40
 
39
- ENV RAILS_ENV production
41
+ ARG RAILS_ENV production
42
+ ENV RAILS_ENV $RAILS_ENV
40
43
  ENV SHIPLANE running
41
44
  ENV RAILS_LOG_TO_STDOUT true
42
45
  ENV RAILS_SERVE_STATIC_FILES true
@@ -6,8 +6,8 @@ project:
6
6
  bootstrap:
7
7
  env_file: .env.production
8
8
  chef-bootstrapper:
9
- package_name: chefdk_3.6.57-1_amd64.deb
10
- package_url: https://packages.chef.io/files/stable/chefdk/3.6.57/ubuntu/18.04/chefdk_3.6.57-1_amd64.deb
9
+ package_name: chefdk_3.13.1-1_amd64.deb
10
+ package_url: https://packages.chef.io/files/stable/chefdk/3.13.1/ubuntu/16.04/chefdk_3.13.1-1_amd64.deb
11
11
  build:
12
12
  registry:
13
13
  # url: ghcr.io # for Github Container Service. Should work for similar services such as Gitlab
@@ -34,9 +34,9 @@ build:
34
34
  - services.container-name.depends_on
35
35
  deploy:
36
36
  servers:
37
- # put the server domain or ip address here
37
+ # `server-url` is your server domain or ip address here (e.g. `12.345.67.89` or `myapp.com`)
38
38
  server-url:
39
- # Only set this flag if you need docker to run as the sudo user (default Ubuntu AMI on AWS requires this)
39
+ # Only set this flag if you need docker to escalate permissions and run everything as sudo (default Ubuntu AMI on AWS requires this)
40
40
  requires_sudo: false
41
41
  # Put SSH options here
42
42
  # ssh_options:
@@ -19,6 +19,16 @@ module Shiplane
19
19
  @postfix = postfix
20
20
 
21
21
  Dotenv.overload File.join(Dir.pwd, build_config.fetch('environment_file', '.env'))
22
+
23
+ # Add any ENV variable overrides from the capistrano configuration
24
+ environment_variable_overrides = fetch(:shiplane_build_environment_variables, {})
25
+ environment_variable_overrides.each do |key, value|
26
+ if value.is_a? Proc
27
+ ENV[key.to_s] = value.call
28
+ else
29
+ ENV[key.to_s] = value
30
+ end
31
+ end
22
32
  end
23
33
 
24
34
  def build!
@@ -73,7 +83,7 @@ module Shiplane
73
83
  def token_login_command
74
84
  @token_login_command ||= [
75
85
  'echo',
76
- login_token,
86
+ "\"#{login_token}\"",
77
87
  '|',
78
88
  'docker',
79
89
  'login',
@@ -44,7 +44,11 @@ module Shiplane
44
44
  end
45
45
 
46
46
  def virtual_host
47
- @virtual_host ||= options[:virtual_host]
47
+ return @virtual_host if defined?(@virtual_host) && @virtual_host
48
+
49
+ if options[:virtual_host]
50
+ @virtual_host = options[:virtual_host].is_a?(Proc) ? options[:virtual_host].call : options[:virtual_host]
51
+ end
48
52
  end
49
53
 
50
54
  def letsencrypt_host
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Shiplane
4
- VERSION = "0.2.2"
4
+ VERSION = "0.2.6"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shiplane
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Epperson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-04-18 00:00:00.000000000 Z
11
+ date: 2021-10-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: shiplane_bootstrappers_chef
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 0.2.2
19
+ version: 0.2.6
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 0.2.2
26
+ version: 0.2.6
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: shiplane_deployers_capistrano_docker
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 0.2.2
33
+ version: 0.2.6
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 0.2.2
40
+ version: 0.2.6
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: dotenv
43
43
  requirement: !ruby/object:Gem::Requirement