An open API service indexing awesome lists of open source software.

https://github.com/webmakaka/mern-stack-the-complete-guide

[Next.js, Semantic-UI][Reed Barger] MERN Stack - The Complete Guide [ENG, 2020]
https://github.com/webmakaka/mern-stack-the-complete-guide

kubernetes minikube mongodb nextjs nodejs reactjs semantic-ui skaffold

Last synced: about 2 months ago
JSON representation

[Next.js, Semantic-UI][Reed Barger] MERN Stack - The Complete Guide [ENG, 2020]

Awesome Lists containing this project

README

          

# [Reed Barger] MERN Stack - The Complete Guide [ENG, 2020]



## How to run the final app

I am working in ubuntu linux 18.04.

Minikube, Kubectl, Docker, Skaffold should be installed.


### Skaffold installation

$ curl -Lo skaffold https://storage.googleapis.com/skaffold/releases/latest/skaffold-linux-amd64

$ chmod +x skaffold
$ sudo mv skaffold /usr/local/bin


### Run app in minikube

```
$ {
minikube --profile my-profile config set memory 8192
minikube --profile my-profile config set cpus 4

// minikube --profile my-profile config set vm-driver virtualbox
minikube --profile my-profile config set vm-driver docker

minikube --profile my-profile config set kubernetes-version v1.18.2
minikube start --profile my-profile
}
```


// Enable ingress
$ minikube addons --profile my-profile enable ingress


$ minikube --profile my-profile ip
172.17.0.2


$ sudo vi /etc/hosts

```
#---------------------------------------------------------------------
# Minikube
#---------------------------------------------------------------------
172.17.0.2 mern-stack-app.dev
```


$ kubectl create secret generic jwt-secret --from-literal=JWT_KEY=asdf

// from stripe.com
$ kubectl create secret generic stripe-secret --from-literal=STRIPE_KEY=


$ cd skaffold

$ docker login

Need update webmakaka/mern-stack-the-complite-guide on your data in the scripts

$ skaffold dev


$ kubectl get pods
NAME READY STATUS RESTARTS AGE
mern-stack-app-deployment-7b74fccb78-sbvx9 1/1 Running 0 24m
mongo-db-deployment-c6bdbcf4-j9knq 1/1 Running 0 24m


$ kubectl exec -it mongo-db-deployment-c6bdbcf4-j9knq bash


# cd ~
# apt update -y && apt install -y git
# git clone https://github.com/webmakaka/MERN-Stack-The-Complete-Guide


$ mongoimport --db mongo-db --collection products --type json --file ./MERN-Stack-The-Complete-Guide/app/static/products.json --jsonArray


$ mongo

> use mongo-db
> db.products.find().pretty()


chrome browser --> https://mern-stack-app.dev/


type: **thisisunsafe** in window with security warning.


Expected result:

![Application](/img/pic-final-01.png?raw=true)


**should return data:**

https://mern-stack-app.dev/api/products


**From containers should works**:

$ curl \
--header "Host: mern-stack-app.dev" \
--request GET http://172-17-0-2.kubernetes.default.svc.cluster.local/api/products


### Delete minikube with project

$ minikube --profile my-profile stop && minikube --profile my-profile delete




## [Development step by step](./Development.md)


---


**Marley**

Any questions on eng: https://jsdev.org/chat/
Любые вопросы на русском: https://jsdev.ru/chat/