trashposs/docs/kubernetes.md

46 lines
1.4 KiB
Markdown
Raw Permalink Normal View History

2024-04-06 23:55:59 +02:00
# Running a trashposs server with Kubernetes and Helm
2023-05-11 01:07:45 +02:00
This is a [Helm](https://helm.sh/) chart directory in the root of the project
2024-04-06 23:55:59 +02:00
that you can use to deploy trashposs to a Kubernetes cluster
2023-05-11 01:07:45 +02:00
## Deployment
1. Copy the example helm values and make your changes:
```shell
cp .config/helm_values_example.yml .config/helm_values.yml
```
2. Update helm dependencies:
```shell
cd chart
helm dependency list $dir 2> /dev/null | tail +2 | head -n -1 | awk '{ print "helm repo add " $1 " " $3 }' | while read cmd; do $cmd; done;
cd ../
```
2024-04-06 23:55:59 +02:00
3. Create the trashposs helm release (also used to update existing deployment):
2023-05-11 01:07:45 +02:00
```shell
helm upgrade \
--install \
2024-04-06 23:55:59 +02:00
--namespace trashposs \
2023-05-11 01:07:45 +02:00
--create-namespace \
2024-04-06 23:55:59 +02:00
trashposs chart/ \
2023-05-11 01:07:45 +02:00
-f .config/helm_values.yml
```
2024-04-06 23:55:59 +02:00
4. Watch your trashposs server spin up:
2023-05-11 01:07:45 +02:00
```shell
2024-04-06 23:55:59 +02:00
kubectl -n trashposs get po -w
2023-05-11 01:07:45 +02:00
```
5. Initial the admin user and managed config:
```shell
2024-04-06 23:55:59 +02:00
export trashposs_USERNAME="my_desired_admin_handle" && \
export trashposs_PASSWORD="myDesiredInitialPassword" && \
export trashposs_HOST="trashposs.example.com" && \
export trashposs_TOKEN=$(curl -X POST https://$trashposs_HOST/api/admin/accounts/create -H "Content-Type: application/json" -d "{ \"username\":\"$trashposs_USERNAME\", \"password\":\"$trashposs_PASSWORD\" }" | jq -r '.token') && \
echo "Save this token: ${trashposs_TOKEN}" && \
curl -X POST -H "Authorization: Bearer $trashposs_TOKEN" https://$trashposs_HOST/api/admin/accounts/hosted
2023-05-11 01:07:45 +02:00
```
6. Enjoy!