Giter VIP home page Giter VIP logo

ktp-forked-repos / git-captain Goto Github PK

View Code? Open in Web Editor NEW

This project forked from confuseddeer/git-captain

0.0 1.0 0.0 1.04 MB

An open-source web-application built with Node.js utilizing GitHub API to find, create, and delete a branch throughout numerous GitHub repositories. Can be setup for organizations or a single user.

Home Page: https://youtu.be/LOLxImi5t7w

License: MIT License

JavaScript 59.23% Batchfile 2.06% CSS 21.01% HTML 17.71%

git-captain's Introduction

Alternative text

1   Git-Captain: A easy to use site that facilitates working with numerous GitHub repositories.

Git-Captain is a Node.js powered site that came about as a solution and time-saver for frustrated developers having to work with numerous GitHub repositories in support of the same project.

It's primary goal was to facilitate the creation of the same named branch across multiple repositories but has grown to allow a few more features. It works well for teams running TeamCity and GitFlow, which require repositories to have same named branches.

Git Captain can also serve as a great starting point for Node.js beginners and the steps laid out in the setup are specifically explicit to allow newbies to setup and run their first Node.js projects.

1.1   Main features

  • Create New Branches
  • Cleanup Existing Branches
  • Find Branches
  • Find Open Pull Requests

1.2   Create New oAuth App in GitHub

  1. Login to GitHub
  2. In your profile settings page, click Developer Settings
  3. In OAuth Apps, click “New OAuth App”
  4. Application Name (whatever you like)
  5. Homepage URL:
    1. IP address of your box. For Example: https://myawsbox.com or https://10.40.15.57)
  6. Authorization call ball URL:
    1. This is the callback URL were users will be redirected back to after GitHub authorizes your users.
    2. You will use the authenticated.html page as the landing point after the user logs into GitHub. Example: https://myawsbox.com/authenticated.html or https://10.40.15.57/authenticated.html
  7. Click the “Register application” button.
  8. Notice the “Client ID” and “Client Secret” and jot them down. You will need both in your node.js server.

1.3   Windows Server Installation

The Following steps are to prevent having to transfer a large node_Modules directory from your DEV box to the Windows Server box.

1.3.1   Install Git for Windows

  1. Navigate to the Git Windows download URL: https://git-scm.com/download/win
  2. Execute the installer that was downloaded, click Run, and finish the "Git for Windows" install.

1.3.2   Download and Install Node.js

  1. Download and install Node.js from https://nodejs.org/en/download/
  2. For a Windows Server you want the "Windows Installer (.msi)" (example: v10.15.0-x64.msi or newer)
  3. Run the installer and install in the default location. Once the Node.js installer is complete, open a command prompt and type in node --version and you should see the node version installed, otherwise verify you have downloaded the correct installer and re-install.
  4. Do a npm -v and you should see the NPM version installed.

1.3.3   Clone the Git-Captain Project repository

  1. Open a command line and run 'git clone https://github.com/ConfusedDeer/Git-Captain.git' to clone the 'Git-Captain' repo.
  2. Unzip and drop the content contents of folder into your windows server 'C:\' drive. (You don't need the top-level folder)
  3. If you downloaded the repo make sure it's named 'Git-Captain' (Not 'Git-Captain-Master'), otherwise rename it to 'Git-Captain'.
  4. You should have a folder named 'Git-Captain' with a 'controllers and 'public' folders with several files.

1.3.4   Update the client-side endpoint and config.js

  1. In 'Git-Captain\public\js\tools.js', upate line 1 constant named 'gitPortEndPoint' value to the domain or IP address of you Node.js server. For example: const gitPortEndPoint = 'https://awsMyserver.com';
  2. In 'Git-Captain\controllers\config.js', upate the 'config.gitHub.orgName' value to either the organization name or your GitHub username. If more than one user will access Git-Captain, then you need to create an organization in Github.
  3. In 'Git-Captain\controllers\config.js', update the config.web.gitCaptainTimeOutInMinutes if you want to change the Git-Captain timeout.

1.3.5   Installing NPM

  1. Go to the 'Git-Captain' directory and in a CMD console execute npm install npm-install -g.
  2. Go to the main 'Git-Captain' directory where the 'package.json' file is located and in a command window run npm install, so the required node modules can be downloaded. You should notice there is now a node_modules directory.
  3. Verify there is a node_modules and contents in the 'Git-Captain' directory.

1.3.6   Create a self-signed certificate (For SSL/HTTPS)

  1. We need to create a self-signed certificate that we will use to secure communication between our client and Node.js Server.
  2. It's important to note, since this is a self-signed certificate, thus any user that accesses the site will receive a warning stating the site is not secure.
  3. The warning occurs because most modern browsers require a certificate to be issued and signed from a Certificate Authority (CA).
  4. If you don't want this security warning to occur, purchase a CA signed and issued certificate.
  5. Install OpenSSL: Windows Installer. I use the "OpenSSL v1.1.1a Light" MSI (Experimental) the following site: https://slproweb.com/products/Win32OpenSSL.html
  6. Once OpenSSL is installed, find the OpenSSL BIN directory (example: C:\Program Files\OpenSSL-Win64\bin) and in an ADMINISTRATOR CMD line, run the following command: openssl req -nodes -new -x509 -keyout theKey.key -out theCert.cert and it will prompt with various questions to create your SSL key and certificate. Once the questions are complete, you should have now two new files 'theCert.cert' and 'theKey.key' in your bin directory (C:\Program Files\OpenSSL-Win64\bin).
  7. Copy the 'theKey.key' and 'theCert.cert' files to your C:\Git-Captain\controllers directory.

1.3.7   Create a .env file (DO NOT COMMIT THIS FILE!)

  1. Create a new file named ".env" with no file name and just the extension.
  2. In the ".env" file add the following lines:
Example:

client_secret=[Your GitHub client secret]
client_id=[Your GitHub client ID]
privateKeyPath=[name and location of SSL key]
certificatePath =[name and location of SSL cert]


Here's an example of how your file will look like:

client_secret=3arg1a6889b113d206t68197z88z5488eeaq6967
client_id=g1e6187c5g1gt691g8b4
privateKeyPath=./theKey.key
certificatePath =./theCert.cert


  1. Place the ".env" file in the Git-Captain\controllers directory.

1.3.8   Do a basic test of server.js

  1. Go to the 'Git-Captain\Controllers' directory and execute node server.js.

    You should see http server listening on port 3000.

    If you do NOT see http server listening on port 3000, verify that all required modules listed in the 'Git-Captain\package.json' file exist in the 'Git-Captain\node_modules' directory. Look over the previous steps to make sure you didn't miss anything.

  2. In the console window execute a CTRL+C to kill the node process.

1.3.9   Install Forever

  1. To keep the node process running in the background or in case of app crash, I highly recommend installing FOREVER: https://www.npmjs.com/package/forever by going to 'Git-Captain' directory and executing npm install forever -g.
  2. Once 'forever' is installed, execute a forever --version to verify installation.
  3. Go to the 'Git-Captain\controllers' directory and execute forever start server.js and you should see 'http server listening on port 3000'.
  4. In the CMD windows execute taskmgr and verify node.exe is running or you can do a forever list
  5. Close the CMD window and open Chrome browser to 'https://localhost:3000/' and you should see an index page for 'Git-Captain' with a login button.
  6. open the CMD window and type in forever stopall and do a forever list to verify there are no forever processes running.

1.3.10   Install uglify-es and clean-css

  1. Go to the 'Git-Captain' directory and execute the following command npm install uglify-es -g to install uglify-es, which we will use to minify JavaScript file(s).
  2. While in 'Git-Captain' directory, execute the following command npm install clean-css-cli -g to install clean-css, which we will use to minify css file(s).

1.3.11   Setup Script to auto restart server.js if server is rebooted (Task Scheduler)

1a. If Git-Captain is located somewhere other than C:\Git-Captain, then you will need to update 'nodeStartupDEV.bat', 'nodeStartupPROD.bat', and 'nodeStopAll.bat' files to update the location. Do not update the scripts to point to simply point to current directory '.\', which will work when executed manually, but fail in the windows task scheduler.

1b. In Windows find and open 'Task Scheduler' program.

  1. Click "Create Task".
  2. Name the task whatever you desire (ex. "Startup Git-Captain after box reboot").
  3. Push the radio button for "Run whether user is logged on or not."
  4. Checkmark "Run with the highest privileges".
  5. Checkmark "Hidden".
  6. In "Configure for:" select your server OS (ex. "Windows Server 2012 R2").
  7. Select the 'Triggers' tab and press the 'New...' button and the "New Trigger" window should appear.
  8. In "Begin the task:" dropdown field select "At startup", verify the 'Enabled' checkbox is checked, and click the OK button.
  9. Select the 'Actions' tab and press the 'New..' button, leave the action as "Start a program". Click the 'Browse...' button to locate the 'nodeStartupPROD.bat' file and select it.
  10. The 'Program/script:' field should now be populated with 'nodeStartupPROD.bat'. Click the 'OK' button.
  11. Select the 'Conditions' tab and under 'Power' category, uncheck the "Stop if the computer switches to battery power" and uncheck the "Start the task only if the computer is on AC power".
  12. Select the 'Settings' tab and uncheck "Stop the task if it runs longer than:" and uncheck "If the running task does not end when requested, force it to stop" and verify only the "Allow task to be run on demand" is checked.
  13. Verify under "if the task is already running, then the following rule applies:" the select box is set to "Do not start a new instance".
  14. Click OK button (Windows may prompt for credentials).
  15. Verify "Startup Git-Captain after box reboot” (or whatever you named it) is listed in the grid.
  16. Reboot or turn off/on your Windows Server. Once server is running, open browser and go to 'localhost:3000'. Verify you get the Git-Captain login.

1.3.12   Open port 3000 and port 443 to allow calls through firewall

  1. Open "Windows Firewall with Advanced Security" application.
  2. Select 'Inbound Rules' and add a new rule. Select Port and for specific local ports enter in port 3000 and click the 'Next' button. Verify 'Allow the connection' radio button is pushed and click the 'Next' button. Leve all three checkboxes checked and click the 'Next' button once again. Name the rule (ex. "Port3000 Inbound") and click the 'Finish' button.
  3. Select 'Outbound Rules' and add a new rule. Select Port and for specific local ports enter in port 3000 and click the 'Next' button. push the 'Allow the connection' radio button and click the 'Next' button. Leve all three checkboxes checked and click the 'Next' button once again. Name the rule (ex. "Port3000 Outbound") and click the 'Finish' button.
  4. Verify that a rule already exists (if not add it) to allow ALL traffic, inbound and outbound for port 443 (the standard Windows Server port 80 and 443 rule is too restrictive).
  5. Go to a browser on another box (not in the server) and go to https[URL for the server or name of the server] followed by port 3000 (ex. https://10.50.16.58:3000 or https://AWSserver.com:3000 ).

1.3.13   Forward all calls to port 443 to port 3000 using windows Netsh

Prerequisite: IPv6 must be installed. You can verify if IPv6 is installed by opening network and sharing, clicking on your connection, properties, and verifying if "Internet Protocol Version 6 (TCP/IPv6) is check-marked.
  1. We will user three basic commands using Netsh to allow us to ADD, DELETE, or DISPLAY a list of port-forwarding rules.

    For example:

    To ADD a rule: netsh interface portproxy add v4tov4 listenport=443 listenaddress=10.50.16.58 connectport=3000 connectaddress=10.50.16.58

    To DELETE a rule: netsh interface portproxy delete v4tov4 listenport=443 listenaddress=10.50.16.58

    to DISPLAY all current rules: netsh interface portproxy show all

  2. Open an administrator command prompt window and type in ipconfig and get your IPv4 Address, which we will need to setup port forwarding.

  3. We need to add a rule to forward all calls to port 443 to port 3000, which our Node.js server is monitoring.

  4. In the command line with administrative privileges, run the following command to add a port forwarding rule for forwarding all calls to port 443 to port 3000. Substitute [your IPv4 Address] with your address from the previous step: netsh interface portproxy add v4tov4 listenport=443 listenaddress=[your IPv4 Address] connectport=3000 connectaddress=[your IPv4 Address].

  5. Run the netsh interface portproxy show all command to view all current rules and verify your rule is listed. "Listen on..." should be port 443 and 'Connect to..." should be port 3000.

  6. If you made a mistake, delete the rule and add it once again using the delete and add commands in previous step.

  7. Open Windows Services, find "IP Helper", look at the properties, set the "Startup type:" to 'Automatic', click 'Start', and click the 'OK' button. Open windows Task Manager and go to the services tab, find the service named 'iphlpsvc' (description: "IP Helper") and verify it's running. For the port-forwarding to work the iphlpsvc must be running.

  8. Open a browser window INSIDE your server and type in [your IPv4 Address] in the URL (without 3000) and your port 443 call should automatically be forwarded to port 3000, thus displaying the Git-Captain login page, which confirms the netsh command to forward all port 443 calls to port 3000.

  9. Open a browser window OUTSIDE your server, type in [your IPv4 Address] in the URL (without 3000) and your port 443 call should automatically be forwarded to port 3000, thus displaying the Git-Captain login page. If your page displays within your server and NOT outside your server then go back to the Windows Firewall and verify you have configured it correctly.

1.4   Linux Server Installation

(Coming Soon).

1.5   User support

(coming soon).

1.6   License

This project is licensed under the MIT License - see the LICENSE.md file for details,

1.7   Built With

  • Node.js — The run-time environment used.
  • GitHub API — Used to integrate with Github.
  • Express — Node.js framework.
  • NPM — Package Manager for JavaScript.

1.8   Authors

1.9   Contributions and Special Thanks

1.10   Possible future updates

  1. Linux steps
  2. Forward calls to port 80 http://myserver.com to port 443 https://myserver.com.
  3. Hide extensions from URL, for example authenticated.html

git-captain's People

Contributors

confuseddeer avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.