Anonymous user
Add new server to GitLab AutoDeploy: Difference between revisions
Installing autostarting Git auto Deploy on Windows.
(permissions) |
(Installing autostarting Git auto Deploy on Windows.) |
||
| Line 5: | Line 5: | ||
* the <nowiki>https://gitlab.apoyar.eu/somepath</nowiki> will be the url to the project in question - to be obtained from GitLab | * the <nowiki>https://gitlab.apoyar.eu/somepath</nowiki> will be the url to the project in question - to be obtained from GitLab | ||
=== And now the steps: === | |||
==== Linux servers: ==== | |||
* Install Git AutoDeploy | * Install Git AutoDeploy | ||
| Line 53: | Line 54: | ||
* Add the <nowiki>http://hostname:8001</nowiki> as webhook to GitLab project in question: <nowiki>https://gitlab.apoyar.eu/root/bleckmann/settings/integrations</nowiki> | * Add the <nowiki>http://hostname:8001</nowiki> as webhook to GitLab project in question: <nowiki>https://gitlab.apoyar.eu/root/bleckmann/settings/integrations</nowiki> | ||
* Reboot the server and check whether it’s listening on port 8001: netstat -anp | * Reboot the server and check whether it’s listening on port 8001: netstat -anp | ||
==== Windows servers: ==== | |||
* All installation files and prerequisites are in the \\ncc1701d\SourceFiles\Git network folder | |||
* Install the Windows Git client (Git-2.11.1-64-bit) | |||
* Install Python for Windows (pywin32-220.win-amd64-py2.7) | |||
* Reboot | |||
* 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 'quit()') | |||
* Make sure you can run Git from command line. Just type git in the CMD window | |||
* If the above two are not working, just check the Windows PATH environmental variable in the computer's properties | |||
* Now, installing GitAutoDeploy: | |||
** Open the Command Prompt as admin | |||
** cd to 'C:\inetpub\wwwroot' | |||
** run 'git clone https://github.com/olipo186/Git-Auto-Deploy.git' | |||
** cd to newly created subfolder: 'cd Git-Auto-Deploy' | |||
** run the Python requirements checker 'pip install -r requirements.txt' It will check and install all required Python files, if needed. | |||
* From the \\ncc1701d\SourceFiles\Git network path copy these files to the C:\inetpub\wwwroot\Git-Auto-Deploy folder: | |||
** gitautodeploy.bat | |||
** GitAutoDeploy.py | |||
** invisible.vbs | |||
** config.json | |||
* Please note that if the 'Hide extensions for known file types' option is ticked, the above 4 files will be visible without their extension! | |||
* Create a folder which will contain the IIS files. In this example I'll be using 'C:\inetpub\wwwroot\BleckmannAPItest' | |||
* You will point your new IIS website to the above folder. | |||
* Edit the config.json file according to your needs. Particularly change the: | |||
** GitLab url | |||
** Branch to manage (uat-server) | |||
** Local path for the files ('C:/inetpub/wwwroot/BleckmannAPItest') | |||
*** Please note I'm using forwardslash instead of backslash. This is the way it needs to be entered in the config.json file! | |||
* Should you need to serve more than one project, please refer to the complex-config.json file in the same network folder. | |||
* Now get the initial copy of the website from GitLab: | |||
** start CMD and browse to your new empty folder: 'cd C:\inetpub\wwwroot\BleckmannAPItest' | |||
** run git clone https://root@gitlab.apoyar.eu/root/BleckmannAPI.git . | |||
** don't forget the ending dot after the url as this makes sure the files will be saved to the current folder | |||
* Check the contents of the folder | |||
* Add the http://hostname:8001 as webhook to GitLab project in question: https://gitlab.apoyar.eu/root/BleckmannAPI/settings/integrations | |||
* Again, the above url is '''just an example''' | |||
* As for the hostname, it'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 | |||
* Time for the console test: | |||
** Open CMD | |||
** copy and paste 'python C:\inetpub\wwwroot\Git-Auto-Deploy\GitAutoDeploy.py --config C:\inetpub\wwwroot\Git-Auto-Deploy\config.json' | |||
* You'll get the initialization messages and the script should stop at 'listening on' | |||
* Go to GitLab, project in question, settings, Integrations | |||
* Find the entry you have just added recently and hit Test | |||
* You should get the 'Hook executed succesfully' blue bar at the top. | |||
* Now the startup: | |||
** Open the registry editor: start, run, 'regedit' | |||
** Browse to the: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run | |||
** Add a new 'Expandable String Value' | |||
** Name it 'GitAutoDeploy' | |||
** Copy and paste this value: "%SystemRoot%\System32\WScript.exe" "C:\inetpub\wwwroot\Git-Auto-Deploy\invisible.vbs" "C:\inetpub\wwwroot\Git-Auto-Deploy\gitautodeploy.bat" | |||
** Reboot the server and '''log on as administrator''' | |||
** The above is required as the python script won't otherwise run in the background | |||
* Test | |||