Here are the step by step instructions to set up Git deployment with Azure DevOps using RunCloud:
- Create a project on Azure DevOps. Give your project a name, and choose the visibility level. After creating your project, switch to the Repos tab from the left menu to see your git repository.
- Go to the Repositories tab and clone the project to your local machine. You can use the command
git clone
followed by the SSH URL of your project. You can find the URL of your project by clicking the clone button and switching to the “SSH” tab.
- Use the
git clone
command with the provided URL in a terminal window to clone your web application to your computer.
For example,git clone [email protected]:v3/tatticoder/my-runcloud-site/my-runcloud-site
.
- After cloning the application, make the required changes to your project files. For example, you can create an index file with some HTML code.
- Save and commit your changes using
git add .
andgit commit -m "message"
. Then push your changes to Azure DevOps usinggit push origin main
. - After creating your project, you’ll need to create a new web application on RunCloud.
Go to the Web Application tab and click on Create Web Application. Choose Git Repository as the source and select Azure DevOps as the provider.
- Give your web application a name and select a user account on your server. You can also create a new user account for each web application for better security.
- Specify the domain name and SSL settings for your web application. You can use a custom domain name or a subdomain provided by RunCloud. You can also enable SSL using Let’s Encrypt or a custom certificate.
- Under the Git section, Provide the Azure DevOps username (for SSH), domain name, repository name, and branch name for your project. You can get this information from the git clone command in the Azure DevOps dashboard.
- In the above example, the provided SSH URL was
[email protected]:v3/runcloud/My-Website/My-Website
. Use the information in this URL to populate the given fields :- Git user:
git
- Git Host:
ssh.dev.azure.com
- Repository:
v3/runcloud/My-Website/My-Website
- Branch: Your desired branch (
main
by default)
- Git user:
- Next, we need to create a deployment key for your web application. If this is your first time using Git with RunCloud, you need to generate a deployment key. Click on Generate and copy the key.
- Then go to your Azure DevOps dashboard and navigate to User Settings > SSH Public Keys. Click on Add Key, paste the key, and give it a label. This will allow RunCloud to access your Azure DevOps repository.
- Go back to the RunCloud dashboard and click on Deploy Web Application. This will pull the latest changes from your Azure DevOps repository and deploy them to your server. Once the deployment is successful, you can access your web application from the URL that you specified earlier.
- After deploying the application, you’ll need to configure the webhooks for your web application. This will enable RunCloud to automatically update your web application when you push changes to your Azure DevOps branch.
- Go to your Azure DevOps dashboard and navigate to Project Settings > Service Hooks. Click on Create Subscription and select Web Hooks as the service.
- On the next screen, choose Code pushed as the trigger, and select both your repository and branch.
- Click on Next and enter the webhook URL provided by RunCloud. You can find this URL in the Git tab of your web application. Click “Finish” to complete the webhook setup.
- Finally, go back to your IDE and push a small change to your web application. Once you push your changes to Azure, RunCloud will create a new version of your web application and deploy it automatically.