{"id":25382790,"url":"https://github.com/seehiong/appwrite-k8s-deployment","last_synced_at":"2025-06-12T05:32:11.020Z","repository":{"id":222933668,"uuid":"758507009","full_name":"seehiong/appwrite-k8s-deployment","owner":"seehiong","description":null,"archived":false,"fork":false,"pushed_at":"2024-03-10T13:25:36.000Z","size":25,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-09T14:06:35.487Z","etag":null,"topics":["appwrite","k3s-cluster","k8s-deployment","kompose","traefik-v2"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/seehiong.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-02-16T13:24:45.000Z","updated_at":"2024-05-08T10:57:09.000Z","dependencies_parsed_at":"2024-02-17T05:19:38.457Z","dependency_job_id":"6dbccd1d-d431-4f5b-b2c4-0e202143e8db","html_url":"https://github.com/seehiong/appwrite-k8s-deployment","commit_stats":null,"previous_names":["seehiong/appwrite-k8s-deployment"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/seehiong/appwrite-k8s-deployment","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seehiong%2Fappwrite-k8s-deployment","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seehiong%2Fappwrite-k8s-deployment/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seehiong%2Fappwrite-k8s-deployment/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seehiong%2Fappwrite-k8s-deployment/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/seehiong","download_url":"https://codeload.github.com/seehiong/appwrite-k8s-deployment/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seehiong%2Fappwrite-k8s-deployment/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259404404,"owners_count":22852181,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["appwrite","k3s-cluster","k8s-deployment","kompose","traefik-v2"],"created_at":"2025-02-15T07:51:44.704Z","updated_at":"2025-06-12T05:32:10.997Z","avatar_url":"https://github.com/seehiong.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"In this post, we'll embark on installing [Appwrite](https://appwrite.io/), an open-source platform designed to facilitate the integration of authentication, databases, functions, and storage, enabling the development of scalable applications within our HomeLab setup.\n\n# Prepartion\n\nReferencing my [previous K3s setup post](https://seehiong.github.io/2023/setting-up-k3s/), let's initiate the installation process by deploying K3s server, this time with Traefik disabled:\n\n```bash\nsudo curl -sfL https://get.k3s.io | INSTALL_K3S_EXEC=\"--disable traefik\" K3S_KUBECONFIG_MODE=\"644\" sh -\n```\n\nAs usual, we verify the status with:\n\n```bash\nkc get no\n```\n\nFollowing that, we deploy Portainer to the K3s cluster:\n\n```bash\nmkdir portainer\ncd portainer\n\n# Download Portainer and deploy it\nwget https://raw.githubusercontent.com/portainer/k8s/master/deploy/manifests/portainer/portainer.yaml -O deploy.yaml\nkca deploy.yaml\n\n# Check the port to use\nkc get svc portainer -n portainer\n```\n\nNavigate to the specified port (e.g., http://bee:30777) and sets portainer up. and set up Portainer. Next, proceed by clicking on **Get started**.\n\n![portainer-get-started](https://seehiong.github.io/images/appwrite/portainer-get-started.png)\n\n## Generating Appwrite K8s Files\n\nReferencing Appwrite's [Manual (Docker Compose)](https://appwrite.io/docs/advanced/self-hosting#manual), let's download the *docker-compose.yml* and *.env* files. We'll utilize [Kompose](https://kompose.io/) to convert them from Docker Compose to Kubernetes.\n\n```bash\n# Download Appwrite files\nwget https://appwrite.io/install/compose -O docker-compose.yml\nwget https://appwrite.io/install/env -O env\n\ncurl -L https://github.com/kubernetes/kompose/releases/download/v1.32.0/kompose-linux-amd64 -o kompose\nchmod +x kompose\n\n# Convert to K8s files\n./kompose convert\n```\n\n![appwrite-converted-k8s-files](https://seehiong.github.io/images/appwrite/appwrite-converted-k8s-files.png)\n\n## Preparing Appwrite Volumes\n\nFrom my [previous NFS post](https://seehiong.github.io/2024/integrating-nfs-for-improved-scalability/), let's prepare the files to be placed in */var/lib/rancher/k3s/server/manifests*. We require a total of 9 storage classes. Refer to my public repository, [appwrite-k8s-deployment](https://github.com/seehiong/appwrite-k8s-deployment) for all necessary Kubernetes files mentioned in this post.\n\nBelow is an example for *appwrite-builds.yaml*:\n\n```yaml\n# Example: appwrite-builds.yaml\napiVersion: helm.cattle.io/v1\nkind: HelmChart\nmetadata:\n  name: appwrite-builds\n  namespace: appwrite\nspec:\n  chart: nfs-subdir-external-provisioner\n  repo: https://kubernetes-sigs.github.io/nfs-subdir-external-provisioner\n  set:\n    nfs.server: tnas.local\n    nfs.path: /mnt/public/appwrite\n    storageClass.name: appwrite-builds\n    storageClass.reclaimPolicy: Retain\n    storageClass.accessModes: ReadWriteMany\n    nfs.reclaimPolicy: Retain\n```\n\nLet's proceed to copying these 9 files to the auto-deployed folder:\n\n```bash\nls appwrite-*.yaml\nsudo cp appwrite-*.yaml /var/lib/rancher/k3s/server/manifests\n\n# Verify files are copied correctly\nsudo ls /var/lib/rancher/k3s/server/manifests\n```\n\nSimilarly, create the corresponding persistent volume claims and apply them:\n\n```bash\nkc create ns appwrite\nkca pvc-appwrite-builds.yaml \nkca pvc-appwrite-cache.yaml \nkca pvc-appwrite-certificates.yaml\nkca pvc-appwrite-config.yaml\nkca pvc-appwrite-functions.yaml\nkca pvc-appwrite-influxdb.yaml\nkca pvc-appwrite-mariadb.yaml\nkca pvc-appwrite-redis.yaml \nkca pvc-appwrite-uploads.yaml\n```\n\n![appwrite-required-volumes](https://seehiong.github.io/images/appwrite/appwrite-required-volumes.png)\n\n## Preparing Misc Services\n\nAs Kompose do not include any required environment variables, we'll manually map them against the original Docker Compose files and merge values from the .env file. These are the items to note of:\n\n1. To add env var to all deployment files:\n\n```yaml\n# Example: mariadb-deployment.yaml\nspec:\n  template:\n    spec:\n      containers:\n        - args:\n            - mysqld\n            - --innodb-flush-method=fsync\n          # To include the required env\n          env:\n            - name: MYSQL_DATABASE\n              value: appwrite\n            - name: MYSQL_PASSWORD\n              value: password\n            - name: MYSQL_ROOT_PASSWORD\n              value: rootsecretpassword\n            - name: MYSQL_USER\n              value: user\n          image: mariadb:10.7\n          name: appwrite-mariadb     \n```\n\n2. To use hostPath to access host's */var/run/docker.sock*:\n\n```yaml\n# Example: openruntimes-executor-deployment.yaml\nspec:\n  template:\n    metadata:\n    spec:\n      hostname: appwrite-executor\n      restartPolicy: Always\n      volumes:\n        # To use hostPath to host's /var/run/docker.sock and tmp folder\n        - name: openruntimes-executor-claim0\n          hostPath:\n            path: /var/run/docker.sock\n        - name: appwrite-builds\n          persistentVolumeClaim:\n            claimName: appwrite-builds\n        - name: appwrite-functions\n          persistentVolumeClaim:\n            claimName: appwrite-functions\n        - name: openruntimes-executor-claim3\n          hostPath:\n            path: /tmp\n```\n\n3. To use the fully qualified name for the DB and other services.\n\n```yaml\n# Example: appwrite-deployment.yaml\nspec:\n  template:\n    spec:\n      containers:\n        - image: appwrite/appwrite:1.4.13\n          name: appwrite\n          # To include the required env\n          env:\n          # Using the fully qualified name to DB host\n          - name: _APP_DB_HOST\n            value: mariadb-svc.appwrite.svc\n```\n\nApply all necessary DB and services:\n\n```bash\n# Deployments\nkca influxdb-deployment.yaml\nkca mariadb-deployment.yaml\nkca openruntimes-executor-deployment.yaml\nkca redis-deployment.yaml\nkca telegraf-deployment.yaml\n\n# Services\nkca influxdb-svc.yaml\nkca mariadb-svc.yaml\nkca openruntimes-executor-svc.yaml\nkca redis-svc.yaml\nkca telegraf-svc.yaml\n```\n\n![appwrite-used-volumes](https://seehiong.github.io/images/appwrite/appwrite-used-volumes.png)\n\n![appwrite-applications](https://seehiong.github.io/images/appwrite/appwrite-applications.png)\n\n## Installing Appwrite Services\n\nFinally, apply the remaining items:\n\n```bash\n# Deployments\nkca appwrite-worker-webhooks-deployment.yaml\nkca appwrite-worker-migrations-deployment.yaml\nkca appwrite-worker-messaging-deployment.yaml\nkca appwrite-worker-mails-deployment.yaml\nkca appwrite-worker-functions-deployment.yaml\n\nkca appwrite-worker-deletes-deployment.yaml\nkca appwrite-worker-databases-deployment.yaml\nkca appwrite-worker-certificates-deployment.yaml\nkca appwrite-worker-builds-deployment.yaml\nkca appwrite-worker-audits-deployment.yaml\n\nkca appwrite-usage-deployment.yaml\nkca appwrite-schedule-deployment.yaml\nkca appwrite-realtime-deployment.yaml\nkca appwrite-maintenance-deployment.yaml\nkca appwrite-deployment.yaml\n\n# You need to enter your own OPENAI API key for this to work\nkca appwrite-assistant-deployment.yaml\n```\n\nUpon completion, all services should start normally:\n\n![appwrite-applications-2](https://seehiong.github.io/images/appwrite/appwrite-applications-2.png)\n\n![appwrite-used-volumes-2](https://seehiong.github.io/images/appwrite/appwrite-used-volumes-2.png)\n\nAdditionally, apply the *appwrite-svc.yaml*:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: appwrite-svc\n  namespace: appwrite\nspec:\n  selector: \n    io.kompose.service: appwrite\n  type: LoadBalancer\n  ports:\n  - name: appwrite-port\n    protocol: TCP\n    port: 80\n    targetPort: 80\n```\n\nThen apply it:\n\n```bash\nkca appwrite-svc.yaml\n\n# Check external-ip being assigned\nkc get svc -n appwrite\n```\n\nCongratulations! By now, you should see the Appwrite login page:\n\n![appwrite-login](https://seehiong.github.io/images/appwrite/appwrite-login.png)\n\n![appwrite-hello-world-app](https://seehiong.github.io/images/appwrite/appwrite-hello-world-app.png)\n\nThat's all for this post! Happy Appwriting!\n\n## Optional\n\n### Enable Traefik\n\nFor those who wish to enable *traefik*, install k3s with this:\n\n```bash\nsudo curl -sfL https://get.k3s.io | K3S_KUBECONFIG_MODE=\"644\" sh -\n```\n\nProceed with the rest of this post but to apply the following (instead of *appwrite-svc.yaml*):\n\n```bash\nkca appwrite-svc-with-ing.yaml\nkca appwrite-ing.yaml\n\n# Check your traefik loadbalancer external-ip\nkc get svc -n kube-system\n```\n\n### Appwrite Functions\n\nUpdate your deployment files accordingly for [Configuring Appwrite Functions with K3s](https://seehiong.github.io/2024/configuring-appwrite-functions-with-k3s/)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseehiong%2Fappwrite-k8s-deployment","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fseehiong%2Fappwrite-k8s-deployment","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseehiong%2Fappwrite-k8s-deployment/lists"}