feat: enhance deployment and installation process in build-and-push workflow
This commit is contained in:
@@ -39,6 +39,6 @@ jobs:
|
||||
KUBEB64: '${{ secrets.KUBEB64 }}'
|
||||
name: deploy
|
||||
run: mkdir -p $HOME/.kube &&echo "$KUBEB64" | base64 -d > $HOME/.kube/config &&
|
||||
/usr/local/bin/helm upgrade --install papi-prod papi-helm/ -f ./papi-helm/v.prod.yaml --set image.tag=${{ steps.extract_branch.outputs.branch }} --set name=papi-prod # Deploy the Helm chart
|
||||
/usr/local/bin/helm upgrade --install papi-${{ steps.extract_branch.outputs.branch }} papi-helm/ -f ./papi-helm/v.prod.yaml --set image.tag=${{ steps.extract_branch.outputs.branch }} --set name=papi-prod # Deploy the Helm chart
|
||||
|
||||
|
||||
|
||||
3
.vscode/settings.json
vendored
Normal file
3
.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"llama-vscode.endpoint": "http://192.168.1.142:11434"
|
||||
}
|
||||
6
Makefile
6
Makefile
@@ -17,8 +17,8 @@ clean:
|
||||
rm -rf test.db
|
||||
rm -rf htmlcov
|
||||
|
||||
install:
|
||||
pip3 install -r requirements.txt
|
||||
install.log: requirements.txt
|
||||
pip3 install -r requirements.txt > install.log
|
||||
report.xml: *.py
|
||||
pytest --cov=papi --cov=posts --cov=users test_papi.py test_posts.py test_users.py --junitxml=report.xml --cov-report=html --cov-report=xml --cov-report=term --cov-fail-under 90
|
||||
|
||||
@@ -53,7 +53,7 @@ k8s-tok:
|
||||
kubectl --context microk8s create token serviceaccounts-cluster-admin
|
||||
echo login at https://kube.fairfaxmedia.net
|
||||
|
||||
run: install
|
||||
run: install.log
|
||||
uvicorn papi:app --reload --port 8912 --host 0.0.0.0
|
||||
|
||||
|
||||
|
||||
3
db.py
3
db.py
@@ -12,7 +12,8 @@ engine = create_engine(DATABASE_URL)
|
||||
SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
|
||||
Base = declarative_base()
|
||||
version = os.environ.get("VERSION", "0.0.0")
|
||||
|
||||
def create_db():
|
||||
Base.metadata.create_all(bind=engine)
|
||||
|
||||
|
||||
def get_db():
|
||||
|
||||
18
install.log
Normal file
18
install.log
Normal file
@@ -0,0 +1,18 @@
|
||||
Requirement already satisfied: fastapi in /home/steve/py312/lib/python3.12/site-packages (from -r requirements.txt (line 1)) (0.115.8)
|
||||
Requirement already satisfied: sqlalchemy in /home/steve/py312/lib/python3.12/site-packages (from -r requirements.txt (line 2)) (2.0.29)
|
||||
Requirement already satisfied: uvicorn in /home/steve/py312/lib/python3.12/site-packages (from -r requirements.txt (line 3)) (0.30.6)
|
||||
Requirement already satisfied: pyresttest in /home/steve/py312/lib/python3.12/site-packages (from -r requirements.txt (line 4)) (1.7.1)
|
||||
Requirement already satisfied: starlette<0.46.0,>=0.40.0 in /home/steve/py312/lib/python3.12/site-packages (from fastapi->-r requirements.txt (line 1)) (0.45.3)
|
||||
Requirement already satisfied: pydantic!=1.8,!=1.8.1,!=2.0.0,!=2.0.1,!=2.1.0,<3.0.0,>=1.7.4 in /home/steve/py312/lib/python3.12/site-packages (from fastapi->-r requirements.txt (line 1)) (2.10.6)
|
||||
Requirement already satisfied: typing-extensions>=4.8.0 in /home/steve/py312/lib/python3.12/site-packages (from fastapi->-r requirements.txt (line 1)) (4.12.2)
|
||||
Requirement already satisfied: greenlet!=0.4.17 in /home/steve/py312/lib/python3.12/site-packages (from sqlalchemy->-r requirements.txt (line 2)) (3.0.3)
|
||||
Requirement already satisfied: click>=7.0 in /home/steve/py312/lib/python3.12/site-packages (from uvicorn->-r requirements.txt (line 3)) (8.1.7)
|
||||
Requirement already satisfied: h11>=0.8 in /home/steve/py312/lib/python3.12/site-packages (from uvicorn->-r requirements.txt (line 3)) (0.14.0)
|
||||
Requirement already satisfied: pyyaml in /home/steve/py312/lib/python3.12/site-packages (from pyresttest->-r requirements.txt (line 4)) (6.0.1)
|
||||
Requirement already satisfied: pycurl in /home/steve/py312/lib/python3.12/site-packages (from pyresttest->-r requirements.txt (line 4)) (7.45.3)
|
||||
Requirement already satisfied: future in /home/steve/py312/lib/python3.12/site-packages (from pyresttest->-r requirements.txt (line 4)) (1.0.0)
|
||||
Requirement already satisfied: annotated-types>=0.6.0 in /home/steve/py312/lib/python3.12/site-packages (from pydantic!=1.8,!=1.8.1,!=2.0.0,!=2.0.1,!=2.1.0,<3.0.0,>=1.7.4->fastapi->-r requirements.txt (line 1)) (0.7.0)
|
||||
Requirement already satisfied: pydantic-core==2.27.2 in /home/steve/py312/lib/python3.12/site-packages (from pydantic!=1.8,!=1.8.1,!=2.0.0,!=2.0.1,!=2.1.0,<3.0.0,>=1.7.4->fastapi->-r requirements.txt (line 1)) (2.27.2)
|
||||
Requirement already satisfied: anyio<5,>=3.6.2 in /home/steve/py312/lib/python3.12/site-packages (from starlette<0.46.0,>=0.40.0->fastapi->-r requirements.txt (line 1)) (4.6.2.post1)
|
||||
Requirement already satisfied: idna>=2.8 in /home/steve/py312/lib/python3.12/site-packages (from anyio<5,>=3.6.2->starlette<0.46.0,>=0.40.0->fastapi->-r requirements.txt (line 1)) (3.6)
|
||||
Requirement already satisfied: sniffio>=1.1 in /home/steve/py312/lib/python3.12/site-packages (from anyio<5,>=3.6.2->starlette<0.46.0,>=0.40.0->fastapi->-r requirements.txt (line 1)) (1.3.1)
|
||||
2
posts.py
2
posts.py
@@ -9,7 +9,7 @@ class Post(db.Base):
|
||||
id = Column(Integer, primary_key=True, index=True)
|
||||
title = Column(String)
|
||||
content = Column(String)
|
||||
author_id = Column(Integer, ForeignKey("users.id"))
|
||||
author_id = Column(Integer, ForeignKey("users.id"),index=True)
|
||||
|
||||
|
||||
router = APIRouter(prefix="/posts")
|
||||
|
||||
Reference in New Issue
Block a user