Rake task with write permissions

I’m using a rake task to generate a sitemap, but I keep getting this error: Permission denied @ rb_sysopen

How can I run a rake task within cloud66 with write permissions?

Your rake tasks run with the ubuntu user, which is part of the app_writers group. An easy way to do this would be using a deploy hook, which essentially chowns your folder to app_writers and chmod it to 755 to allow group writes.

production:
    after_rails:
        command: chown nginx:app_writers $STACK_PATH/folder && chmod 775 $STACK_PATH/folder
        target: rails
        run_on: all_servers
        sudo: true

Note: please replace “folder” with your own folder.

You must be logged in to answer this question