Add Prod Build
This commit is contained in:
parent
572828cf73
commit
dc2df93572
@ -4,6 +4,7 @@ import (
|
||||
"fmt"
|
||||
"furtuna-be/internal/constants/role"
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
|
||||
@ -48,7 +49,8 @@ func (h *AuthHandler) AuthLogin(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
authUser, err := h.service.AuthenticateUser(c, bodyParam.Email, bodyParam.Password)
|
||||
email := strings.ToLower(bodyParam.Email)
|
||||
authUser, err := h.service.AuthenticateUser(c, email, bodyParam.Password)
|
||||
if err != nil {
|
||||
response.ErrorWrapper(c, err)
|
||||
return
|
||||
|
||||
@ -3,6 +3,7 @@ package customerauth
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
|
||||
@ -49,8 +50,8 @@ func (h *AuthHandler) AuthLogin(c *gin.Context) {
|
||||
response.ErrorWrapper(c, errors.ErrorBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
authUser, err := h.service.AuthenticateUser(c, bodyParam.Email, bodyParam.Password)
|
||||
email := strings.ToLower(bodyParam.Email)
|
||||
authUser, err := h.service.AuthenticateUser(c, email, bodyParam.Password)
|
||||
if err != nil {
|
||||
response.ErrorWrapper(c, err)
|
||||
return
|
||||
|
||||
@ -5,6 +5,7 @@ import (
|
||||
"furtuna-be/internal/constants/role"
|
||||
"furtuna-be/internal/entity"
|
||||
"github.com/go-playground/validator/v10"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type User struct {
|
||||
@ -35,7 +36,7 @@ func (u *User) ToEntity(ctx mycontext.Context, userType string) *entity.User {
|
||||
|
||||
return &entity.User{
|
||||
Name: u.Name,
|
||||
Email: u.Email,
|
||||
Email: strings.ToLower(u.Email),
|
||||
Password: u.Password,
|
||||
RoleID: role.Role(u.RoleID),
|
||||
PartnerID: u.PartnerID,
|
||||
@ -131,7 +132,7 @@ func (e *UserRegister) Validate() error {
|
||||
func (u *UserRegister) ToEntity() *entity.User {
|
||||
return &entity.User{
|
||||
Name: u.Name,
|
||||
Email: u.Email,
|
||||
Email: strings.ToLower(u.Email),
|
||||
PhoneNumber: u.PhoneNumber,
|
||||
Password: u.Password,
|
||||
RoleID: role.Customer,
|
||||
|
||||
40
k8s/production/deployment.yaml
Normal file
40
k8s/production/deployment.yaml
Normal file
@ -0,0 +1,40 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: furtuna-backend
|
||||
namespace: altru-production
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: furtuna-backend
|
||||
replicas: 1
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: furtuna-backend
|
||||
spec:
|
||||
serviceAccountName: custom-serviceaccount
|
||||
containers:
|
||||
- name: furtuna-backend
|
||||
image: registry.gitlab.com/altru.id/furtuna/furtuna-backend:<VERSION>
|
||||
ports:
|
||||
- containerPort: 3300
|
||||
volumeMounts:
|
||||
- mountPath: "/infra"
|
||||
name: furtuna-backend-secret
|
||||
readOnly: true
|
||||
- mountPath: "/templates"
|
||||
name: templates-configmap
|
||||
env:
|
||||
- name: ENV_MODE
|
||||
value: "production"
|
||||
volumes:
|
||||
- name: furtuna-backend-secret
|
||||
secret:
|
||||
secretName: furtuna-backend-secret
|
||||
- name: templates-configmap
|
||||
configMap:
|
||||
name: templates-configmap
|
||||
imagePullSecrets:
|
||||
- name: regcred
|
||||
|
||||
30
k8s/production/ingress-cors.yaml
Normal file
30
k8s/production/ingress-cors.yaml
Normal file
@ -0,0 +1,30 @@
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: furtuna-backend
|
||||
namespace: altru-production
|
||||
annotations:
|
||||
kubernetes.io/ingress.class: "nginx"
|
||||
cert-manager.io/cluster-issuer: "letsencrypt-prod"
|
||||
nginx.ingress.kubernetes.io/ingress-class: "nginx"
|
||||
nginx.ingress.kubernetes.io/enable-cors: "true"
|
||||
nginx.ingress.kubernetes.io/cors-allow-origin: "*"
|
||||
nginx.ingress.kubernetes.io/cors-allow-methods: "GET, POST, PUT, DELETE, OPTIONS"
|
||||
nginx.ingress.kubernetes.io/cors-allow-headers: "Content-Type, Authorization, x-access-token"
|
||||
nginx.ingress.kubernetes.io/cors-allow-credentials: "true"
|
||||
spec:
|
||||
rules:
|
||||
- host: "api.furtuna.id"
|
||||
http:
|
||||
paths:
|
||||
- pathType: Prefix
|
||||
path: /
|
||||
backend:
|
||||
service:
|
||||
name: furtuna-backend
|
||||
port:
|
||||
number: 3300
|
||||
tls:
|
||||
- hosts:
|
||||
- "api.furtuna.id"
|
||||
secretName: api-furtuna-biz-id-tls
|
||||
25
k8s/production/ingress.yaml
Normal file
25
k8s/production/ingress.yaml
Normal file
@ -0,0 +1,25 @@
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: furtuna-backend
|
||||
namespace: altru-production
|
||||
annotations:
|
||||
kubernetes.io/ingress.class: "nginx" # Add this line
|
||||
cert-manager.io/cluster-issuer: "letsencrypt-prod"
|
||||
nginx.ingress.kubernetes.io/ingress-class: "nginx" # Add this line
|
||||
spec:
|
||||
rules:
|
||||
- host: "api.furtuna.id"
|
||||
http:
|
||||
paths:
|
||||
- pathType: Prefix
|
||||
path: /
|
||||
backend:
|
||||
service:
|
||||
name: furtuna-backend
|
||||
port:
|
||||
number: 3300
|
||||
tls:
|
||||
- hosts:
|
||||
- "api.furtuna.id"
|
||||
secretName: api-furtuna-biz-id-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: altru-production
|
||||
15
k8s/production/service.yaml
Normal file
15
k8s/production/service.yaml
Normal file
@ -0,0 +1,15 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: furtuna-backend
|
||||
namespace: altru-production
|
||||
labels:
|
||||
run: furtuna-backend
|
||||
spec:
|
||||
ports:
|
||||
- port: 3300
|
||||
protocol: TCP
|
||||
targetPort: 3300
|
||||
selector:
|
||||
app: furtuna-backend
|
||||
type: ClusterIP
|
||||
Loading…
x
Reference in New Issue
Block a user