plausible-hosting/k8s-manifests/README.org

78 lines
2.5 KiB
Org Mode
Raw Normal View History

2020-10-08 04:07:58 -05:00
#+TITLE: Setup Plausible
2020-10-08 04:15:38 -05:00
* Prelimiary requirements
** Notes
- Postgres manifests are also included, in case you don't want to deploy a highly available Postgres database locally (~DATABASE_URL~ will need to be updated also)
2020-10-08 04:07:58 -05:00
* Setup
#+NAME: create namespace
2021-05-14 17:05:31 -05:00
#+begin_src tmate :window plausible-setup
kubectl create ns plausible
2020-10-08 04:07:58 -05:00
#+end_src
2021-05-14 17:05:31 -05:00
#+NAME: label the namespace
#+BEGIN_SRC tmate :window plausible-setup
kubectl label ns plausible cert-manager-tls=sync --overwrite
#+END_SRC
2020-10-08 04:07:58 -05:00
#+NAME: create the database secrets
2021-05-14 17:05:31 -05:00
#+begin_src tmate :window plausible-setup
kubectl -n plausible create secret generic postgres-configuration \
--from-literal=POSTGRES_DB=plausible \
--from-literal=POSTGRES_USER=plausible \
--from-literal=POSTGRES_PASSWORD=plausible \
--from-literal=PGUSER=plausible \
--from-literal=PGPASSWORD=plausible \
--from-literal=PGDATABASE=plausible \
--dry-run=client \
-o yaml | kubectl apply -f -
2020-10-08 04:07:58 -05:00
#+end_src
#+NAME: install Postgres
2021-05-14 17:05:31 -05:00
#+begin_src tmate :window plausible-setup
kubectl -n plausible apply -f postgres.yaml
2020-10-08 04:07:58 -05:00
#+end_src
#+NAME: create secrets
2021-05-14 17:05:31 -05:00
#+begin_src tmate :window plausible-setup
kubectl -n plausible create secret generic plausible \
--from-literal=ADMIN_USER_EMAIL="$GIT_AUTHOR_EMAIL" \
--from-literal=ADMIN_USER_NAME="$GIT_AUTHOR_NAME" \
--from-literal=ADMIN_USER_PWD="password" \
--from-literal=SECRET_KEY_BASE="$(openssl rand -base64 64)" \
--from-literal=DATABASE_URL="postgres://plausible:plausible@postgres/plausible?ssl=false" \
--from-literal=CLICKHOUSE_DATABASE_URL=http://plausible-events-db:8123/plausible \
--dry-run=client \
-o yaml | kubectl apply -f -
2020-10-08 14:08:01 -05:00
#+end_src
2020-10-08 04:07:58 -05:00
#+NAME: create configuration
2021-05-14 17:05:31 -05:00
#+begin_src tmate :window plausible-setup
kubectl -n plausible create configmap plausible \
--from-literal=BASE_URL=https://plausible.$SHARINGIO_PAIR_BASE_DNS_NAME \
--dry-run=client \
-o yaml | kubectl apply -f -
2020-10-08 04:07:58 -05:00
#+end_src
#+NAME: install Plausible
2021-05-14 17:05:31 -05:00
#+begin_src tmate :window plausible-setup
kubectl -n plausible apply \
-f event-data-persistentvolumeclaim.yaml \
-f mail-deployment.yaml \
-f plausible-deployment.yaml \
-f plausible-service.yaml \
-f plausible-ingress.yaml \
-f plausible-events-db-deployment.yaml \
-f plausible-events-db-service.yaml
2020-10-08 04:07:58 -05:00
#+end_src
2021-05-14 17:05:31 -05:00
#+BEGIN_SRC tmate :window plausible-setup
kubectl -n plausible exec -it statefulset/postgres -- psql -c "UPDATE users SET email_verified = true;"
#+END_SRC
2020-10-08 04:07:58 -05:00
* Notes and references
- https://docs.plausible.io/self-hosting-configuration/
- https://github.com/plausible/hosting/blob/c5146231aa0bf8d7a0da11370845e11a4973373e/docker-compose.yml