CException Error while deploying yii application on OpenShift? - yii

Friends, I tried to deploy my yii production application from cloud9 IDE to OpenShift while do so, I got this error message,
CException
Application runtime path "/var/lib/openshift/51dd48794382ecfd530001e8/app-root/runtime/repo/php/protected/runtime" is not valid. Please make sure it is a directory writable by the Web server process.
Even when I changed folder permissions to 775 (chmod -R 775 directory) on Cloud9 IDE and deployed again, but I get the same error coming.

It's an old question, but I just bumped into the same issue very recently.
When you extracted the "yii" package several folders were empty, "framework/protected/runtime" was one of them.
To deploy to OpenShift you need to commit the yii package to git, and the push the commit to OS. But, git won't commit empty folders, so they are not created in your deployment. You need to create some file inside those folders and add those files to your git repo before committing/pushing. The usual procedure would be to add a ".gitkeep" file to those folders (it's just a empty dummy file, so git would see those folders).
That would fix this particular error.

It may be due the ownership given to the folder.
Check the web server user group, is that directory is writable or not and also What effects a web server when we change the platform.
Hope my suggestion would be useful.

For Yii applications, the assets and protected/runtime folders are special. First, both folders must exist and writable by the server (httpd) process. Second, these two folders contains temporary files, and should be ignored by git. If these temporary files got committed, deployment in plain servers (not Openshift servers) would cause git merge conflicts. So I put these two folders in .gitignore :
php/assets/
php/protected/runtime/
In my deployment, I add a shell script to be called by openshift, creating both folders under $OPENSHIFT_DATA_DIR and creating symbolic link to both of them in the application's folders. This is the content of the shell script (.openshift/action_hooks/deploy) which I adapted from here :
#!/bin/bash
if [ ! -d $OPENSHIFT_DATA_DIR/runtime ]; then
mkdir $OPENSHIFT_DATA_DIR/runtime
fi
# remove symlink if already exists, fix problem when with gears > 1 and nodes > 1
rm $OPENSHIFT_REPO_DIR/php/protected/runtime
ln -sf $OPENSHIFT_DATA_DIR/runtime $OPENSHIFT_REPO_DIR/php/protected/runtime
if [ ! -d $OPENSHIFT_DATA_DIR/assets ]; then
mkdir $OPENSHIFT_DATA_DIR/assets
fi
rm $OPENSHIFT_REPO_DIR/php/assets
ln -sf $OPENSHIFT_DATA_DIR/assets $OPENSHIFT_REPO_DIR/php/assets
The shell script ensures the temporary folders created on each gear after openshift deployment. By default, a new directory's right are u+rwx, and it became writable by the httpd process because the gear runs httpd as the gear user (not apache or something else).

Related

Singularity sandbox file management

Fed up with struggling with lib install/dependencies problems, I'm starting working with Singularity.
Though, I'm not sure I understand precisely how it works regarding files management in the sandbox mode (not data, programs).
For example, I designed a very simple definition file that is just a "naked" Debian:
Bootstrap: library
From: debian
%post
apt-get update
I create a sandbox with this to add stuff:
sudo singularity build --sandbox Test/ naked_Debian.def
And I try to install a program. But what I don't understand is that I managed to do it, removed the sandbox directory but I think there are still files that were created during the sandbox life (in /dev, /run, /root, etc.). For example, the program that I cloned from git is now in /root of my local (independently of any container).
From what I understood, everything was in the container and should disappear if I remove the sandbox directory. Otherwise, I'm gonna leave a lot of mess with all the tests? And then I can't port the container from system to another.
If I create any new sandbox directory, the program is already there.
Cheers,
Mathieu
By default, singularity mounts $HOME to the container and uses that path as the working directory for singularity shell / exec. Since you're running the sandbox with sudo, /root is being mounted in and that's where any repos you cloned would end up if you didn't cd to a different directory. /tmp is also automatically mounted in, though that is unlikely to cause an issue since it's just temp files.
You have a few options to avoid files ending up in places you don't expect.
Disable automount of home: singularity shell --no-home ...
The default working directory is now / instead of $HOME and files are created directly in sandbox (as opposed to a mounted in directory)
If you want to get files out of the sandbox, you'll either need to copy to /tmp inside the container, and on the host OS from /tmp to the desired location
Set a different location to use as home: singularity shell --home $PWD ...
This mounts in and uses the current directory as $HOME instead of the user's $HOME on the host OS
Simpler to move files between host OS and container, but still creates files in the host OS
Don't mount system directories at all: singularity shell --contain --workdir /some/dir ...
Directories for /tmp and /var/tmp are created inside /some/dir instead of using /tmp and /var/tmp on the host. $HOME has the same path as the host and is used as the working directory, but it is empty and separate from the host OS
Complete separation from host OS, while still allowing some access between container and OS
Additional details on these options can be found in the documentation.

Restoring Apache Tomcat after an accidental delete

I have a server running apache tomcat. The path to the server is following:
root#serverb:/usr/tomcat/apache-tomcat-7.0.23# pwd
/usr/tomcat/apache-tomcat-7.0.23
root#serverb:/usr/tomcat/apache-tomcat-7.0.23# ls
LICENSE NOTICE RELEASE-NOTES RUNNING.txt bin conf lib logs temp webapps work ws.war
From time to time, I have to go logs/ folder and run following command:
find . -mtime +2 -exec rm {} \;
However, I accidentally ran this command in /usr/tomcat/apache-tomcat-7.0.23 as a result, my ws.war file and other files from within bin/ folder got deleted.
I have the backup of ws.war but not of the apache folder. Is there anyway I can reinstall the apache and restore my server.
Most likely you're not asking how to create a backup after you need it (not before...), right?
Of course, you can get tomcat at http://tomcat.apache.org, but if you don't have your configuration and changed settings (e.g. memory settings, host setup etc.) you'll have to redo it from memory or until nobody complains any more.
Congratulations, you've learnt about the importance of backups. When you're done with the new installation, consider having a proper backup from now on. Keep in mind: IMHO you're only allowed to call something a backup if you have demonstrated that you can use it to restore to a new environment in the time that you specify as acceptable downtime.

How do configure and access up my subversion repository after I install Subversion on my GoDaddy CentOS Dedicated Server

I successfully installed subversion on my server. When I run the command:
which svn
I get the response:
/usr/bin/svn
I create a repository inside my root directory which is my httpdocs folder with the following command:
svnadmin create ~/svn
I successfully created the following files and folders and configured them and I see the following files and directories inside the svn directory:
conf db format hooks locks README.txt
But I cannot create trunk, branch, and tag directories. In fact I cannot create directories period. Here is the command I have been using:
svn mkdir file:///httpdocs/svn/site
When I make this command the message I get is the following:
svn: Could not use external editor to fetch log message; consider setting the
$SVN_EDITOR environment variable or using the --message (-m) or --file (-F) options
svn: None of the environment variables SVN_EDITOR, VISUAL or EDITOR are set, and no
'editor-cmd' run-time configuration option was found
Also When I type in url:
http://mydomain.com/svn
I get the follwoing message:
404 - Not Found
What do I need to do to configure my repository, check to see if my repository is actually working. Oh and I did run the following command:
svnserve -d
I create a repository inside my root directory which is my httpdocs folder with the following command...
That's not how you get Subversion to work with Apache httpd if that's what you're trying to do. You need the mod_dav and mod_dav_svn modules for Apache. You might have to recompile Apache to get these.
Once you get mod_dav and mod_dav_svn installed, you need to configure your httpd.conf file (or put a configuration file under your httpd's conf.d depending how it's configured on your system) for it to work.
In the end, it's not all that difficult. Most Apache installations have mod_dav and mod_dav_svn added in, and you can see if your http.conf file is configured correctly. The on line Subversion manual will have everything you need to get it working.
svn: Could not use external editor to fetch log message; consider setting the
$SVN_EDITOR environment variable or using the --message (-m) or --file (-F) options
svn: None of the environment variables SVN_EDITOR, VISUAL or EDITOR are set, and no
'editor-cmd' run-time configuration option was found
Read the message. It says Could not use external editor because you didn't specify one. Again the Subversion on line manual explains it in detail.
Basically, when you commit a change in Subversion, you need to create a commit message. This can be done in two ways:
You use the -m option like svn commit -m "This is my commit message".
You set the variables SVN_EDITOR, VISUAL, or EDITOR to the name of the program you want to use. For example, in Windows, you'd say C:> set EDITOR=notepad.exe. On Unix, you'd say something like $ export EDITOR=vi. Subversion first checks the value of the SVN_EDITOR variable, then VISUAL, then EDITOR. If none of them are set, it gives you the error you saw.
Why did you get it on the svn mkdir command?
Because you use the URL form of the command, it will make the directory, then commit the change, thus the need for a commit message. This should work:
svn mkdir -m"Adding the site directory to my repository" file:///httpdocs/svn/site
Now, you need to move your repository out of your HTTPDOCs directory. That's a very bad thing to have because it hurts your web server.
If you don't want to use the file:// protocol, you can use svnserve. This is a built-in Subversion repository server and uses the svn:// protocol. Observe:
$ svnadmin create my_repos #Creates the repository
$ vi my_repos/conf/svnserve.conf #See footnote 1 below
$ vi my_repos/conf/passwd #See footnote 1 below
$ svnserve -r my_repos -d
$ svn mkdir -m "Making basic directory layout svn://localhost/trunk \
> svn://localhost/tags svn://localhost/branches
$ export SVN_EDITOR="vi"
Your repository also becomes accessible to all the machines on your network too. Using svnserve is much simpler than Apache httpd, but there are a few issues:
You can't run multiple instances of svnserve since it wants to use port 3690 and it doesn't like to share. With Apache httpd, you can have multiple repositories.
Security setup with svnserve is limited. With Apache, I can use Windows Active directory or LDAP or I can configure it manually.
Some web based subversion repository browsers don't like svnserve.
By the way, if you haven't, go through the Subversion on line manual. It's one of the best manuals I've seen for any open source project.
1 When you setup your repository using svnserve, you need to edit the svnserve.conf file by enabling the line password-db = passed which is about line #20 in the file. Then you have to edit the passed file (located in the same directory) to configure the users and their passwords. Both are very straight forward, but easy to forget, and if you don't do it, you can't commit anything into your repository.
when you need to trunk branches and tags than you have to need the download import_dirs.copy
than after than cd /location/import_dirs.copy than run than command
cd /data/svn/import_dirs.copy/
svn import file:///location of repos/reposname/ -m "inital message"
this is the example of it.....
cd /home/raj/import_dirs.copy/
svn import file:///srv/svn/nmg/ -m "inital message"
than trunk branches and tags have been done

Yii + EasyPHP Runtime Path not Writable?

I'm trying to get a Yii program running, but I get the error:
Application runtime path "C:\Program Files\EasyPHP-5.3.8.1\www\project\protected\runtime" is not valid. Please make sure it is a directory writable by the Web server process.
Does this mean I have to change something inside EasyPHP? I've tried adding permissions through directory->properties->security and changing the permissions to allow everything, but that did nothing. I have no idea where to go from here. Any ideas?
I had this problem with Yii. Yii creates a lot of empty folders. And I was using a GIT repository to work between the production environment and my DEV machine. GIT by default doesn't save empty folders. So when I was working on my DEV machine, I cloned the repo minus all the empties. Use this command on a Linux machine, from the root of your repo, to put empty ".gitignore" files in each of the empty directories. This will make sure git indexes and saves them.
find . \( -type d -empty \) -and \( -not -regex ./\.git.* \) -exec touch {}/.gitignore \;
That either means the directory doesn't exist or you need to CHMOD it with the right permissions. chmod -R 777 runtime
Since you're on windows, you shouldn't need to CHMOD anything. Are you absolutely sure that the runtime directory exists?
Otherwise I would suggest using xampp. I'm running yii on it locally with no problems.

Joomla - Warning! Failed to move file error

I have found some solutions to this error and tried implementing them but none of which has worked and hope that some here at SO might have a different answer.
I get this error, "Warning! Failed to move file" when I try install modules into my new installation of Joomla here:
http://sun-eng.sixfoot.co.za
Here's some solutions I have tried to no avail:
http://forum.joomla.org/viewtopic.php?f=199&t=223206
http://www.saibharadwaj.com/blog/2008/03/warning-failed-to-move-file-joomla-10x-joomla-15x/
Anyone know of another solution to this please?
Thanks!
Go to Help -> System Info in your administrator backend and check your Directory Permissions tab to make sure everything is writable.
Also make sure your Path to Temp Folder is correct in Site -> Global Configuration.
Finally, check to make sure that the module isn't already installed. It's possible that some files already got copied or something and now your system is having problems overwriting them.
If none of this works, let us know if the error message specifies which file can't be moved. That would help figure out a solution.
In the configuration folder change the temporal folder location to /tmp (public $tmp_path = '/tmp';) or create your own temperate folder and set it to /myowntemp and change the file permission to 777. you are good to go .
This is typically a file permissions issue. If the system cannot write to the tmp directory within Joomla it will give you the "Warning Failed To Move File" error.
The typical solution is to make the directory wide-open, in general a bad practice but a quick fix. You log in to the Linux command line via a terminal (telnet or ssh) session and set the permissions of the directory.
# chmod -R 777 ./tmp
The better option is to find out what user/group the Apache server is running as and assign the permissions accordingly. For example, if Apache is running your site as the myuser:nobody user:group then you can open up write permissions for the group by changing ownership of the tmp folder and making it writable by anyone in the group:
# chgrp -R nobody ./tmp
# chmod -R 775 ./tmp
Security can be a pain to get set correctly if you don't know *nix commands and security settings, so most people just blast a huge hole in the security with chmod 777.
The next thing you'll probably run into is another error message about not being able to update a specific directory. Again, this is a permissions issue and is typically a piece of the file being unzipped into the administrator subdirectory. Depending on whether your installing a component, a module, or a complex plugin with multiple pieces you may need to open up one or more of these directories using the same approach as above. Here is the "blow a big open hole in security" method:
# chmod -R 777 ./administrator/
Or more selectively:
# chmod -R 777 ./administrator/components/
# chmod -R 777 ./administrator/modules/
If you are a linux user then it is very simple to solve. Just type the following command and try again to install plugin/entension.
sudo chmod -R 777 /var/www/html/my_joomla_folder
You can also refer this link for brief information regarding permission of each folder and file.
Cheers!!
In Joomla 3.x you should go to System->System Information to see directory permissions
If one or more directories that are listed are not "writable" then you should change the permission of those directories:
If you are using one of Linux distributions you can use this command
to give the directories read/write/execute permission:
sudo chmod 777 -R address_of_lampp_directory/lampp/htdocs/joomla_directory
I have had a similar issue today and found is was the permissions set on the 'temp folder'. To resolve I changed them to 777 and my plugin installs worked fine!!
Another thing to check is whether you actually have space on the disk. I had this error and discovered that the drive was 100% full. Removing some unused files fixed the problem.
One other thing to try if everything else is not working is to add the following to your .htaccess file:
php_value upload_max_filesize 10M
Make sure 10M covers the size of the file you are uploading - increase it if your file is 12Mb, for instance.
[Source]
This issue was solved like this.
On the configuration.php file change the tmp_path variable according to:
if you site is mysite.azurewebsites.net, the path should looks like
'C:\DWASFiles\Sites\mysite\VirtualDirectory0\site\wwwroot\tmp'
instead of
'C:\DWASFiles\Sites\mysite.azurewebsites.net\VirtualDirectory0\site\wwwroot\tmp'
Refer to the link: http://social.msdn.microsoft.com/Forums/en-US/windowsazurewebsitespreview/thread/2701eadc-9977-46ab-9c56-81a2234bdce4
I did it and every is working for every error problem with OSX, I use OSX version 10.9.2 and get many problems. The way to fix every error is
# cd /Applications
# chmod -R 777 ./XAMPP
some files might not change permission but the problem is gone.
you can create folder and upload fine and picture, including install plugin.