I'm using gem 'mina', '~> 1.0', '>= 1.0.6'.
Below is my deploy.rb:
require 'mina/rails'
require 'mina/git'
require 'mina_sidekiq/tasks'
# 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, 'muse'
set :domain, 'xx.xxx.xx.xxx'
set :deploy_to, '/home/deploy/app'
set :repository, 'git@github.com:KudosX/muse.git'
set :branch, 'master'
# Optional settings:
set :user, 'deploy' # 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('log', 'tmp', 'public', 'tmp/pids', 'tmp/sockets')
set :shared_files, fetch(:shared_files, []).push(
'config/database.yml',
'config/secrets.yml',
'config/app_credentials.yml',
'config/omni_contacts.yml',
'config/cable.yml',
'config/ses.yml'
)
set :sidekiq, -> { "#{fetch(:bundle_prefix)} sidekiq" }
# 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}
# command %[mkdir -p "#{deploy_to}/current"]
command %(mkdir -p "#{fetch(:deploy_to)}/shared/pids/")
command %(mkdir -p "#{fetch(:deploy_to)}/shared/log/")
command %[touch "#{fetch(:shared_path)}/config/database.yml"]
command %[touch "#{fetch(:shared_path)}/config/secrets.yml"]
command %[touch "#{fetch(:shared_path)}/config/app_credentials.yml"]
command %[touch "#{fetch(:shared_path)}/config/omni_contacts.yml"]
command %[touch "#{fetch(:shared_path)}/config/cable.yml"]
command %[touch "#{fetch(:shared_path)}/config/ses.yml"]
command %[echo "-----> Be sure to edit '#{fetch(:shared_path)}/config/database.yml', 'cable.yml', 'secrets.yml', 'app_credentials.yml' and 'omni_contacts.yml'."]
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.
# stop accepting new workers
invoke :'sidekiq:quiet'
invoke :'git:clone'
invoke :'deploy:link_shared_paths'
invoke :'bundle:install'
invoke :'rails:db_create' # later to remove
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
invoke :'sidekiq:restart'
end
end
# you can use `run :local` to run tasks on local machine before of after the deploy scripts
# run(:local){ say 'done' }
end
task :'elasticsearch:start' do
comment 'start elasticsearch service'
command %{sudo systemctl start elasticsearch.service}
end
task :'elasticsearch:stop' do
comment 'stop elasticsearch service'
command %{sudo systemctl stop elasticsearch.service}
end
# For help in making your deploy script, see the Mina documentation:
#
# - https://github.com/mina-deploy/mina/tree/master/docs
I ran mina:setup. Now when I try to deploy getting below error:
bundle exec mina deploy -v
-----> Creating a temporary build path
$ touch "deploy.lock"
$ mkdir -p "$build_path"
$ cd "$build_path"
-----> Quiet sidekiq (stop accepting new work)
bash: line 50: cd: /home/deploy/app/current: No such file or directory
! ERROR: Deploy failed.
-----> Cleaning up build
$ rm -rf "$build_path"
Unlinking current
$ rm -f "deploy.lock"
OK
Connection to 'xx.xxx.xx.xxx' closed.
! Run Error
Any idea why current folder is not being created automatically?
I'm using
gem 'mina', '~> 1.0', '>= 1.0.6'.Below is my
deploy.rb:I ran
mina:setup. Now when I try to deploy getting below error:Any idea why
currentfolder is not being created automatically?