Permission Denied when deploying with Jenkins to Apache-owned directory - wordpress

Background
At work we recently started using Jenkins CI for our Java code. We liked it so much, we wanted to use it for some PHP projects and some WordPress themes that we maintain as well.
The problem
I have set up Jenkins to run a gulp task to build the theme, which works fine. Then I have a deploy job that removes the old theme and moves the new code in place. This is where the problem lies. I have a bash script that runs in the deploy job like so:
whoami
mv /var/www/html/wordpress/wp-content/themes/my-theme /var/www/html/wordpress/wp-content/backups/theme/$(date '+%F')_$BUILD_NUMBER-backup_my-theme
mv $JENKINS_HOME/workspace/Build_MyTheme/build/my-theme /var/www/html/wordpress/wp-content/themes
When this runs, I get into the permission issues. Lots of "Permission Denied" errors. The whoami command prints off tomcat. Then the commands after that, like I mentioned, throw permission denied errors for the moving of the folder (whose parent folder, and self, are owned by apache). As far as I know, in order for WordPress themes to have handy features like updating itself, and plugins to be able to update and delete; the themes and plugins need to be owned by the apache user.
I am new at Jenkins CI, in fact another Developer set it up in Java. So I could be doing something wrong, but I think the main problem is the permission issues. How would you overcome permission errors where tomcat has to manipulate files owned by apache?
What I've tried
I have tried adding both apache and tomcat to a group called webusers, but I still got permission denied errors when trying to manipulate the files with Jenkins.
I have tried changing the owner of the files to tomcat:
This is the wp-content directory. As you can see, or maybe not because its so pixelated, that the plugins and themes folders are owned by tomcat and in the webusers directory. This works but with a major downside:
This is a major drawback, as it creates a bad user experience.
I have also tried making apache the owner, and using the group (previously created), then WordPress works, but Jenkins fails to deploy:
I'm just at a loss here, I have googled many times on the topics of "WordPress and Jenkins," "deplying WordPress with Jenkins," etc. As many varieties as I can think of. I have even gone to the Jenkins Documentation for help, but it refrences Drupal tutorials.
I read somewhere that you can deploy an Apache version of Jenkins, which may work for our PHP projects, but is it really best practice to have an instance of Jenkins per language?
Any help would be fantastic. Thank you ahead of time.

Related

Mamp PRO No Owner / Permission trouble on Windows (Running Wordpress)

I have setup multiple hosts and everything was running fine until I wanted to deploy my website. All files uploaded via wordpress failed to transfer. I found out they had no Owner. So even me as a user/admin couldnt open them. I have to use powershell command "icacls * /reset /t /c /q" to fix the permissions and finally uploaded them but it doesnt sort this problem in a long term. Could anyone help me find out how to change the Owner with which Mamp saves files? Or is there any work around ? I havent been able to find anything in documentation not the interent.

can not change folder permission during installation

i know that people couldn't say that this is trivial, but i have search for days in internet and can not be able to do this.
i am using visual studio 2010 ultimate and have created my setup with setup and deployment of vs 2010.the problem is that i have an application folder which contains my database and which is deployed with my application. When i deploy it in administrator part of computer, all is correct, i devined that it is due to fullcontrol permission of administrator programfiles folder.But when i deploy it in another account, application don't has access to database for writting. i looked for the web site and understood that this is due to programfiles folder permission for others users.So i decide to do another research in order to give more rights to users for this folder.
I finally understood that i can achieve this with authoring tools like robocopy by using custom action or with a command line by just correctly write my custom action. After more researchs, i understood that i can do it with a command line which use robocopy and give folder permission during installation for this custom action or only with custom action.
for custom action, i tried many links, but the best link that i obtained was (How to give Read/Write permissions to a Folder during installation using .NET) without success (i change /folder="[CommonAppDataFolder][ProductName] with /folder="[CommonAppDataFolder][Manufacturer][ProductName] in customactiondata" due to the fact that product name is in my manufacturer folder").i don't understand why this code don't change folder permissions during installing and don't know how i can use robocopy or icalcs in custom action to change folder permissions during installation. my setup and others requirements have been packaged with dotnetInstaller, i dont know if i can be able to continue use it.
please, i greatly need your help to be able to do this
i have solved the problem. After many trying, i understood that i was giving permission to the wrong folder because my documents and database were contained in programfile folder. after understand this, i only change the place to set permission by :/folder="[ProgramFilesFolder][Manufacturer][ProductName]" and permission have been setted.

Silverstripe install admin js errors

For some reason my admin screen just hangs with some javascript errors. I have it installed on xampp on windows 7 ultimate 64bit. What could be causing this? Ill post a screenshot of the errors any help would be nice! p.s. This is my first time installing silverstripe ever so be nice. :)
This sort of things usually occurs when combined asset files cannot be created. Make sure the web server user has write access to the assets/ and assets/_combinedfiles folders, then go to your-site.com/admin/pages?flush=1.
Alternatively, since this is a local install, run in dev mode. There are instructions in the documentation on how to set this.
As indicated by #simon_w, this issue occurs due to the folder permissions:
In your local environment, in addition to the way via yml config, you can just put the following in _config.php inside mysite folder.
Director::set_environment_type("dev");
In dev mode, the installation doesnt need to write to assets/_combinedfiles. However, you had better have write permission for assets folder anyway.
So, just increase permissions for assets and directories under it. Uploaded files are also stored there, if not sufficient permission, you can't upload files from the admin panel. Other functionalists may also be affected.

IIS unable to write to disk

I have one server that works (that I originally remember took me a loooong time to figure out--dont remember solution). I copy the exact same permissions to the new server, and it does not work. 'Everyone' is given total permission.
I have given permissions to _IUSR, IIS_USR, and Everyone., yet I still have errors with PHP trying to write/modify files.
Whats up?
You didn't mention IIS version you are using and what's application you are trying to run on top of it - these would be helpful to get a proper answer.
Looking at account names you mentioned you are running IIS 7.x... If you are running app which requires some fancy permissions config on its folders and files just try to temporarily grant full access to Everyone and IUSR from the top of app folder (overwriting everything below it) just to verify that this is permissions problem indeed.

Error: Forbidden Access Message (Drupal-6.x)

I'm new to Drupal and I'm trying to create multiple sites inside Drupal. I'm trying to create a symlink via the command line. I tried going to my browser to run the new installation for the new website, but I receive a message that says Forbidden Access.
To create the symlink in the terminal:
ln -s ~/Sites/drupal-6.20/sites/sitename2.com
My Drupal-6.20 folder is the root directory of my localhost.
In the browser to start the installation I tried:
http://localhost:80/sitename2.com
Short answer: the web root should be pointing to the index.php in the Drupal root for all of the sites you're hosting on that codebase.
In your case, you are getting an error because there's nothing in the /sites/yoursite.com directory that your webserver can run on it's own.
Longer answer: Configuring Drupal for multiple domains takes a little bit more reading and learning that can be summarized in an SO response.
The guide at http://drupal.org/getting-started/6/install/multi-site is a great place to start, and includes links to videos and additional tutorials in case you need additional help.
I don't know drupal that much, but i know other cms. And i think you should check for "permisions tab".
I worked with joomla, which i think is quite simmilar. And the first time you just have to go to http://localhost/. Installation started. And when it finnished, i had to delete installation folder out of localhost root.
But this is for joomla.

Resources