Sublime SFTP + Rails + DigitalOcean -- Uploading Files - ruby-on-rails

Recently had the pleasure of picking up a VPS over # DigitalOcean. It's a Ubuntu 14.04 running Rails + Nginx & Unicorn.
I wanted to work with Sublime, as I have locally, so I installed the commercial SFTP plugin. I was able to successfully gain remote access to my VPS, and I even downloaded the rails folder locally. Now is where it gets difficult though, and I need some help.
How I do I keep the local folder and the remote folder in sync?
Right clicking on the folder via Sublime offers some options like, sync Local -> Remote, which seems like what I want, except that every upload ends in failure (Permission denied).
Am I supposed to be doing this local to remote sync? Or am I off base here? If I'm on base, why do I get permission denied?

Probably, the user you're using for the SFTP connection has read permissions on the folder you're working on, but is not allowed to write.
For this reason, you were allowed to download your remote folder, but no longer allowed to write in it (upload).
You can check this by running ls -ld /path/to/rails/ and reading the first part (for example, it could be drwxr--r--). If needed, here you can learn more about file system permissions.
If it's a permission problem, you can solve it in different ways, but you should consider how each solution could impact the security and/or functionality of your application:
You could change the owner of the rails directory to match the Sublime SFTP user (see man chown), and ensure the owner of the rails user has write access on it (sudo chmod o+w /path/to/rails)
You could use a different user for Sublime SFTP access (one that has write permissions on the rails folder)
You could add the Sublime SFTP user to the group of the rails folder (useradd -G {group-name} username) and then grant the folder group write access (sudo chmod g+w /path/to/rails)

Related

Physical Path in Beanstalk

I'm totally newbie in Beanstalk. I'm developing a web application in which a sealed and black-box plugin is used. That plugin needs a physical path with full permission to use for cache.
Any solution?
You can use the .ebextensions files in the main project that will, for example, create a directory and change the access rights to it. It is not clear from your question how you install the plugin (e.g. is it a service that is loaded after the web application is installed or is it part of the web application).
Execute a command in the .ebextensions file such as in:
How to grant permission to users for a directory using command line in Windows?
You'll find a introduction into container customization in
http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/customize-containers-windows-ec2.html
Be careful about the format of the files (ie. spaces, no tabs, the best is to edit it in a separate text editor). Experiment with simple commands first, so that you get the hang of how the commands are executed.
Note: The ebextensions commands are executed for each deployment, so your script should check if the directory exists already and only create it if it doesn't. Otherwise the execution will fail as you try to create a directory that exists already. In a second step you can add the permissions.

How to change sprocket's temp cache directory for rails app to another file location

I'm running my development environment inside of a Ubuntu VM hosted by a Windows OS, so I'm using a windows-hosted NFS which the VM uses. I've been having problems lately with 'too-quick' file access (sprockets tries to unlink a file but fails, and I can do so manually only seconds later). This frequent problem shows up as: Permission denied # unlink_internal - /home/vagrant/rails/dev.website/tmp/cache/assets/development/sprockets/v3.0/[some-random-string]. This crops up with different asset references every time, so I know it's not a problem with the files themselves.
My stop-gap solution was to use memcached as sprockets' cache method (instead of filestore).
This works, however when I want to debug rendering time/iteration within my logs, I don't want memcached running. Ideally I'd like to set the entire app's temp directory to the local file system of the VM instead of the NFS mounted folder that my rails app resides in - unless someone has a better solution.

Installing local checks for Check_MK's agent

I'm trying to write local checks for a Check_MK instance on a computer with OMD installed. I don't have admin rights on this machine, so I work as an OMD site like this:
sudo omd su $MY_SITE
And, like my standard user, the site user does not have admin rights either.
In the Check_MK documentation for writing agent-based checks I find that I have two options for doing this:
Editing /usr/bin/check_mk_agent, which is impossible with the rights I have or
Creating a script in /usr/lib/check_mk_agent/plugins/, which is also impossible because this folder is only writeable to root.
When I run cmk --paths I see that there's a folder for "locally installed agents and plugins" at $MY_SITE_HOME/local/share/check_mk/agents/. This folder has a subfolder named plugins. If I put a script in there, however, its output doesn't show up when I run check_mk -d localhost. It is set to be executable and it does produce valid output, as far as I can tell:
<<<helloworld>>>
Hello world!
Am I putting the script in the wrong folder? Is it necessary to have admin rights in order to write agent based checks in Check_MK?
One way of doing this without admin rights would have been to edit main.mk to include include a new datasource program. I would have liked to have a local folder that was analog to /usr/lib/check_mk_agent/plugins/, but it seems that this is not possible. I ended up having one of our admins give me the rights to /usr/lib/check_mk_agent/plugins/.

vim and cream windows 7 access privileges

I recently installed cream onto a windows 7 laptop. I was installing the rails.vim plugin when tried to issue the :helptags ~/vim/docs command so I can have the rails helpfiles available.
I have since discovered that w7 doesn't allow user privileges in the program files directory so I haven't been able to add the helptags or use edit -> startup settings to change my vimfiles.
I found this thread here Allow access permission to write in Program Files of Windows 7 and a few websites referring to "ultimate windows tweaker" . Has anyone without third party software been able to get access rights for vim or cream on win7?
If you want to have access privileges to the vim folder, then you should rather try a portable version of vim (try gvimportable from http://www.portableapps.com).
The access control has been designed such that multiple users can share a software and not modify it.
As far as I know, on windows XP at least, you can put your vim files in your $HOME directory in a subdirectory called 'vimfiles'.
And you shoud have read/write access to that directory.
If you want to check where Vim is looking for config files in runtime, use
:echo &rtp
You should at least see the default system wide vim directory and your home directory.
If this is a personal install, you'd better put everything in your home.
Have you tried ?
:helptags $HOME/vimfiles/doc
There is a how-to here Take ownership Win 7 on how to grant user access to a folder and subfolders, which will allow me to set the ~/vim folder and subs to have write access.

Permission denied - /tmp/.ruby_inline/Inline_ImageScience_cdab.c

I have a Ruby on Rails app that I've recently deployed to a remote server (Ubuntu 9.10, nginx, passenger, ruby-enterprise) and I'm getting the error (works fine locally):
Permission denied - /var/www/project_name/tmp/.ruby_inline/Inline_ImageScience_cdab.c
First, the folder /tmp/.ruby_inline/ is empty - should it be? Is it trying to create Inline_ImageScience_cdab.c or read it?
I think I have all the required gems installed: 'gem list' shows image_science and RubyInline installed. libfreeimage3 and libfreeimage-dev are also installed.
I've run chmod 755 on /tmp/.ruby_inline/ to match the permissions on surrounding folders but I cannot go any higher than that, however, or I get another error:
/var/www/project_name/tmp/.ruby_inline is insecure (40777). It may not be group or world writable. Exiting.
And I guess second, why am I getting this error? :)
Thanks
I was able to fix the problem. The folder /tmp/.ruby_inline/ wasn't supposed to be empty so it wasn't finding Inline_ImageScience_cdab.c and giving a 'permission denied'. The files required were installed to ~/.ruby_inline so I just copied them to /tmp/.ruby_inline and chmod 755 them.
also i guess the filesystem in the production is for some reason read-only to store static content. Contact your host.

Resources