Follow the next sections for details of the setup process. This section details the operator guide.
Checkout source
git clone git@bitbucket.org:thuydang/vfossorg_pj.git
Build db, app, or both:
make build-db make build-app # both make build
Deploy with k8s
kubectl apply -f ./kubernetes/postgres kubectl apply -f ./kubernetes/django
Django version 2.1.15
Django-cms version 3.6.0
Migrations can also be executed from the shell of a running container using the kubectl exec command. In order to run the migrations, we need to get the name of the running pod of interest by:
kubectl get pods
Once the pod name has been found, the migrations can be run by:
kubectl exec <pod_name> -- python /app/manage.py migrate
Execute pods:
kubectl exec -it -n vfoss vfoss-org-app-7bbd4ff7db-bpxx8 -- /bin/bash ./manage.py createsuperuser user: admin password: a1d3m7
This removes error with large search icon, etc.
./manage.py collectstatic
If you weren’t updating the Replication Controller definition and wanted to just change the image, the safest way is a rolling-update, which will spin up 1 new container at a time and only keep going if the new containers successfully start.
kubectl rolling-update frontend \
--image=gcr.io/${GCLOUD_PROJECT}/guestbook
If, like me, you like to live dangerously, and don’t mind a little downtime you can instead edit the frontend.yaml file to point to your new image, scale the replication controller down to 0 (killing all your pods) and then scale it back up.
kubectl scale replicaset -n vfoss vfoss-org-app-7bbd4ff7db --replicas=0# kill your pods kubectl scale replicaset -n vfoss vfoss-org-app-7bbd4ff7db --replicas=1 # new image