Skip to content

Commit

Permalink
Merge pull request #16 from xmlking/develop
Browse files Browse the repository at this point in the history
Angular 7
  • Loading branch information
xmlking authored Oct 28, 2018
2 parents 232cfc0 + 22df1d1 commit bf09868
Show file tree
Hide file tree
Showing 314 changed files with 9,561 additions and 6,373 deletions.
42 changes: 42 additions & 0 deletions .deploy/api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,46 @@ oc delete all,configmap,secret -l app=ngx-starter-kit-api -n ngx-starter-kit
Applications > Deployments > ngx-starter-kit > Deploy
```

#### Kubernetes Deployment
> assume you already setup `ngx-starter-kit` context
> make sure `Env`, docker image `Version` are correct in `api.yml`
```bash
## view all preset contexts
kubectl config get-contexts
# switch to `ngx-starter-kit` contexts
kubectl config use-context ngx-starter-kit

## create (first time deployment)
kubectl create -f ./api.yml
kubectl describe deployment api

## checking
# see logs
kubectl logs -f my-pod
# Once you’ve created a Service of type NodePort, you can use this command to find the NodePort
kubectl get service api --watch
# to get <NODE> names
kubectl get pod -o wide

## delete
kubectl delete -f ./api.yml

## redeploy (new image)
update tag in api.yml and delete and create again.
```

#### Kubernetes Commands
```bash
kubectl get deployment -o wide
kubectl get pods -o wide
kubectl get service -o wide

kubectl exec -it my-pod -- /bin/bash
kubectl logs -f my-pod
kubectl logs my-pod --previous
kubectl logs my-pod -c my-container
```


61 changes: 61 additions & 0 deletions .deploy/api/api.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
apiVersion: v1
kind: Service
metadata:
name: api
namespace: ngx-starter-kit
labels:
app: api
spec:
type: NodePort
ports:
- name: api-3000
port: 3000
nodePort: 31442
protocol: TCP
selector:
app: api

---
apiVersion: apps/v1
kind: Deployment
metadata:
name: api
namespace: ngx-starter-kit
labels:
app: api
spec:
replicas: 1
strategy:
type: RollingUpdate
selector:
matchLabels:
app: api
template:
metadata:
name: api
labels:
app: api
spec:
containers:
- name: api
image: xmlking/ngx-starter-kit-api:latest
imagePullPolicy: Always
resources:
limits:
memory: 4G
requests:
memory: 2G
ports:
- containerPort: 3000
protocol: TCP
env:
- name: TYPEORM_HOST
value: postgres
- name: TYPEORM_PORT
value: '5432'
- name: TYPEORM_DATABASE
value: cockpit
- name: TYPEORM_USERNAME
value: cockpit
- name: TYPEORM_PASSWORD
value: cockpit123
2 changes: 1 addition & 1 deletion .deploy/api/prod.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ RUN npm ci

COPY . .

RUN $(npm bin)/tsc -p ./apps/api/tsconfig.json
RUN $(npm bin)/tsc -p ./apps/api/tsconfig.app.json

EXPOSE 3000

Expand Down
2 changes: 1 addition & 1 deletion .deploy/keycloak/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM jboss/keycloak-openshift:4.3.0.Final
FROM jboss/keycloak-openshift:4.5.0.Final
LABEL maintainer="Sumanth <xmlking@gmail.com>"

COPY configuration/* $JBOSS_HOME/standalone/configuration/
Expand Down
58 changes: 53 additions & 5 deletions .deploy/keycloak/realm-manual-import.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{
"realm": "kubernetes",
"realm": "ngx",
"enabled": true,
"users": [
{
"username": "kubeadmin",
"username": "ngxadmin",
"enabled": true,
"firstName" : "kube",
"firstName" : "ngx",
"lastName" : "admin",
"email" : "kubeadmin@kube.com",
"email" : "ngxadmin@kube.com",
"credentials": [
{
"type": "password",
"value": "kubeadmin"
"value": "ngxadmin"
}
],
"realmRoles": [
Expand All @@ -33,6 +33,54 @@
"realmRoles": [
"ROLE_USER"
]
},
{
"username": "sumo1",
"enabled": true,
"firstName" : "sumo1",
"lastName" : "demo",
"email" : "sumo1@demo.com",
"credentials": [
{
"type": "password",
"value": "demo"
}
],
"realmRoles": [
"ROLE_USER"
]
},
{
"username": "sumo2",
"enabled": true,
"firstName" : "sumo2",
"lastName" : "demo",
"email" : "sumo2@demo.com",
"credentials": [
{
"type": "password",
"value": "demo"
}
],
"realmRoles": [
"ROLE_USER"
]
},
{
"username": "sumo3",
"enabled": true,
"firstName" : "sumo3",
"lastName" : "demo",
"email" : "sumo3@demo.com",
"credentials": [
{
"type": "password",
"value": "demo"
}
],
"realmRoles": [
"ROLE_USER"
]
}
],
"roles": {
Expand Down
115 changes: 0 additions & 115 deletions .deploy/mongodb/README.md

This file was deleted.

Loading

0 comments on commit bf09868

Please sign in to comment.