california 0.4.1 → 1.0.0

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
  SHA1:
3
- metadata.gz: 9adb6fd666b3eabfd3b9bd6c4da5dd419c3f06b5
4
- data.tar.gz: ff63ffad385ad07dd09c421c05babc3140aa44e6
3
+ metadata.gz: 8bfdd67a9f3ee5fdd0b596fd1167067e0077a5ac
4
+ data.tar.gz: 2222a88579562b1b19b3c6198129ad22ce21e8f4
5
5
  SHA512:
6
- metadata.gz: dd60f30690bc3442ce3ad810c5df6295c69ed69cc89410d69f80d73f17abb18d816078d08cbddf510694fd33167858004aa5847cf4c7cae5506e90a4bc54958d
7
- data.tar.gz: fd9fbae30bdcce5eb55436f738634d759cf9a66aa34a47a869f1daabad874af6ab7b134ec4c96788b2ad9017a08082aca6819c3b4f5067f132a3405e3b0c2359
6
+ metadata.gz: 8b7a2a7ff7f4271948d4233bec61225651493c33e66267669c9ee83d02667085309536ecfcf5fa1214a109b8c4d39353ea8b64e7ad4dc2c1417ec78cc3dab214
7
+ data.tar.gz: 42ce9ca509167b5cd4c0f1a98a337d3341a217cab2d840ae4ab903ed70d9618babef041e5f5337f88a7cd3991f233fe15798dfa9ca13fb53e763f5f8bdf4efa9
data/LICENSE.md CHANGED
@@ -1,4 +1,6 @@
1
- Copyright 2015 halo
1
+ Copyright (c) 2018 halo https://github.com/halo/california
2
+
3
+ MIT License
2
4
 
3
5
  Permission is hereby granted, free of charge, to any person obtaining
4
6
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -1,7 +1,22 @@
1
- ## Opinionated capistrano deployment for dummies Edit
1
+ ## Opinionated Capistrano deployment for dummies
2
2
 
3
+ [![Version](https://img.shields.io/gem/v/california.svg?style=flat)](https://rubygems.org/gems/california)
3
4
  [![Build Status](https://travis-ci.org/halo/california.svg?branch=master)](https://travis-ci.org/halo/california)
4
5
 
6
+ When using [Capistrano](https://github.com/capistrano/capistrano) to deploy an application to a server, it runs [all this stuff](https://github.com/capistrano/capistrano/blob/master/lib/capistrano/tasks/deploy.rake) creating a new symlink for every release, cleans up old ones, etc..
7
+
8
+ California is an opinionated out-of-the-box, best-practice configuration that aims to make things a little bit simpler for both beginners and advanced users.
9
+
10
+ ### Design Goals
11
+
12
+ * Don't separate releases in different directories. Just [perform a simple checkout](https://github.com/halo/california/blob/master/lib/california/capistrano/tasks/deploy.rake#L21-L24) that updates the code in place.
13
+
14
+ * Introduce convention over configuration, e.g. as to [where the applications are deployed](https://github.com/halo/california/blob/master/lib/california/stage.rb#L40-L42).
15
+
16
+ * Every app has its own user on the server and when running commands during deploy, [load the `.bash_profile` of that user](https://github.com/halo/california/blob/master/lib/california/stage.rb#L65-L67)
17
+
18
+ * Nicer logging output so that you *really* know at which stage of the deploy you are (update code, run bundler, restart)
19
+
5
20
  ### Requirements
6
21
 
7
22
  * Ruby >= 2.0
@@ -15,7 +30,7 @@ Create a new repository with a Gemfile like this and run `bundle install` to get
15
30
  # Content of Gemfile
16
31
  source 'https://rubygems.org'
17
32
 
18
- gem 'california', github: 'halo/california'
33
+ gem 'california'
19
34
  ```
20
35
 
21
36
  Then run the generator for creating your first app you may want to deploy.
@@ -26,17 +41,18 @@ Let's say the name of the app is "hello_world".
26
41
  bundle exec california generate hello_world
27
42
  ```
28
43
 
29
- Modify `hello_world/deploy/production.rb` (or whichever stages you have) and define which servers you want to deploy to.
44
+ Follow the instructions in `hello_world/deploy/production.rb` (or whichever stages you have) and define which servers you want to deploy to.
30
45
 
31
46
  ### Server preparation
32
47
 
33
- When deploying your `hello_world` app, it is assumed that you can ssh into the server with the user `hello_world` and that the repository has been cloned to `/mnt/apps/hello_world/repository`.
48
+ When deploying your `hello_world` app, it is assumed that you can ssh into the server with the username `hello_world` and that the repository has been cloned to `/mnt/apps/hello_world/repository`.
49
+
50
+ The reason for this directory is that if you are on AWS, `/mnt` is the default path for permanent storage. If you're not on AWS, you may just ride along and follow the convention.
34
51
 
35
- Any additional environment variables needed to configure your application should be located in a file called `/mnt/envs/hello_world`.
52
+ If you configure your application via environment variables, you can add them in a file called `/mnt/envs/hello_world`.
36
53
 
37
54
  ```bash
38
55
  # Example of content of /mnt/envs/hello_world
39
- SECRET_TOKEN="abcdef"
40
56
  DATABASE_URL="postgres://db.example.com"
41
57
  ```
42
58
 
@@ -54,4 +70,4 @@ bundle exec cap production deploy migrate=true
54
70
 
55
71
  ### Copyright
56
72
 
57
- MIT 2016 halo. See [MIT-LICENSE](http://github.com/halo/california/blob/master/MIT-LICENSE).
73
+ MIT 2018 halo. See [LICENSE.md](http://github.com/halo/california/blob/master/LICENSE.md).
@@ -57,15 +57,19 @@ namespace :deploy do
57
57
  # –––––––––––––––
58
58
 
59
59
  task :updated do
60
- logger.info 'Running Bundler...'
61
-
62
- on roles :app do
63
- as fetch(:application) do
64
- within fetch(:deploy_to) do
65
-
66
- # Running Bundler.
67
- core_count = capture(:nproc).chomp
68
- execute :bundle, :install, '--deployment', '--quiet', '--without', 'development', 'test', '--jobs', core_count
60
+ if fetch(:skip_bundler)
61
+ logger.info 'Skipping Bundler...'
62
+ else
63
+ logger.info 'Running Bundler...'
64
+
65
+ on roles :app do
66
+ as fetch(:application) do
67
+ within fetch(:deploy_to) do
68
+
69
+ # Running Bundler.
70
+ core_count = capture(:nproc).chomp
71
+ execute :bundle, :install, '--deployment', '--quiet', '--without', 'development', 'test', '--jobs', core_count
72
+ end
69
73
  end
70
74
  end
71
75
  end
@@ -76,13 +80,23 @@ namespace :deploy do
76
80
  # ––––––––––––––––––
77
81
 
78
82
  task :publishing do
79
- logger.info 'Restarting the app...'
80
-
81
- on roles :app do
82
- as fetch(:application) do
83
- within File.join(fetch(:deploy_to), 'tmp') do
84
-
85
- execute :touch, 'restart.txt'
83
+ if fetch(:skip_restart)
84
+ logger.info 'Skipping Restart...'
85
+ else
86
+
87
+ on roles :app do
88
+ as fetch(:application) do
89
+
90
+ if fetch(:restart_strategy) == 'restart.txt'
91
+ logger.info 'Restarting the app via restart.txt...'
92
+ within File.join(fetch(:deploy_to), 'tmp') do
93
+ execute :touch, 'restart.txt'
94
+ end
95
+
96
+ else
97
+ logger.info 'Restarting the app via passenger-config...'
98
+ execute 'passenger-config', 'restart-app', fetch(:deploy_to)
99
+ end
86
100
  end
87
101
  end
88
102
  end
@@ -1,4 +1,4 @@
1
- module BenderLogger
1
+ module CaliforniaLogger
2
2
  def self.logger
3
3
  @logger ||= logger!
4
4
  end
@@ -15,7 +15,7 @@ module BenderLogger
15
15
  end
16
16
 
17
17
  def logger
18
- BenderLogger.logger
18
+ CaliforniaLogger.logger
19
19
  end
20
20
 
21
21
  # Rails environment sanity check.
@@ -1,17 +1,30 @@
1
- # The stage name is derived from this very filename,
2
- # which should include "production", "staging", or "test" in its name.
1
+ # First we need to set a stage name.
2
+ # This is usually an environment such as `production`, `staging`, or `test`.
3
+ # By default, the stage name is derived from the filename of THIS file.
3
4
  set :stage, File.basename(__FILE__, '.rb')
4
5
 
5
- # Loading task defaults.
6
- load 'california/stage'
6
+ # By default, we will run `bundle install`, to skip that, uncomment the following line.
7
+ # This is useful for non-ruby applications.
8
+ # set :skip_bundler, true
7
9
 
8
- # You need to define at least one server.
9
- # The one with the role "migrator" will be entitled to run migrations:
10
- # server '203.0.113.19', roles: %w{ all app web_server migrator }
10
+ # By default the webserver is restarted using `/usr/bin/passenger-config`.
11
+ # If you prefer the old-fashioned `touch tmp/restart.txt` uncomment the following line.
12
+ # set :restart_strategy, 'restart.txt'
11
13
 
12
- # You may also set any custom Capistrano options:
14
+ # You can skip the restart alltogether by uncommenting the following line.
15
+ # set :skip_restart, true
16
+
17
+ # You may also set any custom Capistrano options if you wish:
13
18
  # set :ssh_options, {
14
19
  # forward_agent: true,
15
20
  # port: 12345,
16
21
  # keys: Pathname.new('~/.ssh/mykey').expand_path.to_s,
17
22
  # }
23
+
24
+ # That's all for custom configuration. Now we can load the default configuration.
25
+ load 'california/stage'
26
+
27
+ # Important: Now you need to define AT LEAST ONE server.
28
+
29
+ # Example: The one with the role "migrator" will be entitled to run migrations:
30
+ # server '203.0.113.19', roles: %w{ all app web_server migrator }
@@ -1,3 +1,3 @@
1
1
  module California
2
- VERSION = '0.4.1'.freeze
2
+ VERSION = '1.0.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: california
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - halo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-05 00:00:00.000000000 Z
11
+ date: 2018-07-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capistrano
@@ -16,30 +16,30 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '3.8'
19
+ version: '3.11'
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: '3.8'
26
+ version: '3.11'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: thor
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0.19'
33
+ version: '0.20'
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.19'
40
+ version: '0.20'
41
41
  - !ruby/object:Gem::Dependency
42
- name: rspec
42
+ name: guard-rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ">="
@@ -53,7 +53,7 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: guard-rspec
56
+ name: rb-fsevent
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - ">="
@@ -67,7 +67,7 @@ dependencies:
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
- name: rb-fsevent
70
+ name: rspec
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - ">="
@@ -115,7 +115,8 @@ files:
115
115
  - lib/california/templates/app/config/deploy/stage.rb
116
116
  - lib/california/version.rb
117
117
  homepage: https://github.com/halo/california
118
- licenses: []
118
+ licenses:
119
+ - MIT
119
120
  metadata: {}
120
121
  post_install_message:
121
122
  rdoc_options: []
@@ -133,7 +134,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
133
134
  version: '0'
134
135
  requirements: []
135
136
  rubyforge_project:
136
- rubygems_version: 2.5.2
137
+ rubygems_version: 2.6.11
137
138
  signing_key:
138
139
  specification_version: 4
139
140
  summary: Capistrano 3 for dummies.