Compare commits

...

3 Commits

Author SHA1 Message Date
Letsplaybar da852bfbb7
Merge 386d01710a into 7cd721d6d4 2023-12-17 22:50:46 +00:00
Letsplaybar 386d01710a add helm chart to deploy on Kubernetes clusters 2023-12-17 23:50:32 +01:00
Letsplaybar da133ca676 update to laravel 10 2023-12-17 21:48:13 +01:00
14 changed files with 591 additions and 646 deletions

View File

@ -12,6 +12,7 @@ class Kernel extends HttpKernel
\App\Http\Middleware\TrimStrings::class,
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
\App\Http\Middleware\TrustProxies::class,
\Illuminate\Http\Middleware\HandleCors::class
];
protected $middlewareGroups = [

View File

@ -57,9 +57,7 @@ class Link extends Model
];
protected $casts = [
'is_watched' => 'bool',
];
protected $dates = [
'http_checked_at',
'http_checked_at' => 'datetime',
];
protected $touches = ['post'];
@ -88,7 +86,7 @@ class Link extends Model
$this->attributes['is_watched'] = false;
}
$this->attributes['is_watched'] = in_array($value, ['on', true, '1', 1]) ? true : false;
$this->attributes['is_watched'] = in_array($value, ['on', true, '1', 1]);
if ($this->attributes['is_watched'] === false) {
$this->attributes['http_status'] = null;

View File

@ -17,7 +17,9 @@ class SecureLogin extends Model
public $primaryKey = 'token';
public $incrementing = false;
protected $keyType = 'string';
protected $dates = ['expires_at'];
protected $casts = [
'expires_at' => 'datetime',
];
public function user(): BelongsTo
{

View File

@ -18,8 +18,8 @@ class Share extends Model
'token',
'expires_at',
];
protected $dates = [
'expires_at',
protected $casts = [
'expires_at' => 'datetime',
];
public function post(): BelongsTo

View File

@ -14,7 +14,6 @@ class AuthServiceProvider extends ServiceProvider
public function boot()
{
$this->registerPolicies();
Gate::define('restricted', function (?User $user) {
if (app('shaark')->getIsPrivate() === false) {

View File

@ -26,11 +26,10 @@
"require": {
"php": "^8.0",
"doctrine/dbal": "^3.1",
"fruitcake/laravel-cors": "^2.0",
"guzzlehttp/guzzle": "^7.0.1",
"hashids/hashids": "^4.1",
"lab404/laravel-auth-checker": "^1.6",
"laravel/framework": "^9.0",
"lab404/laravel-auth-checker": "^2.0",
"laravel/framework": "^10.0",
"laravel/scout": "^9.2",
"laravel/tinker": "^2.5",
"laravel/ui": "^4.0",
@ -43,16 +42,16 @@
"spatie/laravel-medialibrary": "^10.5",
"spatie/valuestore": "^1.2",
"symfony/dom-crawler": "^4.3",
"teamtnt/laravel-scout-tntsearch-driver": "^11.5"
"teamtnt/laravel-scout-tntsearch-driver": "^13.0"
},
"require-dev": {
"fakerphp/faker": "^1.9.1",
"laravel/dusk": "^7.0",
"laravel/sail": "^1.0.1",
"mockery/mockery": "^1.4.2",
"nunomaduro/collision": "^6.1",
"phpunit/phpunit": "^9.3.3",
"spatie/laravel-ignition": "^1.0"
"nunomaduro/collision": "^7.0",
"phpunit/phpunit": "^10.0",
"spatie/laravel-ignition": "^2.0"
},
"config": {
"optimize-autoloader": true,
@ -79,7 +78,7 @@
"provide": {
"ext-imagick": "*"
},
"minimum-stability": "dev",
"minimum-stability": "stable",
"prefer-stable": true,
"scripts": {
"post-autoload-dump": [

1075
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,25 @@
# Helm
This project has a helm chart, in order to use it, the Docker image must first be built and loaded into a repo.
After this is done, copy the file from `helm/values.yml` and fill it in. Here you can see a small example with fields that have to be filled in:
````yml
deployment:
image: <url to image>
files:
# Location of .env file
env: <path to .env file>
# Location of storage folder
storage: <path to storage folder>
ingress:
url: <url to reach shaark instance>
#optional
annotations:
cert-manager.io/issuer: "<issuer name when used cert-manager>"
````
if no cert-manager is used, the appropriate certificate must be stored under <name>-secret-tls as secret
Once this has been done, you can install the helm chart as follows: `helm install <name> ./helm --values <edit-values-file>`
The installation comes without mysql and redis if this is required, this must be installed externally by existing charts from the intenet and then the corresponding kubernetes-url must be stored in the .env as host

9
helm/Chart.yaml Normal file
View File

@ -0,0 +1,9 @@
apiVersion: v2
name: Shaark
description: "Shaark is a self-hosted platform to keep and share your content: web links, posts, passwords and pictures."
type: application
version: 2.0.0-alpha
appVersion: 2.0.0-alpha

View File

@ -0,0 +1,34 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "Shaark.name" . }}-deployment
namespace: {{ .Release.Namespace }}
spec:
replicas: 1
selector:
matchLabels:
app: {{ include "Shaark.name" . }}
template:
metadata:
labels:
app: {{ include "Shaark.name" . }}
spec:
containers:
- name: shaark
image: {{.Values.deployment.image}}
imagePullPolicy: Always
ports:
- containerPort: 80
volumeMounts:
- name: env
mountPath: /var/www/laravel/.env
subPath: .env
- name: storage
mountPath: /var/www/laravel/storage
volumes:
- name: env
hostPath:
path: {{ .Values.deployment.files.env }}
- name: storage
hostPath:
path: {{ .Values.deployment.files.storage }}

View File

@ -0,0 +1,25 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ include "Shaark.name" . }}-ingress
namespace: {{ .Release.Namespace }}
annotations:
nginx.ingress.kubernetes.io/proxy-body-size: 1G
nginx.org/client-max-body-size: 1G
{{- .Values.ingress.annotations | toYaml | indent 4}}
spec:
tls:
- hosts:
- {{ .Values.ingress.url }}
secretName: {{ include "Shaark.name" . }}-secret-tls
rules:
- host: {{ .Values.ingress.url }}
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: {{ include "Shaark.name" . }}-service
port:
number: 80

View File

@ -0,0 +1,14 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "Shaark.name" . }}-service
labels:
app: {{ include "Shaark.name" . }}
namespace: {{ .Release.Namespace }}
spec:
selector:
app: {{ include "Shaark.name" . }}
ports:
- protocol: TCP
port: 80
targetPort: 80

View File

@ -0,0 +1,7 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "Shaark.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

17
helm/values.yaml Normal file
View File

@ -0,0 +1,17 @@
nameOverride:
deployment:
image:
files:
# Location of .env file
env:
# Location of storage folder
storage:
ingress:
url:
#Example
# annotations:
# cert-manager.io/issuer: "letsencrypt-prod"
# nginx.ingress.kubernetes.io/ssl-redirect: true
annotations: