<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://wiki.apoyar.eu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=84.47.33.253</id>
	<title>Apoyar Wiki - User contributions [en-gb]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.apoyar.eu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=84.47.33.253"/>
	<link rel="alternate" type="text/html" href="https://wiki.apoyar.eu/index.php?title=Special:Contributions/84.47.33.253"/>
	<updated>2026-07-21T11:32:06Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://wiki.apoyar.eu/index.php?title=Add_new_server_to_GitLab_AutoDeploy&amp;diff=65</id>
		<title>Add new server to GitLab AutoDeploy</title>
		<link rel="alternate" type="text/html" href="https://wiki.apoyar.eu/index.php?title=Add_new_server_to_GitLab_AutoDeploy&amp;diff=65"/>
		<updated>2017-05-01T09:26:53Z</updated>

		<summary type="html">&lt;p&gt;84.47.33.253: Installing autostarting Git auto Deploy on Windows.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;If not mentioned otherwise, the following values are variables and will change from project to project (or server to server):&lt;br /&gt;
&lt;br /&gt;
* dev-server - Git branch name, usually following the name of the server which the files will be deployed to (can be uat-server or live-server, etc)&lt;br /&gt;
* the /var/www/html path is just an example, this will be the root folder of the website we want to deploy to (from nginx/apache sites-enabled)&lt;br /&gt;
* the &amp;lt;nowiki&amp;gt;https://gitlab.apoyar.eu/somepath&amp;lt;/nowiki&amp;gt; will be the url to the project in question - to be obtained from GitLab&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== And now the steps: ===&lt;br /&gt;
==== Linux servers: ====&lt;br /&gt;
&lt;br /&gt;
* Install Git AutoDeploy&lt;br /&gt;
** apt-get install software-properties-common&lt;br /&gt;
** add-apt-repository ppa:olipo186/git-auto-deploy&lt;br /&gt;
** apt-get update&lt;br /&gt;
** apt-get install git-auto-deploy&lt;br /&gt;
* copy the settings file from Dev: /etc/git-auto-deploy.conf.json&lt;br /&gt;
* amend the file contents: url to access (GitLab project), active branch required&lt;br /&gt;
* open the /etc/init.d/git-auto-deploy file and make the daemon running as www-data:&lt;br /&gt;
** DAEMON_UID=&amp;quot;www-data&amp;quot;&lt;br /&gt;
** DAEMON_GID=&amp;quot;www-data&amp;quot;&lt;br /&gt;
* Run systemctl daemon-reload after you’ve made the changes above&lt;br /&gt;
* A reboot may be required here&lt;br /&gt;
* Make sure the Deploy Bot account has access to the project and is made a Master&lt;br /&gt;
* Backup the current website contents: cp -R /var/www/html/ /home/neal/backup/&lt;br /&gt;
* Delete the website contents, including the git part (if present):&lt;br /&gt;
** cd /var/www/html&lt;br /&gt;
** rm –rf *&lt;br /&gt;
** rm –rf .git .gitignore .htaccess&lt;br /&gt;
* Before you do the below process, you may need to check the owner of the /var/log/git-auto-deploy.log file. It should be www-data. Also check the /var/run/git-auto-deploy/git-auto-deploy.pid If not, change them:&lt;br /&gt;
** chown www-data:www-data /var/log/git-auto-deploy.log&lt;br /&gt;
** chown www-data:www-data /var/run/git-auto-deploy/git-auto-deploy.pid&lt;br /&gt;
* Start the daemon in foreground, but as the user www-data: sudo -H -u www-data bash -c &#039;git-auto-deploy --pid-file /var/run/git-auto-deploy/git-auto-deploy.pid --log-file /var/log/git-auto-deploy.log --config /etc/git-auto-deploy.conf.json&#039;&lt;br /&gt;
* Once static, Ctrl-C the process&lt;br /&gt;
* It should create the tree&lt;br /&gt;
* Check the contents of the /var/www/html/.gitignore file&lt;br /&gt;
* If not present, create one, own it by www-data and push back to the server. If present, leave out the 3 next steps&lt;br /&gt;
** vi .gitignore&lt;br /&gt;
** chown www-data:www-data .gitignore&lt;br /&gt;
** git push origin dev-server&lt;br /&gt;
* Copy the ignored files listed above from backup&lt;br /&gt;
* Clear the cache and push changes to GitLab:&lt;br /&gt;
** cd /var/www/html&lt;br /&gt;
** git rm –rf –cached .&lt;br /&gt;
** git add .&lt;br /&gt;
** git status&lt;br /&gt;
** if the above command says nothing to commit, you can leave out the 2 next steps&lt;br /&gt;
** git commit&lt;br /&gt;
** git push origin dev-server&lt;br /&gt;
* Make sure all objects in the .git/objects folder are owned by www-data: chown –R www-data:www-data *&lt;br /&gt;
* Change the Deploy Bot to be a Reporter in GitLab&lt;br /&gt;
* Start the service: service git-auto-deploy start&lt;br /&gt;
* Observe the log file: tail –f /var/log/git-auto-deploy.log&lt;br /&gt;
* If you don’t see anything in the log and the foreground app runs fine, reboot the server&lt;br /&gt;
* Add the &amp;lt;nowiki&amp;gt;http://hostname:8001&amp;lt;/nowiki&amp;gt; as webhook to GitLab project in question: &amp;lt;nowiki&amp;gt;https://gitlab.apoyar.eu/root/bleckmann/settings/integrations&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
* Reboot the server and check whether it’s listening on port 8001: netstat -anp&lt;br /&gt;
&lt;br /&gt;
==== Windows servers: ====&lt;br /&gt;
&lt;br /&gt;
* All installation files and prerequisites are in the \\ncc1701d\SourceFiles\Git network folder&lt;br /&gt;
* Install the Windows Git client (Git-2.11.1-64-bit)&lt;br /&gt;
* Install Python for Windows (pywin32-220.win-amd64-py2.7)&lt;br /&gt;
* Reboot&lt;br /&gt;
* Make sure you can run Python from command line without specifying the installation path (open CMD, then type python -v, you should get the python command prompt. Close it by typing &#039;quit()&#039;)&lt;br /&gt;
* Make sure you can run Git from command line. Just type git in the CMD window&lt;br /&gt;
* If the above two are not working, just check the Windows PATH environmental variable in the computer&#039;s properties&lt;br /&gt;
* Now, installing GitAutoDeploy:&lt;br /&gt;
** Open the Command Prompt as admin&lt;br /&gt;
** cd to &#039;C:\inetpub\wwwroot&#039;&lt;br /&gt;
** run &#039;git clone https://github.com/olipo186/Git-Auto-Deploy.git&#039;&lt;br /&gt;
** cd to newly created subfolder: &#039;cd Git-Auto-Deploy&#039;&lt;br /&gt;
** run the Python requirements checker &#039;pip install -r requirements.txt&#039; It will check and install all required Python files, if needed.&lt;br /&gt;
* From the \\ncc1701d\SourceFiles\Git network path copy these files to the C:\inetpub\wwwroot\Git-Auto-Deploy folder:&lt;br /&gt;
** gitautodeploy.bat&lt;br /&gt;
** GitAutoDeploy.py&lt;br /&gt;
** invisible.vbs&lt;br /&gt;
** config.json&lt;br /&gt;
* Please note that if the &#039;Hide extensions for known file types&#039; option is ticked, the above 4 files will be visible without their extension!&lt;br /&gt;
* Create a folder which will contain the IIS files. In this example I&#039;ll be using &#039;C:\inetpub\wwwroot\BleckmannAPItest&#039;&lt;br /&gt;
* You will point your new IIS website to the above folder.&lt;br /&gt;
* Edit the config.json file according to your needs. Particularly change the:&lt;br /&gt;
** GitLab url&lt;br /&gt;
** Branch to manage (uat-server)&lt;br /&gt;
** Local path for the files (&#039;C:/inetpub/wwwroot/BleckmannAPItest&#039;)&lt;br /&gt;
*** Please note I&#039;m using forwardslash instead of backslash. This is the way it needs to be entered in the config.json file!&lt;br /&gt;
* Should you need to serve more than one project, please refer to the complex-config.json file in the same network folder.&lt;br /&gt;
* Now get the initial copy of the website from GitLab:&lt;br /&gt;
** start CMD and browse to your new empty folder: &#039;cd C:\inetpub\wwwroot\BleckmannAPItest&#039;&lt;br /&gt;
** run git clone https://root@gitlab.apoyar.eu/root/BleckmannAPI.git .&lt;br /&gt;
** don&#039;t forget the ending dot after the url as this makes sure the files will be saved to the current folder&lt;br /&gt;
* Check the contents of the folder&lt;br /&gt;
* Add the http://hostname:8001 as webhook to GitLab project in question: https://gitlab.apoyar.eu/root/BleckmannAPI/settings/integrations&lt;br /&gt;
* Again, the above url is &#039;&#039;&#039;just an example&#039;&#039;&#039;&lt;br /&gt;
* As for the hostname, it&#039;s always good to check that the computer name (for example bleckmannapi.apoyar-networks.com) is pingable from Linuxweb, which is the machine GitLab runs on&lt;br /&gt;
* Time for the console test:&lt;br /&gt;
** Open CMD&lt;br /&gt;
** copy and paste &#039;python C:\inetpub\wwwroot\Git-Auto-Deploy\GitAutoDeploy.py --config C:\inetpub\wwwroot\Git-Auto-Deploy\config.json&#039;&lt;br /&gt;
* You&#039;ll get the initialization messages and the script should stop at &#039;listening on&#039;&lt;br /&gt;
* Go to GitLab, project in question, settings, Integrations&lt;br /&gt;
* Find the entry you have just added recently and hit Test&lt;br /&gt;
* You should get the &#039;Hook executed succesfully&#039; blue bar at the top.&lt;br /&gt;
* Now the startup:&lt;br /&gt;
** Open the registry editor: start, run, &#039;regedit&#039;&lt;br /&gt;
** Browse to the: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run&lt;br /&gt;
** Add a new &#039;Expandable String Value&#039;&lt;br /&gt;
** Name it &#039;GitAutoDeploy&#039;&lt;br /&gt;
** Copy and paste this value: &amp;quot;%SystemRoot%\System32\WScript.exe&amp;quot; &amp;quot;C:\inetpub\wwwroot\Git-Auto-Deploy\invisible.vbs&amp;quot; &amp;quot;C:\inetpub\wwwroot\Git-Auto-Deploy\gitautodeploy.bat&amp;quot;&lt;br /&gt;
** Reboot the server and &#039;&#039;&#039;log on as administrator&#039;&#039;&#039;&lt;br /&gt;
** The above is required as the python script won&#039;t otherwise run in the background&lt;br /&gt;
* Test&lt;/div&gt;</summary>
		<author><name>84.47.33.253</name></author>
	</entry>
</feed>