-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit c204b39
Showing
18 changed files
with
898 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Patterns to ignore when building packages. | ||
# This supports shell glob matching, relative path matching, and | ||
# negation (prefixed with !). Only one pattern per line. | ||
.DS_Store | ||
# Common VCS dirs | ||
.git/ | ||
.gitignore | ||
.bzr/ | ||
.bzrignore | ||
.hg/ | ||
.hgignore | ||
.svn/ | ||
# Common backup files | ||
*.swp | ||
*.bak | ||
*.tmp | ||
*.orig | ||
*~ | ||
# Various IDEs | ||
.project | ||
.idea/ | ||
*.tmproj | ||
.vscode/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
dependencies: | ||
- name: postgresql | ||
repository: https://charts.bitnami.com/bitnami | ||
version: 11.6.20 | ||
- name: redis | ||
repository: https://charts.bitnami.com/bitnami | ||
version: 17.3.5 | ||
digest: sha256:c7f8c3ea9009ead238c633b6be0be75fefd02832a3700d7b97db9a606dcc92ef | ||
generated: "2022-10-18T16:21:29.614938307+02:00" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
apiVersion: v2 | ||
name: status | ||
description: A Helm chart for Kubernetes | ||
|
||
# A chart can be either an 'application' or a 'library' chart. | ||
# | ||
# Application charts are a collection of templates that can be packaged into versioned archives | ||
# to be deployed. | ||
# | ||
# Library charts provide useful utilities or functions for the chart developer. They're included as | ||
# a dependency of application charts to inject those utilities and functions into the rendering | ||
# pipeline. Library charts do not define any templates and therefore cannot be deployed. | ||
type: application | ||
|
||
# This is the chart version. This version number should be incremented each time you make changes | ||
# to the chart and its templates, including the app version. | ||
# Versions are expected to follow Semantic Versioning (https://semver.org/) | ||
version: 0.3.2 | ||
|
||
# This is the version number of the application being deployed. This version number should be | ||
# incremented each time you make changes to the application. Versions are not expected to | ||
# follow Semantic Versioning. They should reflect the version the application is using. | ||
appVersion: v2.5.3 | ||
|
||
dependencies: | ||
- name: postgresql | ||
repository: https://charts.bitnami.com/bitnami | ||
version: 11.6.20 | ||
condition: postgresql.enabled | ||
- name: redis | ||
repository: https://charts.bitnami.com/bitnami | ||
version: 17.3.5 | ||
condition: redis.enabled |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
# status | ||
|
||
![Version: 0.3.2](https://img.shields.io/badge/Version-0.3.2-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v2.5.3](https://img.shields.io/badge/AppVersion-v2.5.3-informational?style=flat-square) | ||
|
||
A Helm chart for Kubernetes | ||
|
||
## How to install this chart | ||
|
||
```console | ||
helm install chart_name ./status | ||
``` | ||
|
||
To install the chart with the release name `my-release`: | ||
|
||
```console | ||
helm install chart_name ./status | ||
``` | ||
|
||
To install with some set values: | ||
|
||
```console | ||
helm install chart_name ./status --set values_key1=value1 --set values_key2=value2 | ||
``` | ||
|
||
To install with custom values file: | ||
|
||
```console | ||
helm install chart_name ./status -f values.yaml | ||
``` | ||
|
||
## Requirements | ||
|
||
| Repository | Name | Version | | ||
|------------|------|---------| | ||
| https://charts.bitnami.com/bitnami | postgresql | 11.6.20 | | ||
| https://charts.bitnami.com/bitnami | redis | 17.3.5 | | ||
|
||
## Values | ||
|
||
| Key | Type | Default | Description | | ||
|-----|------|---------|-------------| | ||
| affinity | object | `{}` | | | ||
| autoscaling.enabled | bool | `false` | Enable autoscaling for status service | | ||
| autoscaling.maxReplicas | int | `3` | Maximum number of replicas for status service | | ||
| autoscaling.minReplicas | int | `1` | Minimal number of replicas for status service | | ||
| autoscaling.targetCPUUtilizationPercentage | int | `80` | Target CPU utilization for horizontal pod autoscaler | | ||
| env.private | string | `nil` | Private environment variables which are stores in a kubernetes secret | | ||
| env.public | object | `{"APP_DEBUG":false,"APP_ENV":"production","APP_LOG":"errorlog","APP_NAME":"statuspage","APP_TIMEZONE":"UTC","CACHET_BEACON":false,"CACHET_EMOJI":false,"CACHET_INTERNET_LOOKUPS":"false","CACHE_DRIVER":"redis","DB_DRIVER":"pgsql","DOCKER":true,"MAIL_ADDRESS":"","MAIL_DRIVER":"log","MAIL_ENCRYPTION":"tls","MAIL_HOST":"","MAIL_NAME":"","MAIL_PORT":25,"QUEUE_DRIVER":"redis","SESSION_DRIVER":"redis"}` | Default settings for cachet / status-service. See https://docs.cachethq.io/docs/installing-cachet for more information | | ||
| existingSecret | string | `""` | Use existing secret for Cachet settings | | ||
| extraLabels | object | `{}` | | | ||
| fullnameOverride | string | `""` | | | ||
| image.pullPolicy | string | `"IfNotPresent"` | | | ||
| image.repository | string | `"ghcr.io/dbildungsplattform/cachet"` | Image to use for deploying | | ||
| imagePullSecrets | list | `[]` | | | ||
| ingress.annotations | object | `{}` | Additional annotations for the Ingress resource. To enable certificate autogeneration, place here your cert-manager annotations. | | ||
| ingress.enabled | bool | `false` | Enable ingress controller resource | | ||
| ingress.hosts[0].host | string | `"chart-example.local"` | | | ||
| ingress.hosts[0].paths[0].path | string | `"/"` | | | ||
| ingress.hosts[0].paths[0].pathType | string | `"Prefix"` | | | ||
| ingress.tls | list | `[]` | Enable TLS configuration for the hostnames defined at ingress.hosts parameter | | ||
| nameOverride | string | `""` | | | ||
| nodeSelector | object | `{}` | | | ||
| podAnnotations | object | `{}` | The annotations to be applied to instances of the status-service pod | | ||
| podSecurityContext | object | `{}` | Settings for security context of the pod | | ||
| postgresql | object | `{"auth":{"database":"status","existingSecret":"","password":"status","postgresPassword":"status","secretKeys":{"adminPasswordKey":"","userPasswordKey":""},"username":"status"},"enabled":true,"primary":{"persistence":{"enabled":true,"size":"10Gi"}},"service":{"ports":{"postgresql":5432}}}` | Postgresql settings. See https://github.com/bitnami/charts/tree/master/bitnami/postgresql fro details | | ||
| redis | object | `{"architecture":"standalone","enabled":true}` | Redis settings. See https://github.com/bitnami/charts/tree/master/bitnami/redis fro details | | ||
| replicaCount | int | `1` | | | ||
| resources.limits | object | `{"cpu":"1000m","memory":"1Gi"}` | The resources limits for the container | | ||
| resources.requests | object | `{"cpu":"100m","memory":"128Mi"}` | The requested resources for the container | | ||
| securityContext.runAsUser | int | `1001` | | | ||
| seedData | object | `{}` | | | ||
| service.port | int | `80` | Status service port | | ||
| service.type | string | `"ClusterIP"` | Kubernetes Service type | | ||
| serviceAccount.annotations | object | `{}` | Annotations to add to the service account | | ||
| serviceAccount.create | bool | `false` | Specifies whether a service account should be created | | ||
| serviceAccount.name | string | `""` | The name of the service account to use. If not set and create is true, a name is generated using the fullname template | | ||
| test.enabled | bool | `true` | | | ||
| tolerations | list | `[]` | | | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) James Brooks | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,233 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of Cachet. | ||
* | ||
* (c) Alt Three Services Limited | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that is next to this file. | ||
*/ | ||
|
||
namespace CachetHQ\Cachet\Console\Commands; | ||
use AltThree\Validator\ValidationException; | ||
use CachetHQ\Cachet\Models\Action; | ||
use CachetHQ\Cachet\Models\Component; | ||
use CachetHQ\Cachet\Models\ComponentGroup; | ||
use CachetHQ\Cachet\Models\Incident; | ||
use CachetHQ\Cachet\Models\IncidentTemplate; | ||
use CachetHQ\Cachet\Models\IncidentUpdate; | ||
use CachetHQ\Cachet\Models\Metric; | ||
use CachetHQ\Cachet\Models\MetricPoint; | ||
use CachetHQ\Cachet\Models\Schedule; | ||
use CachetHQ\Cachet\Models\Subscriber; | ||
use CachetHQ\Cachet\Models\User; | ||
use CachetHQ\Cachet\Settings\Repository; | ||
use Carbon\Carbon; | ||
use DateInterval; | ||
use DateTime; | ||
use Illuminate\Console\Command; | ||
use Illuminate\Console\ConfirmableTrait; | ||
use Illuminate\Support\Str; | ||
use Symfony\Component\Console\Input\InputOption; | ||
|
||
/** | ||
*/ | ||
class SeederCommand extends Command | ||
{ | ||
use ConfirmableTrait; | ||
|
||
/** | ||
* The console command name. | ||
* | ||
* @var string | ||
*/ | ||
protected $name = 'cachet:seeder'; | ||
|
||
/** | ||
* The console command description. | ||
* | ||
* @var string | ||
*/ | ||
protected $description = 'Set ups Cachet'; | ||
|
||
/** | ||
* The settings repository. | ||
* | ||
* @var \CachetHQ\Cachet\Settings\Repository | ||
*/ | ||
protected $settings; | ||
|
||
protected $seedData; | ||
/** | ||
* Create a new demo seeder command instance. | ||
* | ||
* @param \CachetHQ\Cachet\Settings\Repository $settings | ||
* | ||
* @return void | ||
*/ | ||
public function __construct(Repository $settings) | ||
{ | ||
parent::__construct(); | ||
$this->settings = $settings; | ||
$this->componentGroups = []; | ||
} | ||
|
||
/** | ||
* Execute the console command. | ||
* | ||
* @return void | ||
*/ | ||
public function handle() | ||
{ | ||
$seed_data_path = __DIR__ . '/../../seedData.json'; | ||
if(is_file($seed_data_path)) { | ||
$this->info('Seed data found'); | ||
$this->seedData = json_decode(file_get_contents($seed_data_path), true); | ||
} else{ | ||
$this->error('Seed data not found'); | ||
} | ||
$this->info('Starting setup of Cachet'); | ||
$this->seedUsers(); | ||
$this->seedIncidentTemplates(); | ||
$this->seedComponentGroups(); | ||
$this->seedComponents(); | ||
$this->seedSettings(); | ||
$this->info('Setup ran successfully!'); | ||
} | ||
|
||
|
||
/** | ||
* Seed the component groups table. | ||
* | ||
* @return void | ||
*/ | ||
protected function seedIncidentTemplates() | ||
{ | ||
if(isset($this->seedData["enableSeedData"]) && $this->seedData["enableSeedData"]=="true"){ | ||
$this->info('Updating all incident templates'); | ||
if(isset($this->seedData["incidentTemplates"])){ | ||
foreach ($this->seedData["incidentTemplates"] as $template) { | ||
IncidentTemplate::updateOrCreate(['name' => $template['name']], | ||
[ | ||
'name' => $template['name'], | ||
'template' => $template['template'] | ||
]); | ||
} | ||
} | ||
} | ||
} | ||
|
||
/** | ||
* Seed the component groups table. | ||
* | ||
* @return void | ||
*/ | ||
protected function seedComponentGroups() | ||
{ | ||
if(isset($this->seedData["enableSeedData"]) && $this->seedData["enableSeedData"]=="true"){ | ||
$this->info('Updating all component groups'); | ||
if(isset($this->seedData["componentGroups"])){ | ||
$index=1; | ||
foreach ($this->seedData["componentGroups"] as $group) { | ||
ComponentGroup::updateOrCreate(['name' => $group['name']], | ||
[ | ||
'name' => $group['name'], | ||
'order' => $index, | ||
'collapsed' => 0, | ||
'visible' => ComponentGroup::VISIBLE_GUEST, | ||
]); | ||
$this->componentGroups[$group['name']] = $index; | ||
$index++; | ||
} | ||
} | ||
} | ||
} | ||
|
||
/** | ||
* Seed the components table. | ||
* | ||
* @return void | ||
*/ | ||
protected function seedComponents() | ||
{ | ||
if(isset($this->seedData["enableSeedData"]) && $this->seedData["enableSeedData"]=="true"){ | ||
$this->info('Updating all components'); | ||
if(isset($this->seedData["components"])){ | ||
foreach ($this->seedData["components"] as $component) { | ||
Component::updateOrCreate(['name' => $component['name']], | ||
[ | ||
'name' => $component['name'], | ||
'description' => $component['description'], | ||
'status' => 1, | ||
'order' => 0, | ||
'group_id' => $this->componentGroups[$component["componentGroup"]], | ||
'link' => $component['link'] | ||
]); | ||
} | ||
} | ||
} | ||
} | ||
|
||
|
||
/** | ||
* Seed the settings table. | ||
* | ||
* @return void | ||
*/ | ||
protected function seedSettings() | ||
{ | ||
$this->info('Updating all settings'); | ||
if(isset($this->seedData["settings"])){ | ||
foreach ($this->seedData["settings"] as $setting_key => $setting_value) { | ||
$this->settings->set($setting_key, $setting_value); | ||
} | ||
} | ||
} | ||
|
||
|
||
/** | ||
* Seed the users table. | ||
* | ||
* @return void | ||
*/ | ||
protected function seedUsers() | ||
{ | ||
if(isset($this->seedData["enableSeedData"]) && $this->seedData["enableSeedData"]=="true"){ | ||
$this->info('Updating all users'); | ||
if(isset($this->seedData["users"])){ | ||
foreach ($this->seedData["users"] as $user) { | ||
$level= User::LEVEL_USER; | ||
if(isset($user['level']) && $user['level']=='admin'){ | ||
$level= User::LEVEL_ADMIN; | ||
} | ||
$password = env($user['password_env'], Str::random(20)); | ||
$api_key = env($user['api_key_env'], Str::random(20)); | ||
try{ | ||
User::updateOrCreate(['username' => $user['username']], | ||
[ | ||
'username' => $user['username'], | ||
'email' => $user['email'], | ||
'level' => $level, | ||
'password' => $password, | ||
'api_key' => $api_key | ||
]); | ||
} catch(ValidationException $e){ | ||
$this->error('Validation error: ' . $e->getMessage()); | ||
$this->error('User data: '. $user); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
/** | ||
* Get the console command options. | ||
* | ||
* @return array | ||
*/ | ||
protected function getOptions() | ||
{ | ||
return []; | ||
} | ||
} |
Oops, something went wrong.