Kubernetes Sample Project For Node.js + Vue.js+ Mysql Boilerplate

Kubernetes sample project for Node.js (REST API) + Vue.js (Frontend/Backend) + MySQL Boilerplate

This project demonstrates simple IaC (Infrastructure as Code) for NVM boilerplate to Minikube.

This is a Kubernetes sample project, not for a production use.

Prerequisites

How to test in your Minikube

  1. Start minikube

    $ minikube start
    $ minikube addons enable ingress
    $ minikube addons enable metrics-server
    
  2. Go to terraform folder

  3. Run Terraform commands

    $ terraform init
    $ terraform plan
    $ terraform apply
    

    or simply run bash script

    $ ./script/deploy.sh
    
  4. Update hosts file

    $ ./script/update-hosts.sh
    

With this project, you can find

  • Sample Terraform
  • Sample Helm charts to deploy multiple containerised micro-services

Micro-services Repository: Node.js + Vue.js + MySQL Boilerplate

Presslabs MySQL Operator

To see orchestrator, run following port forward.

$ kubectl -nnvm-db port-forward service/presslabs-mysql-operator 8080:80

image

And open http://localhost:8080

To see operator logs, run following command

$ kubectl -nnvm-db logs presslabs-mysql-operator-0 -c operator -f

To access mysql, run following command

$ kubectl -nnvm-db port-forward mysql-cluster-mysql-0 3307:3306
$ mysql -h127.0.0.1 -uroot -proot -P3307 boilerplate

Horizontal Pod Autoscaler

$ kubectl get hpa --all-namespaces

If you see <unknown>/50%, make sure you enabled metrics-server.

$ minikube addons enable metrics-server

Prometheus & Grafana

You can access Grafana via http://nvm-boilerplate.local/grafana.

Once the deployment is completed, then you will see the result like below:

Apply complete! Resources: 0 added, 1 changed, 0 destroyed.

Outputs:

grafana_admin_password = ynSVNykpU72RM5x6

For example, as above, if admin password ynSVNykpU72RM5x6 then you can login Grafana with admin/ynSVNykpU72RM5x6.

image

Todo

  • [x] Update MySQL with a replicated stateful application - Use presslabs/mysql-operator
  • [x] Add HorizontalPodAutoscaler
  • [x] Add Prometheus and Grafana
  • [x] Expose MySQL write node for migration to avoid api migration failure

Download Details:

Author: chrisleekr

Source Code: https://github.com/chrisleekr/k8s-nodejs-vuejs-mysql-boilerplate

#vue #vuejs #javascript

Kubernetes Sample Project For Node.js + Vue.js+ Mysql Boilerplate
15.15 GEEK