Skip to content

Commit

Permalink
rename lc
Browse files Browse the repository at this point in the history
  • Loading branch information
LimpidCrypto committed Mar 7, 2024
1 parent 9756fa1 commit 195e4e6
Show file tree
Hide file tree
Showing 18 changed files with 115 additions and 79 deletions.
8 changes: 7 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,15 @@
3011,
3012
],
"postStartCommand": "cargo install loco-cli && brew install k9s && chmod a+x /workspaces/${localWorkspaceFolderBasename}/bin/*",
"postStartCommand": "cargo install loco-cli && brew install k9s && minikube addons enable ingress && chmod a+x /workspaces/${localWorkspaceFolderBasename}/bin/*",
"customizations": {
"vscode": {
"settings": {
"editor.formatOnSave": true,
"[yaml]": {
"editor.formatOnSave": false
}
},
"extensions": [
// general
"usernamehw.errorlens",
Expand Down
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ WORKDIR /usr/app

COPY --from=builder /usr/src/frontend/dist/frontend/browser /usr/app/frontend/dist/frontend/browser
COPY --from=builder /usr/src/frontend/dist/frontend/browser/index.html /usr/app/frontend/dist/frontend/browser/index.html
COPY --from=builder /usr/src/assets /usr/app/assets
COPY --from=builder /usr/src/config /usr/app/config
COPY --from=builder /usr/src/target/release/${APP_NAME}-cli /usr/app/${APP_NAME}-cli
COPY --from=builder /usr/src/target/release/lc_saas-cli /usr/app/lc_saas-cli

ENTRYPOINT ["/usr/app/${APP_NAME}-cli", "start", "-e", "production"]
ENTRYPOINT ["/usr/app/lc_saas-cli", "start", "-e", "production"]
27 changes: 14 additions & 13 deletions bin/apply_all.sh
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
#!/bin/bash

# apply namespaces
kubectl apply -f ../k8s/namespace.yaml
kubectl apply -f $(pwd)/k8s/namespace.yaml

# apply secrets
kubectl apply -f ../k8s/db/secret.yaml
kubectl apply -f ../k8s/mailer/secret.yaml
# kubectl apply -f $(pwd)/k8s/app/pullSecret.yaml
kubectl apply -f $(pwd)/k8s/db/secret.yaml
kubectl apply -f $(pwd)/k8s/mailer/secret.yaml

# apply configmaps

# apply pv
kubectl apply -f ../k8s/db/pv.yaml
kubectl apply -f $(pwd)/k8s/db/pv.yaml

# apply pvc
kubectl apply -f ../k8s/db/pvc.yaml
kubectl apply -f $(pwd)/k8s/db/pvc.yaml

# apply deployments
kubectl apply -f ../k8s/app/deployment.yaml
kubectl apply -f ../k8s/db/deployment.yaml
kubectl apply -f ../k8s/mailer/deployment.yaml
kubectl apply -f ../k8s/redis/deployment.yaml
kubectl apply -f $(pwd)/k8s/app/deployment.yaml
kubectl apply -f $(pwd)/k8s/db/deployment.yaml
kubectl apply -f $(pwd)/k8s/mailer/deployment.yaml
kubectl apply -f $(pwd)/k8s/redis/deployment.yaml

# apply services
kubectl apply -f ../k8s/app/service.yaml
kubectl apply -f ../k8s/db/service.yaml
kubectl apply -f ../k8s/mailer/service.yaml
kubectl apply -f ../k8s/redis/service.yaml
kubectl apply -f $(pwd)/k8s/app/service.yaml
kubectl apply -f $(pwd)/k8s/db/service.yaml
kubectl apply -f $(pwd)/k8s/mailer/service.yaml
kubectl apply -f $(pwd)/k8s/redis/service.yaml
Empty file added docker-secret.yaml
Empty file.
28 changes: 16 additions & 12 deletions k8s/app/deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: lc-app-deployment
name: lc-saas-app-deployment
labels:
app: lc-app
app: lc-saas-app
namespace: lc-saas-ns
spec:
replicas: 2
selector:
matchLabels:
app: lc-app
app: lc-saas-app
template:
metadata:
labels:
app: lc-app
app: lc-saas-app
spec:
# imagePullSecrets:
# - name: lc-saas-app-pull-secret
containers:
- name: lc-app
image: limpidcrypto/lc:latest
- name: lc-saas-app
image: limidcrypto/lc-saas:latest
ports:
- containerPort: 80
resources:
Expand All @@ -28,23 +30,25 @@ spec:
- name: POSTGRES_DB
valueFrom:
secretKeyRef:
name: lc-db-secret
name: lc-saas-db-secret
key: postgres-db
- name: POSTGRES_USER
valueFrom:
secretKeyRef:
name: lc-db-secret
name: lc-saas-db-secret
key: postgres-user
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: lc-db-secret
name: lc-saas-db-secret
key: postgres-password
- name: DATABASE_URL
value: postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@lc-db-service:5432/${POSTGRES_DB}
value: postgres://limpid:limpid@lc-saas-db-service:5432/limpid
- name: REDIS_URL
value: redis://lc-redis-service:6379
value: redis://lc-saas-redis-service:6379
- name: MAILER_HOST
value: lc-mailer-service
value: lc-saas-mailer-service
- name: SERVER_PORT
value: "80"
# - name: USER_DATABASE_URL
# value: ""
8 changes: 8 additions & 0 deletions k8s/app/pullSecret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: v1
kind: Secret
metadata:
name: lc-saas-app-pull-secret
data:
# kubectl create secret docker-registry --dry-run regsecret --docker-username=<USER> --docker-password=<PW> --docker-email=<Mail> --namespace=lc-saas-ns -o yaml
.dockerconfigjson: |
type: kubernetes.io/dockerconfigjson
6 changes: 4 additions & 2 deletions k8s/app/service.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
apiVersion: v1
kind: Service
metadata:
name: lc-app-service
name: lc-saas-app-service
namespace: lc-saas-ns
spec:
selector:
app: lc-app
app: lc-saas-app
type: ExternalName
externalName: lc-saas-app-service.namespacename.svc.cluster.local
ports:
- port: 80
targetPort: 80
24 changes: 12 additions & 12 deletions k8s/db/deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,49 +1,49 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: lc-db-deployment
name: lc-saas-db-deployment
labels:
app: lc-db
app: lc-saas-db
namespace: lc-saas-ns
spec:
replicas: 1
replicas: 2
selector:
matchLabels:
app: lc-db
app: lc-saas-db
template:
metadata:
labels:
app: lc-db
app: lc-saas-db
spec:
containers:
- name: lc-db
- name: lc-saas-db
image: postgres:15.3-alpine
ports:
- containerPort: 5432
volumeMounts:
- mountPath: /var/lib/postgresql/data
name: lc-db-pv
name: postgres-data
env:
- name: POSTGRES_DB
valueFrom:
secretKeyRef:
name: lc-db-secret
name: lc-saas-db-secret
key: postgres-db
- name: POSTGRES_USER
valueFrom:
secretKeyRef:
name: lc-db-secret
name: lc-saas-db-secret
key: postgres-user
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: lc-db-secret
name: lc-saas-db-secret
key: postgres-password
resources:
limits:
memory: "128Mi"
cpu: "500m"
volumes:
- name: lc-db-pv
- name: postgres-data
persistentVolumeClaim:
claimName: lc-db-pvc
claimName: lc-saas-db-pvc
15 changes: 6 additions & 9 deletions k8s/db/pv.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
apiVersion: v1
kind: PersistentVolume
metadata:
name: lc-db-pv
name: lc-saas-db-pv
labels:
app: postgres
spec:
capacity:
storage: 5Gi
volumeMode: Filesystem
accessModes:
- ReadWriteOnce
persistentVolumeReclaimPolicy: Retain
storageClassName: lc-db-sc
mountOptions:
- hard
- nfsvers=4.1
nfs:
path: /tmp
server: 172.17.0.2
storageClassName: lc-saas-db-sc
hostPath:
path: /data/postgres
5 changes: 2 additions & 3 deletions k8s/db/pvc.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: lc-db-pvc
name: lc-saas-db-pvc
namespace: lc-saas-ns
spec:
storageClassName: lc-saas-db-sc
resources:
requests:
storage: 5Gi
volumeMode: Filesystem
accessModes:
- ReadWriteOnce
storageClassName: lc-db-sc
2 changes: 1 addition & 1 deletion k8s/db/secret.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v1
kind: Secret
metadata:
name: lc-db-secret
name: lc-saas-db-secret
namespace: lc-saas-ns
type: Opaque
data:
Expand Down
4 changes: 2 additions & 2 deletions k8s/db/service.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
apiVersion: v1
kind: Service
metadata:
name: lc-db-service
name: lc-saas-db-service
namespace: lc-saas-ns
spec:
selector:
app: lc-db
app: lc-saas-db
ports:
- protocol: TCP
port: 5432
Expand Down
18 changes: 18 additions & 0 deletions k8s/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: lc-saas-ingress
labels:
name: lc-saas-ingress
spec:
rules:
- host: localhost
http:
paths:
- pathType: Prefix
path: "/"
backend:
service:
name: lc-saas-app-service
port:
number: 80
14 changes: 7 additions & 7 deletions k8s/mailer/deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: lc-mailer-deployment
name: lc-saas-mailer-deployment
labels:
app: lc-mailer
app: lc-saas-mailer
namespace: lc-saas-ns
spec:
replicas: 1
selector:
matchLabels:
app: lc-mailer
app: lc-saas-mailer
template:
metadata:
labels:
app: lc-mailer
app: lc-saas-mailer
spec:
containers:
- name: lc-mailer
- name: lc-saas-mailer
image: mailtutan/mailtutan:latest
ports:
- containerPort: 1080
Expand All @@ -28,10 +28,10 @@ spec:
- name: MAILTUTAN_HTTP_USERNAME
valueFrom:
secretKeyRef:
name: lc-mailer-secret
name: lc-saas-mailer-secret
key: user
- name: MAILTUTAN_HTTP_PASSWORD
valueFrom:
secretKeyRef:
name: lc-mailer-secret
name: lc-saas-mailer-secret
key: password
2 changes: 1 addition & 1 deletion k8s/mailer/secret.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v1
kind: Secret
metadata:
name: lc-mailer-secret
name: lc-saas-mailer-secret
namespace: lc-saas-ns
type: Opaque
data:
Expand Down
4 changes: 2 additions & 2 deletions k8s/mailer/service.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
apiVersion: v1
kind: Service
metadata:
name: lc-mailer-service
name: lc-saas-mailer-service
namespace: lc-saas-ns
spec:
selector:
app: lc-mailer
app: lc-saas-mailer
ports:
- port: 1080
targetPort: 1080
Loading

0 comments on commit 195e4e6

Please sign in to comment.