How to Install and Use Git-Push-Deploy Add-on?
There are different ways to put your code from a Git repository into containers. This includes methods like redeploying the entire container, quickly redeploying using volumes, or using the “git clone” approach. But, when you want to automate this process and move to continuous deployment, it can be challenging. Developers may find it complex because they need to know how to connect all the parts of their application properly.
In the world of containers, managing the building of your stack images involves dealing with the extra complexity of CI/CD pipelines. Redeploying the entire container might not be the best choice if you frequently make commits without changing the configuration of the operating system, application server stack, or its dependencies.
To make deployment automation easier, AccuWeb.Cloud has created a special Git-Push-Deploy package. This package helps deliver your code into pre-built container images. It has several configurations to automatically deploy changes you’ve committed in your Git application source repository to the cloud. This makes your changes available for testing with minimal delays.
Git-Push-Deploy Specifics
The Git-Push-Deploy package can work with GitHub and GitLab. It’s designed to update your Java, PHP, Ruby, Node.js, and Python applications automatically. It can be used with specific templates for certified stacks, like:
Java: Tomcat 6/7/8/9, TomEE, GlassFish 3/4, Jetty 6/8/9, WildFly 8/9/10, JBoss AS 7, Spring Boot 1.x
PHP: Apache 2.4, NGINX 1.10
Ruby: Apache 2.4, NGINX 1.10
Node.js: NodeJS 0.x-6.x
Python: Apache 2.4
How it works depends on the programming language of your project:
For Java, it creates a separate environment with a Maven build node. This node interacts with the Git repository, triggers your application builds, and deploys them to the application server.
For PHP/Ruby/Node.js/Python, it sets up a deployment pipeline directly to the ROOT context on a web server.
Repository Pre-Configurations
To make sure your add-on installs correctly, you’ll need to give it permission using a Personal API Token for your Git account. This token helps the package set up a webhook for your repository, so it knows to redeploy your application whenever there’s a change.
Here’s how to get your personal access token:
For GitHub:
Step 1: Go to Settings -> Developer Settings -> Personal access tokens.
Step 2: Click “Generate new token.”
Step 3: Provide a description, select the repo, and choose admin:repo_hook scopes.
Step 4: Click “Generate token” and copy the access token shown (remember, you can’t see it again later).
How to Install Git-Push-Deploy Package
The Git-Push-Deploy package is like an extra tool you can add to your environment. You can only install it on top of an existing environment. We’ve set up an environment to show you how it works with Apache-PHP application servers for different programming languages.
If you’re using an environment you created before, be aware that the package might replace the application deployed to the main part. To keep your current application, move it to a custom place. We suggest making a new environment and then following these steps:
Step 1: Click the Import button on the dashboard.
Step 2: If you created a jps file on your computer, find and open it. If you didn’t make one, you can get a pre-made jps file from this web link.
Step 3: Click Import.
Step 4: In the new window, give details about your repository and where you want to deploy your app:
Git Repo Url: The link to your application repo.
Branch: The branch of your project.
User: Your Git account login.
Token: The access token you made earlier for the webhook.
Environment name: Choose where your app will be deployed.
Nodes: The name of the application server (it’s automatically filled in when you choose the environment).
Step 5: Click Install. Wait for AccuWeb.Cloud to get your app from GitHub and set up the continuous deployment. Close the notification when it’s done.
Step 7: To start your app, click “Open in browser” next to your web server.
That’s it! Now, whenever you make a change to your code and save it, a new version of your app will automatically go to the application server.
Redeployment Policies for Different Stacks
To eliminate possible application downtime for a server with a Restart update policy, scale it out to be run over multiple containers. In this case, the required updates will be applied to the instances sequentially, with a 30-second delay by default.
Test Automated Deploy from Git
And now, let’s check how this process actually works. Make some minor adjustments to the code in a repo and ensure everything is automated:
Step 1. Click Edit this file for some item within your project repository and Commit changes to it – for example, we’ll modify the text at our nicktest.com start page.
Step 2. As a result, the appropriate webhook will be triggered to deploy the made changes into your hosting environment – refer to the repository Settings > Webhooks section for the details.
Upon clicking on this string, you’ll see the list of Recent Deliveries initiated by the webhook and the result of their execution.
Step 3. As the last checkpoint, return back to your application page and refresh it. That’s it! As you can see, the modifications were successfully applied, so the solution works as intended.
Simply update your code, make commits as usual, and all the changes will be automatically pushed to your AccuWeb.Cloud environment. No need to switch between processes or make manual updates eliminates human errors and accelerates your application’s market time.
Conclusion
In conclusion, installing and using the Git-Push-Deploy add-on is a straightforward process that involves integrating it with your Git repository. By following the provided steps, you can set up automatic delivery of updates to your Java, PHP, Ruby, Node.js, or Python applications.
The add-on streamlines the deployment workflow, ensuring that your code changes trigger redeployment efficiently. Whether you’re deploying to a Java-based environment with Maven build nodes or to other supported languages, Git-Push-Deploy simplifies the process, making it easier to manage and continuously update your applications with minimal effort.