Capistrano deploys to 'current' folder- how to make it my 'root' folder - capistrano

Using capistrano I am successfully deploying code to my server btu it goes into a 'current' directory. How do I then set up my server to use this current folder as its root so the website loads when I visit the url.

This was just a case of modifying the host settings on the server and setting the root directory there to point to the current release directory.

Related

Deploy a test site azure devops pipeline (LAMP)

So I've been looking at getting the pipeline build for automation E2E Acceptance testing going.
I've been able to get the pipeline running on an agent, now the default path that the code is checked out to is
/home/myusername/myagent/_work/1/s
which is $(Pipeline.Workspace), and cannot be changed to custom path like /var/www/html/ and accepts only relative path as described here.
If I try to point the apache webroot to the above dir, I get the forbidden error. I tried
running apache as the directory owner as described here
giving full 777 permission to the directory
Now, how do I get apache to interact with those files or checkout the files inside the apache webroot /var/www/htmlin the first place so no additional work is required?
OS: Ubuntu 18

How do you deploy a release to a sub folder without changing the physical path on IIS

We created a release definition that deploys our build to a onsite IIS server. We need to be able to deploy to a subfolder (e.g. D:\apps\appname\v1\[deploy here]. We tried changing the Physical Path setting in the IIS Web App Manage task, but that changes the Physical Path of the entire IIS server.
How can we specify where we want to put our individual application?
The problem with the IIS Web App Manage task is that it wants to configure and create IIS Web Apps, not just copy files. To just copy files you want to use the Copy Files task. If you're working with a remote machine, make sure you're running the Copy Files task on your deployment group. To do that, in your Release Definition, make sure your task is running under a Deployment group phase that specifies your Deployment Group.
Once you have this set up, your deployment should run, and it will run from whatever machine you configured in the Deployment Group. You can copy files from the build's artifacts to a folder using a path local to that machine. So for example if your IIS Website is located at d:\websites\MySite you would use that as the destination path for the Copy Files task.

How to access the generated File by jenkins server through URL?

I am using jenkins.
In Each build I execute from Jenkins I am storing a build number in a Test file called Build.txt
Which is in opt/jenkins/ path.
I want to access this file through an URL from a browser.
Is it possible and How can I achieve it?
you can artifact the build files using
Post build -> Archieve artifacts
you can see those archieved files in URL using below plugin
https://wiki.jenkins-ci.org/display/JENKINS/Archived+Artifact+Url+Viewer+PlugIn
The solution is to use Jenkins userContent directory. Jenkins has a mechanism known as "User Content", where administrators can place files inside $JENKINS_HOME/userContent, and these files are served from http://yourhost/jenkins/userContent.
Make sure your jenkins have Copy To Slave Plugin installed.
In your job config page, Add Post-build Action-->Copy files back to the job's workspace on the master node.
In the Files to copy field, fill in the files that you want to copy from the slave node back to the jenkins master's corresponding workspace of current job.
Goto your $JENKINS_HOME/userContent folder, create a link to $JENKINS_HOME/jobs/yourjob/workspace/screenshot by issuing command for example:
ln -s screenshot /home/ci/jenkins/jobs/tc_ui_test/workspace/screenshot/
After that, you can access your contents from url: http://yourhost/jenkins/userContent/screenshot

Execute SVN Update in Jenkins - Copy a Folder to Web root Explicitly from SVN as a Build Step

I'm new to Jenkins CI.I'm trying to get SVN update (myFolder) inside a job as build steps. I want to explicitly copy some files to web root as I can't have them inside my solution.
Build Steps I need to perform.
Build Solution
Publish
Copy myFolder to web root
Sync
Up to Publish it works fine.Problem when trying to copy/update myFolder to web root.
MyFolder is located out of the project solution folder as I cant have it inside solution Folder.
Note: This myFolder has serialized items/object that I need to Sync in the next step.It should be copied to web root in-order to sync.
And this folder is committed to SVN.
In my local CMD following batch file works fine but when I try in Jenkins Execute Windows Batch Command it stops at
-- Updating source from SVN
-- Running update...
#echo off
cls
echo -- Initiating system instance variables...
echo. -- Setting the variables...
:: Here you need to make some changes to suit your system.
set SOURCE=C:\inetpub\wwwroot\Test\Website\App_Data\myFolder\
set SVN=C:\Program Files\TortoiseSVN\bin
:: Unless you want to modify the script, this is enough.
echo. %SOURCE%
echo. %SVN%
echo. ++ Done setting variables.
echo.
echo -- Updating source from SVN
echo. -- Running update...
"%SVN%\TortoiseProc.exe" /command:update /path:"%SOURCE%" /closeonend:1
echo. ++ Done.
echo. -- Cleaning up...
set SOURCE=
set SVN=
echo. ++ Done.
I have Subversion Plugin installed.Any solution for this problem.
And Also I tried using below Powershell Script
#Get checkout folder
TortoiseProc.exe /command:"update" /path:"C:\inetpub\wwwroot\Test\Website\App_Data\myFolder\"
It works in my local Windows Powershell but not in Jenkins Windows Powershell
In an effort to help answer your question, I will explain the configuration of a job which should accommodate what you are trying to achieve: building a project under version control after an svn update has been performed and moving the generated files to a separate directory.
Setup the Source Code Management section
Within this section in your job's configuration page, choose the appropriate version control system (ie, Subversion) and point the job to your project's URL, noted below. Also be mindful to select the appropriate check-out strategy. This is what Jenkins will use when your job runs (ie, svn update) as Jenkins will store a copy of your repository on the build-server in the job's workspace.
Without proceeding any further, this job will only pull down any changes from your repository through the appropriate check-out strategy configured above when this job runs.
However, you would like Jenkins job to actually do something meaningful when the job runs, such as build/publish your project. This is achieved through build steps, so let's configure build steps.
Configure the appropriate build step(s)
Build/Publish Website Locally
Assuming you have scripts already written to build/publish the website under version control (let's call it !Publish Website.bat as an example) which builds the project and publishes it locally, you can configure the step underneath the Build section as follows,
Note: %WORKSPACE% is a built-in environment variable which resolves to the current workspace of the job. There is a link under the build-step to list all the different environment variables exposed which can be used.
Without proceeding any further, the job will now pull down any changes and execute the batch file to publish/build a website locally within your workspace when this job runs.
Not quite done considering you wish to have these newly generated files to reside within your website's webroot folder so these changes are reflected on your website. For simplicity's sake we can go ahead and add another build-step to perform the copy.
Copy Contents to Webroot
Assuming you have scripts already written to copy the contents of the website under version control (let's call it !Copy Website.bat) which takes the published files and copies them to the appropriate directory on your webserver, you can configure the step underneath the Build section as follows,
Now when the job runs, it will perform an svn update against the repository on it's local workspace and execute the preceeding build-steps (ie, build/publish the solution and copy the contents to your webroot.)

Deploy with Capistrano to cPanel where DocumentRoot cannot be changed?

I'm trying to use Capistrano to deploy a PHP-based website to shared hosting for a client. I want to keep everything version controlled, but they're on shared hosting with cPanel (Bluehost) and I'm not able to change the DocumentRoot to point to the "current" symlink. Deploying to public_html is fine, but I need to have the website point to the current release at the root.
Is there any way around this so I can continue to use Capistrano and also have the "current" release as the root of the primary domain name?
It's probably too late but I've got your answer.
If your server is managed by cPanel, you can change the documentroot line in this config file:
/var/cpanel/userdata/USERNAME/DOMAIN.COM
Then you can change it to:
/home/USERNAME/public_html/current.
Welcome to my world ... or vice versa? 🤪
It's an old post, but the issue is still there. cPanel doesn't allow a different root folder for the main domain. It does for addon domains, though.
The /var/ folder isn't accessible on shared hosting.
Currently, it seems to be possible to simply delete public_html in the account and replace it by the current symlink. We've been doing that via bitbucket pipeline for a while and it works (although the hoster was cautious at first).