Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions .github/workflows/django-linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@ jobs:
with:
python-version: '3.12'

- name: Install Poetry
run: pip install poetry

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install ruff==0.0.285
poetry install --with dev

- name: Run linter with auto-fix
run: |
ruff check --fix . --format=github
poetry run ruff check --fix .
37 changes: 1 addition & 36 deletions k8s/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,10 @@
## Setup and Configuration

### Prerequisites
- Ensure you have [kubectl](https://kubernetes.io/docs/tasks/tools/) installed and configured.
- Ensure you have [kubectl](https://kubernetes.io/docs/tasks/tools/) and [k3s](https://docs.k3s.io/installation) installed and configured.
- Ensure you have [Helm](https://helm.sh/docs/intro/install/) installed.

### Local Kubernetes Cluster Setup
#### Install Minikube
```bash
minikube start
```

## Rolling Update and Rollback

Expand Down Expand Up @@ -56,34 +52,3 @@ kubectl apply -f k8s/base/morouting/logicway-servicemonitor.yaml -n monitoring
```bash
kubectl --namespace monitoring port-forward svc/prometheus-operated 9090:9090
```

## Remote machine deployment

#### Prerequisites
```bash
git clone https://github.com/LogicWayTeam/LogicWaySolution.git
cd LogicWaySolution
```

#### Apply all manifests
```bash
kubectl apply -f k8s/
```

#### Check the status
```bash
kubectl get all
```

---

#### Access from the client machine (SSH tunnel)
```bash
ssh -L 8000:192.168.49.2:30001 -L 3000:192.168.49.2:30000 devops@logicway-k8s.taile241c6.ts.net
```

#### Access from the browser
Open your browser and go to `http://localhost:3000`. You should see the LogicWay application running.



17 changes: 17 additions & 0 deletions k8s/apply_preprod.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

# --- apply configmaps and secrets ---
kubectl apply -f preprod-env/configmap.yaml -n preprod
kubectl apply -f base/secret.yaml -n preprod

# --- apply deployments ---
kubectl apply -f base/frontend/frontend-deployment.yaml -n preprod
kubectl apply -f base/logicway/logicway-deployment.yaml -n preprod
kubectl apply -f base/postgres/postgres-deployment.yaml -n preprod
kubectl apply -f base/route-engine/route-engine-deployment.yaml -n preprod

# --- apply services ---
kubectl apply -f preprod-env/services/ -n preprod

# --- apply jobs ---
kubectl apply -f base/logicway/job-load-data.yaml -n preprod
17 changes: 17 additions & 0 deletions k8s/apply_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

# --- apply configmaps and secrets ---
kubectl apply -f test-env/configmap.yaml -n test
kubectl apply -f test-env/secret.yaml -n test

# --- apply deployments ---
kubectl apply -f test-env/frontend/frontend-deployment.yaml -n test
kubectl apply -f test-env/logicway/logicway-deployment.yaml -n test
kubectl apply -f test-env/postgres/postgres-deployment.yaml -n test
kubectl apply -f test-env/route-engine/route-engine-deployment.yaml -n test

# --- apply services ---
kubectl apply -f test-env/services/ -n test

# --- apply jobs ---
kubectl apply -f test-env/logicway/job-load-data.yaml -n test
6 changes: 3 additions & 3 deletions k8s/base/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ data:
DB_NAME: "logicway"
DB_HOST: "postgres"
DB_PORT: "5432"
ROUTE_ENGINE_URL: "http://route-engine:8001"
REACT_APP_LOGICWAY_URL: "http://192.168.49.2:30001"
REACT_APP_ROUTE_ENGINE_URL: "http://192.168.49.2:30001/routing/proxy_route_engine"
ROUTE_ENGINE_URL: "/route-engine"
REACT_APP_LOGICWAY_URL: "/logicway"
REACT_APP_ROUTE_ENGINE_URL: "/route-engine"
4 changes: 2 additions & 2 deletions k8s/base/secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ type: Opaque
data:
SECRET_KEY: ZGphbmdvLWluc2VjdXJlLW5tbGFjMmhAaSheLWlyeF9ibnRxKzglKCsqdmp6b3YrJUA5cmZ1c2Ird2d6cw== # base64("django-secret-key")
ROUTE_ENGINE_SECRET_KEY : ZGphbmdvLWluc2VjdXJlLWllaXJnNyZrLTJ5Mzc9ZV51MSg9KjQhdSMxKHBlQDh2JClicHQxJnpwX2s5KiQlYzNe
DB_USER: cG9zdGdyZXM= # base64
DB_PASSWORD: cG9zdGdyZXM= # base64
DB_USER: cG9zdGdyZXM=
DB_PASSWORD: cG9zdGdyZXM=
12 changes: 12 additions & 0 deletions k8s/preprod-env/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: app-config
namespace: preprod
data:
DB_NAME: "logicway"
DB_HOST: "postgres"
DB_PORT: "5432"
ROUTE_ENGINE_URL: "http://route-engine.preprod.svc.cluster.local"
REACT_APP_LOGICWAY_URL: "http://logicway-preprod.taile241c6.ts.net"
REACT_APP_ROUTE_ENGINE_URL: "http://logicway-preprod.taile241c6.ts.net/routing/proxy_route_engine"
15 changes: 15 additions & 0 deletions k8s/preprod-env/services/frontend-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: frontend
namespace: preprod
annotations:
tailscale.com/expose: "true"
tailscale.com/hostname: "frontend-preprod"
spec:
selector:
app: frontend
ports:
- port: 80
targetPort: 80
type: ClusterIP
18 changes: 18 additions & 0 deletions k8s/preprod-env/services/logicway-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: v1
kind: Service
metadata:
name: logicway
labels:
app: logicway
namespace: preprod
annotations:
tailscale.com/expose: "true"
tailscale.com/hostname: "logicway-preprod"
spec:
selector:
app: logicway
ports:
- name: http-django-8000
port: 80
targetPort: 8000
type: ClusterIP
12 changes: 12 additions & 0 deletions k8s/preprod-env/services/postgres-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: v1
kind: Service
metadata:
name: postgres
namespace: preprod
spec:
selector:
app: postgres
ports:
- port: 5432
targetPort: 5432
type: ClusterIP
15 changes: 15 additions & 0 deletions k8s/preprod-env/services/route-engine-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: route-engine
labels:
app: route-engine
namespace: preprod
spec:
selector:
app: route-engine
ports:
- name: http-django-8001
port: 80
targetPort: 8001
type: ClusterIP
12 changes: 12 additions & 0 deletions k8s/test-env/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: app-config
namespace: test
data:
DB_NAME: "logicway"
DB_HOST: "postgres"
DB_PORT: "5432"
ROUTE_ENGINE_URL: "http://route-engine.test.svc.cluster.local"
REACT_APP_LOGICWAY_URL: "http://logicway-test.taile241c6.ts.net"
REACT_APP_ROUTE_ENGINE_URL: "http://logicway-test.taile241c6.ts.net/routing/proxy_route_engine"
15 changes: 15 additions & 0 deletions k8s/test-env/services/frontend-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: frontend
namespace: test
annotations:
tailscale.com/expose: "true"
tailscale.com/hostname: "frontend-test"
spec:
selector:
app: frontend
ports:
- port: 80
targetPort: 80
type: ClusterIP
18 changes: 18 additions & 0 deletions k8s/test-env/services/logicway-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: v1
kind: Service
metadata:
name: logicway
labels:
app: logicway
namespace: test
annotations:
tailscale.com/expose: "true"
tailscale.com/hostname: "logicway-test"
spec:
selector:
app: logicway
ports:
- name: http-django-8000
port: 80
targetPort: 8000
type: ClusterIP
15 changes: 15 additions & 0 deletions k8s/test-env/services/postgres-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: postgres
namespace: test
annotations:
tailscale.com/expose: "true"
tailscale.com/hostname: "postgres-test"
spec:
selector:
app: postgres
ports:
- port: 5432
targetPort: 5432
type: ClusterIP
15 changes: 15 additions & 0 deletions k8s/test-env/services/route-engine-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: route-engine
labels:
app: route-engine
namespace: test
spec:
selector:
app: route-engine
ports:
- name: http-django-8001
port: 80
targetPort: 8001
type: ClusterIP
2 changes: 1 addition & 1 deletion logicway/logicway/asgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@

from django.core.asgi import get_asgi_application

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'logicway.settings')
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'logicway.settings.dev')

application = get_asgi_application()
Loading