Commit 4d35f130 by liyijie

feat: 更新部署脚本

parent 154a6596
......@@ -6,6 +6,7 @@ DATABASE_HOST = localhost
DATABASE_USERNAME = postgres
DATABASE_PASSWORD =
DATABASE_NAME = app_name_to_replace
DATABASE_PORT = 5432
S3_ACCESS_KEY_ID = n7Xqqp1Fweznus_J0o14DJjuDuuZ-UJYa5lVMnSl
S3_SECRET_ACCESS_KEY = M-M8qDXRjz4wPz0khw9-QSco6yLzaeqNaouaDFP1
......
......@@ -17,3 +17,16 @@ task :annotate do
sh 'annotate -i'
sh 'annotate -i --with-comment'
end
task :bundle do
sh "bundle config set --local without 'development test'"
sh 'bundle install'
end
task :start do
sh 'RAILS_ENV=production bundle exec puma -C config/puma.rb'
end
task :bin do
sh 'rake app:update:bin'
end
......@@ -11,6 +11,7 @@ default: &default
username: <%= ENV["DATABASE_USERNAME"] %>
password: <%= ENV["DATABASE_PASSWORD"] %>
host: <%= ENV["DATABASE_HOST"] %>
port: <%= ENV["DATABASE_PORT"] %>
development:
<<: *default
......
......@@ -29,7 +29,7 @@ set :forward_agent, true # SSH forward_agent.
# run `mina -d` to see all folders and files already included in `shared_dirs` and `shared_files`
# set :shared_dirs, fetch(:shared_dirs, []).push('public/assets')
# set :shared_files, fetch(:shared_files, []).push('config/database.yml', 'config/secrets.yml')
set :shared_dirs, fetch(:shared_dirs, []).push('tmp/pids', 'tmp/sockets')
set :shared_dirs, fetch(:shared_dirs, []).push('tmp/pids', 'tmp/sockets', 'public')
set :shared_files, fetch(:shared_files, []).push('.env.production.local')
# sidekiq
......@@ -66,7 +66,9 @@ task :deploy do
# instance of your project.
invoke :'git:clone'
invoke :'deploy:link_shared_paths'
command %{bundle config set without 'development test'}
invoke :'bundle:install'
command 'rake app:update:bin'
# invoke :'rails:db_create'
command %{bundle exec rails db:migrate RAILS_ENV=production}
# invoke :'rails[db:migrate]'
......
......@@ -17,6 +17,11 @@ inject_into_file 'Gemfile', before: "gem 'pg" do <<-COMMENT
COMMENT
end
inject_into_file 'Gemfile', before: "gemspec" do <<-COMMENT
git_source(:tallty) { |repo| "git@git.tallty.com:#{repo}.git" }
COMMENT
end
gsub_file 'app/controllers/application_controller.rb', 'respond_to :html', 'respond_to :json'
# A Ruby static code analyzer, based on the community Ruby style guide. http://rubocop.readthedocs.io
......@@ -25,9 +30,10 @@ gem 'rubocop', require: false
gem 'rubocop-rails'
gem 'rubocop-performance'
gem 'simple_controller', git: 'https://git.tallty.com/open-source/simple_controller.git'
gem 'acts_as_pasting', git: 'http://git.tallty.com/open-source/acts_as_pasting.git'
gem 'tallty_import_export', git: 'https://git.tallty.com/open-source/tallty_import_export.git'
gem 'simple_controller', tallty: 'open-source/simple_controller'
gem 'acts_as_pasting', tallty: 'open-source/acts_as_pasting'
gem 'tallty_import_export', tallty: 'open-source/tallty_import_export'
gem 'pry-byebug'
# deploy
......@@ -42,7 +48,7 @@ gem_group :development, :test do
gem 'rspec-rails'
gem 'shoulda-matchers'
gem 'factory_bot_rails'
gem 'rspec-rails-swagger', git: "https://git.tallty.com/open-source/rspec-rails-swagger.git"
gem 'rspec-rails-swagger', tallty: 'open-source/rails-rails-swagger'
gem 'simplecov', require: false
gem 'annotate'
gem "pry-rails"
......@@ -65,6 +71,7 @@ dump.rdb
# Ignore local files
*.local
.DS_Store
/bin/*
COMMENT
end
......@@ -143,6 +150,7 @@ after_bundle do
# run 'mkdir .pids'
# run 'touch .pids/.keep'
run 'bundle exec rake app:update:bin'
run 'bundle binstubs rspec-core'
run 'bundle binstubs bundler --force'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment