about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--Capfile19
-rw-r--r--Gemfile11
-rw-r--r--Gemfile.lock31
-rw-r--r--config/database.yml25
-rw-r--r--config/deploy.rb43
-rw-r--r--config/deploy/production.rb62
-rw-r--r--config/deploy/staging.rb61
-rw-r--r--config/initializers/mysql_utf8mb4_fix.rb9
-rw-r--r--db/migrate/20170703013609_convert_to_real_unicode.rb8
-rw-r--r--db/schema.rb11
11 files changed, 247 insertions, 34 deletions
diff --git a/.gitignore b/.gitignore index dad415a..09230f9 100644 --- a/.gitignore +++ b/.gitignore
@@ -27,3 +27,4 @@ tags
27.DS_Store 27.DS_Store
28*.swo 28*.swo
29/public/uploads 29/public/uploads
30config/database.yml
diff --git a/Capfile b/Capfile new file mode 100644 index 0000000..1ace4ce --- /dev/null +++ b/Capfile
@@ -0,0 +1,19 @@
1# Load DSL and set up stages
2require "capistrano/setup"
3
4# Include default deployment tasks
5require "capistrano/deploy"
6
7# Load the SCM plugin appropriate to your project:
8require "capistrano/scm/git"
9install_plugin Capistrano::SCM::Git
10
11# Include tasks from other gems included in your Gemfile
12require "capistrano/rvm"
13require "capistrano/bundler"
14require "capistrano/rails/assets"
15require "capistrano/rails/migrations"
16require "capistrano/passenger"
17
18# Load custom tasks from `lib/capistrano/tasks` if you have any defined
19Dir.glob("lib/capistrano/tasks/*.rake").each { |r| import r }
diff --git a/Gemfile b/Gemfile index 69deff3..878e00c 100644 --- a/Gemfile +++ b/Gemfile
@@ -30,9 +30,6 @@ gem 'jbuilder', '~> 2.5'
30# Use ActiveModel has_secure_password 30# Use ActiveModel has_secure_password
31# gem 'bcrypt', '~> 3.1.7' 31# gem 'bcrypt', '~> 3.1.7'
32 32
33# Use Capistrano for deployment
34# gem 'capistrano-rails', group: :development
35
36group :development, :test do 33group :development, :test do
37 # Call 'byebug' anywhere in the code to stop execution and get a debugger console 34 # Call 'byebug' anywhere in the code to stop execution and get a debugger console
38 gem 'byebug', platforms: [:mri, :mingw, :x64_mingw] 35 gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
@@ -48,6 +45,14 @@ group :development do
48 # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring 45 # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
49 gem 'spring' 46 gem 'spring'
50 gem 'spring-watcher-listen', '~> 2.0.0' 47 gem 'spring-watcher-listen', '~> 2.0.0'
48
49 # Use Capistrano for deployment
50 gem 'capistrano', '~> 3.0', require: false
51 gem 'capistrano-rvm', require: false
52 gem 'capistrano-rails', require: false
53 gem 'capistrano-bundler', require: false
54 gem 'capistrano-passenger', require: false
55 gem 'highline', require: false
51end 56end
52 57
53# Windows does not include zoneinfo files, so bundle the tzinfo-data gem 58# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
diff --git a/Gemfile.lock b/Gemfile.lock index 857547f..6058aa8 100644 --- a/Gemfile.lock +++ b/Gemfile.lock
@@ -40,11 +40,29 @@ GEM
40 tzinfo (~> 1.1) 40 tzinfo (~> 1.1)
41 addressable (2.5.1) 41 addressable (2.5.1)
42 public_suffix (~> 2.0, >= 2.0.2) 42 public_suffix (~> 2.0, >= 2.0.2)
43 airbrussh (1.2.0)
44 sshkit (>= 1.6.1, != 1.7.0)
43 arel (8.0.0) 45 arel (8.0.0)
44 bcrypt (3.1.11) 46 bcrypt (3.1.11)
45 bindex (0.5.0) 47 bindex (0.5.0)
46 builder (3.2.3) 48 builder (3.2.3)
47 byebug (9.0.6) 49 byebug (9.0.6)
50 capistrano (3.8.1)
51 airbrussh (>= 1.0.0)
52 i18n
53 rake (>= 10.0.0)
54 sshkit (>= 1.9.0)
55 capistrano-bundler (1.2.0)
56 capistrano (~> 3.1)
57 sshkit (~> 1.2)
58 capistrano-passenger (0.2.0)
59 capistrano (~> 3.0)
60 capistrano-rails (1.2.3)
61 capistrano (~> 3.1)
62 capistrano-bundler (~> 1.1)
63 capistrano-rvm (0.1.2)
64 capistrano (~> 3.0)
65 sshkit (~> 1.2)
48 capybara (2.14.3) 66 capybara (2.14.3)
49 addressable 67 addressable
50 mime-types (>= 1.16) 68 mime-types (>= 1.16)
@@ -82,6 +100,7 @@ GEM
82 haml (5.0.1) 100 haml (5.0.1)
83 temple (>= 0.8.0) 101 temple (>= 0.8.0)
84 tilt 102 tilt
103 highline (1.7.8)
85 i18n (0.8.4) 104 i18n (0.8.4)
86 jbuilder (2.7.0) 105 jbuilder (2.7.0)
87 activesupport (>= 4.2.0) 106 activesupport (>= 4.2.0)
@@ -106,6 +125,9 @@ GEM
106 mini_portile2 (2.2.0) 125 mini_portile2 (2.2.0)
107 minitest (5.10.2) 126 minitest (5.10.2)
108 multi_json (1.12.1) 127 multi_json (1.12.1)
128 net-scp (1.2.1)
129 net-ssh (>= 2.6.5)
130 net-ssh (4.1.0)
109 nio4r (2.1.0) 131 nio4r (2.1.0)
110 nokogiri (1.8.0) 132 nokogiri (1.8.0)
111 mini_portile2 (~> 2.2.0) 133 mini_portile2 (~> 2.2.0)
@@ -177,6 +199,9 @@ GEM
177 activesupport (>= 4.0) 199 activesupport (>= 4.0)
178 sprockets (>= 3.0.0) 200 sprockets (>= 3.0.0)
179 sqlite3 (1.3.13) 201 sqlite3 (1.3.13)
202 sshkit (1.13.1)
203 net-scp (>= 1.1.2)
204 net-ssh (>= 2.8.0)
180 temple (0.8.0) 205 temple (0.8.0)
181 thor (0.19.4) 206 thor (0.19.4)
182 thread_safe (0.3.6) 207 thread_safe (0.3.6)
@@ -206,11 +231,17 @@ PLATFORMS
206 231
207DEPENDENCIES 232DEPENDENCIES
208 byebug 233 byebug
234 capistrano (~> 3.0)
235 capistrano-bundler
236 capistrano-passenger
237 capistrano-rails
238 capistrano-rvm
209 capybara (~> 2.13) 239 capybara (~> 2.13)
210 ckeditor 240 ckeditor
211 coffee-rails (~> 4.2) 241 coffee-rails (~> 4.2)
212 devise 242 devise
213 haml 243 haml
244 highline
214 jbuilder (~> 2.5) 245 jbuilder (~> 2.5)
215 jquery-rails 246 jquery-rails
216 listen (>= 3.0.5, < 3.2) 247 listen (>= 3.0.5, < 3.2)
diff --git a/config/database.yml b/config/database.yml deleted file mode 100644 index 0d02f24..0000000 --- a/config/database.yml +++ /dev/null
@@ -1,25 +0,0 @@
1# SQLite version 3.x
2# gem install sqlite3
3#
4# Ensure the SQLite 3 gem is defined in your Gemfile
5# gem 'sqlite3'
6#
7default: &default
8 adapter: sqlite3
9 pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
10 timeout: 5000
11
12development:
13 <<: *default
14 database: db/development.sqlite3
15
16# Warning: The database defined as "test" will be erased and
17# re-generated from your development database when you run "rake".
18# Do not set this db to the same as development or production.
19test:
20 <<: *default
21 database: db/test.sqlite3
22
23production:
24 <<: *default
25 database: db/production.sqlite3
diff --git a/config/deploy.rb b/config/deploy.rb new file mode 100644 index 0000000..16c6257 --- /dev/null +++ b/config/deploy.rb
@@ -0,0 +1,43 @@
1# config valid only for current version of Capistrano
2lock "3.8.1"
3
4set :application, "thoughts"
5set :repo_url, "git@github.com:hatkirby/thoughts.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
11set :deploy_to, "/srv/www/thoughts"
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 []
24append :linked_files, "config/database.yml"
25
26# Default value for linked_dirs is []
27append :linked_dirs, "log", "tmp/pids", "tmp/cache", "tmp/sockets", "public/uploads"
28
29# Default value for default_env is {}
30# set :default_env, { path: "/opt/ruby/bin:$PATH" }
31
32# Default value for keep_releases is 5
33# set :keep_releases, 5
34
35# rvm
36set :rvm_type, :system
37set :rvm_custom_path, '/usr/local/rvm'
38
39# rails
40set :rails_env, 'production'
41set :conditionally_migrate, true
42set :migration_role, :app
43set :assets_roles, [:app]
diff --git a/config/deploy/production.rb b/config/deploy/production.rb new file mode 100644 index 0000000..6475c07 --- /dev/null +++ b/config/deploy/production.rb
@@ -0,0 +1,62 @@
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}
9server "feffernoo.se", user: "thoughts", roles: %w{app db web}
10
11
12
13# role-based syntax
14# ==================
15
16# Defines a role with one or multiple servers. The primary server in each
17# group is considered to be the first unless any hosts have the primary
18# property set. Specify the username and a domain or IP for the server.
19# Don't use `:all`, it's a meta role.
20
21# role :app, %w{deploy@example.com}, my_property: :my_value
22# role :web, %w{user1@primary.com user2@additional.com}, other_property: :other_value
23# role :db, %w{deploy@example.com}
24
25
26
27# Configuration
28# =============
29# You can set any configuration variable like in config/deploy.rb
30# These variables are then only loaded and set in this stage.
31# For available Capistrano configuration variables see the documentation page.
32# http://capistranorb.com/documentation/getting-started/configuration/
33# Feel free to add new variables to customise your setup.
34
35
36
37# Custom SSH Options
38# ==================
39# You may pass any option but keep in mind that net/ssh understands a
40# limited set of options, consult the Net::SSH documentation.
41# http://net-ssh.github.io/net-ssh/classes/Net/SSH.html#method-c-start
42#
43# Global options
44# --------------
45# set :ssh_options, {
46# keys: %w(/home/rlisowski/.ssh/id_rsa),
47# forward_agent: false,
48# auth_methods: %w(password)
49# }
50#
51# The server-based syntax can be used to override options:
52# ------------------------------------
53# server "example.com",
54# user: "user_name",
55# roles: %w{web app},
56# ssh_options: {
57# user: "user_name", # overrides user setting above
58# keys: %w(/home/user_name/.ssh/id_rsa),
59# forward_agent: false,
60# auth_methods: %w(publickey password)
61# # password: "please use keys"
62# }
diff --git a/config/deploy/staging.rb b/config/deploy/staging.rb new file mode 100644 index 0000000..4bb7a71 --- /dev/null +++ b/config/deploy/staging.rb
@@ -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# }
diff --git a/config/initializers/mysql_utf8mb4_fix.rb b/config/initializers/mysql_utf8mb4_fix.rb new file mode 100644 index 0000000..8388027 --- /dev/null +++ b/config/initializers/mysql_utf8mb4_fix.rb
@@ -0,0 +1,9 @@
1require 'active_record/connection_adapters/abstract_mysql_adapter'
2
3module ActiveRecord
4 module ConnectionAdapters
5 class AbstractMysqlAdapter
6 NATIVE_DATABASE_TYPES[:string] = { :name => "varchar", :limit => 191 }
7 end
8 end
9end
diff --git a/db/migrate/20170703013609_convert_to_real_unicode.rb b/db/migrate/20170703013609_convert_to_real_unicode.rb new file mode 100644 index 0000000..9291c0c --- /dev/null +++ b/db/migrate/20170703013609_convert_to_real_unicode.rb
@@ -0,0 +1,8 @@
1class ConvertToRealUnicode < ActiveRecord::Migration[5.1]
2 def change
3 change_column :records, :recordable_type, :string, limit: 191
4 change_column :users, :login, :string, default: "", null: false, limit: 191
5 change_column :users, :email, :string, default: "", null: false, limit: 191
6 change_column :users, :reset_password_token, :string, limit: 191
7 end
8end
diff --git a/db/schema.rb b/db/schema.rb index c7c82ac..fc6614a 100644 --- a/db/schema.rb +++ b/db/schema.rb
@@ -10,7 +10,7 @@
10# 10#
11# It's strongly recommended that you check this file into your version control system. 11# It's strongly recommended that you check this file into your version control system.
12 12
13ActiveRecord::Schema.define(version: 20170629184901) do 13ActiveRecord::Schema.define(version: 20170703013609) do
14 14
15 create_table "ckeditor_assets", force: :cascade do |t| 15 create_table "ckeditor_assets", force: :cascade do |t|
16 t.string "data_file_name", null: false 16 t.string "data_file_name", null: false
@@ -28,7 +28,6 @@ ActiveRecord::Schema.define(version: 20170629184901) do
28 create_table "entries", force: :cascade do |t| 28 create_table "entries", force: :cascade do |t|
29 t.string "title" 29 t.string "title"
30 t.text "body" 30 t.text "body"
31 t.string "directory", null: false
32 t.string "slug", null: false 31 t.string "slug", null: false
33 t.string "type", null: false 32 t.string "type", null: false
34 t.datetime "created_at", null: false 33 t.datetime "created_at", null: false
@@ -37,7 +36,7 @@ ActiveRecord::Schema.define(version: 20170629184901) do
37 36
38 create_table "records", force: :cascade do |t| 37 create_table "records", force: :cascade do |t|
39 t.text "description" 38 t.text "description"
40 t.string "recordable_type" 39 t.string "recordable_type", limit: 191
41 t.integer "recordable_id" 40 t.integer "recordable_id"
42 t.datetime "created_at", null: false 41 t.datetime "created_at", null: false
43 t.datetime "updated_at", null: false 42 t.datetime "updated_at", null: false
@@ -45,10 +44,10 @@ ActiveRecord::Schema.define(version: 20170629184901) do
45 end 44 end
46 45
47 create_table "users", force: :cascade do |t| 46 create_table "users", force: :cascade do |t|
48 t.string "login", default: "", null: false 47 t.string "login", limit: 191, default: "", null: false
49 t.string "email", default: "", null: false 48 t.string "email", limit: 191, default: "", null: false
50 t.string "encrypted_password", default: "", null: false 49 t.string "encrypted_password", default: "", null: false
51 t.string "reset_password_token" 50 t.string "reset_password_token", limit: 191
52 t.datetime "reset_password_sent_at" 51 t.datetime "reset_password_sent_at"
53 t.datetime "remember_created_at" 52 t.datetime "remember_created_at"
54 t.integer "sign_in_count", default: 0, null: false 53 t.integer "sign_in_count", default: 0, null: false