- Kubernetes cluster
- ArgoCD
-
Clone this repo
git clone [email protected]:agate/rails_on_argocd.git
-
Apply V1
kubectl apply -f versions/v1/argocd/argocd-application.yaml
What we can learn from this version?
- How ArgoCD sync wave works.
- You can see the namespace get created first.
- Then the DB deployment and then the DB service.
- The migration job will be triggered after DB ready. And it will be destroyed after it completes.
- At the end all the other manifest files get synced.
- How to wait when database ready before start the application container.
- How to run database init script to create database / tables
After ArgoCD synced. Run
kubectl port-forward -n rails-on-argocd svc/rails-on-argocd-app 3000:3000
and access http://localhost:3000. You should see the default rails welcome page. - How ArgoCD sync wave works.
-
Apply V2
kubectl apply -f versions/v2/argocd/argocd-application.yaml
What we can learn in this version?
- Before the database migrate be executed. The rails server still running in the old version. The new container will be created after the all the migrations are executed.
After ArgoCD synced. Stop the previous port-forward command and restart the port-forward by running
kubectl port-forward -n rails-on-argocd svc/rails-on-argocd-app 3000:3000
and access http://localhost:3000. You should see a json output which contains all two users data (sam / dean)