- Run
kubectl --namespace argocd get secrets argocd-initial-admin-secret --template={{.data.password}} | base64 --decodecommand and copy ArgoCD admin password - Click on icon
Web previewon the top right of Cloud Shell. Click onChange portand put port number31001to access to ArgoCD - Login with user
adminand password from above command - You will see 2 application with dev and prd environments running but it won't run. Try to check for status and error.
- Go to
https://github.com/[GITHUBUSER]?tab=repositoriesto seencd24-gitopsandncd24-fastapirepositories ncd24-fastapirepository is where your application code and CI/CD herencd24-gitopsrepository is GitOps repository for ArgoCD
- Go to
https://github.com/[GITHUBUSER]/ncd24-fastapi/actionsor go to yourncd24-fastapirepository and click onActionstab - You will see workflow
feat: first initialis automatically run when first pushing the code and it should finished now.- Click on workflow to see workflow jobs
setupjob is for prepare and setup environment variablesbuild-pushjob is to build container image and push to GitHub container registry. You can see your container image herehttps://github.com/[GITHUBUSER]/ncd24-fastapi/pkgs/container/ncd24-fastapior go tohttps://github.com/[GITHUBUSER]first and click onPackagestab thenncd24-fastapipackagegit-commitjob is to update and commit newly build container image intohelm-values/ncd24-fastapi-dev.yamlinncd24-gitopsrepository
- Go check
ncd24-gitopsrepository. And go checkhelm-values/ncd24-fastapi-dev.yamlfile to see tag is changing - Go back to ArgoCD again to see the status of the application in dev environment. It should healthy now.
- Put
curl http://localhost:31002in Cloud Shell to see return output from fastapi application - You can try
curl http://localhost:31002/healthandcurl http://localhost:31002/chainto test other fastapi endpoint
- Put
- Go to
https://github.com/[GITHUBUSER]/ncd24-fastapi/actionsor go to yourncd24-fastapirepository and click onActionstab - Click on
2. Production taggingworkflow - Click on
Run workflowbutton on the right and clickRun workflow - GitHub Actions will run tagging workflow that has only
tag-and-releasejobtag-and-releasejob is going to copy and tag container image first. You can see tag inhttps://github.com/[GITHUBUSER]/ncd24-fastapi/pkgs/container/ncd24-fastapior click onPackageson the main repository pagetag-and-releasejob then is going to create release. You can see fromhttps://github.com/[GITHUBUSER]/ncd24-fastapi/releasesor click onReleaseson the main repository page
- Go to
https://github.com/[GITHUBUSER]/ncd24-fastapi/actionsor go to yourncd24-fastapirepository and click onActionstab - Click on
3. Production deploymentworkflow - Click on
Run workflowbutton on the rightAutomatically pick the latest tag version: checked- Click
Run workflow
- GitHub Actions will run the following jobs
setupjob is for prepare and setup environment variablesgit-commitjob is to update and commit newly build container image intohelm-values/ncd24-fastapi-prd.yamlinncd24-gitopsrepository
- Go check
ncd24-gitopsrepository. And go checkhelm-values/ncd24-fastapi-prd.yamlfile to see tag is changing - Go back to ArgoCD again to see the status of the application in dev environment. It should healthy now.
- If it is not healthy, you can try click on
REFRESHthenSYNCbutton to enforce sync.- Put
curl http://localhost:31003in Cloud Shell to see return output from fastapi application - You can try
curl http://localhost:31003/healthandcurl http://localhost:31003/chainto test other fastapi endpoint
- Put
- Edit
~/ncd24-fastapi/main.pyon@app.get("/")path- Change
return {"Hello": "World"}toreturn {"Hello": "World!"}
- Change
- Click on
Source Controlicon on the left of Cloud Shell Editor - You will see many git repositories
- Go to
Source Controland click on+icon next to yourncd24-fastapigit repository. You will see the file will move toChangestoStaged Changes- It will be the same as
git addcommand
- It will be the same as
- Put the commit message in
ncd24-fastapigit repository and click onCommitorctrl+enteron Windows orcommand+enteron MacOS- It will be the same as
git commitcommand
- It will be the same as
- Click on
...icon next toncd24-fastapigit repository and click onPush- It will be the same as
git pushcommand
- It will be the same as
- Go to
https://github.com/[GITHUBUSER]/ncd24-fastapi/actionsor go to yourncd24-fastapirepository and click onActionstab - You will see new workflow from your committed
- Click on workflow to see workflow jobs
- Go check
ncd24-gitopsrepository. And go checkhelm-values/ncd24-fastapi-dev.yamlfile to see tag is changing again - Go back to ArgoCD again to see the status of the application in dev environment. If it is not update, you can try click on
REFRESHthenSYNCbutton to enforce sync.- Put
curl http://localhost:31002in Cloud Shell to see your new return output from fastapi application
- Put
- Try to deploy to production
- Previous: Preparation
- Home
- Next: DevSecOps Workshop