Versioncontrol Repository in LAN Working copy in Web - version-control

I'm a newbie to version control systems, so please pardon my naiveté.
I want the repository to be on a networked path within our local area network (LAN) so that only local PC's can access it. The files that are edited should be on a server which is accessible via the internet.
Here is a diagram of what I mean:
The Internet server is an ordinary web server, but it offers WebDAV. Is there a version control system with which I can implement this setup?

Sure. What you are trying to achieve is called continuous deployment. You can set up a git server locally and then deploy the build artifacts to the WebDAV server (and/or another server) online.
⚠️ Note
I strongly recommend not running your version control software (VCS) locally, but rather, having a private repo on GitHub, GitLab, AWS CodeCommit, Azure DevOps, or BitBucket that you clone locally for work.
If you're committed (no pun intended) to local VCS, then you can use the set up below.
Continuous Deployment
You can create a local scheduled script to check for critical events (like approved merges on the main branch) of a target local repo. The script will then build the entire project and copy the build artifacts to the WebDAV.
There are almost an infinite number of ways to achieving this, so I will just link to some high level guides:
What is a Deployment pipeline?
Continuous Integration, Delivery, and Deployment
Windows Scheduled Tasks Azure DevOps Extension
scheduling continuous integration pipelines
The script can be as simple as copying files from the repo to the WebDAV; or, as complex as integrating, testing, building, and pushing build artifacts. The specifics (which scripting language[s] and how to schedule) depend on your OS more than anything. Here are instructions for Windows: https://blog.netwrix.com/2018/07/03/how-to-automate-powershell-scripts-with-task-scheduler/
git Server on LAN
Before you can deploy, you need a repo. The following are steps (using Windows 10) to get your local git server going. If you are using a Linux flavour, please adjust the instructions accordingly.
Create a folder where you want to create the Git Server.
Move into that folder, right click and select
 Git Bash Here
 option. This will open a bash command window in the current
folder.
Run the command
 git init anyname.git --bare
 to initialize Git bare repo without the working directory.
That’s it. You have successfully set up your Git server.
Connecting to Local Git Server
On your Git server, Go to control panel → Network And Sharing
Center > Change advanced sharing settings. Select
 
Turn on network discovery option
 and
 
Turn on file and printer sharing
 option.
On your Git server, Go to control panel → Windows Defender
Firewall → Advanced Settings → Inbound Rules. Enable
 
File and Printer Sharing (NB-Name-In) on private,public
profile and
 File and Printer Sharing (SMB-In)
 on private, public profile
 as shown below.
Go to the folder you have created Git Server, right click and select
 properties. Under
 sharing
 tab, click
 Share
 and add
 Everyone. Set the
 permission level
 as
 Read/Write.
Once the permissions are set, you will find a share path.
Go to second Windows PC and open Git terminal and type
 *git clone //GitServerName/PathToGitServerFolder.git *
 command.
You can create new files and folders as if you do on a normal Git
account.
That’s it. You have successfully created your own Git Server
and published on the network.

The simplest way that I can think of, though it take a little getting used to is GIT.
You can do this with local repo C:/some/path/to/repo and the upstream as E:/webdav/location or //link/to/webdav, and just push to upstream to update on the server.

Related

Automatic git pull on server

So I have a server where I keep development files used for my game server. With multiple developers, I was wondering if there is a way to have the repository located on that server automatically pull new files as my developers push their commits to the online master? I have looked into ngrok but am unable to figure out how to implement this as this is not a web server and the files are not located on the root drive of the computer. Hope someone can give me a good step by step or point me in the right direction of a tutorial!
If you are on linux you can use crontab, on windows you can use Windows Task Scheduler

Azure DevOps - Pipeline to pull code down to remote server

I am attempting to create a pipeline in our Azure DevOps org that will automatically 'pull' code down to a single remote server whenever a push request is sent to the master branch of my particular repo. I am having a difficult time understanding the entire process and what I actually need to accomplish this relatively simple pipeline.
Currently, my remote server has a folder on the C: drive with various .ps1 files. I would like to turn this into my repo and install the self-hosted agent on this same server so that way anytime I push something to the master branch on my local server it will automatically be pulled down to my remote server and the scheduled tasks I have running will pick be running the most up to date code.
I believe what I need to do first is install a self-hosted agent on my remote server. I am not completely sure though if this agent is suppose to be a deployment agent or a build agent.. or both? Since I am not technically building a project, but rather simply overwriting .ps1 files, I imagine it should only be given permissions for a deployment agent.
Something else I can't wrap my head around is how I specify the location of my repo on the remote server. Can I define this dynamically or do I need to specify in my path the target path of that specific repo?
According to your description, you could simplify your requirement to be: copy files from a source folder to a target folder on a remote machine over SSH using Copy Files Over SSH task, and then run related Git commands like the following.
cd repo_directory
git add .
git commit -m "upadte"
git push
Thus this remote repo is updated using SSH Deployment task.
In addition, you need to deploy a self-hosted build agent because it can be used in build pipeline.
Finally, configuring a schedule trigger for this build pipeline.

Applying sonarqube for remote repository

I have a project in my github.Sonarqube was running in local machine(windows).Now I want to apply sonarqube on my repository project in my local machine only without using jenkins.
I have applied the sonarqube when that project is in local machine.
Two requirements I want to do
1)Applying sonarqube to remote repository
2)whenever a commit happens update sonarqube on that changes.
Applying sonarqube to remote repository
That means a remote process running Sonar on the GitHub side.
For now, you have GitHub Actions which allow, on push, to run specific programs.
For instance: sonarsource/sonarcloud-github-action will run SonarCloud (you can sign up an account for free) in order to detects bugs, vulnerabilities and code smells in more than 20 programming languages.
No Jenkins required.

Is it possible to have ansible use a "remote" playbook for git-based continuous deployment?

I need to manage a few servers that run code that is currently being deployed there as a couple of git repositories. I would like to be able to store in the project's repository the parts (if not all) of the playbook that is relevant for the repository. For example, the list of package dependencies, virtualenv requirements, configuration templates. This will also allow those to change in a per branch/commit way. Meaning I can make sure that if I need to deploy a specific branch/commit, playbook that is correct for that commit is being used, if, say, the configuration template being used changed.
It seems like the only solution is to checkout the git repository locally. Is it possible in ansible to tell it to run a remote play book (from the git repository that is being checked out on the server)? I was thinking of having ansible run a ansible using a local connection on the remote host, I haven't tried it to see if this will actually work out.
How do people manage to use ansible for continuous deployment based on git without some mechanisms for running a remote playbook?
Take a look at ansible-pull.
It pulls the repo and executes playbook.

How to configure a Thoughtworks:GO task to deploy a repo?

I'm trying to figure out how to create a task (custom-command, not ant/rake, etc) to perform a deployment of a git-repo to some server/target (in this case Heroku). If I were to do this manually, it's just git push heroku master.
I've created a basic pipeline/stage/job/task (custom-command, in this case a Python script), and single agent. The pipeline has a material (git repo, with a name). Inside the script, I'm printing out os.environ.items() - it has several variables, including the SHA of the latest commit - but no URL for the actual repository.
So how is the agent (or task) supposed to know what repository to deploy?
The pipeline knows the material name, and I've tried passing in an Environment Variable such as ${materialName} (which didn't work). I could hard-code a URL in the task, but that's not a real solution.
Thoughtworks:GO's documentation is shiny, but a bit sparse in the details. I'd have thought something this basic would be well documented, but if so, I haven't found it so far.
When a task runs on an agent, it clones the repository specified in the material (config). The .git/config wouldn't have remote Heroku url and as such git push heroku master wouldn't work.
You would need to add Heroku remote url before you can perform a deployment of your git-repo to Heroku.
git remote add heroku git#heroku.com:project.git
where project is the name of your Heroku project. This is required to be done only once unless you perform a clean working directory every time (in Stage Settings which removes all files/directories in the working directory on the agent, you can see this option from the UI as well: Admin -> Piplelines -> Stages -> Stage Settings Tab) in which case you may have to add the remote url via a task before you run the task to deploy.
Once you've done so, you should be able to use the heroku xxxx commands (assuming you have the Heroku Toolbelt installed on the agent machine you are using for deploying), and should be able to push to Heroku as usual via git push heroku master.