Merge branch 'development' into 'devops-staging'
Development See merge request empatnusabangsa/ppob/ppob-backend!91
This commit is contained in:
commit
d9f964de90
|
@ -48,7 +48,7 @@ build-production:
|
|||
services:
|
||||
- docker:dind
|
||||
script:
|
||||
- docker login $REGISTRY_URL -u $NWP_REGISTRY_USER -p $NWP_REGISTRY_PASS
|
||||
- docker login $REGISTRY_URL -u $BKA_REGISTRY_USER -p $BKA_REGISTRY_PASS
|
||||
- docker build -t $REGISTRY_IMAGE:$VERSION_PRODUCTION .
|
||||
- docker push $REGISTRY_IMAGE:$VERSION_PRODUCTION
|
||||
- docker rmi $REGISTRY_IMAGE:$VERSION_PRODUCTION
|
||||
|
@ -59,9 +59,9 @@ deploy-production:
|
|||
only:
|
||||
- devops-production
|
||||
script:
|
||||
- kubectl config set-cluster k8s --server="${NWP_CLUSTER_HOST}"
|
||||
- kubectl config set clusters.k8s.certificate-authority-data ${NWP_CLUSTER_CA}
|
||||
- kubectl config set-credentials gitlab --token="${NWP_CLUSTER_TOKEN}"
|
||||
- kubectl config set-cluster k8s --server="${BKA_CLUSTER_HOST}"
|
||||
- kubectl config set clusters.k8s.certificate-authority-data ${BKA_CLUSTER_CA}
|
||||
- kubectl config set-credentials gitlab --token="${BKA_CLUSTER_TOKEN}"
|
||||
- kubectl config set-context default --cluster=k8s --user=gitlab
|
||||
- kubectl config use-context default
|
||||
- sed -i "s/<VERSION>/${VERSION_PRODUCTION}/g" k8s/production/deployment.yaml
|
||||
|
|
33
k8s/production/deployment.yaml
Normal file
33
k8s/production/deployment.yaml
Normal file
|
@ -0,0 +1,33 @@
|
|||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: ppob-backend
|
||||
namespace: empatnusabangsa-production
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: ppob-backend
|
||||
replicas: 1
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: ppob-backend
|
||||
spec:
|
||||
containers:
|
||||
- name: ppob-backend
|
||||
image: registry-harbor.app.bangun-kreatif.com/empatnusabangsa/ppob-backend:<VERSION>
|
||||
ports:
|
||||
- containerPort: 5000
|
||||
envFrom:
|
||||
- secretRef:
|
||||
name: ppob-backend-env
|
||||
volumeMounts:
|
||||
- name: storage
|
||||
mountPath: /home/node/files
|
||||
volumes:
|
||||
- name: storage
|
||||
persistentVolumeClaim:
|
||||
claimName: ppob-backend-pvc
|
||||
imagePullSecrets:
|
||||
- name: regcred
|
||||
|
24
k8s/production/ingress.yaml
Normal file
24
k8s/production/ingress.yaml
Normal file
|
@ -0,0 +1,24 @@
|
|||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: ppob-backend
|
||||
namespace: empatnusabangsa-production
|
||||
annotations:
|
||||
kubernetes.io/ingress.class: "traefik"
|
||||
cert-manager.io/cluster-issuer: letsencrypt-prod
|
||||
spec:
|
||||
rules:
|
||||
- host: "ppob-backend.k3s.bangun-kreatif.com"
|
||||
http:
|
||||
paths:
|
||||
- pathType: Prefix
|
||||
path: /
|
||||
backend:
|
||||
service:
|
||||
name: ppob-backend
|
||||
port:
|
||||
number: 5000
|
||||
tls:
|
||||
- hosts:
|
||||
- "ppob-backend.k3s.bangun-kreatif.com"
|
||||
secretName: ppob-backend-k3s-bangun-kreatif-com-tls
|
4
k8s/production/namespace.yaml
Normal file
4
k8s/production/namespace.yaml
Normal file
|
@ -0,0 +1,4 @@
|
|||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: empatnusabangsa-production
|
13
k8s/production/pvc.yaml
Normal file
13
k8s/production/pvc.yaml
Normal file
|
@ -0,0 +1,13 @@
|
|||
kind: PersistentVolumeClaim
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: ppob-backend-pvc
|
||||
namespace : empatnusabangsa-production
|
||||
annotations:
|
||||
volume.beta.kubernetes.io/storage-class: "managed-nfs-storage"
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteMany
|
||||
resources:
|
||||
requests:
|
||||
storage: 5Gi
|
16
k8s/production/secret.example copy.yaml
Normal file
16
k8s/production/secret.example copy.yaml
Normal file
|
@ -0,0 +1,16 @@
|
|||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: ppob-backend-env
|
||||
namespace: empatnusabangsa-production
|
||||
type: Opaque
|
||||
stringData:
|
||||
PORT:
|
||||
SECRET:
|
||||
|
||||
DATABASE_HOST:
|
||||
DATABASE_NAME:
|
||||
DATABASE_USERNAME:
|
||||
DATABASE_PASSWORD:
|
||||
DATABASE_PORT:
|
||||
DATABASE_CLIENT:
|
13
k8s/production/service.yaml
Normal file
13
k8s/production/service.yaml
Normal file
|
@ -0,0 +1,13 @@
|
|||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: ppob-backend
|
||||
namespace: empatnusabangsa-production
|
||||
labels:
|
||||
run: ppob-backend
|
||||
spec:
|
||||
ports:
|
||||
- port: 5000
|
||||
protocol: TCP
|
||||
selector:
|
||||
app: ppob-backend
|
|
@ -10,4 +10,4 @@ spec:
|
|||
- ReadWriteMany
|
||||
resources:
|
||||
requests:
|
||||
storage: 10Gi
|
||||
storage: 512m
|
||||
|
|
|
@ -84,28 +84,22 @@ export class ProductService {
|
|||
where: {
|
||||
product: productData.id,
|
||||
partner: partnerData.id,
|
||||
endDate: IsNull(),
|
||||
},
|
||||
});
|
||||
|
||||
} else {
|
||||
dataHistoryPrice = await this.productHistoryPrice.findOne({
|
||||
product: productData,
|
||||
partner: IsNull(),
|
||||
endDate: IsNull(),
|
||||
});
|
||||
}
|
||||
|
||||
if (!dataHistoryPrice) {
|
||||
await this.productHistoryPrice.insert({
|
||||
product: productData,
|
||||
mark_up_price: it[4],
|
||||
price: it[3],
|
||||
type: productType.NORMAL,
|
||||
startDate: new Date(),
|
||||
partner: it[6] != '-' ? partnerData : null,
|
||||
if (dataHistoryPrice) {
|
||||
await this.productHistoryPrice.update(dataHistoryPrice.id, {
|
||||
endDate: new Date(),
|
||||
});
|
||||
} else {
|
||||
dataHistoryPrice.endDate = new Date();
|
||||
await this.productHistoryPrice.save(dataHistoryPrice);
|
||||
}
|
||||
|
||||
await this.productHistoryPrice.insert({
|
||||
product: productData,
|
||||
|
@ -115,7 +109,6 @@ export class ProductService {
|
|||
startDate: new Date(),
|
||||
partner: it[6] != '-' ? partnerData : null,
|
||||
});
|
||||
}
|
||||
} else {
|
||||
let partnerData;
|
||||
if (it[6] != '-' && it[6] != '') {
|
||||
|
|
|
@ -762,7 +762,7 @@ export class TransactionService {
|
|||
`${coaType[coaType.EXPENSE]}-SYSTEM`,
|
||||
);
|
||||
|
||||
if (userData.partner) {
|
||||
if (!userData.partner) {
|
||||
//GET SALES
|
||||
supervisorData = await this.calculateCommission(
|
||||
supervisorData,
|
||||
|
@ -1062,7 +1062,7 @@ export class TransactionService {
|
|||
'status',
|
||||
'userData.name',
|
||||
])
|
||||
.orderBy('transaction.created_at','DESC');
|
||||
.orderBy('transaction.created_at', 'DESC');
|
||||
|
||||
if (startDate && endDate) {
|
||||
baseQuery.andWhere(
|
||||
|
|
Loading…
Reference in New Issue
Block a user