Capistarno deploy each time ckeditor assets removed.

122 views
Skip to first unread message

debadatta

unread,
Nov 29, 2013, 5:02:33 AM11/29/13
to rubyonra...@googlegroups.com
Hi all, I have Rails 4.0.0 app, 

After capistrano deploy my ckeditor_assets  are being removed. Could not symlink to shared/ckeditor_assets folder.

I have followed this step :

    namespace :uploads do
    
      desc <<-EOD
        Creates the upload folders unless they exist
        and sets the proper upload permissions.
      EOD
      task :setup, :except => { :no_release => true } do
        dirs = uploads_dirs.map { |d| File.join(shared_path, d) }
        run "#{try_sudo} mkdir -p #{dirs.join(' ')} && #{try_sudo} chmod g+w #{dirs.join(' ')}"
      end
    
      desc <<-EOD
        [internal] Creates the symlink to uploads shared folder
        for the most recently deployed version.
      EOD
      task :symlink, :except => { :no_release => true } do
        run "rm -rf #{release_path}/public/ckeditor_assets"
        run "ln -nfs #{shared_path}/ckeditor_assets #{release_path}/public/ckeditor_assets"
      end
    
      desc <<-EOD
        [internal] Computes uploads directory paths
        and registers them in Capistrano environment.
      EOD
      task :register_dirs do
        set :uploads_dirs,    %w(public/ckeditor_assets)
        set :shared_children, fetch(:shared_children) + fetch(:uploads_dirs)
      end
    
      after       "deploy:finalize_update", "uploads:symlink"
      on :start,  "uploads:register_dirs"
    
    end

I could not figure this out why my public/ckeditor_assets folder is not copied to shared/ckeditor_assets and doesnt symlink also.

Please help me.

Frederick Cheung

unread,
Nov 29, 2013, 5:36:52 AM11/29/13
to rubyonra...@googlegroups.com


On Friday, November 29, 2013 10:02:33 AM UTC, debadatta wrote:

I could not figure this out why my public/ckeditor_assets folder is not copied to shared/ckeditor_assets and doesnt symlink also.

Just so you we are clear, you do realise that these cap tasks *delete* public/ckeditor_assets ? They then symlink to shared/ckeditor_assets, but obviously that needs to be created by you.The setup task does look like it is half trying to do that but you don't seem to be invoking it, furthermore it would seem to be creating shared/public/ckeditor_assets rather than shared/ckeditor_assets

Fred

debadatta

unread,
Nov 29, 2013, 5:47:29 AM11/29/13
to rubyonra...@googlegroups.com
Thank you very much Frederick Cheung for reply. 

task :register_dirs do
    set :uploads_dirs,    %w(public/ckeditor_assets)
    set :shared_children, fetch(:shared_children) + fetch(:uploads_dirs)
  end 

probably you are saying about this to create a directory for shared/ckeditor_assets where as this is creating a folder shared/public/ckeditor_assets. I have cheked the folders there are no folders such like that after deplyment.

Also for deleting public/ckeditor_assets.. yes i think it gets deleted and after the deployment I can not able to fetch this directory also.
Shall I need to change anything except this in my deploy.rb.

Any help appreciated.
Thanks

debadatta

unread,
Nov 29, 2013, 6:23:08 AM11/29/13
to rubyonra...@googlegroups.com
Now I just changed this to 
task :register_dirs do
    set :uploads_dirs,    %w(/../../shared/ckeditor_assets)

    set :shared_children, fetch(:shared_children) + fetch(:uploads_dirs)
  end

It is creating a ckeditor_assets folder but it is not opening. May be permission issue. 

Frederick Cheung

unread,
Nov 29, 2013, 11:44:08 AM11/29/13
to rubyonra...@googlegroups.com


On Friday, November 29, 2013 10:47:29 AM UTC, debadatta wrote:
Thank you very much Frederick Cheung for reply. 

task :register_dirs do
    set :uploads_dirs,    %w(public/ckeditor_assets)
    set :shared_children, fetch(:shared_children) + fetch(:uploads_dirs)
  end 

probably you are saying about this to create a directory for shared/ckeditor_assets where as this is creating a folder shared/public/ckeditor_assets. I have cheked the folders there are no folders such like that after deplyment.

Also for deleting public/ckeditor_assets.. yes i think it gets deleted and after the deployment I can not able to fetch this directory also.
Shall I need to change anything except this in my deploy.rb.

I would change the setup task to

task :setup, :except => { :no_release => true } do
        dirs = [File.join(shared_path,'ckeditor_assets' )]

        run "#{try_sudo} mkdir -p #{dirs.join(' ')} && #{try_sudo} chmod g+w #{dirs.join(' ')}"
      end 

and leave the rest of your deploy.rb the same.

Then as long as you run that setup task at least once, current/public/ckeditor_assets should point to shared/ckeditor_assets

Fred
Reply all
Reply to author
Forward
0 new messages