Pruebas con queue ! intento de configuracion de ssl tambien

This commit is contained in:
2025-01-04 18:46:50 -03:00
parent c8458a5dd2
commit 5158c888d2
20 changed files with 191 additions and 51 deletions

View File

@@ -1,5 +1,6 @@
./vendor/
./node_modules/
./git
deploy/
.env
compose.yml

21
app/Jobs/QueueTest.php Normal file
View File

@@ -0,0 +1,21 @@
<?php
namespace App\Jobs;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Queue\Queueable;
use Illuminate\Support\Facades\Log;
class QueueTest implements ShouldQueue
{
use Queueable;
public function __construct()
{
}
public function handle(): void
{
Log::info("Probando que la queue funciona correctamente");
}
}

7
build.sh Executable file
View File

@@ -0,0 +1,7 @@
#!/usr/bin/env sh
docker build -t git.skrd.fun/skrd/laravel-k3s:0.2 .
docker tag git.skrd.fun/skrd/laravel-k3s:0.2 git.skrd.fun/skrd/laravel-k3s:latest
docker push git.skrd.fun/skrd/laravel-k3s:0.2
docker push git.skrd.fun/skrd/laravel-k3s:latest

View File

@@ -1,26 +0,0 @@
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: laravel-app
name: laravel-app
spec:
replicas: 4
selector:
matchLabels:
app: laravel-app
template:
metadata:
labels:
app:
laravel-app
spec:
containers:
- image: registry.digitalocean.com/k8s-testing-laravel/laravel-k8s:latest
name: laravel-app
imagePullPolicy: Always
envFrom:
- configMapRef:
name: laravel-app-configmap
- secretRef:
name: laravel-app-secret

View File

@@ -1,18 +0,0 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: laravel-app-ingress
spec:
ingressClassName: nginx
rules:
- host: laravel.internal
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: laravel-app-service
port:
number: 80

View File

@@ -1,7 +1,7 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: laravel-app-configmap
name: laravel-configmap
data:
APP_KEY: base64:6R8+UR+AyBhv9HTlVW7qP+DCAdq6XP8r+uqEE1ahtqI=
APP_DEBUG: "true"

View File

@@ -0,0 +1,28 @@
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: laravel
name: laravel
spec:
replicas: 1
selector:
matchLabels:
app: laravel
template:
metadata:
labels:
app: laravel
spec:
containers:
- image: git.skrd.fun/skrd/laravel-k3s:0.2
name: laravel
envFrom:
- configMapRef:
name: laravel-configmap
- secretRef:
name: laravel-secret
resources:
limits:
memory: 200Mi
cpu: 500m

View File

@@ -0,0 +1,23 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: laravel-ingress
annotations:
cert-manager.io/cluster-issuer: letsencrypt-certificate
spec:
ingressClassName: traefik
tls:
- secretName: laravel.letsencrypt.key.tls
hosts:
- laravel.skrd.fun
rules:
- host: laravel.skrd.fun
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: laravel-service
port:
number: 80

View File

@@ -0,0 +1,29 @@
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: laravel-scheduler
name: laravel-scheduler
spec:
replicas: 1
selector:
matchLabels:
app: laravel-scheduler
template:
metadata:
labels:
app: laravel-scheduler
spec:
containers:
- image: git.skrd.fun/skrd/laravel-k3s:0.2
name: laravel-schedule
command: ["php", "artisan", "schedule:work"]
envFrom:
- configMapRef:
name: laravel-configmap
- secretRef:
name: laravel-secret
resources:
limits:
memory: 200Mi
cpu: 500m

View File

@@ -1,7 +1,7 @@
apiVersion: v1
kind: Secret
metadata:
name: laravel-app-secret
name: laravel-secret
type: Opaque
stringData:
DB_PASSWORD: l#Scim@HiebS3U

View File

@@ -1,10 +1,10 @@
apiVersion: v1
kind: Service
metadata:
name: laravel-app-service
name: laravel-service
spec:
selector:
app: laravel-app
app: laravel
ports:
- protocol: TCP
port: 80

View File

@@ -0,0 +1,29 @@
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: laravel-worker
name: laravel-worker
spec:
replicas: 1
selector:
matchLabels:
app: laravel-worker
template:
metadata:
labels:
app: laravel-worker
spec:
containers:
- image: git.skrd.fun/skrd/laravel-k3s:0.2
name: laravel-worker
command: ["php", "artisan", "queue:work"]
envFrom:
- configMapRef:
name: laravel-configmap
- secretRef:
name: laravel-secret
resources:
limits:
memory: 200Mi
cpu: 500m

View File

@@ -0,0 +1,9 @@
apiVersion: v1
kind: Secret
metadata:
name: aws-secret
namespace: longhorn-system
type: Opaque
stringData:
AWS_ACCESS_KEY_ID: AKIARB5YXNE6MKSF7OWH
AWS_SECRET_ACCESS_KEY: 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

View File

@@ -0,0 +1,17 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: longhorn-ingress
namespace: longhorn-system
spec:
ingressClassName: traefik
rules:
- http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: longhorn-frontend
port:
number: 80

View File

@@ -5,4 +5,4 @@ metadata:
data:
POSTGRES_DB: laravel
POSTGRES_USER: postgres
PGDATA: /var/lib/postgres/data/pgdata
PGDATA: /var/lib/postgresql/data/pgdata

View File

@@ -32,5 +32,5 @@ spec:
- ReadWriteOnce
resources:
requests:
storage: 5Gi
storageClassName: do-block-storage
storage: 2Gi
storageClassName: longhorn

16
deploy/ssl/certs.yaml Normal file
View File

@@ -0,0 +1,16 @@
apiVersion: cert-manager.io/v1
kind: ClusterIssuer
metadata:
name: letsencrypt-certificate
namespace: cert-manager
spec:
acme:
server: https://acme-v02.api.letsencrypt.org/directory
email: hola@danielcortes.xyz
privateKeySecretRef:
name: laravel.letsencrypt.key.tls
solvers:
- selector: {}
http01:
ingress:
class: traefik

View File

@@ -1,8 +1,12 @@
<?php
use App\Jobs\QueueTest;
use Illuminate\Foundation\Inspiring;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\Schedule;
Artisan::command('inspire', function () {
$this->comment(Inspiring::quote());
})->purpose('Display an inspiring quote')->hourly();
Schedule::job(new QueueTest)->everySecond();