This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#==============================================================================# | |
# # | |
# Title: Update from Git # | |
# Purpose: Automated process for keeping local Dir updated when # | |
# there is a WebHook call against it. This is useful when # | |
# configuring a WebHook call on GitHub or GitLab or similar Repo. # | |
# Author: chrimaho # | |
# Created: 13/Apr/2022 # | |
# # | |
#==============================================================================# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ls | |
echo "test message" >> test.txt | |
ls | |
git add test.txt | |
git commit --message "test webhook" | |
git push |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker compose --file ./docker/docker-compose.yml up --detach --build --force-recreate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: "3.8" | |
name: <update> | |
services: | |
listener: | |
image: chrimaho/update-from-git | |
container_name: listener | |
environment: | |
- GIT_URL=<update> | |
- API_ENDPOINT=<optional update> | |
- REPO_DIR=<update> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Uninstall old versions | |
sudo apt-get remove docker docker-engine docker.io containerd runc | |
# Update the package index | |
sudo apt-get update | |
sudo apt-get install \ | |
ca-certificates \ | |
curl \ | |
gnupg \ | |
lsb-release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<style> | |
table {{border-collapse: collapse;}} | |
th {{border: 1.5px solid lightgray;}} | |
td {{border: 0.5px solid lightgray;}} | |
th, td {{padding: 5px;}} | |
</style> | |
</head> | |
<body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Endpoint: Main Endpoint ---- | |
@app.post \ | |
( path=API_ENDPOINT | |
, summary="API Endpoint for Git to Call" | |
, description= \ | |
"Basically, it will:<br><br>" + | |
f"1. `clone`/`pull` repo from: `{GIT_URL}`<br><br>" + | |
f"2. Save repo to: `{REPO_DIR}`" | |
, tags=["Main Process"] | |
, response_class=JSONResponse |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Endpoint: Health Check ---- | |
@app.get \ | |
( path="/api/health" | |
, summary="Health check" | |
, description="Check to ensure that the app is healthy and ready to run." | |
, tags=["App Info"] | |
, response_class=PlainTextResponse | |
, responses= \ | |
{ 200: {"content": {"text/plain": {"schema": None}}} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Endpoint: Health Check ---- | |
@app.get \ | |
( path="/api/health" | |
, summary="Health check" | |
, description="Check to ensure that the app is healthy and ready to run." | |
, tags=["App Info"] | |
, response_class=PlainTextResponse | |
, responses= \ | |
{ 200: {"content": {"text/plain": {"schema": None}}} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Successful Response: status_code=200 ---- | |
class Success(BaseModel): | |
Success:str="Response Text" | |
# Validation Error: status_code=422 ---- | |
class ValidationError(BaseModel): | |
Message:str="Details about the validation error" | |
# Server Error: status_code=500 ---- | |
class InternalServerError(BaseModel): |
NewerOlder