Vue.js 如何使用capistrano部署vuejs应用程序?
我尝试使用capistrano部署我的vuejs应用程序。我尝试了另一种方法(ruby脚本),但我不明白它是如何工作的。在我的通道上,我部署了Dist文件夹,但我必须为我的应用程序在线午餐做些什么 这是我的部署脚本Vue.js 如何使用capistrano部署vuejs应用程序?,vue.js,deployment,capistrano,vue-cli,Vue.js,Deployment,Capistrano,Vue Cli,我尝试使用capistrano部署我的vuejs应用程序。我尝试了另一种方法(ruby脚本),但我不明白它是如何工作的。在我的通道上,我部署了Dist文件夹,但我必须为我的应用程序在线午餐做些什么 这是我的部署脚本 gemfile do source "https://rubygems.org" gem "sshkit" end require "sshkit" require "sshkit/dsl" S
gemfile do
source "https://rubygems.org"
gem "sshkit"
end
require "sshkit"
require "sshkit/dsl"
SERVER = "roicoeur@51.15.209.247"
ARCHIVE_NAME = "current.tar.gz"
REMOTE_DIRECTORY = "/data/roi_coeur_app"
USER = 'roicoeur'
include SSHKit::DSL
def setup
on [SERVER] do |host|
within REMOTE_DIRECTORY do
as USER do
execute :mkdir, :current
execute :mkdir, :backup
end
end
end
end
def remove_old_build
on [SERVER] do |host|
within REMOTE_DIRECTORY do
as USER do
execute :rm, "-rf backup"
end
end
end
end
def deploy
on [SERVER] do |host|
within REMOTE_DIRECTORY do
as USER do
upload! "#{ARCHIVE_NAME}", "."
execute :tar, "xzf #{ARCHIVE_NAME}"
execute :mv, "current/ backup/"
execute :mv, "dist current"
execute :rm, "#{ARCHIVE_NAME}"
end
end
end
end
def start
`rm -rf dist`
puts "cleaning up local build, staring the local build"
`npm run-script build`
puts "local build complete, taking backup"
remove_old_build
puts "backup removal complete, now archiving the new build"
`tar cvzf #{ARCHIVE_NAME} dist/`
deploy
puts "Build done."
`rm #{ARCHIVE_NAME}`
end
puts "starting #{ARGV[0]}"
send(ARGV[0])
如果你有建议,我会听你的