Rails 5 Mina Deployment error

405 Views Asked by At

currently i'm deploying a rails 5 application using mina deployment. my deployment script look like this

require 'mina/rails'
require 'mina/git'
 require 'mina/rbenv'  # for rbenv support. (https://rbenv.org)
# require 'mina/rvm'    # for rvm support. (https://rvm.io)

# Basic settings:
#   domain       - The hostname to SSH to.
#   deploy_to    - Path to deploy into.
#   repository   - Git repo to clone from. (needed by mina/git)
#   branch       - Branch name to deploy. (needed by mina/git)

set :application_name, 'foobar'
set :domain, 'xx.xx.xx.xx'
set :deploy_to, '/home/owner/foo'
set :repository, 'https://github.com/owner/foo.git'
set :branch, 'master'

# Optional settings:
   set :user, 'admin'          # Username in the server to SSH to.
#   set :port, '30000'           # SSH port number.
#   set :forward_agent, true     # SSH forward_agent.

# shared dirs and files will be symlinked into the app-folder by the 'deploy:link_shared_paths' step.
 # set :shared_dirs, fetch(:shared_dirs, []).push('somedir')
 set :shared_files, fetch(:shared_files, []).push('config/database.yml', 'config/secrets.yml')
 # set :shared_dirs, fetch(:shared_files, []).push('public/uploads')
 set :shared_paths, ['public/uploads']

# This task is the environment that is loaded for all remote run commands, such as
# `mina deploy` or `mina rake`.
task :environment do
  # If you're using rbenv, use this to load the rbenv environment.
  # Be sure to commit your .ruby-version or .rbenv-version to your repository.
  # invoke :'rbenv:load'

  # For those using RVM, use this to load an RVM version@gemset.
  # invoke :'rvm:use', 'ruby-1.9.3-p125@default'
end

# Put any custom commands you need to run at setup
# All paths in `shared_dirs` and `shared_paths` will be created on their own.
task :setup do
  # command %{rbenv install 2.3.0}
end

desc "Deploys the current version to the server."
task :deploy do
  # uncomment this line to make sure you pushed your local branch to the remote origin
  # invoke :'git:ensure_pushed'
  deploy do
    # Put things that will set up an empty directory into a fully set-up
    # instance of your project.
    invoke :'git:clone'
    invoke :'deploy:link_shared_paths'
    invoke :'bundle:install'
    invoke :'rails:db_migrate'
    invoke :'rails:assets_precompile'
    invoke :'deploy:cleanup'

    on :launch do
      in_path(fetch(:current_path)) do
        command %{mkdir -p tmp/}
        command %{touch tmp/restart.txt}
      end
    end
  end

  # you can use `run :local` to run tasks on local machine before of after the deploy scripts
  # run(:local){ say 'done' }
end

then when I run the deployment, mina give me this error Precompiling asset files

       rake aborted!
       Errno::EEXIST: File exists @ dir_s_mkdir - /home/owner/foo/tmp/build-14967462635756/tmp/cache
       /home/owner/foo/tmp/build-14967462635756/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/cache/file_store.rb:84:
in `set'
       /home/owner/foo/tmp/build-14967462635756/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/cache.rb:212:in `set'
       /home/owner/foo/tmp/build-14967462635756/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/cache.rb:86:in `fetch'
       /home/owner/foo/tmp/build-14967462635756/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/base.rb:56:in `file_dig
est'

can anyone tell me what happen here and help me with this problem ?

0

There are 0 best solutions below